using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; 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; using FishNet.Broadcast; using FishNet.Connection; using FishNet.Managing; using FishNet.Managing.Logging; using FishNet.Managing.Server; using FishNet.Object; using FishNet.Serializing; using FishNet.Transporting; using GamblersReach.Art; using GamblersReach.Characters; using GamblersReach.Content; using GamblersReach.Core.Blackjack; using GamblersReach.Core.Progression; using GamblersReach.Core.Wildlife; using GamblersReach.Encounters; using GamblersReach.Gameplay; using GamblersReach.Interface; using GamblersReach.Networking; using GamblersReach.Wildlife; using GamblersReach.World; using HarmonyLib; using HowToFish.ExpansionKit; using HowToFish.ExpansionKit.Assets; using HowToFish.ExpansionKit.Packs; using HowToFish.ExpansionKit.Progression; using HowToFish.ExpansionKit.Runtime; using HowToFish.ExpansionKit.Runtime.Commerce; using HowToFish.ExpansionKit.Runtime.Content; using HowToFish.ExpansionKit.Runtime.Persistence; using HowToFish.ExpansionKit.Runtime.Rendering; using HowToFish.ExpansionKit.Runtime.World; using HowToFish.ExpansionKit.World; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using TMPro; using UnityEngine; using UnityEngine.Localization; using UnityEngine.Localization.Components; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("GamblersReach.Qa")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GamblersReach")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.8.4.0")] [assembly: AssemblyInformationalVersion("0.8.4")] [assembly: AssemblyProduct("GamblersReach")] [assembly: AssemblyTitle("GamblersReach")] [assembly: AssemblyVersion("0.8.4.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 GamblersReach { internal static class ExpansionProfile { internal static string Folder => ExpansionSaveProfiles.Folder; } internal sealed class ExpansionRuntime : MonoBehaviour { private sealed class HarborPackAssets : IPackAssetFactory { private readonly AuthoredAssets assets; internal HarborPackAssets(AuthoredAssets assets) { this.assets = assets; } public GameObject Instantiate(string packKey, ArtRecipe art) { if (packKey != "gamblers_reach" || art.Bundle != "gamblersreach.models") { throw new InvalidOperationException("The harbor art adapter received another pack's asset."); } return assets.CreateVisual(Path.GetFileNameWithoutExtension(art.Prefab)); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func <>9__65_2; public static ExternalLootBinder <>9__65_0; public static Func <>9__66_0; public static Func <>9__66_1; public static Func <>9__66_2; public static Func <>9__67_2; internal bool b__65_2(ItemDefinition item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 ItemKind kind = item.Kind; if (kind - 3 <= 1) { return true; } return false; } internal NativeLootTable b__65_0(ExternalRecipeContext context) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown <>c__DisplayClass65_0 CS$<>8__locals3 = new <>c__DisplayClass65_0 { context = context }; return new NativeLootTable(((PackRecipe)CS$<>8__locals3.context.Recipe).Key, ((IEnumerable)CS$<>8__locals3.context.Recipe.Drops).Select((Func)((LootDropRecipe drop) => new LootDrop(CS$<>8__locals3.context.Installer.ResolveItem(ContentReference.Parse(drop.Item)), drop.FixedQuantity, drop.PerPlayerQuantity, ContentReference.Parse(drop.Item)))), (ManualLogSource)null); } internal bool b__66_0(NativeItemRegistrar registrar) { return registrar.CollectionId == 48187; } internal bool b__66_1(NativeItemRegistrar registrar) { return registrar.CollectionId == 48188; } internal bool b__66_2(NativeLootTable table) { return table.Key == "angler_loot"; } internal AsyncOperation? b__67_2(LoadSceneMode mode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ReachWorld.LoadScene(7, mode); } } [CompilerGenerated] private sealed class <>c__DisplayClass65_0 { public ExternalRecipeContext context; internal LootDrop b__4(LootDropRecipe drop) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown return new LootDrop(context.Installer.ResolveItem(ContentReference.Parse(drop.Item)), drop.FixedQuantity, drop.PerPlayerQuantity, ContentReference.Parse(drop.Item)); } } private bool prepared; private AuthoredAssets? authoredAssets; private HarborSceneAssets? harborAssets; private bool disposed; private ChapterQuests? chapterQuests; internal static ExpansionRuntime? Instance { get; private set; } internal bool Ready { get { if (prepared && Object.op_Implicit((Object)(object)ExpansionPlatform.Current)) { return ExpansionPlatform.Current.CoreReady; } return false; } } internal string Status { get; private set; } = "Preparing the extra island..."; internal ArtFactory Art { get; private set; } internal ContentRegistry Content { get; private set; } internal EncounterCatalog Encounters { get; private set; } internal HarborLureCatalog Lures { get; private set; } internal NpcService Characters { get; private set; } internal ReachWorld World { get; private set; } internal ReachNetwork Network { get; private set; } internal ReachSession Session { get; private set; } internal ReachPanel Panel { get; private set; } internal NativeWorldServices NativeServices { get; private set; } internal IslandArtLayout? ArtLayout { get; private set; } internal HawkContent Hawks { get; private set; } private void Awake() { //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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown Instance = this; Characters = new NpcService(); NativeServices = new NativeWorldServices(); World = new ReachWorld(Characters.CaptureTemplates, BuildWorld, SpawnCharacters, ClearSceneServices, NativeServices.Capture); World.IslandCreated += SpawnGrass; ExpansionPlatform.Current.RegisterExtension(new PackExtension("gamblers_reach", (Func)PrepareSource, (Action)ConfigurePack) { ContentInstalled = ContentInstalled, BindWorld = BindPlatformWorld, PrepareGameplay = PrepareGameplay, GameplayReady = () => prepared, VerifyScene = VerifyPlatformScene, AcceptSavedRevision = HarborPackDefinition.AcceptSavedRevision }); Hawks = new HawkContent(this); } private PackSource PrepareSource() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) IslandManager val = Object.FindAnyObjectByType(); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("The native island manager was not found."); } World.Configure(val); Art = new ArtFactory(); authoredAssets = new AuthoredAssets(); harborAssets = new HarborSceneAssets(); World.UseAuthoredScene(harborAssets.ScenePath, "GamblersReachHarbor"); Content = new ContentRegistry(); Content.Begin(authoredAssets.CreateVisual, authoredAssets.CreateVisual); Encounters = new EncounterCatalog(); Encounters.Begin(authoredAssets.CreateVisual); return HarborPackDefinition.Create(World.Position); } private void ConfigurePack(PackContentOptions options) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //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_0103: Expected O, but got Unknown options.Assets = (IPackAssetFactory)(object)new HarborPackAssets(authoredAssets ?? throw new InvalidOperationException("The original harbor assets are unavailable.")); foreach (ContentDescriptor descriptor in Content.Descriptors) { options.ExternalItems.Add(descriptor.Key, (ExternalItemBinder)((ExternalRecipeContext context, NativeItemRegistrar registrar) => Content.Prepare(context.Recipe, registrar))); } foreach (ItemDefinition item in HarborDefinition.Value.Items.Where(delegate(ItemDefinition item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 ItemKind kind = item.Kind; return kind - 3 <= 1; })) { options.ExternalItems.Add(item.Key, (ExternalItemBinder)((ExternalRecipeContext context, NativeItemRegistrar registrar) => Encounters.Prepare(context.Recipe, registrar))); } Dictionary externalLoot = options.ExternalLoot; object obj = <>c.<>9__65_0; if (obj == null) { ExternalLootBinder val = (ExternalRecipeContext context) => new NativeLootTable(((PackRecipe)context.Recipe).Key, ((IEnumerable)context.Recipe.Drops).Select((Func)((LootDropRecipe drop) => new LootDrop(context.Installer.ResolveItem(ContentReference.Parse(drop.Item)), drop.FixedQuantity, drop.PerPlayerQuantity, ContentReference.Parse(drop.Item)))), (ManualLogSource)null); <>c.<>9__65_0 = val; obj = (object)val; } externalLoot.Add("angler_loot", (ExternalLootBinder)obj); } private void ContentInstalled(PackContentInstaller installer) { Content.Complete(installer.Registrars.Single((NativeItemRegistrar registrar) => registrar.CollectionId == 48187)); Encounters.Complete(installer.Registrars.Single((NativeItemRegistrar registrar) => registrar.CollectionId == 48188)); Encounters.BindLoot(installer.Loot.Tables.Single((NativeLootTable table) => table.Key == "angler_loot")); Lures = new HarborLureCatalog(); Lures.Bind(installer.Lures ?? throw new InvalidOperationException("The shared harbor lures did not register.")); NativeServices.PrepareHarpoonUpgrades(Content.HarpoonUpgrades); Network = new ReachNetwork(InstanceFinder.NetworkManager); Panel = ((Component)this).gameObject.AddComponent(); Panel.Initialize(SendAction); Session = new ReachSession(Content, World, Network, Characters, Panel); Session.ChapterChanged += World.RefreshChapterGate; } private void BindPlatformWorld(ExpansionPlatform platform) { platform.World.RegisterExternalIsland("gamblers_reach:harbor", (Func)(() => World.Location ?? throw new InvalidOperationException("The harbor approach was not configured.")), (Func)(() => Session.ChapterState.CoordinatesClaimed), (Func)((LoadSceneMode mode) => ReachWorld.LoadScene(7, mode)), (Func)(() => Session.ChapterState.ExistingIslandFiveAccess)); World.IslandCreated += delegate { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (ArtLayout == null) { throw new InvalidOperationException("The harbor's authored scene did not bind."); } platform.World.MountScene("gamblers_reach:harbor", (byte)6, ArtLayout.Root.scene, ArtLayout.Root.transform); }; } private void VerifyPlatformScene(MountedIsland scene) { if (scene.Reference != "gamblers_reach:harbor") { return; } NPC[] componentsInChildren = ((Component)scene.Root).GetComponentsInChildren(true); foreach (NpcDefinition resident in HarborDefinition.Value.Npcs) { if (componentsInChildren.Count((NPC npc) => npc.ID == resident.Id) != 1) { throw new InvalidOperationException("An authored harbor NPC failed to mount: " + resident.Key); } } if (((Component)scene.Root).GetComponentsInChildren(true).Length >= HarborDefinition.Value.Shops.Count) { return; } throw new InvalidOperationException("The harbor did not mount all its declared shop services."); } private IEnumerator PrepareGameplay() { Status = "Preparing native character and boat behavior..."; yield return World.Prepare(); if (!Characters.HasTemplates) { throw new InvalidOperationException("No compatible native NPC rigs were captured. See the template diagnostics in the log."); } if (!Characters.HasSaleQuest) { throw new InvalidOperationException("The native merchant quest was not captured: " + Characters.SaleQuestOrigin); } if (!NativeServices.IsPrepared) { throw new InvalidOperationException("Native services, grass or the Reel of Fortune could not be prepared."); } prepared = true; Status = "Gambler's Reach ready. A new route opens after island four."; Plugin.Log.LogInfo((object)Status); } private WorldLayout BuildWorld(Transform parent) { //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_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_005d: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) ArtLayout = (harborAssets ?? throw new InvalidOperationException("The authored harbor is unavailable.")).Bind(((Component)parent).gameObject); return new WorldLayout { PlayerSpawn = ArtLayout.PlayerSpawn + Vector3.up * World.PlayerSpawnClearance, BoatSpawn = ArtLayout.BoatSpawn, PlayerHeading = ArtLayout.PlayerHeading, TablePosition = ArtLayout.TablePosition, NpcPositions = new Dictionary(StringComparer.Ordinal) { ["tackle"] = ArtLayout.TackleMakerPosition, ["collector"] = ArtLayout.MarineCollectorPosition, ["dealer"] = ArtLayout.DealerPosition } }; } private void OnNpcInteraction(string key) { SendAction(ReachAction.Talk, key); } private void SpawnCharacters(Transform parent, WorldLayout layout) { //IL_003c: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) if (ArtLayout == null) { throw new InvalidOperationException("The authored island layout is missing."); } NativeServices.Spawn(parent, Content, ArtLayout.ShopPositions, ArtLayout.ShopHeadings, ArtLayout.SlotMachinePosition, ArtLayout.SlotMachineHeading); NativeServices.Cooking.Spawn(parent, ArtLayout.NativeDecorPositions["grill"], ArtLayout.NativeDecorHeadings["grill"]); Characters.Spawn(parent, layout.NpcPositions, OnNpcInteraction); Characters.Targets["tackle"].localRotation = Quaternion.Euler(0f, ArtLayout.NpcHeadings["tackle_maker"], 0f); Characters.Targets["collector"].localRotation = Quaternion.Euler(0f, ArtLayout.NpcHeadings["marine_collector"], 0f); Characters.Targets["dealer"].localRotation = Quaternion.Euler(0f, ArtLayout.NpcHeadings["blackjack_dealer"], 0f); NPC component = ((Component)Characters.Targets["collector"]).GetComponent(); ((Component)component).GetComponent().NativeChapter = true; chapterQuests = new ChapterQuests(component, Lures.Get("angler_lure"), Encounters.Get(192), Encounters.Get(193)); Session.BindChapterQuests(chapterQuests); NativeBlackjackDisplay display = NativeServices.SpawnBlackjackPresentation(parent, layout.TablePosition, ArtLayout.BlackjackPlayerHeading); Panel.BindTable(parent, layout.TablePosition, ArtLayout.BlackjackPlayerHeading, display); Session.RefreshDeposit(); } private void SpawnGrass() { if (ArtLayout == null) { throw new InvalidOperationException("The active harbor has no authored grass placement surface."); } NativeServices.Grass.Spawn(ArtLayout.Root.transform); } private void ClearSceneServices() { chapterQuests?.Dispose(); chapterQuests = null; Characters.ClearScene(); NativeServices.ClearScene(); ArtLayout = null; } private void SendAction(ReachAction action, string argument) { try { Network.Send(action, argument); } catch (InvalidOperationException ex) { Plugin.Log.LogWarning((object)ex.Message); Panel.ShowError(ex.Message); } } private void Update() { if (Network != null) { Network.Tick(); } if (Session != null) { Session.Tick(); } } private void OnGUI() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!Ready && MainMenuManager.IsInMenu) { GUI.Box(new Rect(16f, (float)(Screen.height - 80), (float)Math.Min(600, Screen.width - 32), 60f), "Gambler's Reach\n" + Status); } } private void OnDestroy() { if (!disposed) { disposed = true; Plugin.Log.LogInfo((object)"Disposing the expansion runtime."); prepared = false; if (World != null) { World.IslandCreated -= SpawnGrass; } if (Session != null && World != null) { Session.ChapterChanged -= World.RefreshChapterGate; } chapterQuests?.Dispose(); Session?.Dispose(); Network?.Dispose(); World?.Dispose(); Characters?.Dispose(); NativeServices?.Dispose(); Lures?.Dispose(); Encounters?.Dispose(); Content?.Dispose(); authoredAssets?.Dispose(); harborAssets?.Dispose(); Art?.Dispose(); Instance = null; } } } [BepInPlugin("friends.howtofish.gamblersreach", "Gambler's Reach", "0.8.4")] [BepInDependency("howtofish.expansionkit.runtime", "0.7.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Id = "friends.howtofish.gamblersreach"; public const string Name = "Gambler's Reach"; public const string Version = "0.8.4"; internal static readonly Guid SupportedGame = new Guid("91a1729d-8ab8-4d3b-afcf-c6edfa435491"); private Harmony? patches; internal static ManualLogSource Log { get; private set; } = null; internal static Plugin Instance { get; private set; } = null; private void Awake() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; Guid moduleVersionId = typeof(Item).Assembly.ManifestModule.ModuleVersionId; if (moduleVersionId != SupportedGame) { string text = $"Unsupported How to Fish build ({moduleVersionId}). Expected game 1.0.12. No expansion content was loaded."; Log.LogError((object)text); throw new NotSupportedException(text); } patches = new Harmony("friends.howtofish.gamblersreach"); patches.PatchAll(typeof(Plugin).Assembly); RegisterContent(); Log.LogInfo((object)("Gambler's Reach 0.8.4 loaded on Unity " + Application.unityVersion + "; game assembly verified.")); } private void RegisterContent() { ((Component)this).gameObject.AddComponent(); } } } namespace GamblersReach.World { internal sealed class BlackjackDeposit : MonoBehaviour { internal const int MaximumItems = 12; private BoxCollider region; internal static BlackjackDeposit? Current { get; private set; } internal Vector3 Position => ((Component)region).transform.TransformPoint(region.center); internal bool Ready { get { if (Object.op_Implicit((Object)(object)region)) { return ((Component)region).gameObject.activeInHierarchy; } return false; } } internal void Configure(BoxCollider volume) { if (!Object.op_Implicit((Object)(object)volume) || !((Collider)volume).isTrigger) { throw new ArgumentException("The blackjack deposit needs a dedicated trigger volume.", "volume"); } if (Object.op_Implicit((Object)(object)Current) && (Object)(object)Current != (Object)(object)this) { throw new InvalidOperationException("Only one shared blackjack deposit may be active."); } int num = LayerMask.NameToLayer("Ignore Raycast"); if (num < 0) { throw new InvalidOperationException("The wager sensor's non-interactive layer is unavailable."); } ((Component)volume).gameObject.layer = num; ((Component)volume).gameObject.tag = "Untagged"; region = volume; Current = this; } internal Item[] ItemsSnapshot() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0044: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (!Ready) { return Array.Empty(); } Physics.SyncTransforms(); Vector3 lossyScale = ((Component)region).transform.lossyScale; Vector3 val = Vector3.Scale(region.size * 0.5f, new Vector3(Mathf.Abs(lossyScale.x), Mathf.Abs(lossyScale.y), Mathf.Abs(lossyScale.z))); Collider[] array = Physics.OverlapBox(Position, val, ((Component)region).transform.rotation, LayerMask.op_Implicit(GameInfo.ItemLayer), (QueryTriggerInteraction)2); HashSet hashSet = new HashSet(); Collider[] array2 = array; foreach (Collider val2 in array2) { Item value = null; if (!ItemManager.Items.TryGetValue(((Component)val2).transform, out value) && Object.op_Implicit((Object)(object)val2.attachedRigidbody)) { ItemManager.Items.TryGetValue(((Component)val2.attachedRigidbody).transform, out value); } if (Object.op_Implicit((Object)(object)value)) { hashSet.Add(value); } } return hashSet.OrderBy((Item item) => ((NetworkBehaviour)item).ObjectId).ToArray(); } private void OnDestroy() { if ((Object)(object)Current == (Object)(object)this) { Current = null; } } } internal enum CumulativeShopKind { Weapon, Melee, Explosive, Sharpening, Rod, Utility, Lure, Pocket, Motor } internal sealed class CumulativeShopOffer { internal string Key { get; } internal string Reference => "native_" + Key.Substring("legacy_".Length); internal CumulativeShopKind Kind { get; } internal byte? NativeItemId { get; } internal byte? NativeLureIndex { get; } internal byte? NativeTier { get; } internal string NativeName { get; } internal string? SourceName { get; } internal int? FixedPrice { get; } internal CumulativeShopOffer(string key, CumulativeShopKind kind, byte? nativeItemId, string nativeName, int? fixedPrice, byte? nativeLureIndex = null, byte? nativeTier = null, string? sourceName = null) { Key = key; Kind = kind; NativeItemId = nativeItemId; NativeName = nativeName; FixedPrice = fixedPrice; NativeLureIndex = nativeLureIndex; NativeTier = nativeTier; SourceName = sourceName; } } internal readonly struct CumulativeShopPlacement { internal Vector3 Surface { get; } internal float Heading { get; } internal CumulativeShopPlacement(Vector3 surface, float heading) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Surface = surface; Heading = heading; } } internal readonly struct CumulativeShopFootprint { internal float Width { get; } internal float Height { get; } internal float Depth { get; } internal CumulativeShopFootprint(Vector3 size) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) Width = size.x; Height = size.y; Depth = size.z; } public override string ToString() { return $"{Width:0.00}w x {Depth:0.00}d x {Height:0.00}h m"; } } internal sealed class CumulativeHarborShops : IDisposable { private sealed class Template { internal Purchasable Stand; internal Quaternion Tilt; internal CumulativeShopFootprint Footprint; internal string Source = ""; } private static readonly CumulativeShopOffer[] Island4CarryForward; internal static readonly IReadOnlyList ExistingUpgradeCoverage; private readonly GameObject nursery; private readonly Dictionary nativeItems = new Dictionary(StringComparer.Ordinal); private readonly Dictionary nativeLures = new Dictionary(StringComparer.Ordinal); private readonly Dictionary templates = new Dictionary(StringComparer.Ordinal); private readonly Dictionary stands = new Dictionary(StringComparer.Ordinal); private readonly Dictionary headings = new Dictionary(StringComparer.Ordinal); private GameObject? spawnedRoot; private bool disposed; internal IReadOnlyList Offers => Array.AsReadOnly(Island4CarryForward); internal IReadOnlyList RequiredMarkerKeys => Array.AsReadOnly(Island4CarryForward.Select((CumulativeShopOffer offer) => offer.Key).ToArray()); internal IReadOnlyDictionary Stands => stands; internal IReadOnlyDictionary Sources => new ReadOnlyDictionary(templates.ToDictionary, string, string>((KeyValuePair pair) => pair.Key, (KeyValuePair pair) => pair.Value.Source, StringComparer.Ordinal)); internal IReadOnlyDictionary Footprints => new ReadOnlyDictionary(templates.ToDictionary, string, CumulativeShopFootprint>((KeyValuePair pair) => pair.Key, (KeyValuePair pair) => pair.Value.Footprint, StringComparer.Ordinal)); internal IReadOnlyList Missing { get { Template value; return (from offer in Island4CarryForward where !templates.TryGetValue(offer.Key, out value) || !Object.op_Implicit((Object)(object)value.Stand) select offer.Key).ToArray(); } } internal bool IsPrepared { get { if (!disposed) { return Missing.Count == 0; } return false; } } internal CumulativeHarborShops() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown ValidateCatalogShape(); nursery = new GameObject("Inactive Island4 cumulative shop templates"); nursery.SetActive(false); Object.DontDestroyOnLoad((Object)(object)nursery); } internal object DescribeTemplates() { return new { Footprints = Enumerable.ToDictionary(Footprints, (KeyValuePair pair) => pair.Key, (KeyValuePair pair) => new { pair.Value.Width, pair.Value.Depth, pair.Value.Height }, StringComparer.Ordinal), Sources = Sources, Offers = Offers.Select((CumulativeShopOffer offer) => new { Key = offer.Key, Kind = offer.Kind.ToString(), NativeItemId = offer.NativeItemId, NativeLureIndex = offer.NativeLureIndex, NativeTier = offer.NativeTier, NativeName = offer.NativeName, FixedPrice = offer.FixedPrice }).ToArray() }; } internal static IReadOnlyList FindSpawned(Transform parent) { if (!Object.op_Implicit((Object)(object)parent)) { throw new ArgumentNullException("parent"); } return (from binding in ((Component)parent).GetComponentsInChildren(true) where binding.Shops != null && !binding.Shops.disposed select binding.Shops).Distinct().ToArray(); } internal void Capture(Scene scene) { //IL_0101: Unknown result type (might be due to invalid IL or missing references) ThrowIfDisposed(); if (!((Scene)(ref scene)).IsValid() || !((Scene)(ref scene)).isLoaded) { throw new ArgumentException("Cumulative shop capture requires a loaded native scene.", "scene"); } if (!string.Equals(((Scene)(ref scene)).name, "Island4", StringComparison.Ordinal) || IsPrepared) { return; } if (templates.Count != 0) { throw new InvalidOperationException("The native Island4 cumulative shops were captured more than once."); } ResolveNativeAssets(); Purchasable[] source = ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject root) => root.GetComponentsInChildren(true)).ToArray(); bool flag = false; try { CumulativeShopOffer[] island4CarryForward = Island4CarryForward; foreach (CumulativeShopOffer offer in island4CarryForward) { Purchasable[] array = source.Where((Purchasable candidate) => Matches(candidate, offer) && (offer.SourceName == null || ((Object)((Component)candidate).gameObject).name == offer.SourceName)).ToArray(); if (array.Length != 1) { throw new InvalidOperationException($"Native Island4 must contain exactly one {offer.Key} display; found {array.Length}."); } CaptureTemplate(scene, offer, array[0]); } ValidateNativeCatalog(); flag = true; } finally { if (!flag) { foreach (Template value in templates.Values) { if (Object.op_Implicit((Object)(object)value.Stand)) { Object.Destroy((Object)(object)((Component)value.Stand).gameObject); } } templates.Clear(); nativeItems.Clear(); nativeLures.Clear(); } } } internal void Spawn(Transform parent, IReadOnlyDictionary placements) { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_01d5: 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) ThrowIfDisposed(); if (!IsPrepared) { throw new InvalidOperationException("Missing verified Island4 cumulative shops: " + string.Join(", ", Missing)); } if (!Object.op_Implicit((Object)(object)parent) || placements == null) { throw new ArgumentException("Cumulative shops require a parent and placement catalog."); } if (Object.op_Implicit((Object)(object)spawnedRoot) || stands.Values.Any((Purchasable stand) => Object.op_Implicit((Object)(object)stand))) { throw new InvalidOperationException("Clear cumulative shops before rebuilding them."); } CumulativeShopOffer[] island4CarryForward = Island4CarryForward; foreach (CumulativeShopOffer cumulativeShopOffer in island4CarryForward) { if (!placements.TryGetValue(cumulativeShopOffer.Key, out var value) || !Finite(value.Surface) || !NativeContentAccess.Finite(value.Heading)) { throw new InvalidOperationException("Missing or invalid cumulative shop marker: " + cumulativeShopOffer.Key); } } ValidateNativeCatalog(); spawnedRoot = new GameObject("Island4 cumulative harbor shops"); spawnedRoot.SetActive(false); spawnedRoot.transform.SetParent(parent, false); spawnedRoot.AddComponent().Shops = this; bool flag = false; try { island4CarryForward = Island4CarryForward; foreach (CumulativeShopOffer cumulativeShopOffer2 in island4CarryForward) { Template template = templates[cumulativeShopOffer2.Key]; Purchasable component = NativeSceneMeshes.Clone(((Component)template.Stand).gameObject, spawnedRoot.transform).GetComponent(); CumulativeShopPlacement cumulativeShopPlacement = placements[cumulativeShopOffer2.Key]; ((Object)component).name = "Native Island4 " + cumulativeShopOffer2.Key; ((Component)component).transform.localPosition = cumulativeShopPlacement.Surface; ((Component)component).transform.localRotation = Quaternion.Euler(0f, cumulativeShopPlacement.Heading, 0f) * template.Tilt; ValidateReferences(component); if (!Matches(component, cumulativeShopOffer2)) { throw new InvalidOperationException("A placed cumulative shop lost its native identity: " + cumulativeShopOffer2.Key); } SeatOnSurface(component, spawnedRoot.transform, cumulativeShopPlacement.Surface, cumulativeShopOffer2.Kind == CumulativeShopKind.Motor); stands.Add(cumulativeShopOffer2.Key, component); headings.Add(cumulativeShopOffer2.Key, cumulativeShopPlacement.Heading); ((Component)component).gameObject.SetActive(true); } spawnedRoot.SetActive(true); flag = true; } finally { if (!flag) { Clear(); } } } internal Vector3 ApproachDirection(string key) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_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_0068: 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) ThrowIfDisposed(); if (!Object.op_Implicit((Object)(object)spawnedRoot) || !headings.TryGetValue(key, out var value)) { throw new InvalidOperationException("The cumulative shop is not spawned: " + key); } Vector3 val = Vector3.ProjectOnPlane(spawnedRoot.transform.TransformDirection(Quaternion.Euler(0f, value, 0f) * Vector3.forward), Vector3.up); return ((Vector3)(ref val)).normalized; } internal void ValidateLiveStand(CumulativeShopOffer offer) { ValidateNativeCatalog(); if (!Island4CarryForward.Contains(offer) || !stands.TryGetValue(offer.Key, out Purchasable value) || !Object.op_Implicit((Object)(object)value) || !((Behaviour)value).isActiveAndEnabled || !Matches(value, offer)) { throw new InvalidOperationException("The cumulative native display is missing or inactive: " + offer.Key); } ValidateReferences(value); if (NativeContentAccess.Get(value, "_isFree")) { throw new InvalidOperationException("A cumulative native display became free: " + offer.Key); } int? fixedPrice = offer.FixedPrice; if (fixedPrice.HasValue) { int valueOrDefault = fixedPrice.GetValueOrDefault(); if (NativeContentAccess.Get(value, "_customCost") != valueOrDefault) { throw new InvalidOperationException("A cumulative native display has the wrong price: " + offer.Key); } } if (offer.Kind == CumulativeShopKind.Sharpening && NativeContentAccess.Get(value, "_maxSharpnessUpgrade") != 12) { throw new InvalidOperationException("The sharpening stand no longer has Island4's tier-12 cap."); } if (offer.Kind == CumulativeShopKind.Pocket && NativeContentAccess.Get(value, "_maxSlot") != offer.NativeTier) { throw new InvalidOperationException("The pocket stand no longer has Island4's three-slot cap."); } if (offer.Kind == CumulativeShopKind.Motor && NativeContentAccess.Get(value, "_motorIndex") != offer.NativeTier) { throw new InvalidOperationException("A motor stand no longer has its native boat tier: " + offer.Key); } } internal void ValidateNativeCatalog() { ThrowIfDisposed(); if (nativeItems.Count != Island4CarryForward.Count((CumulativeShopOffer offer) => offer.NativeItemId.HasValue)) { throw new InvalidOperationException("The native cumulative item catalog is incomplete."); } if (nativeLures.Count != Island4CarryForward.Count((CumulativeShopOffer offer) => offer.NativeLureIndex.HasValue)) { throw new InvalidOperationException("The native cumulative lure catalog is incomplete."); } foreach (CumulativeShopOffer item in Island4CarryForward.Where((CumulativeShopOffer offer) => offer.NativeItemId.HasValue)) { Item val = nativeItems[item.Key]; if ((Object)(object)GameInfo.IDToItem(item.NativeItemId.Value) != (Object)(object)val || ((Object)val).name != item.NativeName || val.Cost != item.FixedPrice) { throw new InvalidOperationException("Native item identity changed after capture: " + item.Key); } RequireItemFamily(val, item); } foreach (CumulativeShopOffer item2 in Island4CarryForward.Where((CumulativeShopOffer offer) => offer.NativeLureIndex.HasValue)) { BaitInfo val2 = nativeLures[item2.Key]; byte? nativeLureIndex = item2.NativeLureIndex; if (nativeLureIndex.HasValue) { byte valueOrDefault = nativeLureIndex.GetValueOrDefault(); if (valueOrDefault < GameInfo.AllBaits.Count && !((Object)(object)GameInfo.AllBaits[valueOrDefault] != (Object)(object)val2) && GameInfo.GetIndexOfBait(val2) == valueOrDefault && !(((Object)val2).name != item2.NativeName) && val2.Cost == item2.FixedPrice) { RequireLure(val2, item2); continue; } } throw new InvalidOperationException("Native lure identity changed after capture: " + item2.Key); } } internal void Clear() { if (Object.op_Implicit((Object)(object)spawnedRoot)) { spawnedRoot.GetComponent().Shops = null; spawnedRoot.SetActive(false); Object.Destroy((Object)(object)spawnedRoot); } spawnedRoot = null; stands.Clear(); headings.Clear(); } private void ResolveNativeAssets() { HashSet hashSet = new HashSet(Resources.LoadAll("Items")); HashSet hashSet2 = new HashSet(Resources.LoadAll("Baits")); if (hashSet.Count == 0 || hashSet2.Count == 0) { throw new InvalidOperationException("Initialize native GameInfo before capturing cumulative shops."); } foreach (CumulativeShopOffer item in Island4CarryForward.Where((CumulativeShopOffer offer) => offer.NativeItemId.HasValue)) { Item val = GameInfo.IDToItem(item.NativeItemId.Value); if (!Object.op_Implicit((Object)(object)val) || !hashSet.Contains(val) || ((Object)val).name != item.NativeName || val.Cost != item.FixedPrice || val.IsQuestItem || val is DeadPlayer || (val is Creature && (item.Key != "legacy_beer" || ((object)val).GetType() != typeof(Creature)))) { throw new InvalidOperationException($"Native item {item.NativeItemId} differs from '{item.NativeName}' at ${item.FixedPrice}: " + $"name={((val != null) ? ((Object)val).name : null)}, type={((object)val)?.GetType().Name}, cost={((val != null) ? new int?(val.Cost) : ((int?)null))}, quest={((val != null) ? new bool?(val.IsQuestItem) : ((bool?)null))}, " + $"resource={Object.op_Implicit((Object)(object)val) && hashSet.Contains(val)}, creature={val is Creature}, player={val is DeadPlayer}."); } RequireItemFamily(val, item); nativeItems.Add(item.Key, val); } foreach (CumulativeShopOffer item2 in Island4CarryForward.Where((CumulativeShopOffer offer) => offer.NativeLureIndex.HasValue)) { byte value = item2.NativeLureIndex.Value; if (value >= GameInfo.AllBaits.Count) { throw new InvalidOperationException("Native lure index is unavailable: " + item2.Key); } BaitInfo val2 = GameInfo.AllBaits[value]; if (!Object.op_Implicit((Object)(object)val2) || !hashSet2.Contains(val2) || GameInfo.GetIndexOfBait(val2) != value || ((Object)val2).name != item2.NativeName || val2.Cost != item2.FixedPrice) { throw new InvalidOperationException($"Native lure {value} is not Island4 stock '{item2.NativeName}' at ${item2.FixedPrice}."); } RequireLure(val2, item2); nativeLures.Add(item2.Key, val2); } } private void CaptureTemplate(Scene scene, CumulativeShopOffer offer, Purchasable source) { //IL_0070: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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) ValidateReferences(source); if (NativeContentAccess.Get(source, "_isFree") || !NativeContentAccess.Get(source, "_customCanBuy")) { throw new InvalidOperationException("Island4 source is not an enabled paid purchase: " + offer.Key); } Purchasable component = NativeSceneMeshes.Clone(((Component)source).gameObject, nursery.transform).GetComponent(); bool flag = false; try { ((Object)component).name = "Native Island4 template " + offer.Key; ((Component)component).transform.localPosition = Vector3.zero; ((Component)component).transform.localScale = ((Component)source).transform.lossyScale; Quaternion val = Quaternion.Inverse(Quaternion.Euler(0f, ((Component)source).transform.eulerAngles.y, 0f)) * ((Component)source).transform.rotation; ((Component)component).transform.localRotation = val; NativeContentAccess.Set(component, "_isHovering", false); NativeContentAccess.Set(component, "_customCanBuy", true); ValidateReferences(component); if (!Matches(component, offer)) { throw new InvalidOperationException("Cloning changed the Island4 purchase identity: " + offer.Key); } Bounds val2 = VisibleBounds(component, nursery.transform); templates.Add(offer.Key, new Template { Stand = component, Tilt = val, Footprint = new CumulativeShopFootprint(((Bounds)(ref val2)).size), Source = ((Scene)(ref scene)).name + ":" + Hierarchy(((Component)source).transform) }); flag = true; } finally { if (!flag && Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)((Component)component).gameObject); } } } private bool Matches(Purchasable stand, CumulativeShopOffer offer) { return offer.Kind switch { CumulativeShopKind.Sharpening => ((object)stand).GetType() == typeof(SharpnessPurchasable) && NativeContentAccess.Get(stand, "_maxSharpnessUpgrade") == 12, CumulativeShopKind.Lure => ((object)stand).GetType() == typeof(BaitPurchasable) && (Object)(object)NativeContentAccess.Optional(stand, "_bait") == (Object)(object)nativeLures[offer.Key], CumulativeShopKind.Pocket => ((object)stand).GetType() == typeof(SlotPurchasable) && NativeContentAccess.Get(stand, "_maxSlot") == offer.NativeTier, CumulativeShopKind.Motor => ((object)stand).GetType() == typeof(MotorPurchasable) && NativeContentAccess.Get(stand, "_motorIndex") == offer.NativeTier && NativeContentAccess.Get(stand, "_customCost") == offer.FixedPrice, _ => ((object)stand).GetType() == typeof(ItemPurchasable) && (Object)(object)NativeContentAccess.Optional(stand, "_itemToPurchase") == (Object)(object)nativeItems[offer.Key], }; } private static void RequireItemFamily(Item item, CumulativeShopOffer offer) { bool flag; switch (offer.Kind) { case CumulativeShopKind.Weapon: flag = item is Weapon; break; case CumulativeShopKind.Melee: flag = item is Melee; break; case CumulativeShopKind.Explosive: flag = item is Explosive; break; case CumulativeShopKind.Rod: flag = ((offer.Key == "legacy_cast_rod") ? (item is FishingRodCast) : (offer.Key == "legacy_crab_rod" && item is FishingRodCrab)); break; case CumulativeShopKind.Utility: { bool flag2 = !(item is Weapon) && !(item is Melee) && !(item is FishingRod) && !(item is Explosive); if (flag2) { flag2 = offer.Key switch { "legacy_radio" => item is Radio, "legacy_disc" => item is Disc, "legacy_map" => item is Map, "legacy_beer" => ((object)item).GetType() == typeof(Creature), "legacy_badball" => true, _ => false, }; } flag = flag2; break; } default: flag = false; break; } if (!flag) { throw new InvalidOperationException($"Native item {offer.NativeName} does not match {offer.Kind}."); } } private static void RequireLure(BaitInfo lure, CumulativeShopOffer offer) { if (offer.Kind != CumulativeShopKind.Lure || !Object.op_Implicit((Object)(object)lure.Mesh) || !Object.op_Implicit((Object)(object)lure.MeshForNpc) || lure.ItemWeights == null || lure.ItemWeights.Count == 0 || !lure.ItemWeights.Any((ItemInfoWeight entry) => entry != null && entry.Weight > 0f && Object.op_Implicit((Object)(object)entry.Fishable) && entry.Fishable.ItemToSpawn is Creature)) { throw new InvalidOperationException("Native lure " + offer.NativeName + " has no usable native catch table."); } } private static void ValidateCatalogShape() { //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) if (Island4CarryForward.Length != 25 || Island4CarryForward.Select((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.Key).Distinct(StringComparer.Ordinal).Count() != 25 || Island4CarryForward.Count((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.Kind == CumulativeShopKind.Weapon) != 4 || Island4CarryForward.Count((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.Kind == CumulativeShopKind.Melee) != 2 || Island4CarryForward.Count((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.Kind == CumulativeShopKind.Explosive) != 1 || Island4CarryForward.Count((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.Kind == CumulativeShopKind.Sharpening) != 1 || Island4CarryForward.Count((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.Kind == CumulativeShopKind.Rod) != 2 || Island4CarryForward.Count((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.Kind == CumulativeShopKind.Utility) != 5 || Island4CarryForward.Count((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.Kind == CumulativeShopKind.Lure) != 7 || Island4CarryForward.Count((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.Kind == CumulativeShopKind.Pocket) != 1 || Island4CarryForward.Count((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.Kind == CumulativeShopKind.Motor) != 2 || Island4CarryForward.Any((CumulativeShopOffer cumulativeShopOffer) => cumulativeShopOffer.NativeName.Contains("Scientific") || cumulativeShopOffer.NativeName == "Coconut")) { throw new InvalidOperationException("The Island4 cumulative shop catalog is malformed."); } CumulativeShopOffer[] island4CarryForward = Island4CarryForward; foreach (CumulativeShopOffer offer in island4CarryForward) { ShopDefinition val = HarborDefinition.Value.Shops.Single((ShopDefinition shop) => shop.Key == offer.Key); string text; switch (offer.Kind) { case CumulativeShopKind.Weapon: case CumulativeShopKind.Melee: case CumulativeShopKind.Explosive: case CumulativeShopKind.Rod: case CumulativeShopKind.Utility: text = "NativeItem"; break; case CumulativeShopKind.Lure: text = "NativeLure"; break; case CumulativeShopKind.Sharpening: text = "Sharpening"; break; case CumulativeShopKind.Pocket: text = "Pocket"; break; case CumulativeShopKind.Motor: text = "Motor"; break; default: throw new InvalidOperationException("Unknown cumulative definition kind: " + offer.Kind); } string text2 = text; int num2 = ((int?)offer.NativeItemId) ?? ((int?)offer.NativeLureIndex) ?? (-1); string text3 = ((num2 >= 0) ? offer.NativeName : ""); if (((object)val.Kind/*cast due to .constrained prefix*/).ToString() != text2 || val.Reference != offer.Reference || val.NativeId != num2 || val.NativeName != text3) { throw new InvalidOperationException("The SDK definition differs from the verified native shop: " + offer.Key); } } } private static void ValidateReferences(Purchasable stand) { //IL_010f: Unknown result type (might be due to invalid IL or missing references) Collider val = NativeContentAccess.Get(stand, "_interactCol"); GameObject[] array = NativeContentAccess.Get(stand, "_modelsToOutline"); if (!Object.op_Implicit((Object)(object)val) || !val.enabled || !((Component)val).transform.IsChildOf(((Component)stand).transform) || !((Component)val).CompareTag("Interactable") || !Object.op_Implicit((Object)(object)((Interactable)stand).TextTarget) || !((Interactable)stand).TextTarget.IsChildOf(((Component)stand).transform) || array.Length == 0 || array.Any((GameObject model) => !Object.op_Implicit((Object)(object)model) || !model.transform.IsChildOf(((Component)stand).transform)) || ((Component)stand).GetComponentsInChildren(true).Length != 1 || ((Component)stand).GetComponentsInChildren(true).Length != 0 || ((Component)stand).GetComponentsInChildren(true).Length != 0) { throw new InvalidOperationException("Native cumulative shop has invalid or external references: " + ((Object)stand).name); } VisibleBounds(stand, ((Component)stand).transform); } private static void SeatOnSurface(Purchasable stand, Transform parent, Vector3 surface, bool centerFootprint) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) Bounds val = VisibleBounds(stand, parent); Transform transform = ((Component)stand).transform; transform.localPosition += new Vector3(centerFootprint ? (surface.x - ((Bounds)(ref val)).center.x) : 0f, surface.y - ((Bounds)(ref val)).min.y, centerFootprint ? (surface.z - ((Bounds)(ref val)).center.z) : 0f); } private static Bounds VisibleBounds(Purchasable stand, Transform relativeTo) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00f4: Unknown result type (might be due to invalid IL or missing references) MeshRenderer val3 = default(MeshRenderer); MeshFilter[] array = (from filter in ((Component)stand).GetComponentsInChildren(true) where Object.op_Implicit((Object)(object)filter.sharedMesh) && ActiveBelow(((Component)filter).transform, ((Component)stand).transform) && ((Component)filter).TryGetComponent(ref val3) && ((Renderer)val3).enabled select filter).ToArray(); if (array.Length == 0) { throw new InvalidOperationException("Native cumulative shop has no visible owned geometry: " + ((Object)stand).name); } Bounds? val = null; MeshFilter[] array2 = array; foreach (MeshFilter val2 in array2) { Bounds value = NativeSceneMeshes.TransformBounds(val2.sharedMesh.bounds, relativeTo.worldToLocalMatrix * ((Component)val2).transform.localToWorldMatrix); if (!Finite(((Bounds)(ref value)).min) || !Finite(((Bounds)(ref value)).max)) { throw new InvalidOperationException("Native cumulative shop has invalid geometry bounds: " + ((Object)stand).name); } if (val.HasValue) { Bounds valueOrDefault = val.GetValueOrDefault(); ((Bounds)(ref valueOrDefault)).Encapsulate(((Bounds)(ref value)).min); ((Bounds)(ref valueOrDefault)).Encapsulate(((Bounds)(ref value)).max); val = valueOrDefault; } else { val = value; } } return val.Value; } private static bool ActiveBelow(Transform node, Transform root) { while ((Object)(object)node != (Object)(object)root) { if (!Object.op_Implicit((Object)(object)node) || !((Component)node).gameObject.activeSelf) { return false; } node = node.parent; } return true; } private static string Hierarchy(Transform node) { List list = new List(); while (Object.op_Implicit((Object)(object)node)) { list.Add(((Object)node).name); node = node.parent; } list.Reverse(); return string.Join("/", list); } private static bool Finite(Vector3 value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (NativeContentAccess.Finite(value.x) && NativeContentAccess.Finite(value.y)) { return NativeContentAccess.Finite(value.z); } return false; } private void ThrowIfDisposed() { if (disposed) { throw new ObjectDisposedException("CumulativeHarborShops"); } } public void Dispose() { if (disposed) { return; } Clear(); disposed = true; foreach (Template value in templates.Values) { if (Object.op_Implicit((Object)(object)value.Stand)) { Object.Destroy((Object)(object)((Component)value.Stand).gameObject); } } templates.Clear(); nativeItems.Clear(); Object.Destroy((Object)(object)nursery); } static CumulativeHarborShops() { CumulativeShopOffer[] obj = new CumulativeShopOffer[25] { new CumulativeShopOffer("legacy_brass_knuckles", CumulativeShopKind.Melee, (byte)57, "Brass Knuckles", 24), new CumulativeShopOffer("legacy_pistol", CumulativeShopKind.Weapon, (byte)66, "Pistol", 50), new CumulativeShopOffer("legacy_shotgun", CumulativeShopKind.Weapon, (byte)68, "Shotgun", 150), new CumulativeShopOffer("legacy_smg", CumulativeShopKind.Weapon, (byte)69, "Smg", 650), new CumulativeShopOffer("legacy_sniper_rifle", CumulativeShopKind.Weapon, (byte)70, "Sniper Rifle", 3800), new CumulativeShopOffer("legacy_knife", CumulativeShopKind.Melee, (byte)63, "Knife", 45), new CumulativeShopOffer("legacy_dynamite", CumulativeShopKind.Explosive, (byte)60, "Dynamite", 25), new CumulativeShopOffer("legacy_sharpening", CumulativeShopKind.Sharpening, null, "Sharpness (Purchasable)", null, null, null, "Sharpness (Purchasable)"), new CumulativeShopOffer("legacy_cast_rod", CumulativeShopKind.Rod, (byte)61, "Fishing Rod", 3), new CumulativeShopOffer("legacy_crab_rod", CumulativeShopKind.Rod, (byte)59, "Crab Fishing Rod", 3), new CumulativeShopOffer("legacy_badball", CumulativeShopKind.Utility, (byte)55, "Badball", 3), new CumulativeShopOffer("legacy_beer", CumulativeShopKind.Utility, (byte)56, "Beer", 12), new CumulativeShopOffer("legacy_radio", CumulativeShopKind.Utility, (byte)67, "Radio", 10), new CumulativeShopOffer("legacy_disc", CumulativeShopKind.Utility, (byte)62, "Disc", 10), new CumulativeShopOffer("legacy_map", CumulativeShopKind.Utility, (byte)65, "Map", 10), new CumulativeShopOffer("legacy_hotdog_bait", CumulativeShopKind.Lure, null, "HotDog", 1, (byte)4), new CumulativeShopOffer("legacy_beginner_lure", CumulativeShopKind.Lure, null, "Beginner Lure", 3, (byte)6), new CumulativeShopOffer("legacy_standard_lure", CumulativeShopKind.Lure, null, "Standard Lure", 15, (byte)8), new CumulativeShopOffer("legacy_professional_lure", CumulativeShopKind.Lure, null, "Professional Lure", 50, (byte)10), new CumulativeShopOffer("legacy_beginner_boss_lure", CumulativeShopKind.Lure, null, "Beginner Boss Lure", 40, (byte)9), new CumulativeShopOffer("legacy_standard_boss_lure", CumulativeShopKind.Lure, null, "Standard Boss Lure", 280, (byte)12), new CumulativeShopOffer("legacy_professional_boss_lure", CumulativeShopKind.Lure, null, "Professional Boss Lure", 1200, (byte)15), null, null, null }; byte? nativeTier = (byte)3; obj[22] = new CumulativeShopOffer("legacy_pocket_slot", CumulativeShopKind.Pocket, null, "Slot3 (Purchasable)", null, null, nativeTier, "Slot3 (Purchasable)"); int? fixedPrice = 230; nativeTier = (byte)1; obj[23] = new CumulativeShopOffer("legacy_big_motor", CumulativeShopKind.Motor, null, "BigMotor (Purchasable)", fixedPrice, null, nativeTier, "BigMotor (Purchasable)"); int? fixedPrice2 = 860; nativeTier = (byte)2; obj[24] = new CumulativeShopOffer("legacy_dual_motors", CumulativeShopKind.Motor, null, "DualMotors (Purchasable)", fixedPrice2, null, nativeTier, "DualMotors (Purchasable)"); Island4CarryForward = obj; ExistingUpgradeCoverage = Array.AsReadOnly(new string[7] { "harpoon_red_dot_sight", "harpoon_sniper_scope", "harpoon_compensator", "harpoon_suppressor", "harpoon_laser_sight", "harpoon_extended_mag", "harpoon_ammunition" }); } } internal sealed class CumulativeShopBinding : MonoBehaviour { internal CumulativeHarborShops? Shops { get; set; } } internal readonly struct HarpoonUpgradePlacement { internal Vector3 Surface { get; } internal float Heading { get; } internal HarpoonUpgradePlacement(Vector3 surface, float heading) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Surface = surface; Heading = heading; } } internal sealed class HarpoonUpgradeShops : IDisposable { private const string AmmunitionPolicy = "gamblers_reach:ammunition"; private readonly HarpoonUpgradeCatalog catalog; private readonly IDisposable ammunitionPolicy; private readonly GameObject nursery; private readonly Dictionary attachments = new Dictionary(); private readonly Dictionary stands = new Dictionary(StringComparer.Ordinal); private readonly Dictionary sources = new Dictionary(StringComparer.Ordinal); private BulletPurchasable? ammunition; private bool disposed; internal IReadOnlyDictionary Stands => stands; internal IReadOnlyDictionary Sources => sources; internal IReadOnlyList MissingFamilies => (from offer in catalog.Offers where Object.op_Implicit((Object)(object)offer.Information) && !attachments.ContainsKey(offer.Information) select offer.Key).Concat(Object.op_Implicit((Object)(object)ammunition) ? ((IEnumerable)Array.Empty()) : ((IEnumerable)new string[1] { "harpoon_ammunition" })).ToArray(); internal bool IsPrepared { get { if (!disposed) { return MissingFamilies.Count == 0; } return false; } } internal HarpoonUpgradeShops(HarpoonUpgradeCatalog catalog) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown this.catalog = catalog ?? throw new ArgumentNullException("catalog"); nursery = new GameObject("Reach inactive native harpoon upgrade templates"); nursery.SetActive(false); Object.DontDestroyOnLoad((Object)(object)nursery); ammunitionPolicy = AmmunitionPurchasePolicies.Register("gamblers_reach:ammunition", (Func)MaximumAmmunitionTier); } private static byte? MaximumAmmunitionTier(Weapon weapon) { ReachWorld? current = ReachWorld.Current; if (current == null || !current.IsActive) { return null; } if (((Item)weapon).ID == 188) { return (byte)12; } if (((Item)weapon).ID >= 86) { return null; } ReachSession? current2 = ReachSession.Current; return (byte)((current2 != null && current2.CanVisitIslandFive) ? 12u : 9u); } internal void Capture(Scene scene) { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown ThrowIfDisposed(); if (!((Scene)(ref scene)).IsValid() || !((Scene)(ref scene)).isLoaded) { throw new ArgumentException("Harpoon upgrade capture requires a loaded native scene.", "scene"); } Purchasable[] array = ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject root) => root.GetComponentsInChildren(true)).ToArray(); foreach (Purchasable val in array) { AttachmentPurchasable val2 = (AttachmentPurchasable)(object)((val is AttachmentPurchasable) ? val : null); if (val2 != null) { AttachmentInfo information = NativeContentAccess.Get(val2, "_info"); HarpoonUpgradeOffer harpoonUpgradeOffer = catalog.Offers.SingleOrDefault((HarpoonUpgradeOffer harpoonUpgradeOffer2) => (Object)(object)harpoonUpgradeOffer2.Information == (Object)(object)information); if (harpoonUpgradeOffer != null && !attachments.ContainsKey(information)) { HarpoonUpgradeCatalog.RequireNativeIdentity(information); AttachmentPurchasable value = (AttachmentPurchasable)CloneOwned(val); attachments.Add(information, value); sources.Add(harpoonUpgradeOffer.Key, ((Scene)(ref scene)).name + ":" + ((Object)val).name); } } else if (val is BulletPurchasable && !Object.op_Implicit((Object)(object)ammunition)) { ammunition = (BulletPurchasable)CloneOwned(val); NativeContentAccess.Set(ammunition, "_maxBulletUpgrade", (byte)9); sources.Add("harpoon_ammunition", ((Scene)(ref scene)).name + ":" + ((Object)val).name); } } } internal void Spawn(Transform parent, Weapon target, IReadOnlyDictionary layout) { //IL_00be: 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_01ea: 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) ThrowIfDisposed(); if (!IsPrepared) { throw new InvalidOperationException("Missing native harpoon purchasable families: " + string.Join(", ", MissingFamilies) + ". Capture native Island4 or Island5 before spawning."); } if (!Object.op_Implicit((Object)(object)parent) || !Object.op_Implicit((Object)(object)target) || ((Item)target).ID != 188) { throw new ArgumentException("Harpoon upgrade stands require an authored parent and the registered weapon-188 prefab."); } if (stands.Values.Any((Purchasable val3) => Object.op_Implicit((Object)(object)val3))) { throw new InvalidOperationException("Harpoon upgrade stands have already been spawned; call ClearSpawned before rebuilding."); } foreach (string standKey in catalog.StandKeys) { if (!layout.TryGetValue(standKey, out var value) || !Finite(value.Surface) || !NativeContentAccess.Finite(value.Heading)) { throw new InvalidOperationException("Missing or invalid harpoon shelf marker: " + standKey); } } stands.Clear(); bool flag = false; try { foreach (string key in catalog.StandKeys) { HarpoonUpgradeOffer harpoonUpgradeOffer = catalog.Offers.First((HarpoonUpgradeOffer harpoonUpgradeOffer2) => harpoonUpgradeOffer2.StandKey == key); Purchasable val = Object.Instantiate((Purchasable)(Object.op_Implicit((Object)(object)harpoonUpgradeOffer.Information) ? ((object)attachments[harpoonUpgradeOffer.Information]) : ((object)ammunition)), parent, false); stands.Add(key, val); ((Object)val).name = "Reach native " + key; HarpoonUpgradePlacement harpoonUpgradePlacement = layout[key]; ((Component)val).transform.localPosition = harpoonUpgradePlacement.Surface; ((Component)val).transform.localRotation = Quaternion.Euler(0f, harpoonUpgradePlacement.Heading, 0f); ValidateOwnedReferences(val); SeatOnSurface(val, parent, harpoonUpgradePlacement.Surface.y); BulletPurchasable val2 = (BulletPurchasable)(object)((val is BulletPurchasable) ? val : null); if (val2 != null) { AmmunitionPurchasePolicies.Bind(val2, "gamblers_reach:ammunition"); } ((Component)val).gameObject.SetActive(true); } flag = true; } finally { if (!flag) { ClearSpawned(); } } } internal void ClearSpawned() { foreach (Purchasable value in stands.Values) { if (Object.op_Implicit((Object)(object)value)) { Object.Destroy((Object)(object)((Component)value).gameObject); } } stands.Clear(); } private Purchasable CloneOwned(Purchasable source) { ValidateOwnedReferences(source); Purchasable component = NativeSceneMeshes.Clone(((Component)source).gameObject, nursery.transform).GetComponent(); NativeContentAccess.Set(component, "_isFree", false); NativeContentAccess.Set(component, "_customCanBuy", true); NativeContentAccess.Set(component, "_customCost", 0); NativeContentAccess.Set(component, "_isHovering", false); ValidateOwnedReferences(component); return component; } private static void ValidateOwnedReferences(Purchasable shop) { Collider val = NativeContentAccess.Get(shop, "_interactCol"); GameObject[] array = NativeContentAccess.Get(shop, "_modelsToOutline"); if (!Object.op_Implicit((Object)(object)val) || !((Component)val).transform.IsChildOf(((Component)shop).transform) || !((Component)val).CompareTag("Interactable") || !Object.op_Implicit((Object)(object)((Interactable)shop).TextTarget) || !((Interactable)shop).TextTarget.IsChildOf(((Component)shop).transform) || array.Length == 0 || array.Any((GameObject model) => !Object.op_Implicit((Object)(object)model) || !model.transform.IsChildOf(((Component)shop).transform))) { throw new InvalidOperationException("Native upgrade stand has external or invalid interaction/card/outline references: " + ((Object)shop).name); } if (((Component)shop).GetComponentsInChildren(true).Length != 1 || ((Component)shop).GetComponentsInChildren(true).Length != 0) { throw new InvalidOperationException("Expected one non-networked native purchase display; actual purchases use Server's native RPCs."); } } private static void SeatOnSurface(Purchasable stand, Transform parent, float height) { //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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) MeshFilter[] array = (from filter in ((Component)stand).GetComponentsInChildren(true) where ActiveBelow(((Component)filter).transform, ((Component)stand).transform) select filter).ToArray(); if (array.Length == 0) { throw new InvalidOperationException("Native upgrade shelf display contains no visible geometry: " + ((Object)stand).name); } float num = array.Min(delegate(MeshFilter filter) { //IL_0006: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Bounds val = TransformBounds(filter.sharedMesh.bounds, parent.worldToLocalMatrix * ((Component)filter).transform.localToWorldMatrix); return ((Bounds)(ref val)).min.y; }); Transform transform = ((Component)stand).transform; transform.localPosition += Vector3.up * (height - num); } private static bool ActiveBelow(Transform child, Transform root) { Transform val = child; while ((Object)(object)val != (Object)(object)root) { if (!((Component)val).gameObject.activeSelf) { return false; } val = val.parent; } return true; } private static Bounds TransformBounds(Bounds bounds, Matrix4x4 matrix) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Bounds result = default(Bounds); ((Bounds)(ref result))..ctor(((Matrix4x4)(ref matrix)).MultiplyPoint3x4(((Bounds)(ref bounds)).center), Vector3.zero); for (int i = 0; i < 8; i++) { ((Bounds)(ref result)).Encapsulate(((Matrix4x4)(ref matrix)).MultiplyPoint3x4(((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((i & 1) != 0) ? 1 : (-1)), (float)(((i & 2) != 0) ? 1 : (-1)), (float)(((i & 4) != 0) ? 1 : (-1)))))); } return result; } private static bool Finite(Vector3 value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (NativeContentAccess.Finite(value.x) && NativeContentAccess.Finite(value.y)) { return NativeContentAccess.Finite(value.z); } return false; } private void ThrowIfDisposed() { if (disposed) { throw new ObjectDisposedException("HarpoonUpgradeShops"); } } public void Dispose() { if (!disposed) { disposed = true; ClearSpawned(); ammunitionPolicy.Dispose(); Object.Destroy((Object)(object)nursery); } } } internal sealed class NativeCasinoPresentation : IDisposable { private readonly GameObject nursery; private GameObject? canvasTemplate; private GameObject? highlightTemplate; private Vector3 canvasPosition; private Quaternion canvasRotation; private Vector3 highlightPosition; private Quaternion highlightRotation; private Color winColor; private float pulse; internal bool Ready { get { if (Object.op_Implicit((Object)(object)canvasTemplate)) { return Object.op_Implicit((Object)(object)highlightTemplate); } return false; } } internal NativeCasinoPresentation() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown nursery = new GameObject("Inactive native casino presentation"); nursery.SetActive(false); Object.DontDestroyOnLoad((Object)(object)nursery); } internal void Capture(Scene scene) { //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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_0181: 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) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: 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_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) if (Ready) { return; } LocalCasino val = ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject root) => root.GetComponentsInChildren(true)).FirstOrDefault(); if (Object.op_Implicit((Object)(object)val)) { Transform val2 = NativeContentAccess.Get(val, "_rouletteTableHolder"); TextMeshProUGUI val3 = NativeContentAccess.Get(val, "_curWorthText"); CasinoBox componentInChildren = ((Component)val2).GetComponentInChildren(true); if (!Object.op_Implicit((Object)(object)((Graphic)val3).canvas) || !Object.op_Implicit((Object)(object)componentInChildren)) { throw new InvalidOperationException("The native roulette presentation is incomplete."); } BoxCollider val4 = NativeContentAccess.Get(componentInChildren, "_col"); MeshFilter component = ((Component)componentInChildren).GetComponent(); MeshRenderer component2 = ((Component)componentInChildren).GetComponent(); if (!Object.op_Implicit((Object)(object)val4) || !Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component2) || !Object.op_Implicit((Object)(object)component.sharedMesh) || component.sharedMesh.vertexCount != 24) { throw new InvalidOperationException("The native roulette wager highlight is not the verified standalone cube."); } Quaternion val5 = Quaternion.Euler(0f, 90f, 0f); canvasPosition = val5 * val2.InverseTransformPoint(((Component)((Graphic)val3).canvas).transform.position); canvasRotation = val5 * Quaternion.Inverse(val2.rotation) * ((Component)((Graphic)val3).canvas).transform.rotation; highlightPosition = val5 * val2.InverseTransformPoint(((Component)componentInChildren).transform.position); highlightRotation = val5 * Quaternion.Inverse(val2.rotation) * ((Component)componentInChildren).transform.rotation; canvasTemplate = Object.Instantiate(((Component)((Graphic)val3).canvas).gameObject, nursery.transform, false); canvasTemplate.SetActive(false); LocalizeStringEvent[] componentsInChildren = canvasTemplate.GetComponentsInChildren(true); for (int num = 0; num < componentsInChildren.Length; num++) { ((Behaviour)componentsInChildren[num]).enabled = false; } highlightTemplate = new GameObject("Native tabletop wager highlight", new Type[3] { typeof(MeshFilter), typeof(MeshRenderer), typeof(BoxCollider) }); highlightTemplate.transform.SetParent(nursery.transform, false); highlightTemplate.transform.localScale = Vector3.Scale(((Component)componentInChildren).transform.lossyScale, new Vector3(1f / val2.lossyScale.x, 1f / val2.lossyScale.y, 1f / val2.lossyScale.z)); highlightTemplate.GetComponent().sharedMesh = component.sharedMesh; ((Renderer)highlightTemplate.GetComponent()).sharedMaterials = ((Renderer)component2).sharedMaterials; BoxCollider component3 = highlightTemplate.GetComponent(); component3.size = val4.size; component3.center = val4.center; ((Collider)component3).isTrigger = true; ((Collider)component3).enabled = false; winColor = NativeContentAccess.Get(val, "_wonColor"); pulse = NativeContentAccess.Get(val, "_scaleMultiplier"); Plugin.Log.LogInfo((object)("Captured native roulette typography, floating amount and tabletop highlight from " + ((Scene)(ref scene)).name + ".")); } } internal NativeBlackjackDisplay Spawn(Transform parent, Vector3 tableSurface, float heading) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //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_003e: 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_007c: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) if (!Ready) { throw new InvalidOperationException("Native roulette presentation was not captured before island creation."); } GameObject val = new GameObject("Blackjack native presentation"); val.SetActive(false); val.transform.SetParent(parent, false); val.transform.localPosition = tableSurface - Vector3.up; val.transform.localRotation = Quaternion.Euler(0f, heading, 0f); GameObject obj = Object.Instantiate(canvasTemplate, val.transform, false); obj.transform.localPosition = canvasPosition; obj.transform.localRotation = canvasRotation; GameObject val2 = Object.Instantiate(highlightTemplate, val.transform, false); ((Object)val2).name = "Blackjack deposited fish volume"; val2.transform.localPosition = highlightPosition; val2.transform.localRotation = highlightRotation; FitHighlight(parent, val.transform, val2.transform); BoxCollider component = val2.GetComponent(); val2.AddComponent().Configure(component); TextMeshProUGUI[] componentsInChildren = obj.GetComponentsInChildren(true); NativeBlackjackDisplay nativeBlackjackDisplay = obj.AddComponent(); nativeBlackjackDisplay.Configure(componentsInChildren.Single((TextMeshProUGUI text) => ((Object)text).name == "CurWorthText"), componentsInChildren.Single((TextMeshProUGUI text) => ((Object)text).name == "PlaceBetsText"), winColor, pulse); obj.SetActive(true); val.SetActive(true); return nativeBlackjackDisplay; } private static void FitHighlight(Transform island, Transform table, Transform highlight) { //IL_0002: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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) //IL_0204: 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_0211: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: 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_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d8: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) Bounds val = default(Bounds); bool flag = false; MeshFilter[] componentsInChildren = ((Component)island).GetComponentsInChildren(true); foreach (MeshFilter val2 in componentsInChildren) { MeshRenderer component = ((Component)val2).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)val2.sharedMesh)) { continue; } Material[] sharedMaterials = ((Renderer)component).sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { if (!Object.op_Implicit((Object)(object)sharedMaterials[j]) || !((Object)sharedMaterials[j]).name.StartsWith("felt_green", StringComparison.Ordinal)) { continue; } Mesh sharedMesh = val2.sharedMesh; Matrix4x4 val3 = table.worldToLocalMatrix * ((Component)val2).transform.localToWorldMatrix; Vector3[] vertices = sharedMesh.vertices; foreach (int item in sharedMesh.GetTriangles(j).Distinct()) { Vector3 val4 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(vertices[item]); if (!flag) { val = new Bounds(val4, Vector3.zero); flag = true; } else { ((Bounds)(ref val)).Encapsulate(val4); } } } } if (!flag || ((Bounds)(ref val)).size.x < 1f || ((Bounds)(ref val)).size.z < 0.5f || ((Bounds)(ref val)).size.y > 0.1f) { throw new InvalidOperationException("The authored blackjack felt has no valid surface bounds."); } Mesh sharedMesh2 = ((Component)highlight).GetComponent().sharedMesh; Bounds val5 = NativeSceneMeshes.TransformBounds(sharedMesh2.bounds, Matrix4x4.TRS(Vector3.zero, highlight.localRotation, highlight.localScale)); float num = Mathf.Min(new float[3] { 1f, (((Bounds)(ref val)).size.x - 0.03f) / ((Bounds)(ref val5)).size.x, (((Bounds)(ref val)).size.z - 0.03f) / ((Bounds)(ref val5)).size.z }); Vector3 localScale = highlight.localScale; highlight.localScale = new Vector3(localScale.x * num, localScale.y, localScale.z * num); val5 = NativeSceneMeshes.TransformBounds(sharedMesh2.bounds, Matrix4x4.TRS(Vector3.zero, highlight.localRotation, highlight.localScale)); Vector3 localPosition = highlight.localPosition; localPosition.x = Mathf.Clamp(localPosition.x, ((Bounds)(ref val)).min.x + 0.015f - ((Bounds)(ref val5)).min.x, ((Bounds)(ref val)).max.x - 0.015f - ((Bounds)(ref val5)).max.x); localPosition.z = Mathf.Clamp(localPosition.z, ((Bounds)(ref val)).min.z + 0.015f - ((Bounds)(ref val5)).min.z, ((Bounds)(ref val)).max.z - 0.015f - ((Bounds)(ref val5)).max.z); localPosition.y = ((Bounds)(ref val)).max.y + 0.005f - ((Bounds)(ref val5)).min.y; highlight.localPosition = localPosition; } public void Dispose() { Object.Destroy((Object)(object)nursery); } } internal sealed class NativeBlackjackDisplay : MonoBehaviour { private TextMeshProUGUI worth; private TextMeshProUGUI prompt; private Color winColor; private float pulse; private double displayed; private long target; private string lastRound = ""; private bool wasLocked; private float pulseRemaining; internal long TargetValue => target; internal void Configure(TextMeshProUGUI amount, TextMeshProUGUI label, Color winnerColor, float nativePulse) { //IL_000f: 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_0033: Unknown result type (might be due to invalid IL or missing references) worth = amount; prompt = label; winColor = winnerColor; pulse = nativePulse; ((TMP_Text)worth).text = "$0"; ((Graphic)worth).color = Color.white; ((TMP_Text)prompt).text = "Place items here"; } internal void Show(PanelView state) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) bool num = wasLocked && !state.TableLocked && state.Round == lastRound; target = state.DepositValue; if (num) { bool flag = state.PayoutMultiplier > 1f; ((Graphic)worth).color = (flag ? winColor : Color.white); pulseRemaining = (flag ? 0.5f : 0f); } else if (state.TableLocked || state.Round != lastRound) { ((Graphic)worth).color = Color.white; } string text = state.ActingPlayerName.Replace("<", "").Replace(">", ""); if (text.Length > 24) { text = text.Substring(0, 24); } ((TMP_Text)prompt).text = ((state.DepositMessage.Length > 0) ? state.DepositMessage : (state.TableLocked ? (text + " is playing") : ((state.Round.Length == 0) ? "Place items here" : ((state.DepositItemCount == 0) ? (state.Outcome + "\nPlace another bet") : (state.Outcome + "\nCollect or DEAL again"))))); lastRound = state.Round; wasLocked = state.TableLocked; } private void Update() { //IL_00fc: 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_00e6: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)worth)) { double num = (double)target - displayed; displayed = ((Math.Abs(num) < 1.0) ? ((double)target) : (displayed + num * (1.0 - Math.Exp(-12f * Time.unscaledDeltaTime)))); ((TMP_Text)worth).text = "$" + Math.Round(displayed); if (pulseRemaining > 0f) { pulseRemaining = Mathf.Max(0f, pulseRemaining - Time.unscaledDeltaTime); ((TMP_Text)worth).transform.localScale = Vector3.one * (1f + pulse * Mathf.Sin(pulseRemaining * MathF.PI * 2f)); } else { ((TMP_Text)worth).transform.localScale = Vector3.one; } } } } internal readonly struct NativeGrassTuning { internal readonly float MeshSize; internal readonly float Density; internal readonly float PositionRandomness; internal readonly float RotationRandomness; internal readonly Vector2 ScaleRange; internal float Step => MeshSize / Density; internal NativeGrassTuning(float meshSize, float density, float positionRandomness, float rotationRandomness, Vector2 scaleRange) { //IL_0078: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (meshSize <= 0f || density <= 0f || positionRandomness < 0f || positionRandomness > 1f || rotationRandomness < 0f || rotationRandomness > 360f || scaleRange.x <= 0f || scaleRange.y < scaleRange.x) { throw new InvalidOperationException($"The native grass decoration tuning is invalid: size {meshSize}, density {density}, " + $"jitter {positionRandomness}, roll {rotationRandomness}, scale {scaleRange}."); } MeshSize = meshSize; Density = density; PositionRandomness = positionRandomness; RotationRandomness = rotationRandomness; ScaleRange = scaleRange; } public override string ToString() { return $"size {MeshSize}, density {Density} ({Step:0.###}m grid), jitter {PositionRandomness}, roll +/-{RotationRandomness} degrees, scale {ScaleRange.x}-{ScaleRange.y}"; } } internal sealed class GrassPlacementStats { internal int Candidates; internal int OffGrass; internal int Steep; internal int Low; internal int Edge; internal int Covered; internal int Blocked; internal int Thinned; internal int Accepted; public override string ToString() { return $"{Accepted} accepted of {Candidates} candidates (off grass {OffGrass}, steep {Steep}, low {Low}, path/edge {Edge}, " + $"covered {Covered}, blocked {Blocked}, thinned {Thinned})"; } } internal sealed class NativeGrassPlacement { internal const float MinNormalY = 0.78f; internal const float MinHeightAboveSea = 0.3f; internal const float EdgeMargin = 0.4f; internal const float FootprintHalf = 0.3f; internal const float SkyHeight = 40f; private const float CellSize = 1f; private const int Seed = 27221; private readonly Vector3[] vertices; private readonly int[] excludedTriangles; private readonly TriangleSurface surface; internal MeshCollider Terrain { get; } internal float SeaLevel { get; } internal float Area { get; } internal IReadOnlyList GrassMaterials { get; } internal static int ObstacleMask => LayerMask.op_Implicit(GameInfo.LevelLayer) | LayerMask.op_Implicit(GameInfo.InteractableLayer); private NativeGrassPlacement(MeshFilter filter, MeshCollider collider, int[] grassSubmeshes, string[] grassMaterials, float seaLevel) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown Terrain = collider; SeaLevel = seaLevel; GrassMaterials = grassMaterials; Mesh sharedMesh = filter.sharedMesh; Matrix4x4 toWorld = ((Component)filter).transform.localToWorldMatrix; vertices = sharedMesh.vertices.Select((Vector3 vertex) => ((Matrix4x4)(ref toWorld)).MultiplyPoint3x4(vertex)).ToArray(); int[] array = ((IEnumerable)grassSubmeshes).SelectMany((Func>)sharedMesh.GetTriangles).ToArray(); excludedTriangles = Enumerable.Range(0, sharedMesh.subMeshCount).Except(grassSubmeshes).SelectMany((Func>)sharedMesh.GetTriangles) .ToArray(); if (array.Length < 3) { throw new InvalidOperationException("The harbor terrain's grass materials have no triangles."); } Vector3[] array2 = vertices.Select(ToPortable).ToArray(); surface = new TriangleSurface((IReadOnlyList)array2, (IReadOnlyList)array, 1f); Area = surface.Area; } internal static NativeGrassPlacement ForHarbor(Transform root, float seaLevel) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) MeshFilter[] array = ((Component)root).GetComponentsInChildren(true).Where(delegate(MeshFilter filter) { MeshRenderer component2 = ((Component)filter).GetComponent(); MeshCollider component3 = ((Component)filter).GetComponent(); return Object.op_Implicit((Object)(object)filter.sharedMesh) && Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component3) && (Object)(object)component3.sharedMesh == (Object)(object)filter.sharedMesh && ((Renderer)component2).sharedMaterials.Any(IsGrassMaterial); }).ToArray(); if (array.Length != 1) { throw new InvalidOperationException($"Expected one collidable harbor terrain with grass_* materials, found {array.Length}."); } MeshFilter val = array[0]; Mesh sharedMesh = val.sharedMesh; if (!sharedMesh.isReadable) { throw new InvalidOperationException("The harbor terrain mesh must stay readable for grass placement: " + ((Object)sharedMesh).name); } MeshCollider component = ((Component)val).GetComponent(); if (component.convex || !((Collider)component).enabled || ((Collider)component).isTrigger) { throw new InvalidOperationException("The harbor terrain needs its own enabled concave mesh collider."); } if ((LayerMask.op_Implicit(GameInfo.LevelLayer) & (1 << ((Component)component).gameObject.layer)) == 0) { throw new InvalidOperationException("Place grass after the harbor colliders are moved to the native Level layer."); } if (!((Component)component).gameObject.activeInHierarchy) { throw new InvalidOperationException("Place grass after the harbor root is active so physics queries see the terrain."); } Material[] materials = ((Renderer)((Component)val).GetComponent()).sharedMaterials; if (materials.Length != sharedMesh.subMeshCount) { throw new InvalidOperationException("The harbor terrain's materials do not match its submeshes."); } int[] array2 = (from index in Enumerable.Range(0, materials.Length) where IsGrassMaterial(materials[index]) select index).ToArray(); return new NativeGrassPlacement(val, component, array2, array2.Select((int index) => ((Object)materials[index]).name).ToArray(), seaLevel); } private static bool IsGrassMaterial(Material? material) { if (Object.op_Implicit((Object)(object)material)) { return ((Object)material).name.StartsWith("grass_", StringComparison.OrdinalIgnoreCase); } return false; } internal bool Sample(Vector3 world, out Vector3 point, out Vector3 normal) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) SurfaceSample val = default(SurfaceSample); if (surface.TrySample(ToPortable(world), ref val)) { point = ToNative(((SurfaceSample)(ref val)).Point); normal = ToNative(((SurfaceSample)(ref val)).Normal); return true; } point = default(Vector3); normal = default(Vector3); return false; } internal IEnumerable NonGrassProbes() { for (int index = 0; index < excludedTriangles.Length; index += 3) { yield return (vertices[excludedTriangles[index]] + vertices[excludedTriangles[index + 1]] + vertices[excludedTriangles[index + 2]]) / 3f; } } internal IReadOnlyList Place(NativeGrassTuning tuning, int maxInstances, GrassPlacementStats stats) { //IL_004c: 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_0081: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0168: 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_016d: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) if (maxInstances <= 0) { throw new ArgumentOutOfRangeException("maxInstances"); } Collider[] overlaps = (Collider[])(object)new Collider[8]; int mask = ObstacleMask; GroundCoverSettings val = new GroundCoverSettings(tuning.MeshSize, tuning.Density, tuning.PositionRandomness, tuning.RotationRandomness, tuning.ScaleRange.x, tuning.ScaleRange.y, 0.78f, SeaLevel, 0.3f, 0.4f, 27221); GroundCoverPlan obj = new GroundCoverPlanner(surface, val).Plan(maxInstances, (Func)delegate(GroundCoverPlacement placement) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) Vector3 val5 = ToNative(((GroundCoverPlacement)(ref placement)).Point); RaycastHit val6 = default(RaycastHit); if (Physics.Raycast(val5 + Vector3.up * 40f, Vector3.down, ref val6, 40.5f, mask, (QueryTriggerInteraction)1) && !((Object)(object)((RaycastHit)(ref val6)).collider != (Object)(object)Terrain) && !(Mathf.Abs(((RaycastHit)(ref val6)).point.y - val5.y) > 0.08f)) { int num = Physics.OverlapBoxNonAlloc(val5 + Vector3.up * 0.3f, Vector3.one * 0.3f, overlaps, Quaternion.identity, mask, (QueryTriggerInteraction)1); if (num < overlaps.Length && !overlaps.Take(num).Any((Collider collider) => (Object)(object)collider != (Object)(object)Terrain)) { return (GroundCoverExclusion)0; } return (GroundCoverExclusion)2; } return (GroundCoverExclusion)1; }); GroundCoverPlanStatistics statistics = obj.Statistics; stats.Candidates = statistics.Candidates; stats.OffGrass = statistics.OffSurface; stats.Steep = statistics.Steep; stats.Low = statistics.Low; stats.Edge = statistics.Edge; stats.Covered = statistics.Covered; stats.Blocked = statistics.Blocked; stats.Thinned = statistics.Thinned; stats.Accepted = statistics.Accepted; List list = new List(obj.Placements.Count); foreach (GroundCoverPlacement placement in obj.Placements) { GroundCoverPlacement current = placement; Vector3 val2 = ToNative(((GroundCoverPlacement)(ref current)).Point); Vector3 val3 = ToNative(((GroundCoverPlacement)(ref current)).Normal); Quaternion val4 = Quaternion.LookRotation(val3, (val3.y > 0.999f) ? Vector3.forward : Vector3.up) * Quaternion.Euler(0f, 0f, ((GroundCoverPlacement)(ref current)).RollDegrees); list.Add(Matrix4x4.TRS(val2, val4, Vector3.one * ((GroundCoverPlacement)(ref current)).Scale)); } return list; } private static Vector3 ToPortable(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 ToNative(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); } } internal sealed class NativeGrassRenderState { internal bool RendererAlive; internal bool DecorationsEnabled; internal bool ManagerIsHarbor; internal int BatchCount; internal int LargestBatch; internal int RenderedInstances; internal bool SameMesh; internal bool SameMaterial; internal string Shader = ""; internal float WindSpeed; internal float WindStrength; internal float WindDensity; internal bool Instancing; } internal sealed class NativeGrassService : IDisposable { internal const string InstanceName = "Grass"; internal const string ShaderName = "Shader Graphs/Grass"; internal const int MaxInstances = 2000; private static readonly Type DecorationType = AccessTools.Inner(typeof(DecorationManager), "DecorationType") ?? throw new MissingMemberException("DecorationManager", "DecorationType"); private static readonly string[] WindProperties = new string[5] { "_WindSpeed", "_WindSpeed2", "_WindStrength", "_WindDensity", "_Noise_Map" }; private readonly Dictionary nativeTuftCounts = new Dictionary(StringComparer.Ordinal); private Mesh? mesh; private Material? material; private NativeGrassTuning tuning; private bool prepared; private GameObject? holder; private IReadOnlyList instances = Array.Empty(); internal bool IsPrepared { get { if (prepared && Object.op_Implicit((Object)(object)mesh)) { return Object.op_Implicit((Object)(object)material); } return false; } } internal string Origin { get; private set; } = "not captured"; internal NativeGrassTuning Tuning { get { if (!IsPrepared) { throw new InvalidOperationException("Native grass is not captured."); } return tuning; } } internal Mesh Mesh { get { if (!Object.op_Implicit((Object)(object)mesh) || !IsPrepared) { throw new InvalidOperationException("Native grass is not captured."); } return mesh; } } internal Material Material { get { if (!Object.op_Implicit((Object)(object)material) || !IsPrepared) { throw new InvalidOperationException("Native grass is not captured."); } return material; } } internal IReadOnlyDictionary NativeTuftCounts => nativeTuftCounts; internal NativeGrassPlacement? Placement { get; private set; } internal GrassPlacementStats Stats { get; private set; } = new GrassPlacementStats(); internal IReadOnlyList Instances => instances; internal int Count => instances.Count; internal bool IsSpawned => Object.op_Implicit((Object)(object)holder); internal void Capture(Scene scene) { //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_015f: Unknown result type (might be due to invalid IL or missing references) if (!((Scene)(ref scene)).IsValid() || !((Scene)(ref scene)).isLoaded) { throw new ArgumentException("Native grass capture requires a loaded game scene."); } foreach (DecorationManager item in ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject root) => root.GetComponentsInChildren(true))) { foreach (object item2 in NativeContentAccess.Get(item, "_decorationTypes")) { if (Read(item2, "InstanceName") != "Grass") { continue; } Mesh val = Read(item2, "Mesh"); Material val2 = Read(item2, "Material"); int count = Read(item2, "SavedBatch").Count; nativeTuftCounts[((Scene)(ref scene)).name] = count; if (IsPrepared) { if ((Object)(object)val != (Object)(object)mesh || (Object)(object)val2 != (Object)(object)material) { throw new InvalidOperationException(((Scene)(ref scene)).name + " binds a different native Grass mesh or material than " + Origin + "."); } continue; } Verify(val, val2); Vector2 scaleRange = Read(item2, "ScaleRange"); tuning = new NativeGrassTuning(Read(item2, "MeshSize"), Read(item2, "Density"), Read(item2, "PositionRandomness"), Read(item2, "RotationRandomness"), scaleRange); mesh = val; material = val2; prepared = true; Origin = ((Scene)(ref scene)).name + ":" + ((Object)item).name + " (" + count + " native tufts)"; VerifyRenderer(); Plugin.Log.LogInfo((object)($"Captured native wispy grass from {Origin}: mesh {((Object)val).name} ({val.vertexCount} vertices), " + string.Format("material {0} ({1}, wind speed {2}, ", ((Object)val2).name, ((Object)val2.shader).name, val2.GetFloat("_WindSpeed")) + string.Format("strength {0}); {1}.", val2.GetFloat("_WindStrength"), tuning))); } } } internal void Spawn(Transform parent) { //IL_0060: 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_00b3: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) if (!IsPrepared || Object.op_Implicit((Object)(object)holder)) { throw new InvalidOperationException("Capture native grass and retire the previous harbor meadow before spawning."); } if (!Object.op_Implicit((Object)(object)parent) || !((Component)parent).gameObject.activeInHierarchy) { throw new InvalidOperationException("Spawn native grass after the harbor root is active; its Level colliders must be queryable."); } if (!VerifyRenderer()) { throw new InvalidOperationException("The native InstanceManager is not alive; the grass would never be drawn."); } Physics.SyncTransforms(); GrassPlacementStats grassPlacementStats = new GrassPlacementStats(); NativeGrassPlacement nativeGrassPlacement = NativeGrassPlacement.ForHarbor(parent, parent.position.y); IReadOnlyList readOnlyList = nativeGrassPlacement.Place(tuning, 2000, grassPlacementStats); if (readOnlyList.Count == 0) { throw new InvalidOperationException("No harbor grass could be placed: " + grassPlacementStats); } GameObject val = new GameObject("Harbor wispy grass (native Grass decoration)"); val.SetActive(false); val.transform.SetParent(parent, false); bool flag = false; try { DecorationManager target = val.AddComponent(); object obj = Activator.CreateInstance(DecorationType) ?? throw new InvalidOperationException("Could not create a native decoration type."); Write(obj, "InstanceName", "Grass"); Write(obj, "MeshSize", tuning.MeshSize); Write(obj, "Density", tuning.Density); Write(obj, "PositionRandomness", tuning.PositionRandomness); Write(obj, "RotationRandomness", tuning.RotationRandomness); Write(obj, "ScaleRange", tuning.ScaleRange); Write(obj, "SavedBatch", new List(readOnlyList)); Write(obj, "Mesh", mesh); Write(obj, "Material", material); Array array = Array.CreateInstance(DecorationType, 1); array.SetValue(obj, 0); NativeContentAccess.Set(target, "_decorationTypes", array); NativeContentAccess.Set(target, "_minHeight", 0f); NativeContentAccess.Set(target, "_spawnDecorations", false); NativeContentAccess.Set(target, "_renderDecorations", true); flag = true; } finally { if (!flag) { Object.Destroy((Object)(object)val); } } holder = val; Placement = nativeGrassPlacement; Stats = grassPlacementStats; instances = readOnlyList; val.SetActive(true); Plugin.Log.LogInfo((object)($"Placed {readOnlyList.Count} native wispy grass tufts over {nativeGrassPlacement.Area:0} square metres of harbor " + string.Format("{0} ({1} instanced batches); {2}.", string.Join("/", nativeGrassPlacement.GrassMaterials), (readOnlyList.Count + 999) / 1000, grassPlacementStats))); } internal void ClearScene() { if (Object.op_Implicit((Object)(object)holder)) { holder.SetActive(false); Object.Destroy((Object)(object)holder); } holder = null; Placement = null; instances = Array.Empty(); } internal NativeGrassRenderState Inspect() { NativeGrassRenderState nativeGrassRenderState = new NativeGrassRenderState(); object? value = NativeContentAccess.Field(typeof(InstanceManager), "_instance").GetValue(null); InstanceManager val = (InstanceManager)((value is InstanceManager) ? value : null); nativeGrassRenderState.RendererAlive = Object.op_Implicit((Object)(object)val); nativeGrassRenderState.DecorationsEnabled = NativeContentAccess.Static(typeof(DecorationManager), "_staticRenderDecorations"); object? value2 = NativeContentAccess.Field(typeof(DecorationManager), "_instance").GetValue(null); DecorationManager val2 = (DecorationManager)((value2 is DecorationManager) ? value2 : null); nativeGrassRenderState.ManagerIsHarbor = Object.op_Implicit((Object)(object)holder) && Object.op_Implicit((Object)(object)val2) && (Object)(object)((Component)val2).gameObject == (Object)(object)holder; if (NativeContentAccess.Static>(typeof(InstanceManager), "_instanceTypeDic").TryGetValue("Grass", out var value3)) { nativeGrassRenderState.BatchCount = value3.Batches.Count; nativeGrassRenderState.LargestBatch = ((value3.Batches.Count != 0) ? value3.Batches.Max((List batch) => batch.Count) : 0); nativeGrassRenderState.RenderedInstances = value3.Batches.Sum((List batch) => batch.Count); nativeGrassRenderState.SameMesh = Object.op_Implicit((Object)(object)mesh) && (Object)(object)value3.Mesh == (Object)(object)mesh; nativeGrassRenderState.SameMaterial = Object.op_Implicit((Object)(object)material) && (Object)(object)value3.Material == (Object)(object)material; } if (Object.op_Implicit((Object)(object)material)) { Material val3 = material; nativeGrassRenderState.Shader = (Object.op_Implicit((Object)(object)val3.shader) ? ((Object)val3.shader).name : ""); nativeGrassRenderState.WindSpeed = val3.GetFloat("_WindSpeed"); nativeGrassRenderState.WindStrength = val3.GetFloat("_WindStrength"); nativeGrassRenderState.WindDensity = val3.GetFloat("_WindDensity"); nativeGrassRenderState.Instancing = val3.enableInstancing; } return nativeGrassRenderState; } private bool VerifyRenderer() { object? value = NativeContentAccess.Field(typeof(InstanceManager), "_instance").GetValue(null); if (!Object.op_Implicit((Object)((value is InstanceManager) ? value : null))) { return false; } if (!NativeContentAccess.Static>(typeof(InstanceManager), "_instanceTypeDic").TryGetValue("Grass", out var value2) || (Object)(object)value2.Mesh != (Object)(object)mesh || (Object)(object)value2.Material != (Object)(object)material) { throw new InvalidOperationException("The native InstanceManager's Grass binding differs from the captured island decoration."); } return true; } private static void Verify(Mesh? source, Material? shading) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0047: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)source) || source.vertexCount == 0 || (int)source.GetTopology(0) != 0) { throw new InvalidOperationException("The native grass decoration has no usable tuft mesh."); } Bounds bounds = source.bounds; if (!(((Bounds)(ref bounds)).min.z < -0.05f)) { bounds = source.bounds; if (!(((Bounds)(ref bounds)).max.z < 0.2f)) { if (!Object.op_Implicit((Object)(object)shading) || !Object.op_Implicit((Object)(object)shading.shader) || ((Object)shading.shader).name != "Shader Graphs/Grass" || !shading.enableInstancing) { throw new InvalidOperationException("The native grass material is not the instanced wind grass shader."); } string[] windProperties = WindProperties; foreach (string text in windProperties) { if (!shading.HasProperty(text)) { throw new InvalidOperationException("The native grass material lost its wind property " + text); } } if (shading.GetFloat("_WindSpeed") <= 0f || shading.GetFloat("_WindStrength") <= 0f) { throw new InvalidOperationException("The native grass material has no wind motion configured."); } return; } } throw new InvalidOperationException($"The native grass mesh is not rooted along +Z: bounds {source.bounds}."); } private static T Read(object type, string name) { object value = (AccessTools.Field(DecorationType, name) ?? throw new MissingFieldException(DecorationType.FullName, name)).GetValue(type); if (value is T) { return (T)value; } throw new InvalidOperationException("Native DecorationType." + name + " is not an initialized " + typeof(T).Name + "."); } private static void Write(object type, string name, object value) { (AccessTools.Field(DecorationType, name) ?? throw new MissingFieldException(DecorationType.FullName, name)).SetValue(type, value); } public void Dispose() { ClearScene(); prepared = false; mesh = null; material = null; nativeTuftCounts.Clear(); } } internal sealed class NativeGrillService : IDisposable { private readonly GameObject nursery; private GameObject? template; private GameObject? spawned; private bool prepared; internal GrillBox? Grill { get; private set; } internal bool IsPrepared { get { if (prepared) { return Object.op_Implicit((Object)(object)template); } return false; } } internal string Origin { get; private set; } = "not captured"; internal NativeGrillService() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown nursery = new GameObject("Inactive native harbor grill"); nursery.SetActive(false); Object.DontDestroyOnLoad((Object)(object)nursery); } internal void Capture(Scene scene) { //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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_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_026e: Unknown result type (might be due to invalid IL or missing references) if (IsPrepared) { return; } if (Object.op_Implicit((Object)(object)template)) { Object.Destroy((Object)(object)template); } template = null; GrillBox val = ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject val3) => val3.GetComponentsInChildren(true)).FirstOrDefault(); if (!Object.op_Implicit((Object)(object)val)) { return; } Transform[] source = References(val); Transform root = ((Component)val).transform; while (!source.All((Transform reference) => reference.IsChildOf(root))) { if (!Object.op_Implicit((Object)(object)root.parent)) { throw new InvalidOperationException("The native grill has no self-contained scenery root."); } root = root.parent; } if (((Component)root).GetComponentsInChildren(true).Length != 1 || ((Component)root).GetComponentsInChildren(true).Length > 32 || ((Component)root).GetComponentsInChildren(true).Length != 0 || ((Component)root).GetComponentsInChildren(true).Length != 0) { throw new InvalidOperationException("The native grill capture would include unrelated island objects."); } MeshFilter[] array = (from filter in ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject value) => value.GetComponentsInChildren(true)) where ((Object)filter).name == "Grill2" && Vector3.Distance(((Component)filter).transform.position, root.position) < 3f select filter).ToArray(); if (array.Length != 1 || Vector3.Distance(root.lossyScale, Vector3.one) > 0.001f) { throw new InvalidOperationException("The native grill's separate scenery mesh cannot be identified safely."); } template = new GameObject("Native grill template"); template.transform.SetParent(nursery.transform, false); template.SetActive(false); GameObject obj = NativeSceneMeshes.Clone(((Component)root).gameObject, template.transform); obj.transform.localPosition = Vector3.zero; obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = Vector3.one; obj.SetActive(true); Transform transform = ((Component)array[0]).transform; GameObject val2 = NativeSceneMeshes.Clone(((Component)transform).gameObject, template.transform); val2.transform.localPosition = root.InverseTransformPoint(transform.position); val2.transform.localRotation = Quaternion.Inverse(root.rotation) * transform.rotation; val2.transform.localScale = transform.lossyScale; val2.SetActive(true); GrillBox componentInChildren = template.GetComponentInChildren(true); AddGrateSupport(componentInChildren, val2.GetComponent()); Verify(componentInChildren, template.transform); prepared = true; Origin = ((Scene)(ref scene)).name + ":" + ((Object)root).name; Plugin.Log.LogInfo((object)("Captured native grill, heat trigger, sounds and particles from " + Origin)); } internal void Spawn(Transform parent, Vector3 ground, float heading) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (!IsPrepared || Object.op_Implicit((Object)(object)spawned)) { throw new InvalidOperationException("Prepare the native grill and retire the previous one before spawning."); } spawned = Object.Instantiate(template, parent, false); ((Object)spawned).name = "Harbor communal grill"; spawned.transform.localPosition = ground; spawned.transform.localRotation = Quaternion.Euler(0f, heading, 0f); float num = spawned.GetComponentsInChildren(true).Min(delegate(MeshFilter filter) { //IL_0006: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Bounds val = NativeSceneMeshes.TransformBounds(filter.sharedMesh.bounds, parent.worldToLocalMatrix * ((Component)filter).transform.localToWorldMatrix); return ((Bounds)(ref val)).min.y; }); Transform transform = spawned.transform; transform.localPosition += Vector3.up * (ground.y - num); Grill = spawned.GetComponentInChildren(true); Verify(Grill, spawned.transform); ((Component)Grill).gameObject.AddComponent(); spawned.SetActive(true); } internal void ClearScene() { if (Object.op_Implicit((Object)(object)spawned)) { Object.Destroy((Object)(object)spawned); } spawned = null; Grill = null; } internal static BoxCollider HeatVolume(GrillBox grill) { BoxCollider[] array = (from collider in ((Component)grill).GetComponents().OfType() where ((Collider)collider).isTrigger select collider).ToArray(); if (array.Length != 1) { throw new InvalidOperationException("The native grill must own exactly one box heat trigger."); } return array[0]; } private static void AddGrateSupport(GrillBox grill, MeshFilter visual) { //IL_000d: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_00b3: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_0141: 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_015e: 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_0181: 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) BoxCollider val = HeatVolume(grill); Bounds val2 = NativeSceneMeshes.TransformBounds(visual.sharedMesh.bounds, ((Component)val).transform.worldToLocalMatrix * ((Component)visual).transform.localToWorldMatrix); float num = Mathf.Min(((Bounds)(ref val2)).max.y, val.center.y + val.size.y * 0.5f) - 0.02f; if (((Bounds)(ref val2)).size.x <= 0.1f || ((Bounds)(ref val2)).size.z <= 0.1f || num <= val.center.y - val.size.y * 0.5f) { throw new InvalidOperationException($"Invalid native grate support: mesh {val2}, top {num}, " + $"heat center {val.center}, size {val.size}."); } GameObject val3 = new GameObject("Harbor grill grate support", new Type[1] { typeof(BoxCollider) }); val3.transform.SetParent(((Component)val).transform, false); val3.layer = LayerMask.NameToLayer("Level"); val3.tag = "Level"; BoxCollider component = val3.GetComponent(); component.center = new Vector3(((Bounds)(ref val2)).center.x, num - 0.015f, ((Bounds)(ref val2)).center.z); component.size = new Vector3(((Bounds)(ref val2)).size.x - 0.06f, 0.03f, ((Bounds)(ref val2)).size.z - 0.06f); } private static Transform[] References(GrillBox grill) { return (Transform[])(object)new Transform[5] { ((Component)grill).transform, ((Component)NativeContentAccess.Get(grill, "_sizzlingSource")).transform, ((Component)NativeContentAccess.Get(grill, "_fireSource")).transform, ((Component)NativeContentAccess.Get(grill, "_smokeParticles")).transform, ((Component)NativeContentAccess.Get(grill, "_grillParticles")).transform }; } private static void Verify(GrillBox grill, Transform root) { if (!Object.op_Implicit((Object)(object)grill) || References(grill).Any((Transform reference) => !Object.op_Implicit((Object)(object)reference) || !reference.IsChildOf(root)) || !((Component)root).GetComponentsInChildren(true).Any((Collider collider) => !collider.isTrigger) || !((Collider)HeatVolume(grill)).enabled || NativeContentAccess.Get(grill, "_cookPerTick") <= 0f) { throw new InvalidOperationException("The native grill lost its owned cooking, audio or particle references."); } } public void Dispose() { ClearScene(); prepared = false; Object.Destroy((Object)(object)nursery); } } internal sealed class HarborGrillMarker : MonoBehaviour { } [HarmonyPatch(typeof(GrillBox), "Start")] internal static class HarborGrillReadyPatch { private static void Postfix(GrillBox __instance) { if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent()) && !NativeContentAccess.Get(__instance, "_isUnlocked")) { AccessTools.Method(typeof(GrillBox), "OnUnlockedGrill", (Type[])null, (Type[])null).Invoke(__instance, Array.Empty()); } } } internal sealed class NativeWorldServices : IDisposable { private readonly GameObject nursery; private readonly Dictionary supplies = new Dictionary(StringComparer.Ordinal); private SlotMachine? machineTemplate; private readonly NativeCasinoPresentation casinoPresentation = new NativeCasinoPresentation(); private HarpoonUpgradeShops? upgradeShops; private readonly Dictionary itemStands = new Dictionary(StringComparer.Ordinal); private readonly Dictionary lureStands = new Dictionary(StringComparer.Ordinal); internal NativeGrillService Cooking { get; } = new NativeGrillService(); internal NativeGrassService Grass { get; } = new NativeGrassService(); internal CumulativeHarborShops Cumulative { get; } = new CumulativeHarborShops(); internal HarpoonUpgradeShops UpgradeShops => upgradeShops ?? throw new InvalidOperationException("The harpoon upgrade catalog has not been initialized."); internal SlotMachine? Machine { get; private set; } internal IReadOnlyDictionary ItemStands => itemStands; internal IReadOnlyDictionary LureStands => lureStands; internal bool IsPrepared { get { if (Object.op_Implicit((Object)(object)machineTemplate) && new string[6] { "bait", "bait_standard", "bait_professional", "bait_scientific", "ammo", "radar" }.All(supplies.ContainsKey) && casinoPresentation.Ready && Cooking.IsPrepared && Grass.IsPrepared && Cumulative.IsPrepared) { return upgradeShops?.IsPrepared ?? false; } return false; } } internal NativeWorldServices() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown nursery = new GameObject("Gambler's Reach - inactive native service templates"); nursery.SetActive(false); Object.DontDestroyOnLoad((Object)(object)nursery); } internal void Capture(Scene scene) { //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_004f: 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) if (!((Scene)(ref scene)).IsValid() || !((Scene)(ref scene)).isLoaded) { throw new ArgumentException("Native service capture requires a loaded game scene."); } GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); casinoPresentation.Capture(scene); Cooking.Capture(scene); Grass.Capture(scene); Cumulative.Capture(scene); upgradeShops?.Capture(scene); if (!Object.op_Implicit((Object)(object)machineTemplate)) { SlotMachine val = rootGameObjects.SelectMany((GameObject root) => root.GetComponentsInChildren(true)).FirstOrDefault(); if (Object.op_Implicit((Object)(object)val)) { machineTemplate = Object.Instantiate(val, nursery.transform, false); ((Object)((Component)machineTemplate).gameObject).name = "Native Reel of Fortune template"; ((Component)machineTemplate).gameObject.SetActive(false); VerifyMachineReferences(machineTemplate); } } foreach (Purchasable item in rootGameObjects.SelectMany((GameObject root) => root.GetComponentsInChildren(true))) { object obj; if (!(item is BulletPurchasable)) { if (!(item is BoatRadarPurchasable)) { BaitPurchasable val2 = (BaitPurchasable)(object)((item is BaitPurchasable) ? item : null); obj = ((val2 != null) ? LureKey(val2) : null); } else { obj = "radar"; } } else { obj = "ammo"; } string text = (string)obj; if (text != null && !supplies.ContainsKey(text)) { Purchasable val3 = Object.Instantiate(item, nursery.transform, false); ((Object)((Component)val3).gameObject).name = "Native " + text + " stand template"; ((Component)val3).gameObject.SetActive(false); supplies.Add(text, val3); } } } internal NativeBlackjackDisplay SpawnBlackjackPresentation(Transform parent, Vector3 surface, float heading) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return casinoPresentation.Spawn(parent, surface, heading); } internal void PrepareHarpoonUpgrades(HarpoonUpgradeCatalog catalog) { if (upgradeShops != null) { throw new InvalidOperationException("Harpoon upgrades were already prepared."); } upgradeShops = new HarpoonUpgradeShops(catalog); } private static string? LureKey(BaitPurchasable source) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown BaitInfo val = (BaitInfo)AccessTools.Field(typeof(BaitPurchasable), "_bait").GetValue(source); if (!ContentRegistry.IsOrdinaryLure(val) || val.Cost <= 0 || val.ItemWeights == null || !val.ItemWeights.Any(delegate(ItemInfoWeight entry) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)((entry != null) ? entry.Fishable : null)) && entry.Weight > 0f) { Item itemToSpawn = entry.Fishable.ItemToSpawn; Creature val2 = (Creature)(object)((itemToSpawn is Creature) ? itemToSpawn : null); if (val2 != null) { return (int)val2.BossType == 0; } } return false; })) { return null; } return ((Object)val).name switch { "Beginner Lure" => "bait", "Standard Lure" => "bait_standard", "Professional Lure" => "bait_professional", "Scientific Lure" => "bait_scientific", _ => null, }; } internal void Spawn(Transform parent, ContentRegistry content, IReadOnlyDictionary positions, IReadOnlyDictionary headings, Vector3 machinePosition, float machineHeading) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_01af: 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_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: 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_0373: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Expected O, but got Unknown if (!IsPrepared) { throw new InvalidOperationException("The native shops and Reel of Fortune templates are not prepared."); } itemStands.Clear(); lureStands.Clear(); bool flag = positions.ContainsKey("harbor_lure"); foreach (ContentDescriptor item in content.AvailableItems.Where((ContentDescriptor contentDescriptor) => !contentDescriptor.IsFish)) { string key = ((item.ItemId == 188) ? "weapon" : item.Key); Vector3 location = RequirePosition(positions, key); float heading = RequireHeading(headings, key); ItemPurchasable value = CreateItemStand(parent, content, item, location, heading); itemStands.Add(item.Key, value); } foreach (KeyValuePair supply in supplies) { if (!flag || !(supply.Key != "radar")) { Purchasable obj = Object.Instantiate(supply.Value, parent, false); ((Object)((Component)obj).gameObject).name = "Reach native " + supply.Key + " stand"; ((Component)obj).transform.localPosition = RequirePosition(positions, supply.Key); ((Component)obj).transform.localRotation = Quaternion.Euler(0f, RequireHeading(headings, supply.Key), 0f); SeatSupplyOnSurface(obj, parent, RequirePosition(positions, supply.Key).y); ((Component)obj).gameObject.SetActive(true); } } if (flag) { HarborLureCatalog harborLureCatalog = HarborLureCatalog.Current ?? throw new InvalidOperationException("Register chapter lures before placing their native shop displays."); string[] array = new string[2] { "harbor_lure", "barracuda_lure" }; foreach (string text in array) { BaitPurchasable val = (BaitPurchasable)Object.Instantiate(supplies["bait"], parent, false); ((Object)val).name = "Harbor " + text + " (Purchasable)"; ((Component)val).transform.localPosition = RequirePosition(positions, text); ((Component)val).transform.localRotation = Quaternion.Euler(0f, RequireHeading(headings, text), 0f); harborLureCatalog.ConfigureStand(val, text); SeatSupplyOnSurface((Purchasable)(object)val, parent, RequirePosition(positions, text).y); lureStands.Add(text, val); ((Component)val).gameObject.SetActive(true); } UpgradeShops.ClearSpawned(); Dictionary layout = content.HarpoonUpgrades.StandKeys.ToDictionary((string result) => result, (string key2) => new HarpoonUpgradePlacement(RequirePosition(positions, key2), RequireHeading(headings, key2)), StringComparer.Ordinal); UpgradeShops.Spawn(parent, (Weapon)content.GetItem("tidebreaker_harpoon"), layout); Dictionary placements = Cumulative.RequiredMarkerKeys.ToDictionary((string result) => result, (string key2) => new CumulativeShopPlacement(RequirePosition(positions, key2), RequireHeading(headings, key2)), StringComparer.Ordinal); Cumulative.Spawn(parent, placements); } Machine = Object.Instantiate(machineTemplate, parent, false); ((Object)((Component)Machine).gameObject).name = "Gambler's Reach - Reel of Fortune"; ((Component)Machine).transform.localPosition = machinePosition; ((Component)Machine).transform.localRotation = Quaternion.Euler(0f, machineHeading + 180f, 0f); Item[] array2 = (from descriptor in content.AvailableItems where !descriptor.IsFish select content.GetItem(descriptor.Key)).ToArray(); Item[] array3 = array2; int num = 0; while (num < array3.Length) { Item reward = array3[num]; if (Object.op_Implicit((Object)(object)reward.SkinPreset)) { Rarity[] array4 = new Rarity[3]; RuntimeHelpers.InitializeArray(array4, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); if (!((IEnumerable)(object)array4).Any((Rarity rarity) => !reward.SkinPreset.Skins.Any((ItemSkin skin) => ((ItemSkin)(ref skin)).Rarity == rarity))) { num++; continue; } } throw new InvalidOperationException("The native slot machine requires complete rarity tables for " + ((Object)reward).name); } AccessTools.Field(typeof(SlotMachine), "_availableItems").SetValue(Machine, array2); AccessTools.Field(typeof(SlotMachine), "_excludeBoat").SetValue(Machine, false); ((Component)Machine).gameObject.SetActive(true); Plugin.Log.LogInfo((object)($"Placed {itemStands.Count} equipment stands, {(flag ? (lureStands.Count + 1) : supplies.Count)} supply stands, " + $"{(flag ? UpgradeShops.Stands.Count : 0)} upgrade stands and the native Reel of Fortune.")); } private static ItemPurchasable CreateItemStand(Transform parent, ContentRegistry content, ContentDescriptor descriptor, Vector3 location, float heading) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0068: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_01d5: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_022b: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: 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_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: 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_030a: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Expected O, but got Unknown //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) Item item = content.GetItem(descriptor.Key); if (!Object.op_Implicit((Object)(object)item.Mesh) || item.Mesh.vertexCount == 0) { throw new InvalidOperationException("A physical shop display needs the item's native-compatible preview mesh."); } GameObject val = new GameObject(descriptor.DisplayName + " (Purchasable)"); val.SetActive(false); val.transform.SetParent(parent, false); val.transform.localPosition = location; val.transform.localRotation = Quaternion.Euler(0f, heading, 0f); int num = LayerMask.NameToLayer("Interactable"); if (num < 0) { throw new InvalidOperationException("The native interaction layer is unavailable."); } val.layer = num; val.tag = "Interactable"; GameObject model = new GameObject(descriptor.DisplayName + " display", new Type[2] { typeof(MeshFilter), typeof(MeshRenderer) }); model.transform.SetParent(val.transform, false); MeshFilter component = model.GetComponent(); MeshRenderer component2 = model.GetComponent(); component.sharedMesh = item.Mesh; Bounds bounds = item.Mesh.bounds; Vector3 size = ((Bounds)(ref bounds)).size; float num2 = Mathf.Max(new float[3] { size.x, size.y, size.z }); if (num2 <= 0f || float.IsNaN(num2) || float.IsInfinity(num2)) { throw new InvalidOperationException("The item's shop mesh dimensions are invalid."); } float num3 = ((item is FishingRod) ? 2.05f : 1.05f); float scale = num3 / num2; model.transform.localRotation = ((item is FishingRod) ? Quaternion.Euler(-94f, 0f, 0f) : Quaternion.Euler(0f, 90f, 76f)); model.transform.localScale = Vector3.one * scale; Transform transform = model.transform; Quaternion localRotation = model.transform.localRotation; bounds = item.Mesh.bounds; transform.localPosition = -(localRotation * ((Bounds)(ref bounds)).center * scale); Vector3 val2 = item.Mesh.vertices.Select((Vector3 vertex) => model.transform.localPosition + model.transform.localRotation * (vertex * scale)).Aggregate((Vector3 left, Vector3 right) => (!(left.y < right.y)) ? right : left); Transform transform2 = model.transform; transform2.localPosition -= ((item is FishingRod) ? val2 : (Vector3.up * val2.y)); if (!content.ApplyPreview((Renderer)(object)component2, item)) { throw new InvalidOperationException("The equipment display has no registered material palette: " + descriptor.Key); } Bounds val3 = TransformedBounds(item.Mesh.bounds, model.transform); BoxCollider val4 = val.AddComponent(); val4.center = ((Bounds)(ref val3)).center; val4.size = Vector3.Max(((Bounds)(ref val3)).size + Vector3.one * 0.08f, Vector3.one * 0.2f); GameObject val5 = new GameObject("TextTarget"); val5.transform.SetParent(val.transform, false); val5.transform.localPosition = ((Bounds)(ref val3)).center + Vector3.up * (((Bounds)(ref val3)).extents.y + 0.12f); ItemPurchasable val6 = val.AddComponent(); AccessTools.Field(typeof(ItemPurchasable), "_itemToPurchase").SetValue(val6, item); AccessTools.Field(typeof(Interactable), "_modelsToOutline").SetValue(val6, new GameObject[1] { model }); AccessTools.Field(typeof(Interactable), "_interactCol").SetValue(val6, val4); AccessTools.Field(typeof(Interactable), "_textTarget").SetValue(val6, val5.transform); val.SetActive(true); return val6; } private static void SeatSupplyOnSurface(Purchasable stand, Transform parent, float surface) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) MeshFilter[] array = (from filter in ((GameObject[])AccessTools.Field(typeof(Interactable), "_modelsToOutline").GetValue(stand)).SelectMany((GameObject display) => display.GetComponentsInChildren(true)) where Object.op_Implicit((Object)(object)filter.sharedMesh) && filter.sharedMesh.vertexCount > 0 select filter).Distinct().ToArray(); if (array.Length == 0) { throw new InvalidOperationException("Cannot measure the native supply display's base: " + ((Object)stand).name); } float num = array.Min(delegate(MeshFilter filter) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 val = parent.worldToLocalMatrix * ((Component)filter).transform.localToWorldMatrix; Bounds bounds = filter.sharedMesh.bounds; float num2 = float.PositiveInfinity; for (int i = 0; i < 8; i++) { Vector3 val2 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((i & 1) != 0) ? 1 : (-1)), (float)(((i & 2) != 0) ? 1 : (-1)), (float)(((i & 4) != 0) ? 1 : (-1)))); num2 = Mathf.Min(num2, ((Matrix4x4)(ref val)).MultiplyPoint3x4(val2).y); } return num2; }); Transform transform = ((Component)stand).transform; transform.localPosition += Vector3.up * (surface - num); } private static Bounds TransformedBounds(Bounds mesh, Transform local) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) Vector3 val = local.localRotation * Vector3.right * ((Bounds)(ref mesh)).extents.x * local.localScale.x; Vector3 val2 = local.localRotation * Vector3.up * ((Bounds)(ref mesh)).extents.y * local.localScale.y; Vector3 val3 = local.localRotation * Vector3.forward * ((Bounds)(ref mesh)).extents.z * local.localScale.z; Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(Mathf.Abs(val.x) + Mathf.Abs(val2.x) + Mathf.Abs(val3.x), Mathf.Abs(val.y) + Mathf.Abs(val2.y) + Mathf.Abs(val3.y), Mathf.Abs(val.z) + Mathf.Abs(val2.z) + Mathf.Abs(val3.z)); return new Bounds(local.localPosition + local.localRotation * Vector3.Scale(((Bounds)(ref mesh)).center, local.localScale), val4 * 2f); } private static Vector3 RequirePosition(IReadOnlyDictionary positions, string key) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!positions.TryGetValue(key, out var value)) { throw new InvalidOperationException("No authored native shop location for " + key); } return value; } private static float RequireHeading(IReadOnlyDictionary headings, string key) { if (!headings.TryGetValue(key, out var value)) { throw new InvalidOperationException("No authored native shop heading for " + key); } return value; } private static void VerifyMachineReferences(SlotMachine machine) { string[] array = new string[8] { "_slotDestroyTarget", "_slotCam", "_rollerText", "_rollerLine", "_prizesText", "_rollHolder", "_roller", "_arm" }; foreach (string text in array) { object value = AccessTools.Field(typeof(SlotMachine), text).GetValue(machine); Component val = (Component)((value is Component) ? value : null); object obj; if (val == null) { GameObject val2 = (GameObject)((value is GameObject) ? value : null); obj = ((val2 != null) ? val2.transform : null); } else { obj = val.transform; } Transform val3 = (Transform)obj; if (!Object.op_Implicit((Object)(object)val3) || !val3.IsChildOf(((Component)machine).transform)) { throw new InvalidOperationException("The native machine has an external or missing " + text + " reference."); } } } public void Dispose() { itemStands.Clear(); lureStands.Clear(); Machine = null; casinoPresentation.Dispose(); Cooking.Dispose(); Grass.Dispose(); Cumulative.Dispose(); upgradeShops?.Dispose(); Object.Destroy((Object)(object)nursery); } internal void ClearScene() { itemStands.Clear(); lureStands.Clear(); upgradeShops?.ClearSpawned(); Cooking.ClearScene(); Grass.ClearScene(); Cumulative.Clear(); Machine = null; } } internal sealed class ReachRadarDot : MonoBehaviour { private static readonly Action UpdateDot = (Action)AccessTools.Method(typeof(RadarUI), "UpdateDot", (Type[])null, (Type[])null).CreateDelegate(typeof(Action)); private MapDot? dot; private Image? image; private RadarUI? radar; internal void Initialize(RadarUI owner) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown radar = owner; MapDot[] array = (MapDot[])AccessTools.Field(typeof(RadarUI), "_islandDots").GetValue(owner); if (array.Length == 0) { throw new InvalidOperationException("The native radar has no island marker template."); } Image val = (Image)AccessTools.Field(typeof(MapDot), "_dot").GetValue(array[0]); image = Object.Instantiate(val, ((Component)val).transform.parent); ((Object)image).name = "Gambler's Reach radar marker"; ((Graphic)image).color = new Color(0.95f, 0.71f, 0.29f, 0f); dot = new MapDot(); AccessTools.Field(typeof(MapDot), "_dot").SetValue(dot, image); } internal void Refresh() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (dot == null || !Object.op_Implicit((Object)(object)radar)) { throw new InvalidOperationException("The expansion radar marker is not initialized."); } if (ReachWorld.Eligible() && ReachWorld.Current != null) { ReachSession? current = ReachSession.Current; if (current == null || !current.RequiresHarborInterlude) { UpdateDot(radar, dot, ReachWorld.Current.Position); return; } } dot.Hide(); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)image)) { Object.Destroy((Object)(object)((Component)image).gameObject); } } } [HarmonyPatch(typeof(RadarUI), "UpdateIslandDots")] internal static class ShowReachOnNativeRadar { private static void Postfix(RadarUI __instance) { if (ReachWorld.Current?.Location != null) { ReachRadarDot reachRadarDot = ((Component)__instance).GetComponent(); if (!Object.op_Implicit((Object)(object)reachRadarDot)) { reachRadarDot = ((Component)__instance).gameObject.AddComponent(); reachRadarDot.Initialize(__instance); } reachRadarDot.Refresh(); } } } internal sealed class WorldLayout { internal Vector3 PlayerSpawn { get; set; } internal Vector3 BoatSpawn { get; set; } internal float PlayerHeading { get; set; } internal Dictionary NpcPositions { get; set; } = new Dictionary(StringComparer.Ordinal); internal Vector3 TablePosition { get; set; } } internal sealed class ReachWorld : IDisposable { internal const byte IslandId = 6; internal const string SceneName = "GamblersReach_Island"; private static readonly FieldInfo InfosField = AccessTools.Field(typeof(IslandManager), "_islandInfos"); private static readonly FieldInfo SpawnField = AccessTools.Field(typeof(IslandInfo), "_spawnPosition"); private static readonly FieldInfo WarningField = AccessTools.Field(typeof(IslandInfo), "_warning"); private readonly Action captureTemplates; private readonly Func createArt; private readonly Action createCharacters; private readonly Action clearCharacters; private readonly Action captureServices; private IslandManager? manager; private Boat? boatTemplate; private GameObject? approach; private GameObject? warning; private GameObject? activeRoot; private string? authoredScenePath; private string activeSceneName = "GamblersReach_Island"; private bool loadingAuthoredScene; internal static ReachWorld? Current { get; private set; } internal IslandInfo? Location { get; private set; } internal WorldLayout? Layout { get; private set; } internal bool Prepared { get; private set; } internal Vector3 Position { get; private set; } internal float PlayerSpawnClearance { get; private set; } internal bool IsActive { get { if (Object.op_Implicit((Object)(object)activeRoot) && Object.op_Implicit((Object)(object)OnlineIslandManager.Instance)) { return OnlineIslandManager.CurIsland == 6; } return false; } } internal event Action? IslandCreated; internal event Action? VanillaIslandLoaded; internal ReachWorld(Action captureTemplates, Func createArt, Action createCharacters, Action clearCharacters, Action captureServices) { if (Current != null) { throw new InvalidOperationException("An expansion world is already registered."); } Current = this; this.captureTemplates = captureTemplates; this.createArt = createArt; this.createCharacters = createCharacters; this.clearCharacters = clearCharacters; this.captureServices = captureServices; SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; } internal void Configure(IslandManager instance) { //IL_004f: 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_0069: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)manager)) { manager = instance; IslandInfo[] array = (IslandInfo[])InfosField.GetValue(instance); if (array.Length > 6 && array[6] != null) { throw new InvalidOperationException("Island ID 6 is already occupied by another mod."); } if (array.Length < 5) { throw new InvalidOperationException("The expected five native island locations are missing."); } Position = FindPosition(array); approach = new GameObject("Gambler's Reach - approach"); approach.transform.SetParent(((Component)instance).transform, false); approach.transform.position = Position; SphereCollider obj = approach.AddComponent(); obj.radius = 60f; ((Collider)obj).isTrigger = true; approach.AddComponent(); warning = new GameObject("Gambler's Reach - active location"); warning.transform.SetParent(((Component)instance).transform, false); warning.transform.position = Position; warning.SetActive(false); Location = new IslandInfo(); SpawnField.SetValue(Location, approach); WarningField.SetValue(Location, warning); Plugin.Log.LogInfo((object)$"Registered additional island at {Position}; all original IDs and the vanilla island count are unchanged."); } } internal IEnumerator Prepare() { while (!Object.op_Implicit((Object)(object)manager) || IslandManager.IsLoading) { yield return null; } if (!Prepared) { Position = new Vector3(Position.x, WaterManager.WaterHeight, Position.z); approach.transform.position = Position; warning.transform.position = Position; PlayerSpawnClearance = NativePlayerGeometry.StandingClearance(); Plugin.Log.LogInfo((object)$"Authored sea level aligned to {Position.y}; player spawn clearance {PlayerSpawnClearance:0.###}m."); yield return SceneManager.LoadSceneAsync(1, (LoadSceneMode)1); Scene sceneByBuildIndex = SceneManager.GetSceneByBuildIndex(1); if (!((Scene)(ref sceneByBuildIndex)).IsValid() || !((Scene)(ref sceneByBuildIndex)).isLoaded) { throw new InvalidOperationException("Could not load the native behavior template scene."); } captureTemplates(sceneByBuildIndex); captureServices(sceneByBuildIndex); SpawnManager val = ((Scene)(ref sceneByBuildIndex)).GetRootGameObjects().SelectMany((GameObject root) => root.GetComponentsInChildren(true)).FirstOrDefault(); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("The native island is missing its boat/spawn template."); } ref Boat? reference = ref boatTemplate; object? value = AccessTools.Field(typeof(SpawnManager), "_boatPrefab").GetValue(val); reference = (Boat?)((value is Boat) ? value : null); if (!Object.op_Implicit((Object)(object)boatTemplate)) { throw new InvalidOperationException("The native networked boat prefab is unavailable."); } yield return SceneManager.UnloadSceneAsync(sceneByBuildIndex); yield return SceneManager.LoadSceneAsync(4, (LoadSceneMode)1); Scene sceneByBuildIndex2 = SceneManager.GetSceneByBuildIndex(4); captureServices(sceneByBuildIndex2); yield return SceneManager.UnloadSceneAsync(sceneByBuildIndex2); yield return SceneManager.LoadSceneAsync(5, (LoadSceneMode)1); Scene sceneByBuildIndex3 = SceneManager.GetSceneByBuildIndex(5); captureServices(sceneByBuildIndex3); yield return SceneManager.UnloadSceneAsync(sceneByBuildIndex3); Prepared = true; Plugin.Log.LogInfo((object)"Native boat behavior template prepared; the temporary template island is unloaded."); } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (loadingAuthoredScene && ((Scene)(ref scene)).name == activeSceneName) { loadingAuthoredScene = false; GameObject root = ((Scene)(ref scene)).GetRootGameObjects().Single((GameObject candidate) => ((Object)candidate).name == "IslandHolder"); BindSceneRoot(root); } else if (((Scene)(ref scene)).buildIndex >= 1 && ((Scene)(ref scene)).buildIndex <= 5) { captureTemplates(scene); if (Prepared && Object.op_Implicit((Object)(object)Server.Instance)) { this.VanillaIslandLoaded?.Invoke((byte)(((Scene)(ref scene)).buildIndex - 1)); } } } private void OnSceneUnloaded(Scene scene) { if (!(((Scene)(ref scene)).name != activeSceneName)) { Plugin.Log.LogInfo((object)"The additional island scene was unloaded."); clearCharacters(); activeRoot = null; Layout = null; } } internal void UseAuthoredScene(string path, string name) { if (Object.op_Implicit((Object)(object)activeRoot) || loadingAuthoredScene || string.IsNullOrWhiteSpace(path) || string.IsNullOrWhiteSpace(name)) { throw new InvalidOperationException("Configure the authored scene before any harbor is loaded."); } authoredScenePath = path; activeSceneName = name; } internal static bool Eligible() { return ReachSession.Current?.HarborEligible ?? false; } internal void OnIslandChanged(byte index) { IslandInfo? location = Location; if (location != null) { location.Toggle(index != 6); } RefreshChapterGate(); } internal void RefreshChapterGate() { ExpansionPlatform current = ExpansionPlatform.Current; if (Object.op_Implicit((Object)(object)current) && current.HasWorld) { current.World.RefreshTravel(); } } internal static AsyncOperation? LoadScene(int buildIndex, LoadSceneMode mode) { //IL_0005: 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_0036: Invalid comparison between Unknown and I4 //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) if (buildIndex != 7) { return SceneManager.LoadSceneAsync(buildIndex, mode); } ReachWorld reachWorld = Current ?? throw new InvalidOperationException("The expansion world is not initialized."); if (!reachWorld.Prepared) { throw new InvalidOperationException("The expansion's behavior templates are not ready."); } if ((int)mode != 1) { throw new InvalidOperationException("The expansion must be loaded additively."); } if (reachWorld.authoredScenePath != null) { if (!reachWorld.loadingAuthoredScene) { Scene sceneByName = SceneManager.GetSceneByName(reachWorld.activeSceneName); if (!((Scene)(ref sceneByName)).isLoaded) { reachWorld.loadingAuthoredScene = true; return SceneManager.LoadSceneAsync(reachWorld.authoredScenePath, (LoadSceneMode)1); } } throw new InvalidOperationException("The authored harbor is already loading or active."); } reachWorld.CreateScene(); return null; } private void CreateScene() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) Scene val = SceneManager.CreateScene("GamblersReach_Island"); GameObject val2 = new GameObject("Gambler's Reach"); SceneManager.MoveGameObjectToScene(val2, val); BindSceneRoot(val2); } private void BindSceneRoot(GameObject root) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00f6: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) activeRoot = root; activeRoot.SetActive(false); activeRoot.transform.position = Position; Layout = createArt(activeRoot.transform); activeRoot.AddComponent(); int num = LayerMask.NameToLayer("Level"); if (num < 0) { throw new InvalidOperationException("The native Level collision layer is missing."); } Collider[] componentsInChildren = activeRoot.GetComponentsInChildren(true); foreach (Collider obj in componentsInChildren) { ((Component)obj).gameObject.layer = num; ((Component)obj).gameObject.tag = "Level"; } createCharacters(activeRoot.transform, Layout); GameObject val = new GameObject("Player arrival"); val.transform.SetParent(activeRoot.transform, false); val.transform.localPosition = Layout.PlayerSpawn; val.transform.localRotation = Quaternion.Euler(0f, Layout.PlayerHeading, 0f); GameObject val2 = new GameObject("Boat arrival"); val2.transform.SetParent(activeRoot.transform, false); val2.transform.localPosition = Layout.BoatSpawn; SpawnManager obj2 = activeRoot.AddComponent(); AccessTools.Field(typeof(SpawnManager), "_playerSpawnPoint").SetValue(obj2, val.transform); AccessTools.Field(typeof(SpawnManager), "_boatSpawnPoint").SetValue(obj2, val2.transform); AccessTools.Field(typeof(SpawnManager), "_boatPrefab").SetValue(obj2, boatTemplate); activeRoot.SetActive(true); this.IslandCreated?.Invoke(); Plugin.Log.LogInfo((object)"Gambler's Reach scene created with native island, player, boat and save-loading lifecycle."); } private static Vector3 FindPosition(IslandInfo[] originals) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) Vector3 islandPosition = originals[3].IslandPosition; List list = new List(); foreach (IslandInfo item in originals.Where((IslandInfo value) => value != null)) { Collider[] componentsInChildren = ((GameObject)SpawnField.GetValue(item)).GetComponentsInChildren(true); foreach (Collider collider in componentsInChildren) { list.Add(ColliderBounds(collider)); } } for (int num2 = 0; num2 < 8; num2++) { float num3 = 220f + (float)num2 * 80f; for (int num4 = 0; num4 < 16; num4++) { float num5 = (float)num4 * MathF.PI / 8f; Vector3 candidate = islandPosition + new Vector3(Mathf.Cos(num5) * num3, 0f, Mathf.Sin(num5) * num3); candidate.y = 0f; bool num6 = originals.Where((IslandInfo info) => info != null).All((IslandInfo info) => Vector2.Distance(new Vector2(candidate.x, candidate.z), new Vector2(info.IslandPosition.x, info.IslandPosition.z)) > 170f); bool flag = list.All((Bounds bounds) => ((Bounds)(ref bounds)).SqrDistance(new Vector3(candidate.x, ((Bounds)(ref bounds)).center.y, candidate.z)) > 6400f); if (num6 && flag) { return candidate; } } } throw new InvalidOperationException("No non-overlapping location was found for the expansion island."); } private static Bounds ColliderBounds(Collider collider) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0233: 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) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_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) SphereCollider val = (SphereCollider)(object)((collider is SphereCollider) ? collider : null); if (val != null) { Vector3 lossyScale = ((Component)val).transform.lossyScale; float num = val.radius * Mathf.Max(new float[3] { Mathf.Abs(lossyScale.x), Mathf.Abs(lossyScale.y), Mathf.Abs(lossyScale.z) }); return new Bounds(((Component)val).transform.TransformPoint(val.center), Vector3.one * num * 2f); } BoxCollider val2 = (BoxCollider)(object)((collider is BoxCollider) ? collider : null); Bounds bounds = default(Bounds); if (val2 != null) { ((Bounds)(ref bounds))..ctor(val2.center, val2.size); } else { CapsuleCollider val3 = (CapsuleCollider)(object)((collider is CapsuleCollider) ? collider : null); if (val3 != null) { Vector3 val4 = Vector3.one * val3.radius * 2f; ((Vector3)(ref val4))[val3.direction] = Mathf.Max(val3.height, val3.radius * 2f); ((Bounds)(ref bounds))..ctor(val3.center, val4); } else { MeshCollider val5 = (MeshCollider)(object)((collider is MeshCollider) ? collider : null); if (val5 == null || !Object.op_Implicit((Object)(object)val5.sharedMesh)) { throw new NotSupportedException("Unsupported native island approach collider: " + ((object)collider).GetType().Name); } bounds = val5.sharedMesh.bounds; } } Vector3 val6 = ((Component)collider).transform.TransformVector(Vector3.right * ((Bounds)(ref bounds)).extents.x); Vector3 val7 = ((Component)collider).transform.TransformVector(Vector3.up * ((Bounds)(ref bounds)).extents.y); Vector3 val8 = ((Component)collider).transform.TransformVector(Vector3.forward * ((Bounds)(ref bounds)).extents.z); Vector3 val9 = default(Vector3); ((Vector3)(ref val9))..ctor(Mathf.Abs(val6.x) + Mathf.Abs(val7.x) + Mathf.Abs(val8.x), Mathf.Abs(val6.y) + Mathf.Abs(val7.y) + Mathf.Abs(val8.y), Mathf.Abs(val6.z) + Mathf.Abs(val7.z) + Mathf.Abs(val8.z)); return new Bounds(((Component)collider).transform.TransformPoint(((Bounds)(ref bounds)).center), val9 * 2f); } public void Dispose() { SceneManager.sceneLoaded -= OnSceneLoaded; SceneManager.sceneUnloaded -= OnSceneUnloaded; if (Object.op_Implicit((Object)(object)approach)) { Object.Destroy((Object)(object)approach); } if (Object.op_Implicit((Object)(object)warning)) { Object.Destroy((Object)(object)warning); } Current = null; } } internal sealed class ReachApproach : MonoBehaviour { private void OnTriggerEnter(Collider other) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Server.Instance) && ((NetworkBehaviour)Server.Instance).IsServerInitialized && ReachWorld.Eligible() && !IslandManager.IsLoading && !OnlineIslandManager.TeleportPlayers && !(Time.time - OnlineIslandManager.TimeWhenSwappingIsland < 5f) && ((Component)other).CompareTag("Player")) { Player playerFromBodyPart = PlayerManager.GetPlayerFromBodyPart(((Component)other).transform); if (Object.op_Implicit((Object)(object)playerFromBodyPart) && DazedUtils.AllPlayersNearbyCheck(playerFromBodyPart.Transform.position, IslandManager.NearPlayerRange)) { OnlineIslandManager.Instance.SpawnIsland((byte)6); } } } } [HarmonyPatch(typeof(IslandManager), "Awake")] internal static class RegisterReachLocation { private static void Postfix(IslandManager __instance) { ReachWorld.Current?.Configure(__instance); } } [HarmonyPatch(typeof(IslandManager), "OnIslandChange")] internal static class UpdateReachLocation { private static void Postfix(byte index) { ReachWorld.Current?.OnIslandChanged(index); } } } namespace GamblersReach.Wildlife { internal sealed class HarborHawkBehaviour : MonoBehaviour { [HarmonyPatch(typeof(Bird), "RpcLogic___ObserverSetPos___74395448")] internal static class ReceiveHawkFlight { private static void Postfix(Bird __instance, [HarmonyArgument(0)] Vector3 position) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (Owns(__instance)) { ((Component)__instance).GetComponent().ReceivePosition(position); } } } private Bird bird; private readonly HawkDiveCycle cycle = new HawkDiveCycle(); private Player? target; private float nextPublish; private byte previousAnimation; private HawkFlightCurve? recovery; private bool avoidingDuringRecovery; private readonly HawkFlightHistory flightHistory = new HawkFlightHistory(); private Vector3 velocity; private float circleAngle; internal int Hits { get; private set; } internal int Warnings { get; private set; } internal int ObstructedDives { get; private set; } internal double LastWarningSeconds { get; private set; } internal HawkStage Stage => cycle.Stage; internal double StageElapsed => cycle.Elapsed; internal Vector3 LockedAim => Unity(cycle.LockedAim); internal Player? Target => target; internal bool Dead { get { if (Object.op_Implicit((Object)(object)bird)) { return ((Creature)bird)._hp.Value <= 0; } return true; } } internal static bool Owns(Bird? candidate) { if (Object.op_Implicit((Object)(object)candidate) && ((Item)candidate).ID == 196) { return Object.op_Implicit((Object)(object)((Component)candidate).GetComponent()); } return false; } private void Awake() { bird = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)bird)) { throw new InvalidOperationException("Hawk flight requires its native Bird component."); } } private void Update() { //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_0112: 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_0130: 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_00cf: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)bird) || !((NetworkBehaviour)bird).IsSpawned || ((NetworkBehaviour)bird).IsDeinitializing || ((Item)bird).IsDestroying || ((Creature)bird)._hp.Value <= 0) { return; } if (((NetworkBehaviour)bird).IsServerInitialized) { ExpansionRuntime? instance = ExpansionRuntime.Instance; if (instance == null || !instance.World.IsActive || IslandManager.IsLoading) { return; } float num = Time.deltaTime; while (num > 0f) { float num2 = Math.Min(num, 1f / 60f); Step(num2); num -= num2; } if (Time.realtimeSinceStartup >= nextPublish) { nextPublish = Time.realtimeSinceStartup + 0.05f; bird.ObserverSetPos(((Component)this).transform.position, bird.AnimState, (Channel)1); } } else if (flightHistory.HasSamples) { HawkFlightPose val = flightHistory.Sample(Time.timeAsDouble); ((Component)this).transform.position = Unity(((HawkFlightPose)(ref val)).Position); velocity = Unity(((HawkFlightPose)(ref val)).Velocity); Face(velocity, Time.deltaTime, 10f); } if (bird.AnimState == 3 && previousAnimation != 3) { AudioManager.PlayClipAt("AlbatrossScreamTakeDamage", ((Component)this).transform.position, false, (AudioDistance)2, 0.22f, 0.5f); } previousAnimation = bird.AnimState; } private void Step(float seconds) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected I4, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Invalid comparison between Unknown and I4 //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Invalid comparison between Unknown and I4 //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_038a: 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_00b6: 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_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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Invalid comparison between Unknown and I4 //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: 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) if (seconds <= 0f) { return; } HawkStage stage = cycle.Stage; switch ((int)stage) { case 0: cycle.Advance((double)seconds, true); Circle(seconds); if (cycle.CanWarn) { target = PlayerManager.Players.Where(Eligible).OrderBy(delegate(Player player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector3 val3 = player.Transform.position - ((Component)this).transform.position; return ((Vector3)(ref val3)).sqrMagnitude; }).FirstOrDefault(); if (Object.op_Implicit((Object)(object)target) && ((Vector3)(ref velocity)).sqrMagnitude >= 1f) { cycle.Warn(Core(((Component)this).transform.position), Core(target.Transform.position + Vector3.up * 0.65f), Core(velocity)); Warnings++; bird.SetAnimState((byte)3); } } break; case 1: { HawkFlightPose pose2 = cycle.WarningPose(cycle.Elapsed + (double)seconds); if (!MoveCurve(pose2, seconds)) { cycle.Abort(); BeginRecovery(); break; } double lastWarningSeconds = cycle.Elapsed + (double)seconds; cycle.Advance((double)seconds, Eligible(target)); if ((int)cycle.Stage == 2) { LastWarningSeconds = lastWarningSeconds; bird.SetAnimState((byte)2); } if ((int)cycle.Stage == 3) { BeginRecovery(); } break; } case 2: { if (!TargetAlive(target)) { cycle.Abort(); BeginRecovery(); break; } Vector3 position = ((Component)this).transform.position; HawkFlightPose pose = cycle.DivePose(cycle.Elapsed + (double)seconds); Vector3 val2 = Unity(((HawkFlightPose)(ref pose)).Position); if (!MoveCurve(pose, seconds)) { ObstructedDives++; cycle.Abort(); BeginRecovery(); break; } if (target != null && Object.op_Implicit((Object)(object)target) && cycle.TryStrike(Core(position), Core(val2), Core(target.Transform.position + Vector3.up * 0.65f)) && !Physics.Linecast(val2, target.Transform.position + Vector3.up * 0.65f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1)) { Server.Instance.HitPlayer(target, 8, Vector3.zero, target.Transform.position, (byte)1, (Player)null); Hits++; } cycle.Advance((double)seconds, true); if ((int)cycle.Stage == 3) { BeginRecovery(); } break; } case 3: if (recovery == null) { throw new InvalidOperationException("The hawk has no recovery flight curve."); } if (avoidingDuringRecovery || !MoveCurve(recovery.Sample(cycle.Elapsed + (double)seconds), seconds)) { avoidingDuringRecovery = true; HawkFlightPose val = recovery.Sample(recovery.Duration); MoveSafe(Unity(((HawkFlightPose)(ref val)).Position), seconds, 8f); } cycle.Advance((double)seconds, true); if ((int)cycle.Stage == 0) { target = null; bird.SetAnimState((byte)1); } break; } } private void Circle(float seconds) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) ExpansionRuntime runtime = ExpansionRuntime.Instance ?? throw new InvalidOperationException("The hawk's harbor runtime is unavailable."); Player val = PlayerManager.Players.Where(TargetAlive).OrderBy(delegate(Player player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val4 = player.Transform.position - runtime.World.Position; return ((Vector3)(ref val4)).sqrMagnitude; }).FirstOrDefault(); Vector3 val2 = Vector3.ProjectOnPlane((Object.op_Implicit((Object)(object)val) ? val.Transform.position : runtime.World.Position) - runtime.World.Position, Vector3.up); Vector3 val3 = runtime.World.Position + Vector3.ClampMagnitude(val2, 30f); circleAngle += seconds * 0.55f; Vector3 destination = val3 + new Vector3(Mathf.Cos(circleAngle) * 10f, 13f, Mathf.Sin(circleAngle) * 10f); MoveSafe(destination, seconds, 8f); bird.SetAnimState((byte)1); } private void BeginRecovery() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d4: 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_00f1: Expected O, but got Unknown //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) Vector3 val = Vector3.ProjectOnPlane(velocity, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.ProjectOnPlane(((Component)this).transform.forward, Vector3.up); } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = ((Component)this).transform.position + val * 20f + Vector3.up * 11f; val2.y = Mathf.Max(val2.y, ExpansionRuntime.Instance.World.Position.y + 13f); recovery = new HawkFlightCurve(Core(((Component)this).transform.position), Core(velocity), Core(val2), Core(val * 8f), 4.0); avoidingDuringRecovery = false; bird.SetAnimState((byte)4); } internal void ReceivePosition(Vector3 position) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)bird).IsServerInitialized) { flightHistory.Receive(Core(position), Time.timeAsDouble); } } private bool MoveCurve(HawkFlightPose pose, float seconds) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Unity(((HawkFlightPose)(ref pose)).Position); Vector3 val2 = val - ((Component)this).transform.position; RaycastHit val3 = default(RaycastHit); if (((Vector3)(ref val2)).sqrMagnitude > 1E-06f && Physics.SphereCast(((Component)this).transform.position, 0.18f, ((Vector3)(ref val2)).normalized, ref val3, ((Vector3)(ref val2)).magnitude, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1)) { return false; } velocity = Unity(((HawkFlightPose)(ref pose)).Velocity); Face(velocity, seconds, 12f); ((Component)this).transform.position = val; return true; } private void MoveSafe(Vector3 destination, float seconds, float speed) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_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_0153: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00fb: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0151: Unknown result type (might be due to invalid IL or missing references) Vector3 val = destination - ((Component)this).transform.position; if (((Vector3)(ref val)).sqrMagnitude < 1E-06f) { val = ((Component)this).transform.forward; } velocity = Vector3.MoveTowards(velocity, ((Vector3)(ref val)).normalized * speed, seconds * 12f); Vector3 val2 = velocity * seconds; RaycastHit val3 = default(RaycastHit); if (Physics.SphereCast(((Component)this).transform.position, 0.3f, ((Vector3)(ref val2)).normalized, ref val3, Mathf.Max(1.5f, ((Vector3)(ref val2)).magnitude), LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1)) { Vector3 val4 = Vector3.ProjectOnPlane(Vector3.up + ((RaycastHit)(ref val3)).normal * 0.4f, ((RaycastHit)(ref val3)).normal); val2 = ((((Vector3)(ref val4)).sqrMagnitude < 0.001f) ? (((RaycastHit)(ref val3)).normal * speed * seconds) : (((Vector3)(ref val4)).normalized * speed * seconds)); RaycastHit val5 = default(RaycastHit); if (Physics.SphereCast(((Component)this).transform.position, 0.3f, ((Vector3)(ref val2)).normalized, ref val5, ((Vector3)(ref val2)).magnitude, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1)) { val2 = ((Vector3)(ref val2)).normalized * Mathf.Max(0f, ((RaycastHit)(ref val5)).distance - 0.02f); } } Face(val2, seconds, 4f); Transform transform = ((Component)this).transform; transform.position += val2; velocity = val2 / seconds; } private void Face(Vector3 direction, float seconds, float rate) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref direction)).sqrMagnitude > 1E-06f) { ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(direction), 1f - Mathf.Exp((0f - seconds) * rate)); } } private bool Eligible(Player? player) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0090: Unknown result type (might be due to invalid IL or missing references) if (TargetAlive(player)) { Vector3 val = player.Transform.position - ((Component)this).transform.position; if (((Vector3)(ref val)).sqrMagnitude <= 1225f && !Physics.Raycast(player.Transform.position + Vector3.up, Vector3.up, 18f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1)) { return !Physics.Linecast(((Component)this).transform.position, player.Transform.position + Vector3.up * 0.65f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1); } } return false; } private static bool TargetAlive(Player? player) { if (Object.op_Implicit((Object)(object)player) && !((NetworkBehaviour)player).IsDeinitializing && !player.Dying.IsDead && player.Vitals.Health > 0) { return PlayerManager.Players.Contains(player); } return false; } private static Vector3 Core(Vector3 point) { //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(point.x, point.y, point.z); } private static Vector3 Unity(Vector3 point) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(point.X, point.Y, point.Z); } } [HarmonyPatch(typeof(BirdManager), "AddFlyingBird")] internal static class OwnHawkFlight { private static bool Prefix(Bird bird) { return !HarborHawkBehaviour.Owns(bird); } } [HarmonyPatch(typeof(Bird), "SetAttackingFood")] internal static class HawkNeverTargetsFood { private static bool Prefix(Bird __instance, Item item) { if (!HarborHawkBehaviour.Owns(__instance)) { return true; } if (Object.op_Implicit((Object)(object)item)) { Plugin.Log.LogDebug((object)"Harbor hawks target players, not carried or loose food."); } return false; } } [HarmonyPatch(typeof(Bird), "SetCaughtFood")] internal static class HawkNeverStealsFood { private static bool Prefix(Bird __instance) { if (!HarborHawkBehaviour.Owns(__instance)) { return true; } Plugin.Log.LogDebug((object)"Ignored a food-capture request for a Harbor Hawk."); return false; } } internal sealed class HarborHawkDirector : MonoBehaviour { private ExpansionRuntime runtime; private Bird prefab; private readonly HawkSpawnClock clock = new HawkSpawnClock(); private Bird? flying; private bool initialized; internal int NaturalSpawns { get; private set; } internal Bird? Flying { get { if (!Object.op_Implicit((Object)(object)flying) || ((Creature)flying)._hp.Value <= 0 || ((Item)flying).IsDestroying) { return null; } return flying; } } internal double SpawnElapsed => clock.Elapsed; internal void Initialize(ExpansionRuntime owner, Bird registeredPrefab) { if (initialized || !Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)registeredPrefab) || ((Item)registeredPrefab).ID != 196) { throw new InvalidOperationException("Initialize the hawk director once with its registered prefab."); } runtime = owner; prefab = registeredPrefab; initialized = true; } private void Update() { if (!initialized || !Object.op_Implicit((Object)(object)Server.Instance) || !((NetworkBehaviour)Server.Instance).IsServerInitialized) { return; } bool flag = runtime.Ready && runtime.World.IsActive && !IslandManager.IsLoading; if (!flag && Object.op_Implicit((Object)(object)Flying)) { ((Item)flying).DestroyItem((byte)0, byte.MaxValue); } float num = Math.Min(Time.deltaTime, 0.1f); if (!(num <= 0f)) { bool flag2 = PlayerManager.Players.Any((Player player) => Object.op_Implicit((Object)(object)player) && !player.Dying.IsDead); if (clock.Advance((double)num, flag && flag2, Object.op_Implicit((Object)(object)Flying) ? 1 : 0) && flag) { Spawn(); NaturalSpawns++; } } } private Bird Spawn() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) if (!initialized || !Object.op_Implicit((Object)(object)Server.Instance) || !((NetworkBehaviour)Server.Instance).IsServerInitialized || !runtime.World.IsActive || IslandManager.IsLoading) { throw new InvalidOperationException("Hawks can only spawn on the authoritative active harbor."); } if (Object.op_Implicit((Object)(object)Flying)) { throw new InvalidOperationException("A Harbor Hawk is already alive."); } Player val = ((IEnumerable)PlayerManager.Players).FirstOrDefault((Func)((Player value) => Object.op_Implicit((Object)(object)value) && !value.Dying.IsDead)); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("The harbor has no living crew for a wildlife spawn."); } Vector3 val2 = runtime.World.Position + Vector3.ClampMagnitude(Vector3.ProjectOnPlane(val.Transform.position - runtime.World.Position, Vector3.up), 28f); Vector3 val3 = val2 + new Vector3(12f, 16f, -8f); if (Physics.CheckSphere(val3, 1f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1)) { throw new InvalidOperationException("The reserved hawk arrival airspace is obstructed."); } ref Bird? reference = ref flying; Item obj = ItemManager.Instance.SpawnNewItem((Item)(object)prefab, val3, Quaternion.LookRotation(val2 - val3)); reference = (Bird?)(object)(((obj is Bird) ? obj : null) ?? throw new InvalidOperationException("The native bird spawner did not create the registered hawk.")); return flying; } } internal sealed class HawkContent { [CompilerGenerated] private static class <>O { public static ItemCustomizer <0>__Customize; public static Func, bool> <1>__AcceptWildlife; } internal const string PackKey = "gamblers_reach_wildlife"; internal const string ItemKey = "harbor_hawk"; internal const string BundleName = "gamblersreach.wildlife"; internal const byte ItemId = 196; internal const ushort CollectionId = 48190; private readonly ExpansionRuntime runtime; internal Bird Prefab { get; private set; } internal HarborHawkDirector Director { get; private set; } internal HawkContent(ExpansionRuntime runtime) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0091: Expected O, but got Unknown this.runtime = runtime; ExpansionPlatform.Current.RegisterExtension(new PackExtension("gamblers_reach_wildlife", (Func)Source, (Action)delegate(PackContentOptions options) { //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_0026: Expected O, but got Unknown Dictionary itemCustomizers = options.ItemCustomizers; object obj = <>O.<0>__Customize; if (obj == null) { ItemCustomizer val = Customize; <>O.<0>__Customize = val; obj = (object)val; } itemCustomizers.Add("harbor_hawk", (ItemCustomizer)obj); }) { AcceptSavedRevision = HarborSaveRevision.AcceptWildlife, ContentInstalled = delegate(PackContentInstaller installed) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Item obj = installed.ResolveItem(ContentReference.Pack("gamblers_reach_wildlife", "harbor_hawk")); Prefab = (Bird)(object)(((obj is Bird) ? obj : null) ?? throw new InvalidOperationException("The registered hawk lost its native bird component.")); }, PrepareGameplay = Prepare }); } private PackSource Source() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00c4: 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_00db: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_016f: Expected O, but got Unknown //IL_0174: Expected O, but got Unknown //IL_01a9: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Expected O, but got Unknown string directoryName = Path.GetDirectoryName(typeof(Plugin).Assembly.Location); string sha = PackSource.FileHash(Path.Combine(directoryName, "gamblersreach.wildlife")).ToLowerInvariant(); return new PackSource(new PackDefinition { Key = "gamblers_reach_wildlife", Title = "Gambler's Reach Wildlife", Version = "0.8.4", Dependencies = new List { new PackDependency { Key = "gamblers_reach", MinimumVersion = "0.8.0" } }, ExtensionHooks = new List { "harbor_hawk" }, Collections = new List { new NetworkCollectionRecipe { Key = "birds", Id = 48190 } }, Items = new List { new ItemRecipe { Key = "harbor_hawk", Id = 196, Title = "Harbor Hawk", Kind = (PackItemKind)3, NativeDonor = "native:43", Health = 60f, Worth = 20, Cost = 0, Network = new NetworkBinding { CollectionId = 48190, Slot = 0 }, Art = new ArtRecipe { Bundle = "gamblersreach.wildlife", Sha256 = sha, Prefab = "harbor_hawk" } } } }, directoryName, new Assembly[2] { typeof(Plugin).Assembly, typeof(HawkRules).Assembly }); } private static void Customize(ItemCustomization context) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown Bird obj = context.Item.Require(); NativeItemFactories.ConfigureFish(context.Item, new FishTuning { Health = 60, Worth = 20, Cost = 0, Journal = false, IgnoredByMoneyNpc = false, IgnoredBySeagulls = true, QuestItem = false }); context.Item.Catchable = false; NativeAccess.Set((object)obj, "_skipRandomizedWeight", (object)true); NativeBirdVisuals.Apply(obj, context.Donor, context.Art ?? throw new InvalidOperationException("The original hawk artwork is missing."), context.Visuals); context.MarkVisualBound(); ((Component)obj).gameObject.AddComponent(); } private IEnumerator Prepare() { Director = ((Component)runtime).gameObject.AddComponent(); Director.Initialize(runtime, Prefab); yield break; } } } namespace GamblersReach.Networking { internal enum ReachAction : byte { Hello = 0, Accepted = 1, Error = 2, Talk = 10, Travel = 11, TurnIn = 12, Buy = 13, Bet = 14, Hit = 15, Stand = 16, Refresh = 17, Table = 18, Snapshot = 40, TableState = 41 } internal struct ReachPacket : IBroadcast { internal uint Sequence; internal ReachAction Action; internal string Body; } internal sealed class ReachNetwork : IDisposable { private const int MaximumBodyBytes = 8192; private readonly NetworkManager manager; private readonly HashSet confirmed = new HashSet(); private readonly Dictionary sequences = new Dictionary(); private readonly Dictionary deadlines = new Dictionary(); private readonly Dictionary nextAction = new Dictionary(); private readonly string manifest; private uint sequence; internal bool ClientConfirmed { get; private set; } internal string Manifest => manifest; internal event Action? Request; internal event Action? Response; internal event Action? ClientDeparted; internal event Action? ClientConfirmedOnServer; internal ReachNetwork(NetworkManager manager) { this.manager = manager; manifest = ComputeManifest(); GenericWriter.SetWrite((Action)WritePacket); GenericReader.SetRead((Func)ReadPacket); manager.ServerManager.RegisterBroadcast((Action)OnRequest, true); manager.ClientManager.RegisterBroadcast((Action)OnResponse); manager.ClientManager.OnAuthenticated += SendHello; manager.ClientManager.OnClientConnectionState += OnLocalState; manager.ServerManager.OnAuthenticationResult += OnAuthenticated; manager.ServerManager.OnRemoteConnectionState += OnRemoteState; } private static string ComputeManifest() { using SHA256 sHA = SHA256.Create(); string location = typeof(Plugin).Assembly.Location; string path = Path.Combine(Path.GetDirectoryName(location), "GamblersReach.Core.dll"); string location2 = typeof(ExpansionDefinition).Assembly.Location; string location3 = typeof(ExpansionKitPlugin).Assembly.Location; string text = BitConverter.ToString(sHA.ComputeHash(File.ReadAllBytes(location))).Replace("-", ""); string text2 = BitConverter.ToString(sHA.ComputeHash(File.ReadAllBytes(path))).Replace("-", ""); string text3 = BitConverter.ToString(sHA.ComputeHash(File.ReadAllBytes(location2))).Replace("-", ""); string text4 = BitConverter.ToString(sHA.ComputeHash(File.ReadAllBytes(location3))).Replace("-", ""); string path2 = Path.Combine(Path.GetDirectoryName(location), "gamblersreach.models"); string text5 = BitConverter.ToString(sHA.ComputeHash(File.ReadAllBytes(path2))).Replace("-", ""); string path3 = Path.Combine(Path.GetDirectoryName(location), "gamblersreach.harbor"); string text6 = BitConverter.ToString(sHA.ComputeHash(File.ReadAllBytes(path3))).Replace("-", ""); string text7 = HarborLureCatalog.Current?.RegistrationHash ?? throw new InvalidOperationException("Register harbor lures before creating the content handshake."); return "0.8.4|" + Plugin.SupportedGame.ToString() + "|" + text + "|" + text2 + "|" + text5 + "|" + text6 + "|" + text3 + "|" + text4 + "|" + text7 + "|" + ExpansionPlatform.Current.Fingerprint; } private void OnAuthenticated(NetworkConnection connection, bool success) { if (success) { deadlines[connection.ClientId] = Time.realtimeSinceStartup + 15f; } } private void SendHello() { manager.ClientManager.Broadcast(new ReachPacket { Action = ReachAction.Hello, Body = manifest, Sequence = 0u }, (Channel)0); } internal uint Send(ReachAction action, string body = "") { if (!ClientConfirmed) { throw new InvalidOperationException("The host has not accepted the expansion version yet."); } if ((int)action < 10 || (int)action > 18) { throw new ArgumentOutOfRangeException("action"); } uint result = checked(++sequence); manager.ClientManager.Broadcast(new ReachPacket { Action = action, Sequence = result, Body = body }, (Channel)0); return result; } private void OnRequest(NetworkConnection connection, ReachPacket packet, Channel channel) { uint value; if (packet.Action == ReachAction.Hello) { if (!string.Equals(packet.Body, manifest, StringComparison.Ordinal)) { RejectVersion(connection); return; } confirmed.Add(connection.ClientId); deadlines.Remove(connection.ClientId); Reply(connection, ReachAction.Accepted, "", packet.Sequence); this.ClientConfirmedOnServer?.Invoke(connection); Plugin.Log.LogInfo((object)$"Expansion manifest matched for client {connection.ClientId}."); } else if (!confirmed.Contains(connection.ClientId)) { Reply(connection, ReachAction.Error, "Install the host's exact Gambler's Reach package before playing.", packet.Sequence); } else if ((int)packet.Action < 10 || (int)packet.Action > 18) { Reply(connection, ReachAction.Error, "Unsupported expansion action.", packet.Sequence); } else if (packet.Sequence == 0 || (sequences.TryGetValue(connection.ClientId, out value) && packet.Sequence <= value)) { Reply(connection, ReachAction.Error, "This action has already been processed.", packet.Sequence); } else { sequences[connection.ClientId] = packet.Sequence; if (nextAction.TryGetValue(connection.ClientId, out var value2) && Time.realtimeSinceStartup < value2) { Reply(connection, ReachAction.Error, "Please wait for the previous action.", packet.Sequence); return; } nextAction[connection.ClientId] = Time.realtimeSinceStartup + 0.08f; this.Request?.Invoke(connection, packet); } } private void RejectVersion(NetworkConnection connection) { Reply(connection, ReachAction.Error, "Gambler's Reach versions differ. Install the host's exact package."); Plugin.Log.LogWarning((object)$"Rejected mismatched expansion client {connection.ClientId}."); manager.ServerManager.Kick(connection, (KickReason)5, (LoggingType)3, "Gambler's Reach package mismatch."); } internal void Reply(NetworkConnection connection, ReachAction action, string body, uint request = 0u) { manager.ServerManager.Broadcast(connection, new ReachPacket { Action = action, Body = body, Sequence = request }, true, (Channel)0); } internal void Publish(string body) { foreach (NetworkConnection value in manager.ServerManager.Clients.Values) { if (confirmed.Contains(value.ClientId)) { Reply(value, ReachAction.Snapshot, body); } } } internal void PublishTable(string body) { if (!manager.IsServerStarted) { return; } foreach (NetworkConnection value in manager.ServerManager.Clients.Values) { if (confirmed.Contains(value.ClientId)) { Reply(value, ReachAction.TableState, body); } } } private void OnResponse(ReachPacket packet, Channel channel) { if (packet.Action == ReachAction.Accepted) { ClientConfirmed = true; } this.Response?.Invoke(packet); } internal void Tick() { if (!manager.IsServerStarted) { return; } List list = new List(); foreach (KeyValuePair deadline in deadlines) { if (Time.realtimeSinceStartup >= deadline.Value) { list.Add(deadline.Key); } } foreach (int item in list) { deadlines.Remove(item); if (manager.ServerManager.Clients.TryGetValue(item, out var value)) { RejectVersion(value); } } } private void OnRemoteState(NetworkConnection connection, RemoteConnectionStateArgs state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)state.ConnectionState == 0) { confirmed.Remove(connection.ClientId); sequences.Remove(connection.ClientId); deadlines.Remove(connection.ClientId); nextAction.Remove(connection.ClientId); this.ClientDeparted?.Invoke(connection); } } private void OnLocalState(ClientConnectionStateArgs state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)state.ConnectionState == 1) { ClientConfirmed = false; sequence = 0u; confirmed.Clear(); sequences.Clear(); deadlines.Clear(); nextAction.Clear(); } } private static void WritePacket(Writer writer, ReachPacket packet) { byte[] bytes = Encoding.UTF8.GetBytes(packet.Body ?? ""); if (bytes.Length > 8192) { throw new InvalidDataException("Expansion packet exceeds the permitted size."); } writer.WriteUInt32Unpacked(packet.Sequence); writer.WriteUInt8Unpacked((byte)packet.Action); writer.WriteUInt16Unpacked((ushort)bytes.Length); writer.WriteUInt8Array(bytes, 0, bytes.Length); } private static ReachPacket ReadPacket(Reader reader) { if (reader.Remaining < 7) { throw new InvalidDataException("Truncated expansion packet header."); } uint num = reader.ReadUInt32Unpacked(); byte action = reader.ReadUInt8Unpacked(); int num2 = reader.ReadUInt16Unpacked(); if (num2 > 8192 || num2 > reader.Remaining) { throw new InvalidDataException("Invalid expansion packet length."); } return new ReachPacket { Sequence = num, Action = (ReachAction)action, Body = Encoding.UTF8.GetString(reader.ReadUInt8ArrayAllocated(num2)) }; } public void Dispose() { manager.ServerManager.UnregisterBroadcast((Action)OnRequest); manager.ClientManager.UnregisterBroadcast((Action)OnResponse); manager.ClientManager.OnAuthenticated -= SendHello; manager.ClientManager.OnClientConnectionState -= OnLocalState; manager.ServerManager.OnAuthenticationResult -= OnAuthenticated; manager.ServerManager.OnRemoteConnectionState -= OnRemoteState; } } } namespace GamblersReach.Interface { internal sealed class PanelChoice { public string Label { get; set; } = ""; public ReachAction Action { get; set; } public string Argument { get; set; } = ""; public bool Enabled { get; set; } = true; } internal sealed class PanelView { public string Key { get; set; } = ""; public string Title { get; set; } = ""; public string Subtitle { get; set; } = ""; public string Message { get; set; } = ""; public string Round { get; set; } = ""; public bool NativeDialogue { get; set; } public bool SharedTable { get; set; } public long TableRevision { get; set; } = -1L; public bool TableLocked { get; set; } public int ActingClientId { get; set; } = -1; public string ActingPlayerName { get; set; } = ""; public int ReservedItemId { get; set; } = -1; public int[] ReservedItemIds { get; set; } = Array.Empty(); public int DepositItemCount { get; set; } public long DepositValue { get; set; } public string DepositMessage { get; set; } = ""; public float PayoutMultiplier { get; set; } public string Outcome { get; set; } = ""; public string[] DealerCards { get; set; } = Array.Empty(); public string[] PlayerCards { get; set; } = Array.Empty(); public string DealerTotal { get; set; } = ""; public string PlayerTotal { get; set; } = ""; public List Choices { get; set; } = new List(); } internal sealed class ReachPanel : MonoBehaviour { private GameObject? cards; private Transform? table; private NativeBlackjackDisplay? stakeDisplay; private Action? send; private TMP_FontAsset font; private long tableRevision = -1L; private readonly Dictionary controls = new Dictionary(StringComparer.Ordinal); private readonly List textures = new List(); private readonly Dictionary suits = new Dictionary(); private static readonly Color Cream = new Color(0.94f, 0.89f, 0.74f); private static readonly Color Ink = new Color(0.08f, 0.1f, 0.12f); internal static bool IsOpen { get; private set; } internal PanelView? View { get; private set; } internal PanelView? TableView { get; private set; } internal void Initialize(Action onAction) { send = onAction; RefreshFont(); } private void RefreshFont() { NpcUI val = Object.FindAnyObjectByType(); TMP_FontAsset defaultFontAsset; if (Object.op_Implicit((Object)(object)val)) { object? value = AccessTools.Field(typeof(NpcUI), "_npcText").GetValue(val); TextMeshProUGUI val2 = (TextMeshProUGUI)((value is TextMeshProUGUI) ? value : null); if (val2 != null) { defaultFontAsset = ((TMP_Text)val2).font; goto IL_003f; } } defaultFontAsset = TMP_Settings.defaultFontAsset; goto IL_003f; IL_003f: font = defaultFontAsset; if (!Object.op_Implicit((Object)(object)font)) { throw new InvalidOperationException("The native UI font is not ready."); } } internal void BindTable(Transform parent, Vector3 position, float heading, NativeBlackjackDisplay display) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) RefreshFont(); GameObject val = new GameObject("Blackjack table interaction"); val.transform.SetParent(parent, false); val.transform.localPosition = position + Vector3.up * 0.02f; val.transform.localRotation = Quaternion.Euler(0f, heading, 0f); table = val.transform; stakeDisplay = display; controls.Clear(); string[] array = new string[3] { "DEAL", "HIT", "STAND" }; for (int i = 0; i < array.Length; i++) { string label = array[i]; controls.Add(label, NativeBlackjackControl.Create(table, new Vector3(-1.11f + (float)i * 0.35f, 0.02f, -0.34f), label, font, delegate { Activate(label); })); } DrawCards(TableView ?? IdleView()); stakeDisplay.Show(TableView ?? IdleView()); UpdateControls(); } internal void Show(PanelView view) { if (view.NativeDialogue || view.Key != "dealer") { ShowNativeDialogue(view); } else { ApplySharedTable(view); } } internal bool ApplySharedTable(PanelView view) { if (!view.SharedTable || view.TableRevision <= tableRevision) { return false; } tableRevision = view.TableRevision; view.Choices.Clear(); bool flag = IsLocalActor(view); if (!view.TableLocked && view.DepositItemCount > 0 && view.DepositMessage.Length == 0) { view.Choices.Add(new PanelChoice { Label = "Deal", Action = ReachAction.Bet, Argument = view.TableRevision.ToString(CultureInfo.InvariantCulture) }); } else if (view.TableLocked && flag) { view.Choices.Add(new PanelChoice { Label = "Hit", Action = ReachAction.Hit, Argument = view.Round }); view.Choices.Add(new PanelChoice { Label = "Stand", Action = ReachAction.Stand, Argument = view.Round }); } TableView = view; if (Object.op_Implicit((Object)(object)stakeDisplay)) { stakeDisplay.Show(view); } View = view; IsOpen = view.TableLocked && flag; if (Object.op_Implicit((Object)(object)table)) { DrawCards(view); } UpdateControls(); return true; } internal void ResetSharedTable() { TableView = null; tableRevision = -1L; View = null; IsOpen = false; if (Object.op_Implicit((Object)(object)table)) { DrawCards(IdleView()); } UpdateControls(); } private static PanelView IdleView() { return new PanelView { Key = "dealer", DealerTotal = "BLACKJACK", PlayerTotal = "PLACE YOUR BET, THEN DEAL" }; } internal static bool IsLocalActor(PanelView view) { if (Object.op_Implicit((Object)(object)InstanceFinder.ClientManager) && view.ActingClientId >= 0) { return InstanceFinder.ClientManager.Connection.ClientId == view.ActingClientId; } return false; } private void UpdateControls() { bool flag = TableView != null; bool flag2 = flag && TableView.TableLocked; bool flag3 = flag && IsLocalActor(TableView); foreach (KeyValuePair control in controls) { if (Object.op_Implicit((Object)(object)control.Value)) { control.Value.SetAvailable(flag && ((control.Key == "DEAL") ? (!flag2) : (flag2 && flag3))); } } } internal void ShowNativeDialogue(PanelView view) { View = view; IsOpen = TableView != null && TableView.TableLocked && IsLocalActor(TableView); } internal void ShowError(string error) { //IL_005b: 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) Plugin.Log.LogWarning((object)error); if (View != null) { ExpansionRuntime? instance = ExpansionRuntime.Instance; if (instance != null && instance.Characters.Targets.TryGetValue(View.Key, out Transform value) && Object.op_Implicit((Object)(object)value) && Object.op_Implicit((Object)(object)Player.LocalPlayer) && Vector3.Distance(Player.LocalPlayer.Transform.position, value.position) < 8f) { ExpansionRuntime.Instance.Characters.ShowDialogue(View.Key, error); goto IL_00a4; } } ChatManager.ChatMessage("" + error + ""); goto IL_00a4; IL_00a4: if (Object.op_Implicit((Object)(object)Player.LocalPlayer)) { AudioManager.PlayGlobalClip("Error", false, 0.25f, 0.1f, false); } } internal void Activate(string control) { if (send == null) { throw new InvalidOperationException("Blackjack interaction is not initialized."); } PanelView tableView = TableView; if (tableView == null) { ShowError("The shared table is synchronizing. Please wait."); return; } if (tableView.TableLocked && !IsLocalActor(tableView)) { ShowError(tableView.ActingPlayerName + " is playing this hand. You can watch until it finishes."); return; } ReachAction action = control switch { "HIT" => ReachAction.Hit, "STAND" => ReachAction.Stand, "DEAL" => ReachAction.Bet, _ => throw new ArgumentException("Unknown blackjack control: " + control, "control"), }; PanelChoice panelChoice = tableView.Choices.FirstOrDefault((PanelChoice candidate) => candidate.Action == action && candidate.Enabled); if (panelChoice == null) { ShowError((!(control == "DEAL") || tableView.TableLocked) ? "That control is not available for the current hand." : ((tableView.DepositMessage.Length > 0) ? tableView.DepositMessage : "Place another fish or item on the highlighted area, then DEAL.")); } else { send(panelChoice.Action, panelChoice.Argument); } } private void DrawCards(PanelView view) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)table)) { RefreshFont(); if (Object.op_Implicit((Object)(object)cards)) { cards.SetActive(false); Object.Destroy((Object)(object)cards); } cards = new GameObject("Blackjack cards on the felt", new Type[2] { typeof(RectTransform), typeof(Canvas) }); RectTransform component = cards.GetComponent(); ((Transform)component).SetParent(table, false); ((Transform)component).localPosition = new Vector3(-0.78f, 0.01f, 0.1f); ((Transform)component).localRotation = Quaternion.Euler(90f, 0f, 0f); ((Transform)component).localScale = Vector3.one * 0.0012f; component.sizeDelta = new Vector2(800f, 365f); Canvas component2 = cards.GetComponent(); component2.renderMode = (RenderMode)2; component2.sortingOrder = 10; DrawHand(component, "SILAS " + view.DealerTotal, view.DealerCards, 0f); string text = view.ActingPlayerName.Replace("<", "").Replace(">", ""); if (text.Length > 32) { text = text.Substring(0, 32); } string label = ((view.Round.Length == 0) ? "PLACE YOUR BET, THEN DEAL" : ((IsLocalActor(view) ? "YOU" : text) + " " + view.PlayerTotal + (view.TableLocked ? " | PLAYING" : (" | " + view.Outcome)))); DrawHand(component, label, view.PlayerCards, 185f); } } private void DrawHand(RectTransform parent, string label, string[] hand, float y) { //IL_0019: 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_00a4: 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_014d: 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_0181: 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_0137: Unknown result type (might be due to invalid IL or missing references) AddText(parent, label, 0f, y, 800f, 36f, 23f, Cream); float width = 70f; float num = ((hand.Length > 8) ? 62 : 84); float num2 = (800f - (float)Math.Max(1, hand.Length) * num) * 0.5f; for (int i = 0; i < Math.Min(hand.Length, 12); i++) { string text = hand[i]; RectTransform val = Rect((Transform)(object)parent, "Card " + i, num2 + (float)i * num, y + 39f, width, 107f); Image obj = ((Component)val).gameObject.AddComponent(); ((Graphic)obj).color = (Color)((text == "??") ? new Color(0.18f, 0.12f, 0.27f) : Cream); ((Graphic)obj).raycastTarget = false; if (text == "??") { AddText(val, "?", 0f, 21f, width, 68f, 45f, Cream); continue; } if (text.Length < 2) { throw new InvalidOperationException("Malformed blackjack card presentation."); } char c = text[text.Length - 1]; Color color = (Color)((c == 'H' || c == 'D') ? new Color(0.65f, 0.1f, 0.12f) : Ink); AddText(val, text.Substring(0, text.Length - 1), 3f, 3f, 64f, 35f, 25f, color); Image obj2 = ((Component)Rect((Transform)(object)val, "Suit", 18f, 45f, 34f, 38f)).gameObject.AddComponent(); obj2.sprite = Suit(c); ((Graphic)obj2).color = color; ((Graphic)obj2).raycastTarget = false; } } private void AddText(RectTransform parent, string value, float x, float y, float width, float height, float size, Color color) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = ((Component)Rect((Transform)(object)parent, "Lettering", x, y, width, height)).gameObject.AddComponent(); ((TMP_Text)obj).font = font; ((TMP_Text)obj).text = value; ((TMP_Text)obj).fontSize = size; ((Graphic)obj).color = color; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((Graphic)obj).raycastTarget = false; } private static RectTransform Rect(Transform parent, string name, float x, float y, float width, float height) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject(name, new Type[1] { typeof(RectTransform) }).GetComponent(); ((Transform)component).SetParent(parent, false); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); component.anchorMax = val; component.anchorMin = val; component.pivot = new Vector2(0f, 1f); component.anchoredPosition = new Vector2(x, 0f - y); component.sizeDelta = new Vector2(width, height); return component; } private Sprite Suit(char key) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) if (suits.TryGetValue(key, out Sprite value)) { return value; } if (!"HDSC".Contains(key)) { throw new InvalidOperationException("Unknown card suit."); } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)0 }; Color[] array = (Color[])(object)new Color[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = ((float)j - 15.5f) / 16f; float num2 = ((float)i - 15.5f) / 16f; array[i * 32 + j] = ((key switch { 'D' => Mathf.Abs(num) + Mathf.Abs(num2) < 0.91f, 'H' => Heart(num * 1.1f, num2 * 1.1f), 'C' => Circle(num, num2, 0f, 0.38f) || Circle(num, num2, -0.35f, -0.12f) || Circle(num, num2, 0.35f, -0.12f) || (Mathf.Abs(num) < 0.12f && num2 < 0f && num2 > -0.91f), _ => Heart(num * 1.2f, (0f - num2) * 1.2f + 0.15f) || (Mathf.Abs(num) < 0.12f && num2 < -0.25f && num2 > -0.91f), }) ? Color.white : Color.clear); } } val.SetPixels(array); val.Apply(false, true); textures.Add(val); value = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 32f); suits.Add(key, value); return value; } private static bool Heart(float x, float y) { float num = x * x + y * y - 1f; return num * num * num - x * x * y * y * y <= 0f; } private static bool Circle(float x, float y, float cx, float cy) { return (x - cx) * (x - cx) + (y - cy) * (y - cy) <= 0.1444f; } internal void Close() { View = null; IsOpen = false; } private void Update() { if (IsOpen && (!Object.op_Implicit((Object)(object)table) || !Object.op_Implicit((Object)(object)Player.LocalPlayer) || MainMenuManager.IsInMenu)) { Close(); } } private void OnDestroy() { IsOpen = false; if (Object.op_Implicit((Object)(object)cards)) { Object.Destroy((Object)(object)cards); } foreach (Sprite value in suits.Values) { Object.Destroy((Object)(object)value); } foreach (Texture2D texture in textures) { Object.Destroy((Object)(object)texture); } } } internal sealed class NativeBlackjackControl : Interactable { private string caption = ""; private Action? action; private TextMeshPro? label; internal static NativeBlackjackControl Create(Transform parent, Vector3 position, string caption, TMP_FontAsset font, Action action) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_002b: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Blackjack " + caption); val.SetActive(false); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.layer = LayerMask.NameToLayer("Interactable"); val.tag = "Interactable"; BoxCollider val2 = val.AddComponent(); val2.size = new Vector3(0.3f, 0.1f, 0.2f); GameObject val3 = new GameObject(caption, new Type[1] { typeof(TextMeshPro) }); val3.transform.SetParent(val.transform, false); val3.transform.localPosition = Vector3.up * 0.012f; val3.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); TextMeshPro component = val3.GetComponent(); ((TMP_Text)component).font = font; ((TMP_Text)component).text = caption; ((TMP_Text)component).fontSize = 30f; ((Graphic)component).color = new Color(0.94f, 0.89f, 0.74f); ((TMP_Text)component).alignment = (TextAlignmentOptions)514; Vector2 preferredValues = ((TMP_Text)component).GetPreferredValues(caption); ((TMP_Text)component).rectTransform.sizeDelta = preferredValues; float x = ((TMP_Text)component).GetPreferredValues("STAND").x; val3.transform.localScale = Vector3.one * (0.25f / Mathf.Max(new float[3] { preferredValues.x, x, 1f })); NativeBlackjackControl nativeBlackjackControl = val.AddComponent(); nativeBlackjackControl.caption = caption; nativeBlackjackControl.action = action; nativeBlackjackControl.label = component; ((Interactable)nativeBlackjackControl)._modelsToOutline = Array.Empty(); AccessTools.Field(typeof(Interactable), "_interactCol").SetValue(nativeBlackjackControl, val2); AccessTools.Field(typeof(Interactable), "_textTarget").SetValue(nativeBlackjackControl, val3.transform); val.SetActive(true); return nativeBlackjackControl; } internal void SetAvailable(bool available) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!available && base._isHovering) { ((Interactable)this).UnHover(); } ((Interactable)this).ToggleIsInteractable(available); if (Object.op_Implicit((Object)(object)label)) { ((Graphic)label).color = (available ? new Color(0.94f, 0.89f, 0.74f) : new Color(0.43f, 0.46f, 0.43f)); } } public override void Hover() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) ((Interactable)this).Hover(); PlayerUI.SetLookAtText(caption + " " + SpriteManager.GetPickUpInput(), ((Interactable)this).TextTarget, default(Vector3), false); } public override void UnHover() { PlayerUI.HideLookAtText(caption + " " + SpriteManager.GetPickUpInput()); ((Interactable)this).UnHover(); } public override void Interact(Player player) { if ((Object)(object)player == (Object)(object)Player.LocalPlayer) { (action ?? throw new InvalidOperationException("The table control is not initialized."))(); } } } } namespace GamblersReach.Gameplay { [HarmonyPatch(typeof(NPC), "Awake")] internal static class ChapterNativeTemplateCapture { private static void Postfix(NPC __instance) { ChapterQuests.CaptureNativeTemplates(__instance); } } [HarmonyPatch] internal static class ChapterFirstSaveSelection { private static IEnumerable TargetMethods() { yield return AccessTools.Method(typeof(SaveManager), "SelectServer", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(SaveManager), "CreateServer", (Type[])null, (Type[])null); } private static void Postfix() { ReachSession.LatchChapterBeforeRuntime(); } } [HarmonyPatch(typeof(NPC), "CanEat")] internal static class ChapterNativeIntake { private static void Postfix(NPC __instance, NPCQuest quest, Item item, ref bool __result) { ReachSession current = ReachSession.Current; if (current != null && current.IsChapterNpc(__instance)) { __result = __result && current.CanAcceptChapterItem(__instance, quest, item); } } } [HarmonyPatch(typeof(NPC), "EatItem")] internal static class ChapterNativeEat { private static bool Prefix(NPC __instance, NPCQuest quest, byte questIndex, Item item, out ReachSession.ChapterOperation? __state) { __state = null; ReachSession current = ReachSession.Current; if (current == null || !current.IsChapterNpc(__instance)) { return true; } try { return current.BeginChapterEat(__instance, quest, questIndex, item, out __state); } catch (Exception exception) { current.AbortChapterOperation(__state, exception); __state = null; return false; } } private static void Postfix(ReachSession.ChapterOperation? __state) { if (__state == null) { return; } try { ReachSession.Current?.CompleteChapterEat(__state); } catch (Exception exception) { ReachSession.Current?.AbortChapterOperation(__state, exception); } } private static Exception? Finalizer(ReachSession.ChapterOperation? __state, Exception? __exception) { if (__state != null && __exception != null) { ReachSession.Current?.AbortChapterOperation(__state, __exception); } return __exception; } } [HarmonyPatch(typeof(Server), "RpcLogic___TakeItemFromNpc___1382779195")] internal static class ChapterNativeClaim { private static bool Prefix(object[] __args, out ReachSession.ChapterOperation? __state) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown __state = null; ReachSession current = ReachSession.Current; byte b = (byte)__args[1]; if (current == null || !current.IsChapterNpc(b)) { return true; } try { return current.BeginChapterClaim((Player)__args[0], b, out __state); } catch (Exception exception) { current.AbortChapterOperation(__state, exception); __state = null; return false; } } private static void Postfix(ReachSession.ChapterOperation? __state) { if (__state == null) { return; } try { ReachSession.Current?.CompleteChapterClaim(__state); } catch (Exception exception) { ReachSession.Current?.AbortChapterOperation(__state, exception); } } private static Exception? Finalizer(ReachSession.ChapterOperation? __state, Exception? __exception) { if (__state != null && __exception != null) { ReachSession.Current?.AbortChapterOperation(__state, __exception); } return __exception; } } internal static class ChapterNativePresentation { internal static bool IsOriginalFourRoute(NPC npc, NPCQuest quest) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)npc) && Object.op_Implicit((Object)(object)quest) && (Object)(object)ReachNpcMarker.For(npc) == (Object)null) { Scene scene = ((Component)npc).gameObject.scene; if (((Scene)(ref scene)).buildIndex == 4 && (int)quest.Type == 3 && quest.IslandToUnlock == 5) { return ReachSession.Current?.RequiresHarborInterlude ?? false; } } return false; } } [HarmonyPatch(typeof(NPC), "SetNpcText")] internal static class ChapterNativeSpeech { private static void Postfix(NPC __instance, byte questIndex, QuestLineType lineType) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_003b: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Invalid comparison between Unknown and I4 ReachSession current = ReachSession.Current; if (current == null || !Object.op_Implicit((Object)(object)Player.LocalPlayer) || questIndex >= __instance.Quests.Count) { return; } string text = null; ChapterQuests boundChapterQuests = current.BoundChapterQuests; if (boundChapterQuests != null && boundChapterQuests.Owns(__instance)) { text = boundChapterQuests.Line(questIndex, lineType, current.ChapterState); } else if (ChapterNativePresentation.IsOriginalFourRoute(__instance, __instance.Quests[questIndex])) { text = (((int)lineType == 2 || (int)lineType == 3) ? "Your next berth's Gambler's Reach. Take the chart. Find Oren - he collects debts even the sea won't pay." : "Settle this little matter and I'll mark Gambler's Reach. Oren there knows where the chart runs out."); } if (text != null) { float num = NativeNpc.Read(NativeNpc.Field("_speakingDistance", typeof(float)), __instance); if (!(Vector3.Distance(((Component)__instance).transform.position, Player.LocalPlayer.Transform.position) >= num)) { Interactable val = NativeNpc.Read(NativeNpc.Character, __instance); PlayerUI.SetNpcText(text, val.TextTarget); } } } } [HarmonyPatch(typeof(QuestInteractable), "SetQuest")] internal static class ChapterNativeRewardLabel { private static void Postfix(QuestInteractable __instance, NPCQuest quest) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 object? value = NativeNpc.Field("_npc", typeof(NPC)).GetValue(__instance); NPC val = (NPC)((value is NPC) ? value : null); if (Object.op_Implicit((Object)(object)val)) { string text = null; ChapterQuests chapterQuests = ReachSession.Current?.BoundChapterQuests; if (chapterQuests != null && chapterQuests.Owns(val) && chapterQuests.Owns(quest)) { text = (((int)chapterQuests.RewardFor(quest) == 1) ? "Angler lure" : "island-five coordinates"); } else if (ChapterNativePresentation.IsOriginalFourRoute(val, quest)) { text = "Harbor coordinates"; } if (text != null) { NativeNpc.Field("_hoverString", typeof(string)).SetValue(__instance, "Take " + text + "\n" + SpriteManager.GetPickUpInput()); } } } } [HarmonyPatch(typeof(SaveManager), "SelectServer")] internal static class SelectReachCrewSave { private static void Postfix() { ReachSession.Current?.OnSaveSelected(); } } [HarmonyPatch(typeof(SaveManager), "CreateServer")] internal static class CreateReachCrewSave { private static void Postfix() { ReachSession.Current?.OnSaveSelected(); } } [HarmonyPatch(typeof(ItemManager), "SpawnSavedItem")] internal static class RestoreSavedWorldMetadata { private static void Postfix(SavedWorldItem savedItem, Item __result) { try { ReachSession.Current?.RestoreSavedWorldMetadata(savedItem, __result); } catch (Exception exception) { ReachSession.Current?.RecordFailure(exception); } } } [HarmonyPatch(typeof(SaveManager), "SaveServer")] internal static class StandBeforeNativeSave { private static bool Prefix() { try { ReachSession.Current?.BeforeNativeSave(); return true; } catch (Exception exception) { ReachSession.Current?.RecordFailure(exception); return false; } } } [HarmonyPatch(typeof(SaveSystem), "SaveServer")] internal static class JournalNativeSave { private static bool Prefix(string name, ref string saveString) { try { ReachSession.Current?.BeforeNativeWrite(name, ref saveString); return true; } catch (Exception exception) { ReachSession.Current?.RecordFailure(exception); return false; } } private static void Postfix(string name) { try { ReachSession.Current?.AfterNativeWrite(name); } catch (Exception exception) { ReachSession.Current?.RecordFailure(exception); } } } [HarmonyPatch(typeof(PlayerInventory), "SaveInventory")] internal static class SettleBeforeInventoryDeparture { private static void Prefix(PlayerInventory __instance, bool andDestroy) { ReachSession.Current?.BeforePlayerInventorySave(__instance, andDestroy); } } [HarmonyPatch(typeof(ReachPanel), "Close")] internal static class StandWhenReachPanelCloses { private static void Prefix(ReachPanel __instance, out PanelView? __state) { __state = __instance.TableView; } private static void Postfix(PanelView? __state) { ReachSession.Current?.OnLocalPanelClosed(__state); } } [HarmonyPatch] internal static class LockReservedItemMutations { private static IEnumerable TargetMethods() { string[] array = new string[12] { "SetSyncedHolder", "PickUp", "Drop", "PutInInventory", "SpawnFromInventory", "DestroyItem", "DespawnItemOnServer", "ToggleInteractable", "AddBetMultiplier", "SetKillscoreMultiplier", "CookItem", "CookWithlava" }; foreach (string text in array) { yield return AccessTools.Method(typeof(Item), text, (Type[])null, (Type[])null) ?? throw new MissingMethodException(typeof(Item).Name, text); } } private static bool Prefix(Item __instance, MethodBase __originalMethod, object[] __args) { if (((NetworkBehaviour)__instance).IsServerInitialized) { ReachSession? current = ReachSession.Current; if (current == null) { return true; } return !current.IsReserved(__instance); } if (__originalMethod.Name == "Drop") { object obj = __args[0]; if (obj is bool && (bool)obj) { goto IL_0072; } } if (!(__originalMethod.Name == "PickUp") || !(__args[1] is int num) || num == 0) { return true; } goto IL_0072; IL_0072: ReachSession? current2 = ReachSession.Current; if (current2 == null) { return true; } return !current2.IsReserved(__instance); } } [HarmonyPatch(typeof(MoneyManager), "SellItem")] internal static class BlockReservedSale { private static bool Prefix(Item item) { ReachSession? current = ReachSession.Current; if (current == null) { return true; } return !current.IsReserved(item); } } [HarmonyPatch] internal static class LockReservedInventoryMembership { private static IEnumerable TargetMethods() { yield return AccessTools.Method(typeof(PlayerInventory), "AddItem", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(PlayerInventory), "RemoveItem", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(PlayerInventory), "ServerTryStoreHeldItem", (Type[])null, (Type[])null); } private static bool Prefix(Item item) { ReachSession? current = ReachSession.Current; if (current == null) { return true; } return !current.IsReserved(item); } } [HarmonyPatch] internal static class LockReservedSlotSelection { private static IEnumerable TargetMethods() { yield return AccessTools.Method(typeof(PlayerInventory), "ServerSetSyncedCurSlot", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(PlayerInventory), "LocalTrySelectSlot", (Type[])null, (Type[])null); } private static bool Prefix(PlayerInventory __instance) { Player player = ((IEnumerable)PlayerManager.Players).FirstOrDefault((Func)((Player candidate) => Object.op_Implicit((Object)(object)candidate) && (Object)(object)candidate.Inventory == (Object)(object)__instance)); ReachSession? current = ReachSession.Current; if (current == null) { return true; } return !current.HasReservedHeldItem(player); } } [HarmonyPatch(typeof(PlayerHolding), "SetHeldItem")] internal static class LockReservedHeldReference { private static bool Prefix(PlayerHolding __instance, Item item) { if (((NetworkBehaviour)__instance).IsServerInitialized && !((Object)(object)__instance.HeldItem == (Object)(object)item)) { ReachSession? current = ReachSession.Current; if (current == null) { return true; } return !current.IsReserved(__instance.HeldItem); } return true; } } [HarmonyPatch] internal static class GuardReservedNativeRequests { private static IEnumerable TargetMethods() { string[] array = new string[6] { "RpcLogic___SetItemHolder___", "RpcLogic___PutItemInInventory___", "RpcLogic___RemoveItemFromInventory___", "RpcLogic___BuyItem___", "RpcLogic___UpdateItemPosRot___", "RpcLogic___HandOverItemSimulation___" }; string[] array2 = array; foreach (string prefix in array2) { yield return typeof(Server).GetMethods(BindingFlags.Instance | BindingFlags.Public).Single((MethodInfo method) => method.Name.StartsWith(prefix, StringComparison.Ordinal)); } } private static bool Prefix(object[] __args) { return !__args.Any(delegate(object argument) { Item val = (Item)((argument is Item) ? argument : null); if (val != null) { ReachSession? current = ReachSession.Current; if (current != null && current.IsReserved(val)) { return true; } } Player val2 = (Player)((argument is Player) ? argument : null); return val2 != null && (ReachSession.Current?.HasReservedHeldItem(val2) ?? false); }); } } [HarmonyPatch] internal static class StandBeforeNativeDropAll { private static MethodBase TargetMethod() { return typeof(Server).GetMethods(BindingFlags.Instance | BindingFlags.Public).Single((MethodInfo method) => method.Name.StartsWith("RpcLogic___DropAllItems___", StringComparison.Ordinal)); } private static void Prefix(object[] __args) { object obj = __args[0]; Player val = (Player)((obj is Player) ? obj : null); if (val != null && (val.Dying.IsDead || val.Vitals.Health <= 0 || ((NetworkBehaviour)val).IsDeinitializing)) { ReachSession.Current?.BeforePlayerLeaves(val); } } } [HarmonyPatch] internal static class PreventReservedNetworkDespawn { private static IEnumerable TargetMethods() { return from method in typeof(ServerManager).GetMethods(BindingFlags.Instance | BindingFlags.Public) where method.Name == "Despawn" && method.GetParameters().Any((ParameterInfo parameter) => parameter.ParameterType == typeof(GameObject) || parameter.ParameterType == typeof(NetworkObject)) select method; } private static bool Prefix(object[] __args) { foreach (object obj in __args) { GameObject val = (GameObject)((obj is GameObject) ? obj : null); NetworkObject val2 = (NetworkObject)((obj is NetworkObject) ? obj : null); if (val2 != null) { val = ((Component)val2).gameObject; } if (Object.op_Implicit((Object)(object)val)) { ReachSession? current = ReachSession.Current; if (current != null && current.IsReserved(val.GetComponent())) { return false; } } } return true; } } internal sealed class WagerRecord { [JsonProperty(/*Could not decode attribute arguments.*/)] public ulong SteamId { get; set; } [JsonProperty(/*Could not decode attribute arguments.*/)] public int Slot { get; set; } = -1; [JsonProperty(/*Could not decode attribute arguments.*/)] public SavedItem Original { get; set; } = new SavedItem(); [JsonProperty(/*Could not decode attribute arguments.*/)] public RoundSnapshot Round { get; set; } = new RoundSnapshot(); public WorldEscrow? World { get; set; } } internal sealed class WorldEscrow { [JsonProperty(/*Could not decode attribute arguments.*/)] public Guid TransactionId { get; set; } [JsonProperty(/*Could not decode attribute arguments.*/)] public string NativeHash { get; set; } = ""; [JsonProperty(/*Could not decode attribute arguments.*/)] public List Items { get; set; } = new List(); } internal sealed class WorldStakeRecord { [JsonProperty(/*Could not decode attribute arguments.*/)] public int NativeSlot { get; set; } = -1; [JsonProperty(/*Could not decode attribute arguments.*/)] public SavedItem Original { get; set; } = new SavedItem(); [JsonProperty(/*Could not decode attribute arguments.*/)] public string Snapshot { get; set; } = ""; } internal sealed class NativeCommit { [JsonProperty(/*Could not decode attribute arguments.*/)] public string BeforeHash { get; set; } = ""; [JsonProperty(/*Could not decode attribute arguments.*/)] public string AfterHash { get; set; } = ""; [JsonProperty(/*Could not decode attribute arguments.*/)] public string Json { get; set; } = ""; } internal sealed class ReachSave { public const int CurrentVersion = 3; [JsonProperty(/*Could not decode attribute arguments.*/)] public int Version { get; set; } = 3; [JsonProperty(/*Could not decode attribute arguments.*/)] public string ServerName { get; set; } = ""; [JsonProperty(/*Could not decode attribute arguments.*/)] public ModProgressSnapshot Progress { get; set; } = new ModProgressSnapshot(); [JsonProperty(/*Could not decode attribute arguments.*/)] public bool RareCatchWitnessed { get; set; } [JsonProperty(/*Could not decode attribute arguments.*/)] public byte ReturnIsland { get; set; } = 3; [JsonProperty(/*Could not decode attribute arguments.*/)] public List Wagers { get; set; } = new List(); [JsonProperty(/*Could not decode attribute arguments.*/)] public NativeCommit? Commit { get; set; } public ChapterProgress? Chapter { get; set; } } internal sealed class ReachSaveStore { internal static readonly JsonSerializerSettings JsonSettings = new JsonSerializerSettings { TypeNameHandling = (TypeNameHandling)0, MissingMemberHandling = (MissingMemberHandling)1, MaxDepth = 48, FloatParseHandling = (FloatParseHandling)0 }; private const int MaximumBytes = 4194304; private readonly string serverName; private readonly QuestProgression rules; internal string PathName { get; } internal string NativePath { get; } internal ReachSaveStore(string folder, string serverName, QuestProgression rules) { if (string.IsNullOrWhiteSpace(folder) || string.IsNullOrWhiteSpace(serverName) || serverName.Length > 256) { throw new InvalidDataException("The expansion profile or native save name is unavailable."); } this.serverName = serverName; this.rules = rules; string fullPath = Path.GetFullPath(folder); NativePath = Path.GetFullPath(Path.Combine(fullPath, serverName + ".txt")); if (!string.Equals(Path.GetDirectoryName(NativePath), fullPath.TrimEnd(Path.DirectorySeparatorChar), StringComparison.OrdinalIgnoreCase)) { throw new InvalidDataException("The native save name escapes its profile folder."); } PathName = Path.Combine(fullPath, "reach-" + Hash(serverName) + ".json"); } internal ReachSave Load() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown if (!File.Exists(PathName)) { if (File.Exists(PathName + ".backup") || File.Exists(PathName + ".tmp")) { throw new InvalidDataException("The expansion save is missing but recovery files exist. Restore the matching backup; progress was not reset."); } return new ReachSave { ServerName = serverName }; } JObject val = JObject.Parse(ReadBounded(PathName), new JsonLoadSettings { DuplicatePropertyNameHandling = (DuplicatePropertyNameHandling)2 }); RequireProperties(val["Progress"], "Version", "IslandUnlocked", "IntroductionCompleted", "CollectedSpeciesIds", "GearRewardClaimed", "RareCatchQuestCompleted"); JToken obj = val["Wagers"]; JArray val2 = (JArray)(object)((obj is JArray) ? obj : null); if (val2 != null) { foreach (JToken item in val2) { RequireProperties(item[(object)"Round"], "Version", "RoundId", "EscrowId", "WagerValue", "Deck", "Actions", "State"); } } if (val["Chapter"] is JObject) { RequireProperties(val["Chapter"], "Version", "Initialized", "ExistingIslandFiveAccess", "BarracudaTrophyDelivered", "AnglerLureClaimed", "AnglerTrophyDelivered", "CoordinatesClaimed", "PendingReward"); } ReachSave reachSave = ((JToken)val).ToObject(JsonSerializer.Create(JsonSettings)) ?? throw new InvalidDataException("The expansion save is empty."); Validate(reachSave); reachSave.Version = 3; return reachSave; } private static void RequireProperties(JToken? token, params string[] names) { JObject value = (JObject)(object)((token is JObject) ? token : null); if (value == null || names.Any((string name) => value[name] == null || (int)value[name].Type == 10)) { throw new InvalidDataException("A versioned progress/round snapshot is missing required fields; it was not reset."); } } internal void Write(ReachSave save) { Validate(save); AtomicWrite(PathName, JsonConvert.SerializeObject((object)save, (Formatting)0, JsonSettings)); } private void Validate(ReachSave save) { //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Invalid comparison between Unknown and I4 if (save.Version < 1 || save.Version > 3 || save.ServerName != serverName) { throw new InvalidDataException("The expansion save version or native save identity does not match."); } ChapterProgress? chapter = save.Chapter; if (chapter != null) { chapter.Validate(); } ModProgress val = rules.Restore(save.Progress); if ((save.ReturnIsland != 3 && save.ReturnIsland != 4) || (save.RareCatchWitnessed && !val.GearRewardClaimed)) { throw new InvalidDataException("The expansion travel or rare-catch state is inconsistent."); } if (save.Wagers == null || save.Wagers.Count > 128 || save.Wagers.Any((WagerRecord wager) => wager == null)) { throw new InvalidDataException("The expansion wager journal is invalid."); } HashSet hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); foreach (WagerRecord wager in save.Wagers) { BlackjackRound val2 = BlackjackRound.Restore(wager.Round); if (!hashSet.Add(val2.RoundId) || wager.Slot < -1 || wager.Slot > 8 || !ValidItem(wager.Original)) { throw new InvalidDataException("A saved wager has invalid identity, location, or item metadata."); } if (wager.World != null) { WorldEscrow world = wager.World; if (save.Version == 1 || wager.Slot != -1 || world.TransactionId != val2.RoundId || val2.Wager.EscrowId != world.TransactionId.ToString("N") || !IsHash(world.NativeHash) || world.Items == null || world.Items.Count == 0 || world.Items.Count > 12 || world.Items.Any((WorldStakeRecord item) => item == null) || world.Items.Select((WorldStakeRecord item) => item.NativeSlot).Distinct().Count() != world.Items.Count) { throw new InvalidDataException("The world escrow has invalid transaction or snapshot identities."); } foreach (WorldStakeRecord item in world.Items) { if (item.NativeSlot < 0 || !ValidItem(item.Original) || string.IsNullOrEmpty(item.Snapshot) || item.Snapshot.Length > 8192) { throw new InvalidDataException("The world escrow contains an invalid saved specimen."); } JObject val3 = JObject.Parse(item.Snapshot); RequireProperties((JToken?)(object)val3, "Item", "Position", "Rotation", "IsDeadCreature"); if (!JToken.DeepEquals(val3["Item"], (JToken)(object)JObject.Parse(JsonConvert.SerializeObject((object)item.Original, JsonSettings)))) { throw new InvalidDataException("The world escrow's specimen differs from its native snapshot."); } string[] array = new string[2] { "Position", "Rotation" }; foreach (string text in array) { string[] array2 = ((!(text == "Position")) ? new string[4] { "x", "y", "z", "w" } : new string[3] { "x", "y", "z" }); foreach (string text2 in array2) { JToken obj = val3[text]; double? num3 = (double?)((obj != null) ? obj[(object)text2] : null); if (!num3.HasValue || double.IsNaN(num3.Value) || double.IsInfinity(num3.Value)) { throw new InvalidDataException("The world escrow has an invalid native transform."); } } } } } if ((int)val2.State != 3 && !hashSet2.Add(wager.SteamId)) { throw new InvalidDataException("A player has more than one unresolved wager."); } } if (save.Commit != null && (save.Commit.Json == null || save.Commit.Json.Length > 4194304 || save.Commit.AfterHash != Hash(save.Commit.Json) || (!(save.Commit.BeforeHash == "") && !IsHash(save.Commit.BeforeHash)))) { throw new InvalidDataException("The interrupted native-save journal is corrupt."); } } private static bool ValidItem(SavedItem? item) { if (item != null && item.Exists && item.ItemID != byte.MaxValue && FinitePositive(item.BettingMultiplier) && item.BettingMultiplier <= 400f && FinitePositive(item.Weight) && FinitePositive(item.KillScoreMultiplier) && !float.IsNaN(item.Cookness)) { return !float.IsInfinity(item.Cookness); } return false; } internal static bool FinitePositive(float value) { if (value > 0f && !float.IsNaN(value)) { return !float.IsInfinity(value); } return false; } private static bool IsHash(string value) { if (value != null && value.Length == 64) { return value.All((char c) => (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')); } return false; } internal static string Hash(string value) { using SHA256 sHA = SHA256.Create(); return BitConverter.ToString(sHA.ComputeHash(new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true).GetBytes(value))).Replace("-", "").ToLowerInvariant(); } internal static string ReadBounded(string path) { if (new FileInfo(path).Length > 4194304) { throw new InvalidDataException("The expansion/native recovery file exceeds its safety limit."); } return File.ReadAllText(path, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true)); } internal static string FileHash(string path) { if (!File.Exists(path)) { return ""; } return Hash(ReadBounded(path)); } internal static void AtomicWrite(string path, string text) { byte[] bytes = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true).GetBytes(text); if (bytes.Length > 4194304) { throw new InvalidDataException("The recovery payload exceeds its safety limit."); } Directory.CreateDirectory(Path.GetDirectoryName(path)); string text2 = path + ".tmp"; try { using (FileStream fileStream = new FileStream(text2, FileMode.Create, FileAccess.Write, FileShare.None)) { fileStream.Write(bytes, 0, bytes.Length); fileStream.Flush(flushToDisk: true); } if (File.Exists(path)) { File.Replace(text2, path, path + ".backup"); } else { File.Move(text2, path); } } finally { if (File.Exists(text2)) { File.Delete(text2); } } } } internal sealed class ReachSession : IDisposable { private sealed class LiveWager { internal Player Player; internal Item[] Items = Array.Empty(); internal int[] ItemIds = Array.Empty(); internal BlackjackRound Round; internal WagerRecord Record; internal float Deadline; internal int ActorId; internal string ActorName = ""; internal bool EscrowPrepared; } internal sealed class ChapterOperation { internal NPC Npc; internal NPCQuest Quest; internal Player Player; internal Item? Trophy; internal ChapterReward Reward; internal byte QuestIndex; internal byte BaitIndex; internal int BaitCount; internal byte NativeMax; } private readonly struct CachedReply { internal uint Sequence { get; } internal ReachAction Action { get; } internal string Body { get; } internal CachedReply(uint sequence, ReachAction action, string body) { Sequence = sequence; Action = action; Body = body; } } internal const float MaximumStakeMultiplier = 400f; internal const float MaximumItemMultiplier = 1000f; private readonly Dictionary wagers = new Dictionary(); private readonly BlackjackTableGate tableGate = new BlackjackTableGate(); private LiveWager? tableWager; private int mutationDepth; private bool collectingNativeSave; private bool preparingWorldWager; private Item[] depositItems = Array.Empty(); private string depositFingerprint = ""; private long depositValue; private string depositMessage = ""; private ChapterProgress chapter = new ChapterProgress(); private ChapterProgress? remoteChapter; private ChapterQuests? chapterQuests; private ChapterOperation? chapterOperation; private long chapterRevision; private long remoteChapterRevision = -1L; private byte remoteNativeUnlockCount; private byte publishedNativeUnlockCount; internal static readonly string[] FishKeys = new string[6] { "lantern_perch", "copperfin_bream", "velvet_eel", "crown_puffer", "compass_ray", "moonwake_koi" }; internal static readonly string[] GearKeys = new string[1] { "deepwater_reel" }; internal const string RareTitle = "Keeper of the Moonwake"; internal const int RareRewardMoney = 250; internal const float InteractionRange = 5f; private readonly ContentRegistry content; private readonly ReachWorld world; private readonly ReachNetwork network; private readonly NpcService characters; private readonly ReachPanel panel; private readonly QuestProgression rules = new QuestProgression(new QuestDefinition((IEnumerable)FishKeys, "moonwake_koi")); private readonly Dictionary replies = new Dictionary(); private readonly HashSet suppressedReplies = new HashSet(); private readonly HashSet observedCatches = new HashSet(); private ReachSave save = new ReachSave(); private ModProgress progress = ModProgress.New(); private ReachSaveStore? store; private bool disposed; private bool recovering; private float nextTick; private uint lastResponse; private readonly HashSet localReservedItems = new HashSet(); private string fault = ""; private bool faultDisplayed; private string pendingLeave = ""; private float leaveAfter; internal bool TableLocked => tableGate.IsLocked; internal long TableRevision => tableGate.Revision; internal int TableActorId { get { if (!tableGate.IsLocked) { return -1; } return tableGate.ActorId; } } internal string LastAutoStandDiagnostic { get; private set; } = ""; internal ChapterQuests? BoundChapterQuests => chapterQuests; internal ChapterProgress ChapterState => CopyChapter((ChapterProgress)((IsServer || !network.ClientConfirmed) ? chapter : (((object)remoteChapter) ?? ((object)new ChapterProgress())))); internal bool CanVisitIslandFive => ChapterState.CanVisitIslandFive; internal bool HarborEligible { get { if (ChapterState.Initialized) { return HarborDefinition.Routes.IsEligible((int)EffectiveNativeUnlockCount); } return false; } } internal bool RequiresHarborInterlude { get { if (ChapterState.Initialized) { return !CanVisitIslandFive; } return false; } } internal byte EffectiveNativeUnlockCount { get { if (IsServer || !network.ClientConfirmed) { return NativeUnlockCount; } return remoteNativeUnlockCount; } } private static byte NativeUnlockCount { get { if (!Object.op_Implicit((Object)(object)OnlineIslandManager.Instance)) { return SaveManager.CurServerSave?.MaxIsland ?? 1; } return OnlineIslandManager.MaxIslandUnlocked; } } internal static ReachSession? Current { get; private set; } internal ModProgress Progress => progress; internal string Fault => fault; internal string SavePath => store?.PathName ?? ""; internal bool RareCatchWitnessed => save.RareCatchWitnessed; internal int ActiveRoundCount => wagers.Values.Count((LiveWager wager) => (int)wager.Round.State != 3); internal string CrewTitle { get { if (!progress.RareCatchQuestCompleted) { return ""; } return "Keeper of the Moonwake"; } } private static bool IsServer { get { if (Object.op_Implicit((Object)(object)Server.Instance)) { return ((NetworkBehaviour)Server.Instance).IsServerInitialized; } return false; } } private VanillaProgress Vanilla => new VanillaProgress(Object.op_Implicit((Object)(object)OnlineIslandManager.Instance) ? Math.Min(4, Math.Max(-1, OnlineIslandManager.MaxIslandUnlocked - 2)) : (-1), SaveManager.CurServerSave != null && SaveManager.CurServerSave.HasFinishedGame); private bool PreserveChapterHand { get { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 if ((chapterOperation != null || NativeSaveBridge.IsModuleCheckpoint || NativeSaveBridge.IsAutomaticCheckpoint) && tableWager?.Record.World != null) { return (int)tableWager.Round.State == 0; } return false; } } private static bool NativeWorldItemsReady { get { if ((bool)AccessTools.Field(typeof(SaveManager), "_worldItemsLoaded").GetValue(null)) { return !(bool)AccessTools.Field(typeof(SaveManager), "_worldItemsLoading").GetValue(null); } return false; } } internal event Action? ChapterChanged; internal BlackjackRound? RoundFor(Player player) { if (!wagers.TryGetValue(player.SteamID, out LiveWager value) || value.Player != player) { return null; } return value.Round; } private bool HasActiveWager(Player player) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 if (wagers.TryGetValue(player.SteamID, out LiveWager value) && value.Player == player) { return (int)value.Round.State != 3; } return false; } internal bool IsReserved(Item? item) { if (mutationDepth != 0 || !Object.op_Implicit((Object)(object)item)) { return false; } if (!IsServer && localReservedItems.Contains(((NetworkBehaviour)item).ObjectId)) { return true; } return wagers.Values.Any((LiveWager wager) => wager.Items.Contains(item) && ((int)wager.Round.State != 3 || (tableGate.IsLocked && wager == tableWager))); } internal RoundSnapshot? SavedRound(Guid id) { WagerRecord wagerRecord = save.Wagers.FirstOrDefault((WagerRecord candidate) => candidate.Round.RoundId == id); if (wagerRecord != null) { return BlackjackRound.Restore(wagerRecord.Round).CreateSnapshot(); } return null; } internal bool HasReservedHeldItem(Player? player) { if (Object.op_Implicit((Object)(object)player)) { return IsReserved(player.Holding.HeldItem); } return false; } private string? StakeError(Item? item) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)item) || !((NetworkBehaviour)item).IsServerInitialized || !((NetworkBehaviour)item).IsSpawned || item.IsDestroying || ((NetworkBehaviour)item).IsDeinitializing || Object.op_Implicit((Object)(object)item.SyncedHolder) || Object.op_Implicit((Object)(object)item.Holder) || item.IsInInventory || !item._isInteractable.Value) { return "Drop an unheld, sellable fish or item inside the physical bet tray."; } if (item.IsQuestItem || item.IgnoredByMoneyNpc || item.IgnoredByCloseDots || Object.op_Implicit((Object)(object)item.DeadPlayer) || Object.op_Implicit((Object)(object)item.FishingRod) || Object.op_Implicit((Object)(object)item.AttachedRod) || Object.op_Implicit((Object)(object)item.BirdHolder) || (Object.op_Implicit((Object)(object)item.Creature) && ((int)item.Creature.BossType != 0 || !item.Creature.IsDead))) { return "Quest items, rods, bosses, living creatures, and dead players cannot be wagered."; } if (IsReserved(item)) { return "This item is already reserved."; } if (!ReachSaveStore.FinitePositive(item.BettingMultiplier) || item.BettingMultiplier > 400f || !ReachSaveStore.FinitePositive(item.KillScoreMultiplier) || !ReachSaveStore.FinitePositive(item.RandomizedWeight) || float.IsNaN(item.Cookness) || float.IsInfinity(item.Cookness) || item.Cookness < 0f || item.Cookness > 2f || (!Object.op_Implicit((Object)(object)item.Creature) && item.RandomizedWeight != 1f)) { return "This item's value modifiers are invalid or exceed the wager limit."; } if (item.TotalWorth <= 0 || (float)item.TotalWorth > 1000000f) { return "The stake must be worth between 1 and 1,000,000 coins."; } return null; } internal void RefreshDeposit() { if (IsServer && !tableGate.IsLocked) { Item[] array = (Object.op_Implicit((Object)(object)BlackjackDeposit.Current) ? (from item in BlackjackDeposit.Current.ItemsSnapshot() where StakeError(item) == null select item).ToArray() : Array.Empty()); long num = ((IEnumerable)array).Sum((Func)((Item item) => item.TotalWorth)); string text = ((!Object.op_Implicit((Object)(object)BlackjackDeposit.Current) || !BlackjackDeposit.Current.Ready) ? "The physical bet tray is not ready." : ((array.Length > 12) ? $"Remove items until at most {12} remain in the tray." : (((float)num > 1000000f) ? "The combined tray stake exceeds 1,000,000 coins." : ""))); string text2 = text + "|" + string.Join("|", array.Select((Item item) => ((NetworkBehaviour)item).ObjectId.ToString(CultureInfo.InvariantCulture) + ":" + item.TotalWorth.ToString(CultureInfo.InvariantCulture) + ":" + JsonConvert.SerializeObject((object)CaptureItem(item, 0), ReachSaveStore.JsonSettings))); depositItems = array; depositValue = num; depositMessage = text; if (!(text2 == depositFingerprint)) { depositFingerprint = text2; tableGate.Reset(); PublishTable(); } } } private void BeginWager(Player player, string token) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Invalid comparison between Unknown and I4 if (!long.TryParse(token, NumberStyles.None, CultureInfo.InvariantCulture, out var result)) { throw new InvalidOperationException("The table state is not current. Wait for it to synchronize before dealing."); } RefreshDeposit(); tableGate.RequireAvailable(result); if (HasActiveWager(player)) { throw new InvalidOperationException("Finish your current round before placing another wager."); } if (PlayerManager.Players.Count((Player candidate) => Object.op_Implicit((Object)(object)candidate) && candidate.SteamID == player.SteamID) != 1) { throw new InvalidOperationException("A unique native save identity is required before wagering."); } if (depositMessage.Length != 0) { throw new InvalidOperationException(depositMessage); } if (depositItems.Length == 0) { throw new InvalidOperationException("The tray is empty. Drop eligible fish or items into it before DEAL."); } if (!NativeWorldItemsReady) { throw new InvalidOperationException("Wait for the native world items to finish loading before wagering."); } Item[] array = depositItems.ToArray(); Guid guid = Guid.NewGuid(); CardDeck val = HostDeck(); BlackjackRound val2 = new BlackjackRound(guid, new ItemWager(guid.ToString("N"), (float)checked((int)depositValue)), val); WagerRecord wagerRecord = new WagerRecord { SteamId = player.SteamID, Slot = -1, Original = CaptureItem(array[0], 0), Round = val2.CreateSnapshot(), World = new WorldEscrow { TransactionId = guid, Items = array.Select((Item item) => new WorldStakeRecord { Original = CaptureItem(item, 0) }).ToList() } }; LiveWager liveWager = new LiveWager { Player = player, Items = array, ItemIds = array.Select((Item item) => ((NetworkBehaviour)item).ObjectId).ToArray(), Round = val2, Record = wagerRecord, Deadline = Time.realtimeSinceStartup + 120f, ActorId = ((NetworkBehaviour)player).Owner.ClientId, ActorName = player.SteamName }; tableGate.Claim(result, liveWager.ActorId, guid); tableWager = liveWager; LastAutoStandDiagnostic = ""; wagers[player.SteamID] = liveWager; save.Wagers.Add(wagerRecord); try { mutationDepth++; Item[] array2 = array; for (int num = 0; num < array2.Length; num++) { array2[num].ToggleInteractable(false); } } finally { mutationDepth--; } preparingWorldWager = true; try { SaveNow(); liveWager.EscrowPrepared = true; } finally { preparingWorldWager = false; } if ((int)val2.State == 1) { SaveNow(); } else { PublishTable(); } } private void PlayWager(Player player, string id, PlayerAction action) { //IL_0016: 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_004a: Invalid comparison between Unknown and I4 LiveWager liveWager = RequireRound(player, id); VerifyWorldStake(liveWager); liveWager.Round.Play(action); tableGate.Advance(liveWager.ActorId, liveWager.Round.RoundId); SaveSidecar(); if ((int)liveWager.Round.State == 1) { SaveNow(); } else { PublishTable(); } } private LiveWager RequireRound(Player player, string id, bool allowSettled = false) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!Guid.TryParseExact(id, "N", out var result) || !wagers.TryGetValue(player.SteamID, out LiveWager value) || value.Player != player || value != tableWager || value.Round.RoundId != result) { throw new InvalidOperationException("That round is stale or belongs to another player."); } if (!allowSettled && (int)value.Round.State != 0) { throw new InvalidOperationException("That round has already resolved; its settlement cannot be repeated."); } if ((int)value.Round.State != 3) { tableGate.RequireActor(((NetworkBehaviour)player).Owner.ClientId, result); } return value; } private void AutoStand(LiveWager wager, string reason) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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) if ((int)wager.Round.State == 0) { Player player = wager.Player; bool flag = Object.op_Implicit((Object)(object)player) && !((NetworkBehaviour)player).IsDeinitializing; LastAutoStandDiagnostic = JsonConvert.SerializeObject((object)new { reason = reason, round = wager.Round.RoundId, actor = wager.ActorId, realtime = Time.realtimeSinceStartup, secondsUntilDeadline = wager.Deadline - Time.realtimeSinceStartup, ownerPresent = Object.op_Implicit((Object)(object)player), connected = (Object.op_Implicit((Object)(object)player) && PlayerManager.Players.Contains(player)), deinitializing = (Object.op_Implicit((Object)(object)player) && ((NetworkBehaviour)player).IsDeinitializing), dead = (player != null && flag && player.Dying.IsDead), nearDealer = (player != null && flag && Object.op_Implicit((Object)(object)player.Transform) && NearDealer(player)), islandActive = world.IsActive, menu = MainMenuManager.IsInMenu, moduleCheckpoint = NativeSaveBridge.IsModuleCheckpoint, chapterCheckpoint = (chapterOperation != null), collectingNativeSave = collectingNativeSave, position = ((!(player != null && flag) || !Object.op_Implicit((Object)(object)player.Transform)) ? null : new float[3] { player.Transform.position.x, player.Transform.position.y, player.Transform.position.z }), caller = ((reason == "native-save") ? new StackTrace(1, fNeedFileInfo: false).ToString() : "") }); Plugin.Log.LogInfo((object)("Blackjack auto-stand: " + LastAutoStandDiagnostic)); wager.Round.Play((PlayerAction)1); } } private void ApplySettlement(LiveWager wager) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Invalid comparison between Unknown and I4 if ((int)wager.Round.State == 3) { return; } AutoStand(wager, "native-save"); if ((int)wager.Round.State == 1) { wager.Round.PrepareSettlement(); } for (int i = 0; i < wager.Items.Length; i++) { Item val = wager.Items[i]; SavedItem original = wager.Record.World.Items[i].Original; float target = TargetMultiplier(original, wager.Round); if (!Object.op_Implicit((Object)(object)val) || val.IsDestroying) { throw new InvalidDataException("A reserved world item disappeared before settlement. Recovery was retained."); } if (Object.op_Implicit((Object)(object)val.SyncedHolder) || Object.op_Implicit((Object)(object)val.Holder) || val.IsInInventory || !SameSpecimen(original, CaptureItem(val, 0), target)) { throw new InvalidDataException("A reserved world item's metadata or location changed before settlement."); } } try { mutationDepth++; for (int j = 0; j < wager.Items.Length; j++) { Item val2 = wager.Items[j]; float num = TargetMultiplier(wager.Record.World.Items[j].Original, wager.Round); if (num == 0f) { val2.DestroyItem((byte)0, byte.MaxValue); } else if ((int)wager.Round.Result.Outcome != 1) { val2._bettingMultiplier.Value = num; } } } finally { mutationDepth--; } } private static void VerifyWorldStake(LiveWager wager) { if (wager.Record.World == null || wager.Items.Length != wager.Record.World.Items.Count) { throw new InvalidDataException("The world escrow is incomplete."); } for (int i = 0; i < wager.Items.Length; i++) { Item val = wager.Items[i]; SavedItem original = wager.Record.World.Items[i].Original; if (!Object.op_Implicit((Object)(object)val) || val.IsDestroying || ((NetworkBehaviour)val).IsDeinitializing || Object.op_Implicit((Object)(object)val.SyncedHolder) || Object.op_Implicit((Object)(object)val.Holder) || val.IsInInventory || !SameSpecimen(original, CaptureItem(val, 0), original.BettingMultiplier)) { throw new InvalidDataException("A reserved world item no longer matches its escrow record."); } } } internal static float TargetMultiplier(SavedItem original, BlackjackRound round) { float totalReturnMultiplier = (round.Result ?? throw new InvalidOperationException("An unresolved round cannot be paid.")).TotalReturnMultiplier; float num = original.BettingMultiplier * totalReturnMultiplier; if (float.IsNaN(num) || float.IsInfinity(num) || num < 0f || num > 1000f) { throw new InvalidDataException("The absolute payout multiplier exceeds the item safety limit."); } return num; } internal PanelView SharedTableView() { //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Invalid comparison between Unknown and I4 //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: 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_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Expected I4, but got Unknown //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Expected I4, but got Unknown LiveWager liveWager = tableWager; PanelView obj = new PanelView { Key = "dealer", Title = "Silas Nine · The quiet table", Subtitle = "Drop fish or items into the bet tray · no money buy-in", SharedTable = true, TableRevision = tableGate.Revision, TableLocked = tableGate.IsLocked, ActingClientId = (liveWager?.ActorId ?? (-1)), ActingPlayerName = (liveWager?.ActorName ?? ""), ReservedItemId = ((tableGate.IsLocked && liveWager != null) ? liveWager.ItemIds[0] : (-1)), ReservedItemIds = ((tableGate.IsLocked && liveWager != null) ? liveWager.ItemIds.ToArray() : Array.Empty()), DepositItemCount = ((tableGate.IsLocked && liveWager != null) ? liveWager.Items.Length : depositItems.Length), DepositValue = ((tableGate.IsLocked && liveWager != null) ? ((long)liveWager.Round.Wager.Value) : depositValue), DepositMessage = (tableGate.IsLocked ? "" : depositMessage) }; float? obj2; if (liveWager == null) { obj2 = null; } else { BlackjackResult result = liveWager.Round.Result; obj2 = ((result != null) ? new float?(result.TotalReturnMultiplier) : ((float?)null)); } float? num = obj2; obj.PayoutMultiplier = num.GetValueOrDefault(); obj.Message = "Drop eligible fish or items into the tray. DEAL stakes all its eligible contents, including friends' contributions."; PanelView panelView = obj; if (liveWager != null) { BlackjackRound round = liveWager.Round; if (!liveWager.EscrowPrepared) { panelView.Round = round.RoundId.ToString("N"); panelView.Message = "The tray is locked while its native-save checkpoint is verified. No cards have been revealed."; return panelView; } bool flag = (int)round.State == 0; panelView.Round = round.RoundId.ToString("N"); panelView.PlayerCards = round.PlayerCards.Select(CardText).ToArray(); HandScore val = round.PlayerScore; panelView.PlayerTotal = ((HandScore)(ref val)).Total.ToString(CultureInfo.InvariantCulture); panelView.DealerCards = ((!flag) ? round.DealerCards.Select(CardText).ToArray() : new string[2] { CardText(round.DealerUpCard), "??" }); object dealerTotal; if (!flag) { val = round.DealerScore; dealerTotal = ((HandScore)(ref val)).Total.ToString(CultureInfo.InvariantCulture); } else { dealerTotal = "?"; } panelView.DealerTotal = (string)dealerTotal; PanelView panelView2 = panelView; string outcome; BlackjackOutcome outcome2; if (flag) { outcome = ""; } else { outcome2 = round.Result.Outcome; string text; switch (outcome2 - 1) { case 0: text = "PUSH"; break; case 2: text = "BLACKJACK - 3:2"; break; case 1: text = "WIN - DOUBLE VALUE"; break; default: val = round.PlayerScore; text = (((HandScore)(ref val)).IsBust ? "BUST - STAKE LOST" : "HOUSE WINS"); break; } outcome = text; } panelView2.Outcome = outcome; if (flag) { panelView.Message = $"{liveWager.ActorName} is playing the tray's {liveWager.Items.Length} items, worth {liveWager.Round.Wager.Value}. Only that player can hit or stand."; return panelView; } panelView2 = panelView; outcome2 = round.Result.Outcome; panelView2.Message = (outcome2 - 1) switch { 0 => "“A push. The same specimens remain in the tray, every modifier unchanged.”", 2 => "“A natural. Total returned item value: ×2.5; profit: three to two. A fine hand.”", 1 => "“Your hand takes it. Each original item's value is now twice its stake.”", _ => "“The house takes the stake. No second charge, and no obligation to play again.”", }; } return panelView; } private PanelView DealerView(Player player) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) RefreshDeposit(); PanelView panelView = SharedTableView(); if (tableGate.IsLocked) { if (tableWager != null && tableWager.Player == player && (int)tableWager.Round.State == 0) { panelView.Choices.Add(Choice("Hit", ReachAction.Hit, panelView.Round)); panelView.Choices.Add(Choice("Stand", ReachAction.Stand, panelView.Round)); } return panelView; } bool flag = depositItems.Length != 0 && depositMessage.Length == 0; panelView.Choices.Add(Choice(flag ? $"DEAL · {depositItems.Length} tray items · {depositValue}" : "Drop eligible items into the tray", ReachAction.Bet, tableGate.Revision.ToString(CultureInfo.InvariantCulture), flag)); if (depositMessage.Length != 0) { panelView.Subtitle = depositMessage; } return panelView; } private void PublishTable() { network.PublishTable(JsonConvert.SerializeObject((object)SharedTableView())); } private void OnClientConfirmed(NetworkConnection connection) { network.Reply(connection, ReachAction.TableState, JsonConvert.SerializeObject((object)SharedTableView())); } private static string CardText(Card card) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000c: 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_0021: Expected I4, but got Unknown //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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected I4, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected I4, but got Unknown Rank rank = ((Card)(ref card)).Rank; string text = (((int)rank == 1) ? "A" : ((rank - 11) switch { 0 => "J", 1 => "Q", 2 => "K", _ => ((int)((Card)(ref card)).Rank).ToString(CultureInfo.InvariantCulture), })); string text2 = text; Suit suit = ((Card)(ref card)).Suit; return text2 + (int)suit switch { 2 => 'H', 1 => 'D', 0 => 'C', _ => 'S', }; } private CardDeck HostDeck() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Card[] array = CardDeck.Ordered().Cards.ToArray(); using RandomNumberGenerator randomNumberGenerator = RandomNumberGenerator.Create(); byte[] array2 = new byte[4]; for (int num = array.Length - 1; num > 0; num--) { uint num2 = (uint)(num + 1); uint num3 = uint.MaxValue - uint.MaxValue % num2; uint num4; do { randomNumberGenerator.GetBytes(array2); num4 = BitConverter.ToUInt32(array2, 0); } while (num4 >= num3); int num5 = (int)(num4 % num2); ref Card reference = ref array[num]; ref Card reference2 = ref array[num5]; Card val = array[num5]; Card val2 = array[num]; reference = val; reference2 = val2; } return new CardDeck((IEnumerable)array); } private static SavedItem CaptureItem(Item item, int slot) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown return (SavedItem)AccessTools.Method(typeof(SaveManager), "ItemToSavedItem", (Type[])null, (Type[])null).Invoke(null, new object[2] { (byte)Math.Max(0, slot), item }); } internal static bool SameSpecimen(SavedItem original, SavedItem actual, float target) { if (actual.Exists && actual.ItemID == original.ItemID && (actual.BettingMultiplier == original.BettingMultiplier || actual.BettingMultiplier == target) && actual.Weight == original.Weight && actual.Cookness == original.Cookness && actual.KillScoreMultiplier == original.KillScoreMultiplier && actual.IsDripCreature == original.IsDripCreature && actual.SkinIndex == original.SkinIndex && actual.Sharpness == original.Sharpness && actual.Sight == original.Sight && actual.BarrelAttachment == original.BarrelAttachment && actual.AmmoType == original.AmmoType && actual.ExtendedMag == original.ExtendedMag) { return actual.LaserSight == original.LaserSight; } return false; } internal void BeforePlayerInventorySave(PlayerInventory inventory, bool andDestroy) { if (andDestroy && !collectingNativeSave && IsServer && fault.Length == 0) { Player val = ((IEnumerable)PlayerManager.Players).FirstOrDefault((Func)((Player candidate) => Object.op_Implicit((Object)(object)candidate) && (Object)(object)candidate.Inventory == (Object)(object)inventory)); if (Object.op_Implicit((Object)(object)val)) { BeforePlayerLeaves(val); } } } internal void BeforePlayerLeaves(Player player) { if (!IsServer || collectingNativeSave || fault.Length != 0 || !HasActiveWager(player)) { return; } try { AutoStand(wagers[player.SteamID], "owner-inventory-departure"); SaveNow(); } catch (Exception exception) { Fail(exception); } } internal static ChapterProgress CopyChapter(ChapterProgress value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_004d: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown return new ChapterProgress { Version = value.Version, Initialized = value.Initialized, ExistingIslandFiveAccess = value.ExistingIslandFiveAccess, BarracudaTrophyDelivered = value.BarracudaTrophyDelivered, AnglerLureClaimed = value.AnglerLureClaimed, AnglerTrophyDelivered = value.AnglerTrophyDelivered, CoordinatesClaimed = value.CoordinatesClaimed, PendingReward = value.PendingReward }; } internal void BindChapterQuests(ChapterQuests quests) { if (quests == null || quests.IsDisposed) { throw new ArgumentException("Live native chapter quests are required."); } if (chapterQuests != null && chapterQuests != quests && !chapterQuests.IsDisposed && Object.op_Implicit((Object)(object)chapterQuests.Collector)) { throw new InvalidOperationException("Retire the previous collector before rebinding chapter quests."); } chapterQuests = quests; RefreshChapterPresentation(); } internal void UnbindChapterQuests(ChapterQuests quests) { if (chapterQuests == quests) { chapterQuests = null; } } private void TickChapter() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (publishedNativeUnlockCount != NativeUnlockCount) { PublishChapter(); } if (chapterOperation == null && chapterQuests != null && !chapterQuests.IsDisposed && Object.op_Implicit((Object)(object)chapterQuests.Collector) && Object.op_Implicit((Object)(object)NPCManager.Instance) && chapter.Initialized) { byte b = chapterQuests.IndexFor(chapter.PendingReward); byte b2 = default(byte); if (!NPCManager.Instance._idToShowingQuestIndex.TryGetValue(chapterQuests.Collector.ID, ref b2) || b2 != b) { RefreshChapterPresentation(); } } } private void RefreshChapterPresentation() { ChapterProgress chapterState = ChapterState; if (chapterState.Initialized) { chapterQuests?.RestoreReward(chapterState, IsServer); } } private SessionResponse WithChapter(SessionResponse response) { if (!chapter.Initialized) { return response; } response.Chapter = CopyChapter(chapter); response.ChapterRevision = chapterRevision; response.NativeUnlockCount = NativeUnlockCount; return response; } private SessionResponse ChapterResponse() { return WithChapter(new SessionResponse { View = new PanelView { Key = "chapter-state" } }); } private void PublishChapter() { checked { chapterRevision++; publishedNativeUnlockCount = NativeUnlockCount; this.ChapterChanged?.Invoke(); if (IsServer && chapter.Initialized) { network.Publish(JsonConvert.SerializeObject((object)ChapterResponse())); } } } private void OnChapterClientConfirmed(NetworkConnection connection) { if (IsServer) { EnsureLoaded(); network.Reply(connection, ReachAction.Snapshot, JsonConvert.SerializeObject((object)ChapterResponse())); } } private void ResetRemoteChapter() { remoteChapter = null; remoteChapterRevision = -1L; remoteNativeUnlockCount = 0; } private void ReceiveChapter(SessionResponse response) { if (response.Chapter != null && !IsServer) { response.Chapter.Validate(); if (!response.Chapter.Initialized || response.ChapterRevision < 0 || response.NativeUnlockCount < 1) { throw new InvalidDataException("The host sent an invalid harbor chapter snapshot."); } if (response.ChapterRevision > remoteChapterRevision) { remoteChapter = CopyChapter(response.Chapter); remoteChapterRevision = response.ChapterRevision; remoteNativeUnlockCount = response.NativeUnlockCount; RefreshChapterPresentation(); this.ChapterChanged?.Invoke(); } } } internal bool IsChapterNpc(NPC? npc) { return chapterQuests?.Owns(npc) ?? false; } internal bool IsChapterNpc(byte id) { if (chapterQuests != null && chapterQuests.Owns(chapterQuests.Collector)) { return chapterQuests.Collector.ID == id; } return false; } internal bool CanAcceptChapterItem(NPC npc, NPCQuest quest, Item item) { //IL_007b: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Invalid comparison between Unknown and I4 //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Invalid comparison between Unknown and I4 if (!IsChapterNpc(npc) || chapterQuests == null || !chapterQuests.Owns(quest) || fault.Length != 0 || chapterOperation != null || !HarborEligible || !world.IsActive || IslandManager.IsLoading || !Object.op_Implicit((Object)(object)item) || item.IsDestroying || ((NetworkBehaviour)item).IsDeinitializing || IsReserved(item)) { return false; } ChapterProgress chapterState = ChapterState; if ((int)chapterState.PendingReward != 0) { return false; } ChapterReward val = chapterQuests.RewardFor(quest); if ((int)val != 1) { if ((int)val == 2) { return item.ID == chapterQuests.AnglerTrophy.ID && chapterState.AnglerLureClaimed && !chapterState.CoordinatesClaimed; } return false; } return item.ID == chapterQuests.BarracudaTrophy.ID; } internal bool BeginChapterEat(NPC npc, NPCQuest quest, byte questIndex, Item item, out ChapterOperation? operation) { //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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) operation = null; if (!IsServer || !CanAcceptChapterItem(npc, quest, item) || Object.op_Implicit((Object)(object)item.Holder) || Object.op_Implicit((Object)(object)item.SyncedHolder) || item.IsInInventory || !((NetworkBehaviour)item).IsSpawned || !Object.op_Implicit((Object)(object)item.LastHolder) || Object.op_Implicit((Object)(object)item.DeadPlayer) || !item.IsInteractable || (Object.op_Implicit((Object)(object)item.Creature) && !item.Creature.IsDead) || !NativeWorldItemsReady || item.IgnoredByCloseDots || Object.op_Implicit((Object)(object)item.BirdHolder) || Object.op_Implicit((Object)(object)item.AttachedRod)) { return false; } EnsureLoaded(); if (!EligibleChapterActor(item.LastHolder)) { return false; } ChapterReward reward = chapterQuests.RewardFor(quest); if (questIndex != chapterQuests.IndexFor(reward) || NPCManager.Instance.NpcIsHoldingItem(npc.ID)) { return false; } operation = new ChapterOperation { Npc = npc, Quest = quest, Player = item.LastHolder, Trophy = item, Reward = reward, QuestIndex = questIndex, NativeMax = NativeUnlockCount }; chapterOperation = operation; SaveNow(); return true; } internal void CompleteChapterEat(ChapterOperation operation) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Invalid comparison between Unknown and I4 RequireChapterOperation(operation); if ((Object.op_Implicit((Object)(object)operation.Trophy) && !operation.Trophy.IsDestroying && ((NetworkBehaviour)operation.Trophy).IsSpawned) || !NPCManager.Instance.NpcIsHoldingItem(operation.Npc.ID) || NPCManager.Instance.GetShowingQuest(operation.Npc.ID) != operation.Quest) { throw new InvalidOperationException("The native collector did not consume the trophy and present its reward."); } if ((int)operation.Reward == 1) { chapter.DeliverBarracudaTrophy(); } else { chapter.DeliverAnglerTrophy(); } SaveNow(); chapterOperation = null; PublishChapter(); } internal bool BeginChapterClaim(Player player, byte npcId, out ChapterOperation? operation) { //IL_0063: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Invalid comparison between Unknown and I4 operation = null; if (!IsServer || !IsChapterNpc(npcId) || this.chapterOperation != null || fault.Length != 0 || !HarborEligible || !world.IsActive || IslandManager.IsLoading || !Object.op_Implicit((Object)(object)NPCManager.Instance) || !NPCManager.Instance.NpcIsHoldingItem(npcId) || (int)chapter.PendingReward == 0) { return false; } EnsureLoaded(); if (!EligibleChapterActor(player)) { return false; } NPCQuest showingQuest = NPCManager.Instance.GetShowingQuest(npcId); if (!chapterQuests.Owns(showingQuest) || chapterQuests.RewardFor(showingQuest) != chapter.PendingReward) { return false; } ChapterOperation chapterOperation = new ChapterOperation { Npc = chapterQuests.Collector, Quest = showingQuest, Player = player, Reward = chapter.PendingReward, QuestIndex = chapterQuests.IndexFor(chapter.PendingReward), NativeMax = NativeUnlockCount }; if ((int)chapterOperation.Reward == 1) { chapterOperation.BaitIndex = GameInfo.GetIndexOfBait(chapterQuests.AnglerLure); if (chapterOperation.BaitIndex == 0 || chapterOperation.BaitIndex > player.Inventory._ownedBaits.Count || GameInfo.AllBaits[chapterOperation.BaitIndex] != chapterQuests.AnglerLure) { throw new InvalidOperationException("The native inventory has not registered the Angler lure."); } chapterOperation.BaitCount = player.Inventory._ownedBaits[chapterOperation.BaitIndex - 1]; if (chapterOperation.BaitCount < 0 || chapterOperation.BaitCount == int.MaxValue) { throw new InvalidOperationException("The player's native lure inventory cannot accept this reward."); } } operation = chapterOperation; this.chapterOperation = chapterOperation; SaveNow(); return true; } internal void CompleteChapterClaim(ChapterOperation operation) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 //IL_009c: Unknown result type (might be due to invalid IL or missing references) RequireChapterOperation(operation); if (NPCManager.Instance.NpcIsHoldingItem(operation.Npc.ID)) { throw new InvalidOperationException("The native reward handoff did not finish."); } if ((int)operation.Reward == 1 && operation.Player.Inventory._ownedBaits[operation.BaitIndex - 1] != operation.BaitCount + 1) { throw new InvalidOperationException("The native Angler lure handoff did not grant exactly one personal lure."); } byte b = (((int)operation.Reward == 2) ? Math.Max(operation.NativeMax, (byte)5) : operation.NativeMax); if (NativeUnlockCount != b) { throw new InvalidOperationException("The chapter reward unexpectedly changed the native island count."); } chapter.Claim(operation.Reward); SaveNow(); chapterOperation = null; PublishChapter(); } private void RequireChapterOperation(ChapterOperation operation) { RequireHealthy(); if (chapterOperation != operation) { throw new InvalidOperationException("The native chapter transaction is no longer current."); } } private bool EligibleChapterActor(Player player) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (IsServer && Object.op_Implicit((Object)(object)player) && PlayerManager.Players.Contains(player) && !((NetworkBehaviour)player).IsDeinitializing && !player.Dying.IsDead && player.Vitals.Health > 0 && chapterQuests != null && Object.op_Implicit((Object)(object)chapterQuests.Collector)) { return Vector3.Distance(player.Transform.position, ((Component)chapterQuests.Collector).transform.position) <= 5f; } return false; } internal void AbortChapterOperation(ChapterOperation? operation, Exception exception) { if (operation != null && chapterOperation == operation) { chapterOperation = null; } Fail(exception); } internal ReachSession(ContentRegistry content, ReachWorld world, ReachNetwork network, NpcService characters, ReachPanel panel) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown if (Current != null) { throw new InvalidOperationException("A gameplay session is already active."); } this.content = content ?? throw new ArgumentNullException("content"); this.world = world ?? throw new ArgumentNullException("world"); this.network = network ?? throw new ArgumentNullException("network"); this.characters = characters ?? throw new ArgumentNullException("characters"); this.panel = panel ?? throw new ArgumentNullException("panel"); Current = this; network.Request += OnRequest; network.Response += OnResponse; network.ClientDeparted += OnDeparted; network.ClientConfirmedOnServer += OnClientConfirmed; network.ClientConfirmedOnServer += OnChapterClientConfirmed; content.FishHooked += OnFishHooked; if (SaveManager.CurServerSave != null) { OnSaveSelected(); } } internal void Tick() { //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Invalid comparison between Unknown and I4 if (disposed || Time.realtimeSinceStartup < nextTick) { return; } nextTick = Time.realtimeSinceStartup + 0.25f; if (pendingLeave.Length != 0 && network.ClientConfirmed && Time.realtimeSinceStartup >= leaveAfter) { string text = pendingLeave; pendingLeave = ""; try { suppressedReplies.Add(network.Send(ReachAction.Refresh, "leave:" + text)); } catch (Exception ex) { Plugin.Log.LogWarning((object)("The host will auto-stand the abandoned round: " + ex.Message)); } } if (fault.Length != 0) { DisplayFault(); } else { if (!IsServer || SaveManager.CurServerSave == null) { return; } try { EnsureLoaded(); if (fault.Length != 0) { return; } RefreshDeposit(); observedCatches.RemoveWhere((Item item) => !Object.op_Implicit((Object)(object)item) || !((NetworkBehaviour)item).IsSpawned); TickChapter(); bool flag = false; foreach (LiveWager value in wagers.Values) { if ((int)value.Round.State != 3) { string text2 = ((!Object.op_Implicit((Object)(object)value.Player)) ? "owner-missing" : (((NetworkBehaviour)value.Player).IsDeinitializing ? "owner-deinitializing" : (value.Player.Dying.IsDead ? "owner-dead" : ((!PlayerManager.Players.Contains(value.Player)) ? "owner-absent" : ((!world.IsActive) ? "island-departure" : ((!NearDealer(value.Player)) ? "owner-left-table" : ((Time.realtimeSinceStartup >= value.Deadline) ? "deadline" : null))))))); if (text2 != null) { AutoStand(value, text2); flag = true; } } } if (flag) { SaveNow(); } } catch (Exception exception) { Fail(exception); } } } private void OnRequest(NetworkConnection connection, ReachPacket packet) { if (replies.TryGetValue(connection.ClientId, out var value) && packet.Sequence <= value.Sequence) { if (packet.Sequence == value.Sequence) { network.Reply(connection, value.Action, value.Body, packet.Sequence); } else { network.Reply(connection, ReachAction.Error, "That request is stale.", packet.Sequence); } return; } ReachAction action = ReachAction.Snapshot; string body; try { Player player = ((IEnumerable)PlayerManager.Players).SingleOrDefault((Func)((Player candidate) => Object.op_Implicit((Object)(object)candidate) && ((NetworkBehaviour)candidate).Owner == connection)) ?? throw new InvalidOperationException("The connection has no authoritative player."); PanelView view = Execute(player, packet.Action, packet.Body); int reservedItem = ((tableGate.IsLocked && tableWager != null && tableWager.Items.Length != 0 && Object.op_Implicit((Object)(object)tableWager.Items[0])) ? ((NetworkBehaviour)tableWager.Items[0]).ObjectId : (-1)); body = JsonConvert.SerializeObject((object)WithChapter(new SessionResponse { View = view, ReservedItem = reservedItem })); } catch (Exception ex) { if (IsPersistenceFailure(ex)) { Fail(ex); } action = ReachAction.Error; body = ((fault.Length == 0) ? ex.Message : fault); } replies[connection.ClientId] = new CachedReply(packet.Sequence, action, body); network.Reply(connection, action, body, packet.Sequence); } private void OnResponse(ReachPacket packet) { //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) if (packet.Action == ReachAction.Accepted) { lastResponse = 0u; localReservedItems.Clear(); pendingLeave = ""; suppressedReplies.Clear(); panel.ResetSharedTable(); ResetRemoteChapter(); } else if (packet.Action == ReachAction.TableState) { PanelView view = JsonConvert.DeserializeObject(packet.Body, ReachSaveStore.JsonSettings) ?? throw new InvalidDataException("The host sent an empty shared table state."); ReceiveSharedTable(view); } else { if (packet.Sequence != 0 && packet.Sequence < lastResponse) { return; } if (packet.Sequence != 0) { lastResponse = packet.Sequence; } bool flag = suppressedReplies.Remove(packet.Sequence); try { if (packet.Action == ReachAction.Error) { if (!flag) { panel.ShowError(packet.Body); } } else { if (packet.Action != ReachAction.Snapshot) { return; } SessionResponse sessionResponse = JsonConvert.DeserializeObject(packet.Body, ReachSaveStore.JsonSettings) ?? throw new InvalidDataException("The host sent an empty expansion view."); if (sessionResponse.View == null || sessionResponse.View.Choices == null || sessionResponse.View.Choices.Count > 4) { throw new InvalidDataException("The host sent an invalid expansion view."); } ReceiveChapter(sessionResponse); if (sessionResponse.View.Key == "chapter-state" || flag) { return; } if (sessionResponse.View.SharedTable) { ReceiveSharedTable(sessionResponse.View); return; } bool flag2 = sessionResponse.View.NativeDialogue || sessionResponse.View.Key == "tackle" || sessionResponse.View.Key == "collector"; if (packet.Sequence == 0 && !flag2 && (panel.View?.Key != "dealer" || panel.View.Round != sessionResponse.View.Round)) { return; } if (sessionResponse.View.Key == "closed") { if (panel.View != null) { panel.View.Choices.Clear(); } panel.Close(); } else if (flag2) { if (Object.op_Implicit((Object)(object)Player.LocalPlayer) && characters.Targets.TryGetValue(sessionResponse.View.Key, out Transform value) && Object.op_Implicit((Object)(object)value) && !(Vector3.Distance(Player.LocalPlayer.Transform.position, value.position) > 8f)) { characters.ShowDialogue(sessionResponse.View.Key, sessionResponse.View.Message); panel.ShowNativeDialogue(sessionResponse.View); } } else { panel.Show(sessionResponse.View); } } } catch (Exception ex) { Plugin.Log.LogError((object)("Expansion response could not be displayed: " + ex.Message)); panel.ShowError("The expansion response could not be displayed: " + ex.Message); } } } private void ReceiveSharedTable(PanelView view) { if (!view.SharedTable || view.Key != "dealer" || view.TableRevision < 0 || view.PlayerCards == null || view.DealerCards == null || view.PlayerCards.Length > 12 || view.DealerCards.Length > 12 || view.ActingPlayerName == null || view.ActingPlayerName.Length > 256 || view.ReservedItemIds == null || view.ReservedItemIds.Length > 12 || view.ReservedItemIds.Any((int id) => id < 0) || view.ReservedItemIds.Distinct().Count() != view.ReservedItemIds.Length || view.DepositItemCount < 0 || view.DepositValue < 0 || view.DepositMessage == null || view.DepositMessage.Length > 256 || (view.TableLocked && (view.ActingClientId < 0 || !Guid.TryParseExact(view.Round, "N", out var _) || view.ReservedItemIds.Length == 0 || view.ReservedItemIds.Length != view.DepositItemCount))) { throw new InvalidDataException("The host sent an invalid shared blackjack state."); } if (panel.ApplySharedTable(view)) { localReservedItems.Clear(); if (view.TableLocked) { localReservedItems.UnionWith(view.ReservedItemIds); } } } internal PanelView Execute(Player player, ReachAction action, string body = "") { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Invalid comparison between Unknown and I4 RequireHostPlayer(player); EnsureLoaded(); RequireHealthy(); if (!content.IsReady) { throw new InvalidOperationException("The expansion item registry is not ready."); } if (body == null || body.Length > 160) { throw new ArgumentException("Invalid action body.", "body"); } switch (action) { case ReachAction.Travel: throw new InvalidOperationException("Use the boat and radar to sail between islands."); case ReachAction.Talk: RequireNpc(player, body); return TalkNative(player, body); case ReachAction.Table: RequireDealer(player); return DealerView(player); case ReachAction.TurnIn: return TurnIn(player, body); case ReachAction.Buy: return Buy(player, body); case ReachAction.Bet: RequireDealer(player); BeginWager(player, body); return DealerView(player); case ReachAction.Hit: case ReachAction.Stand: RequireDealer(player); PlayWager(player, body, (PlayerAction)(action != ReachAction.Hit)); return DealerView(player); case ReachAction.Refresh: if (body.StartsWith("leave:", StringComparison.Ordinal)) { RequireDealer(player); LiveWager liveWager = RequireRound(player, body.Substring(6), allowSettled: true); if ((int)liveWager.Round.State != 3) { AutoStand(liveWager, "owner-panel-closed"); SaveNow(); } return new PanelView { Key = "closed" }; } RequireNpc(player, body); return BuildView(player, body); default: throw new ArgumentOutOfRangeException("action", "Unsupported gameplay action."); } } private PanelView BuildView(Player player, string key) { if (key == "dealer") { return DealerView(player); } return new PanelView { Key = key, NativeDialogue = true, Title = ((key == "tackle") ? "Mara Brass · Tackle maker" : "Dr. Oren Reed · Marine collector"), Subtitle = CrewTitle, Message = ((key == "tackle") ? "Gear and lures are on the stands. The harpoon and its upgrades are available now. The heavy rod is optional, not a quest reward. Hold spare fish near me, then drop them to sell." : ChapterQuests.CollectorLine(ChapterState)) }; } private PanelView TurnIn(Player player, string body) { throw new InvalidOperationException("Hold the trophy near Oren, then drop it. Take the reward from his outstretched hand."); } private PanelView Buy(Player player, string key) { throw new InvalidOperationException("Buy equipment and lures from their native shop stands."); } internal void NotifyCaught(Player player, Item item) { if (chapter.Initialized || !IsServer || !world.IsActive || !Object.op_Implicit((Object)(object)player) || player.Dying.IsDead || !Object.op_Implicit((Object)(object)item) || !((NetworkBehaviour)item).IsServerInitialized || FishKey(item) != "moonwake_koi") { return; } try { EnsureLoaded(); RequireHealthy(); bool flag = observedCatches.Add(item); if (Vanilla.HasCompletedGame && progress.GearRewardClaimed && !progress.RareCatchQuestCompleted && !save.RareCatchWitnessed && flag) { save.RareCatchWitnessed = true; SaveSidecar(); } } catch (Exception exception) { Fail(exception); } } private void OnFishHooked(ContentDescriptor descriptor, Item item, Bait bait) { if (!(descriptor.Key != "moonwake_koi") && Object.op_Implicit((Object)(object)bait) && Object.op_Implicit((Object)(object)bait.FishingRod)) { Player syncedHolder = ((Item)bait.FishingRod).SyncedHolder; if (Object.op_Implicit((Object)(object)syncedHolder)) { NotifyCaught(syncedHolder, item); } } } private static void RequireHostPlayer(Player player) { //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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0095: 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) if (!IsServer) { throw new InvalidOperationException("Only the authoritative host can perform this action."); } if (!Object.op_Implicit((Object)(object)player) || !PlayerManager.Players.Contains(player) || ((NetworkBehaviour)player).IsDeinitializing || player.Dying.IsDead || player.Vitals.Health <= 0) { throw new InvalidOperationException("An alive, connected player is required."); } Vector3 position = player.Transform.position; if (float.IsNaN(position.x) || float.IsNaN(position.y) || float.IsNaN(position.z) || float.IsInfinity(position.x) || float.IsInfinity(position.y) || float.IsInfinity(position.z)) { throw new InvalidOperationException("The authoritative player position is invalid."); } } private void RequireNpc(Player player, string key) { //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) if (key != "tackle" && key != "collector" && key != "dealer") { throw new ArgumentException("Unknown character."); } Transform value; if (key == "dealer") { RequireDealer(player); } else if (!world.IsActive || world.Layout == null || IslandManager.IsLoading || !characters.Targets.TryGetValue(key, out value) || !Object.op_Implicit((Object)(object)value) || !(Vector3.Distance(player.Transform.position, value.position) <= 5f)) { throw new InvalidOperationException("Move closer to the correct Gambler's Reach character."); } } private bool NearDealer(Player player) { //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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) if (world.Layout != null && world.IsActive) { if (!(Vector3.Distance(player.Transform.position, world.Position + world.Layout.TablePosition) <= 5f)) { if (world.Layout.NpcPositions.TryGetValue("dealer", out var value)) { return Vector3.Distance(player.Transform.position, world.Position + value) <= 5f; } return false; } return true; } return false; } private void RequireDealer(Player player) { if (IslandManager.IsLoading || !characters.Targets.TryGetValue("dealer", out Transform value) || !Object.op_Implicit((Object)(object)value) || !NearDealer(player)) { throw new InvalidOperationException("Stand beside Silas Nine's table."); } } private Item RequireHeldFish(Player player, string key) { Item heldItem = player.Holding.HeldItem; if (!FishKeys.Contains(key) || !Object.op_Implicit((Object)(object)heldItem) || (Object)(object)heldItem.SyncedHolder != (Object)(object)player || FishKey(heldItem) != key || heldItem.IsDestroying || ((NetworkBehaviour)heldItem).IsDeinitializing || IsReserved(heldItem) || !Object.op_Implicit((Object)(object)heldItem.Creature) || !heldItem.Creature.IsDead) { throw new InvalidOperationException("Hold the requested, unreserved caught fish before donating it."); } return heldItem; } private string? FishKey(Item? item) { if (!chapter.Initialized && Object.op_Implicit((Object)(object)item)) { return FishKeys.FirstOrDefault((string key) => content.GetItem(key).ID == item.ID); } return null; } private static bool CanAfford(int cost) { if (Object.op_Implicit((Object)(object)MoneyManager.Instance) && cost > 0 && MoneyManager.Instance._money.Value >= cost) { if (!MoneyManager.CanAfford(cost)) { return !((NetworkBehaviour)MoneyManager.Instance).IsClientInitialized; } return true; } return false; } private static void RequireInventoryRoom(Player player, int count) { int num = (int)AccessTools.Method(typeof(PlayerInventory), "GetTotalSlots", (Type[])null, (Type[])null).Invoke(player.Inventory, Array.Empty()); int num2 = ((IEnumerable>)player.Inventory._items).Count((KeyValuePair pair) => Object.op_Implicit((Object)(object)pair.Value)); Item held = player.Holding.HeldItem; int num3 = count - 1 + ((Object.op_Implicit((Object)(object)held) && !((IEnumerable>)player.Inventory._items).Any((KeyValuePair pair) => (Object)(object)pair.Value == (Object)(object)held)) ? 1 : 0); if (num - num2 < num3) { throw new InvalidOperationException("Make room in your inventory before accepting this equipment."); } } private void GiveGear(Player player, string key) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) Item heldItem = player.Holding.HeldItem; if (Object.op_Implicit((Object)(object)heldItem) && !player.Inventory.ServerTryStoreHeldItem(heldItem)) { throw new InvalidOperationException("The held item could not be safely stored."); } if (!((NetworkBehaviour)player).Owner.IsLocalClient) { player.Hands.PrepareForItemPickup(content.GetItem(key).ID); } player.Holding.SetHeldItem((Item)null); Item val = Object.Instantiate(content.GetItem(key), player.Transform.position + Vector3.up, Quaternion.identity); val.SetSyncedHolder(player, false); ((NetworkBehaviour)Server.Instance).Spawn(((Component)val).gameObject, (NetworkConnection)null, default(Scene)); player.Holding.SetHeldItem(val); } private void DestroyOwnedItem(Player player, Item item) { mutationDepth++; try { player.Inventory.RemoveItem(item); if ((Object)(object)player.Holding.HeldItem == (Object)(object)item) { player.Holding.SetHeldItem((Item)null); } item.SetSyncedHolder((Player)null, false); item.DestroyItem((byte)0, byte.MaxValue); } finally { mutationDepth--; } } internal void OnLocalPanelClosed(PanelView? view) { if (!disposed && !(view?.Key != "dealer") && view.TableLocked && view.Round.Length != 0 && ReachPanel.IsLocalActor(view) && network.ClientConfirmed) { pendingLeave = view.Round; leaveAfter = Time.realtimeSinceStartup + 0.12f; } } private void OnDeparted(NetworkConnection connection) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Invalid comparison between Unknown and I4 replies.Remove(connection.ClientId); LiveWager[] array = wagers.Values.Where((LiveWager value) => Object.op_Implicit((Object)(object)value.Player) && ((NetworkBehaviour)value.Player).Owner == connection).ToArray(); foreach (LiveWager liveWager in array) { try { if ((int)liveWager.Round.State != 3) { AutoStand(liveWager, "owner-disconnected"); SaveNow(); } if ((int)liveWager.Round.State == 3) { wagers.Remove(liveWager.Player.SteamID); } } catch (Exception exception) { Fail(exception); } } } private void RequireHealthy() { if (fault.Length != 0) { throw new InvalidOperationException(fault); } } private static bool IsPersistenceFailure(Exception exception) { if (!(exception is IOException) && !(exception is UnauthorizedAccessException)) { return exception is JsonException; } return true; } private void Fail(Exception exception) { if (fault.Length == 0) { fault = "Gambler's Reach is paused to protect this save: " + exception.Message + " No progress was reset. Keep the expansion/native save and their backups together."; Plugin.Log.LogError((object)fault); DisplayFault(); } } private void DisplayFault() { if (!faultDisplayed && Object.op_Implicit((Object)(object)Player.LocalPlayer)) { faultDisplayed = true; try { panel.ShowError(fault); } catch (Exception ex) { Plugin.Log.LogError((object)ex.Message); } } } internal void RecordFailure(Exception exception) { Fail(exception); } private static PanelChoice Choice(string label, ReachAction action, string argument, bool enabled = true) { return new PanelChoice { Label = label, Action = action, Argument = argument, Enabled = enabled }; } private static string ItemName(string key) { return key switch { "lantern_perch" => "Lantern Perch", "copperfin_bream" => "Copperfin Bream", "velvet_eel" => "Velvet Eel", "crown_puffer" => "Crown Puffer", "compass_ray" => "Compass Ray", "moonwake_koi" => "Moonwake Koi", "deepwater_reel" => "Deepwater Winch", _ => throw new ArgumentException("Unknown content key."), }; } public void Dispose() { if (disposed) { return; } try { if (IsServer && store != null && fault.Length == 0 && SaveManager.CurServerSave != null) { SaveNow(); } } catch (Exception exception) { Fail(exception); } disposed = true; network.Request -= OnRequest; network.Response -= OnResponse; network.ClientDeparted -= OnDeparted; network.ClientConfirmedOnServer -= OnClientConfirmed; network.ClientConfirmedOnServer -= OnChapterClientConfirmed; chapterQuests = null; content.FishHooked -= OnFishHooked; localReservedItems.Clear(); Current = null; } private PanelView TalkNative(Player player, string key) { if (key == "dealer") { return new PanelView { Key = key, NativeDialogue = true, Message = "Drop spare fish on the highlighted area on the table, then press DEAL. The first player locks the stakes and plays; everyone can watch. I stand on seventeen." }; } return BuildView(player, key); } internal bool ReceiveNativeOffering(string npcKey, Item item) { return false; } internal static void LatchChapterBeforeRuntime() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (Current != null || SaveManager.CurServerSave == null) { return; } QuestProgression val = new QuestProgression(new QuestDefinition((IEnumerable)FishKeys, "moonwake_koi")); ReachSaveStore reachSaveStore = new ReachSaveStore(ExpansionProfile.Folder, SaveManager.CurServerSave.Name, val); ReachSave reachSave = reachSaveStore.Load(); ChapterProgress val2 = CopyChapter((ChapterProgress)(((object)reachSave.Chapter) ?? ((object)new ChapterProgress()))); int num = SaveManager.CurServerSave.MaxIsland; if (reachSave.Commit != null) { int? num2 = (int?)JObject.Parse(reachSave.Commit.Json)["MaxIsland"]; if (!num2.HasValue || num2 < 1 || num2 > 255) { throw new InvalidDataException("The prepared native checkpoint has an invalid island count."); } num = Math.Max(num, num2.Value); } val2.Initialize(num, 4); reachSave.Chapter = val2; reachSaveStore.Write(reachSave); } internal void OnSaveSelected() { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) if (disposed || recovering || SaveManager.CurServerSave == null) { return; } fault = ""; faultDisplayed = false; try { if (IsServer && tableGate.IsLocked && PlayerManager.Players.Count != 0) { throw new InvalidDataException("Checkpoint the locked tray before reselecting a native crew save."); } if (IsServer && PlayerManager.Players.Count != 0 && store != null && save.ServerName != SaveManager.CurServerSave.Name) { throw new InvalidDataException("Stop the active crew before changing expansion save profiles."); } store = new ReachSaveStore(ExpansionProfile.Folder, SaveManager.CurServerSave.Name, rules); save = store.Load(); progress = rules.Restore(save.Progress); chapter = CopyChapter((ChapterProgress)(((object)save.Chapter) ?? ((object)new ChapterProgress()))); chapterOperation = null; wagers.Clear(); tableWager = null; tableGate.Reset(); replies.Clear(); observedCatches.Clear(); localReservedItems.Clear(); depositItems = Array.Empty(); depositFingerprint = ""; depositValue = 0L; depositMessage = ""; RecoverNativeCommit(); RecoverInterruptedRounds(); chapter.Initialize((int)SaveManager.CurServerSave.MaxIsland, HarborDefinition.Value.NextIslandId); SaveSidecar(); RefreshChapterPresentation(); PublishChapter(); PublishTable(); fault = ""; } catch (Exception exception) { Fail(exception); } } private void EnsureLoaded() { RequireHealthy(); if (SaveManager.CurServerSave == null) { throw new InvalidOperationException("Select a native crew save first."); } if (store == null || save.ServerName != SaveManager.CurServerSave.Name) { OnSaveSelected(); } if (store == null) { throw new InvalidDataException("The expansion save could not be opened."); } RequireHealthy(); } private void CaptureState() { save.Progress = progress.CreateSnapshot(); if (chapter.Initialized) { save.Chapter = CopyChapter(chapter); } foreach (LiveWager value in wagers.Values) { value.Record.Round = value.Round.CreateSnapshot(); } WagerRecord[] array = save.Wagers.Where((WagerRecord record) => (int)record.Round.State == 3).ToArray(); foreach (WagerRecord item in array.Take(Math.Max(0, array.Length - 64))) { save.Wagers.Remove(item); } } private void SaveSidecar() { RequireHealthy(); if (store == null) { throw new InvalidDataException("The expansion save store is not initialized."); } CaptureState(); store.Write(save); } internal void SaveNow() { if (!IsServer) { throw new InvalidOperationException("Only the host may save crew progress."); } EnsureLoaded(); try { SaveManager.SaveServer(true); RequireHealthy(); if (save.Commit != null || collectingNativeSave) { throw new IOException("The native save did not finish its verified expansion checkpoint."); } } catch (Exception exception) { Fail(exception); throw; } } internal void BeforeNativeSave() { if (recovering || !IsServer || SaveManager.CurServerSave == null) { return; } EnsureLoaded(); collectingNativeSave = true; if (preparingWorldWager) { return; } foreach (LiveWager value in wagers.Values) { if (!PreserveChapterHand || value != tableWager) { ApplySettlement(value); } } } internal void BeforeNativeWrite(string name, ref string nativeJson) { if (recovering || disposed || store == null || name != save.ServerName) { return; } RequireHealthy(); if (save.Commit != null) { throw new IOException("A previous native-save transaction is still pending recovery."); } if (IsServer && tableGate.IsLocked && tableWager?.Record.World != null && !collectingNativeSave) { throw new IOException("A native write bypassed the locked tray's verified save checkpoint."); } JObject val = JObject.Parse(nativeJson); if (IsServer && Object.op_Implicit((Object)(object)MoneyManager.Instance)) { val["Money"] = JToken.op_Implicit(MoneyManager.Instance._money.Value); if (SaveManager.CurServerSave != null && SaveManager.CurServerSave.Name == name) { SaveManager.CurServerSave.Money = MoneyManager.Instance._money.Value; } } bool flag = save.Wagers.Any((WagerRecord wager) => wager.World != null); if (IsServer && collectingNativeSave && !NativeWorldItemsReady && wagers.Values.Any((LiveWager wager) => wager.Record.World != null && (int)wager.Round.State != 3)) { throw new InvalidDataException("The reserved world items cannot be checkpointed while the native world is loading."); } if (IsServer && collectingNativeSave && NativeWorldItemsReady && (world.IsActive || flag)) { CaptureEscrowWorld(val); } nativeJson = ((JToken)val).ToString((Formatting)0, Array.Empty()); if (preparingWorldWager || PreserveChapterHand) { tableWager.Record.World.NativeHash = ReachSaveStore.Hash(nativeJson); } CaptureState(); save.Commit = new NativeCommit { BeforeHash = ReachSaveStore.FileHash(store.NativePath), AfterHash = ReachSaveStore.Hash(nativeJson), Json = nativeJson }; store.Write(save); } private void CaptureEscrowWorld(JObject native) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown if (!NativeWorldItemsReady) { throw new InvalidDataException("Wait for the native world items to finish loading before wagering."); } Item[] array = (from val3 in ItemManager.Items.Values.Distinct().Where((Func)NativeSaveBridge.IsWorldItemSaveEligible) orderby ((NetworkBehaviour)val3).ObjectId select val3).ToArray(); List list = new List(array.Length); JArray val = new JArray(); Item[] array2 = array; foreach (Item val2 in array2) { SavedWorldItem item = new SavedWorldItem { Item = CaptureItem(val2, 0), Position = ((Component)val2).transform.position, Rotation = ((Component)val2).transform.rotation, IsDeadCreature = (Object.op_Implicit((Object)(object)val2.Creature) && val2.Creature.IsDead) }; list.Add(item); val.Add((JToken)(object)WorldItemJson(item)); } native["WorldItems"] = (JToken)(object)val; SaveManager.CurServerSave.WorldItems = list; if (!preparingWorldWager && !PreserveChapterHand) { return; } LiveWager liveWager = tableWager ?? throw new InvalidDataException("The prepared world wager is missing."); VerifyWorldStake(liveWager); for (int num2 = 0; num2 < liveWager.Items.Length; num2++) { int num3 = Array.IndexOf(array, liveWager.Items[num2]); if (num3 < 0) { throw new InvalidDataException("A tray item was excluded by the native world-save rules."); } WorldStakeRecord worldStakeRecord = liveWager.Record.World.Items[num2]; worldStakeRecord.NativeSlot = num3; worldStakeRecord.Snapshot = val[num3].ToString((Formatting)0, Array.Empty()); } } internal static JObject WorldItemJson(SavedWorldItem item) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown return new JObject { ["Item"] = (JToken)(object)JObject.FromObject((object)item.Item), ["Position"] = (JToken)new JObject { ["x"] = JToken.op_Implicit(item.Position.x), ["y"] = JToken.op_Implicit(item.Position.y), ["z"] = JToken.op_Implicit(item.Position.z) }, ["Rotation"] = (JToken)new JObject { ["x"] = JToken.op_Implicit(item.Rotation.x), ["y"] = JToken.op_Implicit(item.Rotation.y), ["z"] = JToken.op_Implicit(item.Rotation.z), ["w"] = JToken.op_Implicit(item.Rotation.w) }, ["IsDeadCreature"] = JToken.op_Implicit(item.IsDeadCreature) }; } internal void RestoreSavedWorldMetadata(SavedWorldItem snapshot, Item item) { if (IsServer && snapshot?.Item != null && Object.op_Implicit((Object)(object)item) && fault.Length == 0 && SaveManager.CurServerSave?.WorldItems != null && SaveManager.CurServerSave.WorldItems.Contains(snapshot)) { SavedItem item2 = snapshot.Item; if (!item2.Exists || item.ID != item2.ItemID || !ReachSaveStore.FinitePositive(item2.Weight) || !ReachSaveStore.FinitePositive(item2.KillScoreMultiplier)) { throw new InvalidDataException("A native world item has invalid identity or value metadata."); } item._curSkin.Value = item2.SkinIndex; item._syncedRandomWeight.Value = item2.Weight; item._killScoreMultiplier.Value = item2.KillScoreMultiplier; } } internal void AfterNativeWrite(string name) { if (!recovering && !disposed && store != null && !(name != save.ServerName) && save.Commit != null) { if (ReachSaveStore.FileHash(store.NativePath) != save.Commit.AfterHash) { IOException ex = new IOException("The game did not write the expected native inventory save. The prepared recovery journal was retained."); Fail(ex); throw ex; } CompleteCheckpoint(); collectingNativeSave = false; } } private void CompleteCheckpoint() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Invalid comparison between Unknown and I4 //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Invalid comparison between Unknown and I4 LiveWager[] array = wagers.Values.Where((LiveWager wager) => (int)wager.Round.State == 2).ToArray(); foreach (LiveWager value in wagers.Values) { if ((int)value.Round.State == 2) { value.Round.AcknowledgeSettlement(value.Round.RoundId); } } foreach (WagerRecord wager in save.Wagers) { if ((int)wager.Round.State == 2) { BlackjackRound val = BlackjackRound.Restore(wager.Round); val.AcknowledgeSettlement(val.RoundId); wager.Round = val.CreateSnapshot(); } } save.Commit = null; CaptureState(); store.Write(save); if (array.Length == 0 || tableWager == null || (int)tableWager.Round.State != 3 || !tableGate.IsLocked) { return; } try { mutationDepth++; Item[] items = tableWager.Items; foreach (Item val2 in items) { if (Object.op_Implicit((Object)(object)val2) && !val2.IsDestroying && !((NetworkBehaviour)val2).IsDeinitializing) { val2.ToggleInteractable(true); } } } finally { mutationDepth--; } tableGate.Release(tableWager.ActorId, tableWager.Round.RoundId); RefreshDeposit(); PublishTable(); } private void RecoverNativeCommit() { if (save.Commit == null) { return; } NativeCommit commit = save.Commit; recovering = true; try { ServerSaveObject value = ExpansionPlatform.Current.Saves.RecoverPreparedCheckpoint(save.ServerName, commit.Json, commit.BeforeHash, commit.AfterHash); AccessTools.Field(typeof(SaveManager), "k__BackingField").SetValue(null, value); CompleteCheckpoint(); } finally { recovering = false; } } private void RecoverInterruptedRounds() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Invalid comparison between Unknown and I4 //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Invalid comparison between Unknown and I4 //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Invalid comparison between Unknown and I4 //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Expected O, but got Unknown WagerRecord[] array = save.Wagers.Where((WagerRecord wagerRecord) => (int)wagerRecord.Round.State != 3).ToArray(); if (array.Length == 0) { return; } if (IsServer && PlayerManager.Players.Count != 0) { throw new InvalidDataException("Unfinished wager recovery requires reopening the crew before players spawn."); } string text = ReachSaveStore.ReadBounded(store.NativePath); string nativeHash = ReachSaveStore.Hash(text); JObject val = JObject.Parse(text); bool flag = false; WagerRecord[] array2 = array; foreach (WagerRecord record in array2) { BlackjackRound val2 = BlackjackRound.Restore(record.Round); if ((int)val2.State == 0) { val2.Play((PlayerAction)1); } if ((int)val2.State == 1) { val2.PrepareSettlement(); } if (record.World != null) { ApplyWorldRecovery(val, record, val2, nativeHash); record.Round = val2.CreateSnapshot(); continue; } float num2 = TargetMultiplier(record.Original, val2); flag = true; SavedPlayer val3 = ((IEnumerable)SaveManager.CurServerSave.Players).SingleOrDefault((Func)((SavedPlayer player) => player.SteamID == record.SteamId)) ?? throw new InvalidDataException("The native save has no owner for the reserved wager."); SavedItem val4 = (SavedItem)((record.Slot == -1) ? ((object)val3.HeldItem) : ((object)val3.InventoryItems?.SingleOrDefault((Func)((SavedItem candidate) => candidate.InventorySlot == record.Slot)))); if (val4 == null || !val4.Exists) { if (num2 != 0f || (int)record.Round.State != 2) { throw new InvalidDataException("The reserved specimen is missing from the native save; no replacement was created."); } } else { if (!SameSpecimen(record.Original, val4, num2)) { throw new InvalidDataException("The saved escrow slot contains a different specimen. Recovery was stopped without modifying it."); } if (num2 == 0f) { if (record.Slot == -1) { val3.HeldItem = new SavedItem { Exists = false }; } else { val3.InventoryItems.Remove(val4); } } else if ((int)val2.Result.Outcome != 1) { val4.BettingMultiplier = num2; } } record.Round = val2.CreateSnapshot(); } if (flag) { val["Players"] = (JToken)(object)JArray.FromObject((object)SaveManager.CurServerSave.Players, JsonSerializer.Create(ReachSaveStore.JsonSettings)); } string text2 = ((JToken)val).ToString((Formatting)0, Array.Empty()); SaveManager.CurServerSave.WorldItems = val["WorldItems"].ToObject>(); SaveSystem.SaveServer(save.ServerName, text2); if (save.Commit != null) { throw new IOException("Interrupted wagers could not be checkpointed."); } Plugin.Log.LogInfo((object)$"Recovered {array.Length} unfinished wager(s) by standing and applying absolute saved-item settlements."); } internal static void ApplyWorldRecovery(JObject native, WagerRecord record, BlackjackRound round, string nativeHash) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Invalid comparison between Unknown and I4 WorldEscrow worldEscrow = record.World ?? throw new InvalidDataException("The world escrow is missing."); if ((int)round.State == 2 && !(worldEscrow.NativeHash != nativeHash) && !(worldEscrow.TransactionId != round.RoundId)) { JToken obj = native["WorldItems"]; JArray val = (JArray)(object)((obj is JArray) ? obj : null); if (val != null && worldEscrow.Items.Count != 0 && worldEscrow.Items.Count <= 12 && worldEscrow.Items.Select((WorldStakeRecord item) => item.NativeSlot).Distinct().Count() == worldEscrow.Items.Count) { foreach (WorldStakeRecord item in worldEscrow.Items) { if (item.NativeSlot < 0 || item.NativeSlot >= ((JContainer)val).Count || !JToken.DeepEquals(val[item.NativeSlot], (JToken)(object)JObject.Parse(item.Snapshot)) || !SameSpecimen(item.Original, val[item.NativeSlot][(object)"Item"].ToObject(), item.Original.BettingMultiplier)) { throw new InvalidDataException("The exact saved world escrow slot changed. No same-ID replacement was touched."); } TargetMultiplier(item.Original, round); } { foreach (WorldStakeRecord item2 in worldEscrow.Items.OrderByDescending((WorldStakeRecord item) => item.NativeSlot)) { float num = TargetMultiplier(item2.Original, round); if (num == 0f) { val.RemoveAt(item2.NativeSlot); } else if ((int)round.Result.Outcome != 1) { val[item2.NativeSlot][(object)"Item"][(object)"BettingMultiplier"] = JToken.op_Implicit(num); } } return; } } } throw new InvalidDataException("The world escrow and native file are not the same prepared checkpoint."); } } internal sealed class SessionResponse { public PanelView View { get; set; } = new PanelView(); public int ReservedItem { get; set; } = -1; public ChapterProgress? Chapter { get; set; } public long ChapterRevision { get; set; } public byte NativeUnlockCount { get; set; } } internal sealed class NativeOfferingZone : MonoBehaviour { internal string NpcKey { get; set; } = ""; } } namespace GamblersReach.Encounters { internal sealed class EncounterCatalog : IDisposable { internal const byte MiniBossId = 190; internal const byte BossId = 191; internal const byte MiniTrophyId = 192; internal const byte TrophyId = 193; internal const ushort CollectionId = 48188; private readonly Dictionary items = new Dictionary(); private readonly ContentVisuals fishVisuals = new ContentVisuals(); private readonly HarborStaticVisuals trophyVisuals = new HarborStaticVisuals(); private NativeItemRegistrar? registrar; private NativeLootTable? anglerLoot; private Func? visualFactory; private bool ownsRegistrar; private bool attempted; private bool disposed; internal static EncounterCatalog? Current { get; private set; } internal bool IsReady { get; private set; } internal int RewardsSpawned { get; private set; } internal event Action? BossDefeated; internal Item Get(byte id) { if (!items.TryGetValue(id, out Item value)) { throw new KeyNotFoundException("Unknown harbor item " + id); } return value; } internal void Begin(Func factory) { if (disposed) { throw new ObjectDisposedException("EncounterCatalog"); } if (attempted || Current != null) { throw new InvalidOperationException("Harbor encounters are already registered."); } visualFactory = factory ?? throw new ArgumentNullException("factory"); attempted = true; } internal void Initialize(Func factory) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown Begin(factory); registrar = new NativeItemRegistrar("gamblers_reach", (ushort)48188, 256, (ManualLogSource)null); ownsRegistrar = true; try { for (byte b = 190; b <= 193; b++) { Prepare(b, checked((ushort)(b - 190)), registrar); } registrar.Commit(); Complete(registrar); } catch { Dispose(); throw; } } internal PreparedItem Prepare(ItemRecipe recipe, NativeItemRegistrar target) { if (((PackRecipe)recipe).Key != Key(recipe.Id) || recipe.Network.CollectionId != 48188) { throw new InvalidOperationException("The modular encounter identity differs from its harbor definition."); } return Prepare(recipe.Id, recipe.Network.Slot, target); } private PreparedItem Prepare(byte id, ushort slot, NativeItemRegistrar target) { if (!attempted || visualFactory == null || disposed || IsReady || target.CollectionId != 48188 || target.PackKey != "gamblers_reach") { throw new InvalidOperationException("Begin encounter art preparation with its matching shared registrar first."); } ItemDefinition val = HarborDefinition.Item(Key(id)); Item val2 = NativeItemRegistrar.NativeDonor(checked((byte)val.NativeDonorId)); PreparedItem val3 = target.Prepare(Key(id), id, slot, val2, val.Title, "", (string)null); Item clone = val3.Clone; ((Object)clone).name = "GamblersReach_" + Key(id); ((Component)clone).gameObject.AddComponent().Configure(id); if (id == 190 || id == 191) { EncounterDefinition val4 = HarborDefinition.Value.Encounters.Single((EncounterDefinition value) => value.Item == Key(id)); if (((object)val2).GetType() != typeof(AttackingFish) || val4.NativeDonorId != val2.ID) { throw new InvalidOperationException("The verified plain AttackingFish donor changed: " + val2.ID); } ConfigureBoss(val3.Require(), val2, val4.Health, val4.Damage, val4.Force, visualFactory); } else { NativeContentAccess.Set(clone, "_worth", 0); NativeContentAccess.Set(clone, "_cost", 0); NativeContentAccess.Set(clone, "_ignoredByMoneyNPC", true); NativeContentAccess.Set(clone, "_ignoredBySeagulls", true); NativeContentAccess.Set(clone, "k__BackingField", true); trophyVisuals.ConfigureTrophy(clone, val2, Key(id), visualFactory); } val3.MarkCustomVisual(); items.Add(id, clone); return val3; } internal void Complete(NativeItemRegistrar registered) { if (disposed || IsReady || registered.CollectionId != 48188 || registered.PackKey != "gamblers_reach" || !registered.IsReady) { throw new InvalidOperationException("The shared encounter registration did not complete."); } registrar = registered; Current = this; IsReady = true; Validate(); } internal void BindLoot(NativeLootTable table) { if (anglerLoot != null || table.Key != "angler_loot") { throw new InvalidOperationException("Bind the Angler's registered loot table exactly once."); } anglerLoot = table; } private void ConfigureBoss(AttackingFish fish, Item source, int hp, int damage, float duration, Func factory) { byte iD = ((Item)fish).ID; NativeContentAccess.Set(fish, "_bossType", (object)(BossType)((iD == 190) ? 1 : 2)); NativeContentAccess.Set(fish, "_maxHp", hp); NativeContentAccess.Set(fish, "_bossHpMultiplier", 0.5f); NativeContentAccess.Set(fish, "_bossTimeInSeconds", duration); NativeContentAccess.Set(fish, "_onHitDamage", damage); NativeContentAccess.Set(fish, "_timeBetweenDamage", 1f); NativeContentAccess.Set(fish, "_excludeFromJournal", false); NativeContentAccess.Set(fish, "_isEndangered", false); NativeContentAccess.Set(fish, "_ignoreDeathByWater", true); NativeContentAccess.Set(fish, "_hasCustomMovement", false); NativeContentAccess.Set(fish, "_worth", HarborDefinition.Item(Key(iD)).Worth); NativeContentAccess.Set(fish, "_weight", (iD == 190) ? 75f : 180f); if (iD == 191) { Rigidbody[] componentsInChildren = ((Component)fish).GetComponentsInChildren(true); foreach (Rigidbody obj in componentsInChildren) { obj.mass *= 1.4f; } } NativeContentAccess.Set(fish, "_ignoredByMoneyNPC", iD == 191); NativeContentAccess.Set(fish, "_ignoredBySeagulls", true); NativeContentAccess.Set(fish, "k__BackingField", false); NativeContentAccess.Set(fish, "_attackInAir", true); NativeContentAccess.Set(fish, "_jumpOnWater", false); NativeContentAccess.Set(fish, "_jumpToLandOnWater", false); NativeContentAccess.Set(fish, "_randomTowardsPlayerDir", 0.12f); NativeContentAccess.Set(fish, "_setNewTargetDelay", 3f); NativeContentAccess.Set(fish, "_underwaterAttackForceMulti", 1.15f); NativeContentAccess.Set(fish, "_keepOldVelOnAttackPercent", 0.3f); NativeContentAccess.Set(fish, "_motorTime", 0.12f); HarborBossBehavior.SetAttack(fish, enraged: false, lunge: false); if (iD == 190) { ConfigureBarracudaScale(fish); } ((Component)fish).gameObject.AddComponent(); fishVisuals.ConfigureFish((Creature)(object)fish, source, Key(iD), factory); } private static void ConfigureBarracudaScale(AttackingFish fish) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: 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_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Expected O, but got Unknown Transform transform = ((Component)fish).transform; float num = 1.65f; Vector3 val = transform.localScale - Vector3.one; if (((Vector3)(ref val)).sqrMagnitude > 0.0001f) { throw new InvalidOperationException("The barracuda donor root must retain native unit item scale."); } foreach (Transform item in transform) { item.localPosition *= num; item.localScale *= num; } Collider[] components = ((Component)transform).GetComponents(); foreach (Collider val3 in components) { BoxCollider val4 = (BoxCollider)(object)((val3 is BoxCollider) ? val3 : null); if (val4 != null) { val4.center *= num; val4.size *= num; continue; } CapsuleCollider val5 = (CapsuleCollider)(object)((val3 is CapsuleCollider) ? val3 : null); if (val5 != null) { val5.center *= num; val5.height *= num; val5.radius *= num; continue; } SphereCollider val6 = (SphereCollider)(object)((val3 is SphereCollider) ? val3 : null); if (val6 != null) { val6.center *= num; val6.radius *= num; continue; } throw new InvalidOperationException("An unsupported root collider was added to the barracuda donor."); } Joint[] componentsInChildren = ((Component)fish).GetComponentsInChildren(true); foreach (Joint val7 in componentsInChildren) { if ((Object)(object)((Component)val7).transform == (Object)(object)transform) { val7.anchor *= num; } if (Object.op_Implicit((Object)(object)val7.connectedBody) && (Object)(object)((Component)val7.connectedBody).transform == (Object)(object)transform) { Vector3 connectedAnchor = (val7.autoConfigureConnectedAnchor ? transform.InverseTransformPoint(((Component)val7).transform.TransformPoint(val7.anchor)) : (val7.connectedAnchor * num)); val7.autoConfigureConnectedAnchor = false; val7.connectedAnchor = connectedAnchor; } } string[] array = new string[2] { "_handTransformsLeft", "_handTransformsRight" }; foreach (string name in array) { HandTransforms val8 = NativeContentAccess.Get(fish, name); if (val8 != null && val8.Exists && (!Object.op_Implicit((Object)(object)val8.Parent) || (Object)(object)val8.Parent == (Object)(object)transform)) { NativeContentAccess.Set(fish, name, (object?)new HandTransforms(true, val8.HandPos * num, val8.HandRot, val8.FingerRots, val8.Parent)); } } NativeContentAccess.Set(fish, "_headPos", ((Creature)fish).HeadPos * num); NativeContentAccess.Set(fish, "_modelForwardLength", NativeContentAccess.Get(fish, "_modelForwardLength") * num); Rigidbody[] componentsInChildren2 = ((Component)fish).GetComponentsInChildren(true); foreach (Rigidbody obj in componentsInChildren2) { obj.mass *= 1.5f; obj.collisionDetectionMode = (CollisionDetectionMode)2; } NativeContentAccess.Set(fish, "_defaultColMode", (object)(CollisionDetectionMode)2); } internal bool ApplyPreview(Renderer renderer, Item? item, bool showShiny = false, byte? skinIndex = null) { if (!Owns(item)) { RestorePreview(renderer); return false; } if (item is Creature) { trophyVisuals.RestorePreview(renderer); return fishVisuals.ApplyPreview(renderer, item, showShiny, skinIndex); } fishVisuals.RestorePreview(renderer); return trophyVisuals.ApplyPreview(renderer, item); } internal void RestorePreview(Renderer renderer) { fishVisuals.RestorePreview(renderer); trophyVisuals.RestorePreview(renderer); } internal void OnDeath(Creature creature) { //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_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_00bf: 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_00d7: 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_00e0: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (!Owns((Item?)(object)creature) || !((NetworkBehaviour)creature).IsServerInitialized || !((NetworkBehaviour)creature).IsSpawned || creature._hp.Value != 0 || NativeContentAccess.Get(creature, "<_spawnedByDynamite>k__BackingField")) { return; } HarborEncounterIdentity component = ((Component)creature).GetComponent(); if (component.DamageObserved && !component.RewardIssued) { object? value = NativeContentAccess.Field(typeof(BossManager), "_instance").GetValue(null); BossManager target = (BossManager)(((value is BossManager) ? value : null) ?? throw new InvalidOperationException("The native boss reward controller is unavailable.")); byte id = (byte)((((Item)creature).ID == 190) ? 192 : 193); Item obj = ItemManager.Instance.SpawnNewItem(Get(id), ((Item)creature).Rig.worldCenterOfMass + Vector3.up * 0.5f, Quaternion.identity); obj.RigidbodySync.StartSimulateLocal(default(Vector3), default(Quaternion)); obj.Rig.linearVelocity = Vector3.up * NativeContentAccess.Get(target, "_trophyVel"); obj.Rig.angularVelocity = Vector3.one * NativeContentAccess.Get(target, "_trophyAngVel"); component.RewardIssued = true; if (((Item)creature).ID == 191 && !(anglerLoot ?? throw new InvalidOperationException("The Angler's crew-scaled food reward was not registered.")).TryIssue(creature)) { throw new InvalidOperationException("The Angler's first valid combat death did not issue its loot."); } RewardsSpawned++; ((Component)creature).GetComponent().MarkDefeated(); this.BossDefeated?.Invoke(((Item)creature).ID); } } internal void Validate() { if (!IsReady || registrar == null || items.Count != 4 || registrar.Items.Count != 4) { throw new InvalidOperationException("Harbor registry is incomplete."); } registrar.Validate(); foreach (KeyValuePair item in items.OrderBy, byte>((KeyValuePair pair) => pair.Key)) { if ((Object)(object)registrar.GetItem(Key(item.Key)) != (Object)(object)item.Value || !Owns(item.Value) || !Object.op_Implicit((Object)(object)item.Value.Mesh)) { throw new InvalidOperationException("Invalid harbor mapping: " + item.Key); } } } internal static bool Owns(Item? item) { if (!Object.op_Implicit((Object)(object)item) || Current == null || !Current.IsReady || !Current.items.ContainsKey(item.ID)) { return false; } HarborEncounterIdentity component = ((Component)item).GetComponent(); string text = "GamblersReach_" + Key(item.ID); if (Object.op_Implicit((Object)(object)component) && component.ItemId == item.ID) { if (!(((Object)item).name == text)) { return ((Object)item).name == text + "(Clone)"; } return true; } return false; } internal static string Key(byte id) { return id switch { 190 => "barracuda", 191 => "deepsea_angler", 192 => "barracuda_jaw", 193 => "angler_lantern", _ => throw new ArgumentOutOfRangeException("id"), }; } internal static string DisplayName(byte id) { return HarborDefinition.Value.Items.Single((ItemDefinition item) => item.Id == id).Title; } public void Dispose() { if (disposed) { return; } disposed = true; IsReady = false; if (Current == this) { Current = null; } this.BossDefeated = null; if (ownsRegistrar) { NativeItemRegistrar? obj = registrar; if (obj != null) { obj.Dispose(); } } fishVisuals.Dispose(); trophyVisuals.Dispose(); items.Clear(); } } internal sealed class HarborEncounterIdentity : MonoBehaviour { [SerializeField] private byte itemId; internal bool DamageObserved; internal bool RewardIssued; internal bool DeathEffectsPlayed; internal byte ItemId => itemId; internal void Configure(byte id) { itemId = id; } } [HarmonyPatch(typeof(Item), "GetName")] internal static class HarborItemNamePatch { private static bool Prefix(Item __instance, ref string __result) { if (!EncounterCatalog.Owns(__instance)) { return true; } __result = EncounterCatalog.DisplayName(__instance.ID); return false; } } [HarmonyPatch(typeof(Creature), "ServerChangeHp")] internal static class HarborDamagePatch { private static void Prefix(Creature __instance, int damage) { if (EncounterCatalog.Owns((Item?)(object)__instance) && ((NetworkBehaviour)__instance).IsServerInitialized && __instance._hp.Value > 0 && damage > 0 && !BossManager.IsImmortal) { ((Component)__instance).GetComponent().DamageObserved = true; } } } [HarmonyPatch(typeof(Creature), "OnDeath")] internal static class HarborDeathPatch { [ThreadStatic] internal static int Depth; private static void Prefix(Creature __instance, out bool __state) { __state = EncounterCatalog.Owns((Item?)(object)__instance); if (__state) { Depth++; } } private static void Postfix(Creature __instance, bool __state) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (__state) { EncounterCatalog.Current?.OnDeath(__instance); HarborEncounterIdentity component = ((Component)__instance).GetComponent(); if (!component.DeathEffectsPlayed && ((NetworkBehaviour)__instance).IsClientInitialized && __instance._hp.Value == 0 && !NativeContentAccess.Get(__instance, "<_spawnedByDynamite>k__BackingField")) { component.DeathEffectsPlayed = true; BossManager.BossExplosion(((Item)__instance).Rig.worldCenterOfMass, false); } } } private static Exception? Finalizer(Exception? __exception, bool __state) { if (__state) { Depth--; } return __exception; } } [HarmonyPatch(typeof(BossManager), "ObserverFastBossAchievement")] internal static class HarborFastAchievementPatch { private static bool Prefix() { if (HarborDeathPatch.Depth == 0) { return !EncounterCatalog.Owns((Item?)(object)BossManager.Boss); } return false; } } [HarmonyPatch(typeof(AchievementManager), "CheckAllCreaturesAchievement")] internal static class HarborJournalAchievementPatch { private static bool Prefix() { return HarborDeathPatch.Depth == 0; } } internal enum BarracudaStage { Hooked, Stalking, Surfacing, Telegraph, Charge, Recovery } internal enum HarborAttack { Rush, Breach } internal sealed class HarborBossBehavior : MonoBehaviour { internal const float TelegraphDuration = 1.05f; internal const float RecoveryDuration = 1.4f; internal const float BarracudaRigScale = 1.65f; internal const float WarningHeadClearance = 0.15f; internal const float WarningPreparationLimit = 3.75f; internal const float AnglerTelegraphDuration = 1.2f; internal const float AnglerRecoveryDuration = 1.6f; private AttackingFish fish; private Rigidbody[] bodies; private Collider[] headColliders; private float deathTime = -1f; private float stageTime; private float targetTime; private float unstuckTime; private float preparationDeadline; private float minimumWarningClearance; private float circleSign = 1f; private bool hitThisCharge; private bool attackEnraged; private bool followUp; private float chargeDuration; private float chargeSpeed; private Player? lastTarget; internal int Attacks { get; private set; } internal bool Enraged { get; private set; } internal bool Lunging { get; private set; } internal BarracudaStage Stage { get; private set; } internal Player? Target { get; private set; } internal Vector3 LockedAim { get; private set; } internal Vector3 ChargeDirection { get; private set; } internal int Telegraphs { get; private set; } internal int Recoveries { get; private set; } internal int Contacts { get; private set; } internal float LastTelegraphDuration { get; private set; } internal float LastRecoveryDuration { get; private set; } internal float LastWarningHeadClearance { get; private set; } internal int AbortedWarnings { get; private set; } internal bool Grounded { get; private set; } internal string GroundSupport { get; private set; } = ""; internal float WarningAlignment { get; private set; } internal float WarningHeadAlignment { get; private set; } internal string WarningObstacle { get; private set; } = ""; internal bool AttackFromLand { get; private set; } internal HarborAttack Attack { get; private set; } internal int GroundAttacks { get; private set; } internal int WaterAttacks { get; private set; } internal int FollowUps { get; private set; } internal float StageElapsed => Time.time - stageTime; internal float VisibleWarningElapsed { get { if (Stage != BarracudaStage.Telegraph) { return 0f; } return StageElapsed; } } internal float RequiredTelegraphDuration { get { if (!IsAngler) { return 1.05f; } return 1.2f; } } internal float RequiredRecoveryDuration { get { if (!IsAngler) { return 1.4f; } return 1.6f; } } private bool IsAngler => ((Item)fish).ID == 191; private float StalkSpeed { get { if (!IsAngler) { if (!Enraged) { return 7.5f; } return 8.5f; } if (!Enraged) { return 7f; } return 8f; } } internal float RequiredStalkDuration { get { if (!IsAngler) { if (!Enraged) { return 1.6f; } return 1.05f; } if (!followUp) { if (!Enraged) { return 1.4f; } return 0.9f; } return 0.45f; } } internal Vector3 WarningHeadPosition => ((Item)fish).Rig.worldCenterOfMass; internal float WarningSurfaceClearance => WarningHeadPosition.y - WaterManager.GetWaterHeight(WarningHeadPosition); internal bool CanBite { get { if (Stage == BarracudaStage.Charge && !hitThisCharge && !Object.op_Implicit((Object)(object)((Item)fish).AttachedRod)) { return !((Creature)fish).IsDead; } return false; } } private void Awake() { fish = ((Component)this).GetComponent(); bodies = ((Component)this).GetComponentsInChildren(true); headColliders = (from collider in ((Component)fish).GetComponentsInChildren(true) where (Object)(object)collider.attachedRigidbody == (Object)(object)((Item)fish).Rig select collider).ToArray(); } private void FixedUpdate() { //IL_00cd: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)fish) || !EncounterCatalog.Owns((Item?)(object)fish) || !((NetworkBehaviour)fish).IsServerInitialized || !((NetworkBehaviour)fish).IsSpawned) { return; } if (((Creature)fish).IsDead) { if (((Item)fish).ID == 191 && deathTime >= 0f && Time.time - deathTime > 1f) { ((Item)fish).DestroyItem((byte)0, byte.MaxValue); } return; } if (Object.op_Implicit((Object)(object)((Item)fish).AttachedRod)) { Stage = BarracudaStage.Hooked; Lunging = false; followUp = false; return; } if (!((Item)fish).RigidbodySync.IsSimulatedLocal) { ((Item)fish).RigidbodySync.StartSimulateLocal(default(Vector3), default(Quaternion)); } if (!((Item)fish).Rig.isKinematic) { Enraged |= ((Creature)fish)._hp.Value <= Mathf.Max(BossManager.BossMaxHp, BossManager.GetBossMaxHp(((Creature)fish).MaxHp, ((Creature)fish).BossHpMultiplier)) / 2; UpdateGrounded(); UpdatePredator(); } } internal void MarkDefeated() { deathTime = Time.time; foreach (HingeJoint joint in ((Fish)fish)._joints) { joint.useMotor = false; } } internal void RecordContact() { Contacts++; hitThisCharge = true; } private void UpdatePredator() { //IL_0061: 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_007a: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_0246: 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_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_048b: 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_0491: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_027c: 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_028e: 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_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: 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_0504: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0534: 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_053f: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_055b: 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_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0341: 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_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_036c: 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_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_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) if (Stage == BarracudaStage.Hooked) { foreach (HingeJoint joint in ((Fish)fish)._joints) { joint.useMotor = false; } Rigidbody[] array = bodies; foreach (Rigidbody val in array) { if (!val.isKinematic) { val.linearVelocity = Vector3.ClampMagnitude(val.linearVelocity, StalkSpeed); val.angularVelocity = Vector3.ClampMagnitude(val.angularVelocity, 2.4f); } } ChooseTarget(); Enter(BarracudaStage.Stalking); } if (Object.op_Implicit((Object)(object)Target) && (!((NetworkBehaviour)Target).IsSpawned || Target.Dying.IsDead || !PlayerManager.AlivePlayers.Contains(Target))) { Target = null; } if (!Object.op_Implicit((Object)(object)Target) && (Stage == BarracudaStage.Surfacing || Stage == BarracudaStage.Telegraph || Stage == BarracudaStage.Charge)) { Enter(BarracudaStage.Recovery); } if (Stage == BarracudaStage.Stalking && Time.time >= targetTime) { ChooseTarget(); } foreach (HingeJoint joint2 in ((Fish)fish)._joints) { joint2.useMotor = Stage == BarracudaStage.Stalking && Object.op_Implicit((Object)(object)Target) && (Grounded || WarningSurfaceClearance < 0.15f); if (joint2.useMotor) { JointMotor motor = joint2.motor; ((JointMotor)(ref motor)).targetVelocity = Mathf.Sin(Time.time * 6f) * 35f; joint2.motor = motor; } } if (!Object.op_Implicit((Object)(object)Target) && Stage != BarracudaStage.Recovery) { Swim(Vector3.zero, 28f); return; } Vector3 worldCenterOfMass = ((Item)fish).Rig.worldCenterOfMass; switch (Stage) { case BarracudaStage.Stalking: { Vector3 val2 = Target.Transform.position - worldCenterOfMass; val2.y = 0f; float magnitude = ((Vector3)(ref val2)).magnitude; Vector3 val3 = ((magnitude > 0.1f) ? (val2 / magnitude) : ((Component)fish).transform.forward); Vector3 val4 = Vector3.Cross(Vector3.up, val3) * circleSign; bool flag = Target.Transform.position.y > WaterManager.GetWaterHeight(Target.Transform.position) + 0.3f; float num = ((!Grounded) ? 7f : (IsAngler ? 5f : 4.5f)); Vector3 val5 = val3 * Mathf.Clamp((magnitude - num) / 3f, -1f, 1f) + val4 * (flag ? 0.3f : 0.8f); Vector3 val6 = ((Vector3)(ref val5)).normalized; if (flag && !Grounded && magnitude > 6f) { val6 = val3; } RaycastHit val7 = default(RaycastHit); if (Physics.SphereCast(worldCenterOfMass + Vector3.up * 0.25f, 0.3f, val6, ref val7, 3f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val7)).normal.y < 0.55f) { val5 = Vector3.ProjectOnPlane(val6, ((RaycastHit)(ref val7)).normal); val6 = ((Vector3)(ref val5)).normalized; } Swim(val6 * StalkSpeed, 28f); Face(val6); Unstick(); if (StageElapsed >= RequiredStalkDuration && magnitude <= (Grounded ? 15f : 20f) && (Grounded || WarningSurfaceClearance < 0.8f)) { PrepareAttack(); } break; } case BarracudaStage.Surfacing: SurfaceForWarning(); Face(LockedAim - worldCenterOfMass); if (Time.time >= preparationDeadline) { AbortedWarnings++; Enter(BarracudaStage.Recovery); } else if (WarningIsVisible()) { Enter(BarracudaStage.Telegraph); } break; case BarracudaStage.Telegraph: SurfaceForWarning(); Face(LockedAim - worldCenterOfMass); if (!WarningIsVisible()) { Enter(BarracudaStage.Surfacing); break; } minimumWarningClearance = Mathf.Min(minimumWarningClearance, WarningSurfaceClearance); if (StageElapsed >= RequiredTelegraphDuration) { LastTelegraphDuration = StageElapsed; LastWarningHeadClearance = minimumWarningClearance; Launch(); } break; case BarracudaStage.Charge: { if (Attack == HarborAttack.Rush && Grounded) { Swim(ChargeDirection * chargeSpeed, 64f); } RaycastHit val8 = default(RaycastHit); if (StageElapsed >= chargeDuration || hitThisCharge || (Physics.SphereCast(worldCenterOfMass + Vector3.up * 0.25f, 0.3f, ChargeDirection, ref val8, 0.7f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val8)).normal.y < 0.55f)) { Enter(BarracudaStage.Recovery); } break; } case BarracudaStage.Recovery: Swim(Vector3.zero, Grounded ? 40f : 18f); if (StageElapsed >= RequiredRecoveryDuration) { LastRecoveryDuration = StageElapsed; lastTarget = Target; circleSign = 0f - circleSign; followUp = IsAngler && Enraged && Attacks % 2 == 1; ChooseTarget(); Enter(BarracudaStage.Stalking); } break; } } private void UpdateGrounded() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_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_0085: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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) Vector3 warningHeadPosition = WarningHeadPosition; float num = 0.55f; Collider[] array = headColliders; foreach (Collider val in array) { if (val.enabled && ((Component)val).gameObject.activeInHierarchy && !val.isTrigger) { float num2 = num; float y = warningHeadPosition.y; Bounds bounds = val.bounds; num = Mathf.Max(num2, y - ((Bounds)(ref bounds)).min.y); } } RaycastHit val2 = default(RaycastHit); Grounded = Physics.Raycast(warningHeadPosition + Vector3.up * 0.15f, Vector3.down, ref val2, Mathf.Min(num, 2f) + 0.35f, LayerMask.op_Implicit(GameInfo.LevelLayer) | LayerMask.op_Implicit(GameInfo.BoatLayer), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val2)).normal.y > 0.55f && ((RaycastHit)(ref val2)).point.y >= WaterManager.GetWaterHeight(((RaycastHit)(ref val2)).point) - 0.1f && ((Item)fish).Rig.linearVelocity.y < 1.5f; GroundSupport = (Grounded ? ((Object)((RaycastHit)(ref val2)).collider).name : ""); } private void PrepareAttack() { //IL_0075: 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_0063: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_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) attackEnraged = Enraged; AttackFromLand = Grounded && WarningSurfaceClearance >= 0.15f; Attack = ((!AttackFromLand || (IsAngler && Attacks % 2 != 0)) ? HarborAttack.Breach : HarborAttack.Rush); Vector3 val = (Object.op_Implicit((Object)(object)Target.Rigidbody) ? (Target.Rigidbody.linearVelocity * 0.15f) : Vector3.zero); val.y = 0f; LockedAim = Target.Transform.position + Vector3.up * 0.35f + Vector3.ClampMagnitude(val, 1.2f); float num = (AttackFromLand ? WarningHeadPosition.y : WaterManager.GetWaterHeight(WarningHeadPosition)); LockedAim = new Vector3(LockedAim.x, Mathf.Clamp(LockedAim.y, num - (AttackFromLand ? 2f : 1.2f), num + (IsAngler ? 3.5f : 2.8f)), LockedAim.z); if (AttackFromLand && LockedAim.y > WarningHeadPosition.y + 1.5f) { Attack = HarborAttack.Breach; } preparationDeadline = Time.time + 3.75f; Enter(BarracudaStage.Surfacing); } private bool WarningIsVisible() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Target) || WarningSurfaceClearance < 0.15f) { return false; } Vector3 val = Vector3.ProjectOnPlane(LockedAim - WarningHeadPosition, Vector3.up); Vector3 val2 = Vector3.ProjectOnPlane(((Component)fish).transform.forward, Vector3.up); WarningAlignment = ((((Vector3)(ref val)).sqrMagnitude < 0.01f) ? 1f : Vector3.Dot(((Vector3)(ref val)).normalized, ((Vector3)(ref val2)).normalized)); float warningHeadAlignment; if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val3 = Vector3.ProjectOnPlane(((Component)((Item)fish).Rig).transform.forward, Vector3.up); warningHeadAlignment = Vector3.Dot(normalized, ((Vector3)(ref val3)).normalized); } else { warningHeadAlignment = 1f; } WarningHeadAlignment = warningHeadAlignment; RaycastHit val4 = default(RaycastHit); bool flag = Physics.Linecast(Target.Transform.position + Vector3.up * 0.5f, WarningHeadPosition + Vector3.up * 0.1f, ref val4, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1); WarningObstacle = (flag ? ((Object)((RaycastHit)(ref val4)).collider).name : ""); if (WarningAlignment >= 0.85f) { return !flag; } return false; } private void Launch() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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) Vector3 val = LockedAim - WarningHeadPosition; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.z); Vector3 val3; Vector3 normalized; if (!(((Vector3)(ref val2)).sqrMagnitude > 0.01f)) { val3 = Vector3.ProjectOnPlane(((Component)fish).transform.forward, Vector3.up); normalized = ((Vector3)(ref val3)).normalized; } else { normalized = ((Vector3)(ref val2)).normalized; } ChargeDirection = normalized; val3 = ChargeDirection; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { ChargeDirection = Vector3.forward; } chargeSpeed = ((!IsAngler) ? ((!AttackFromLand) ? (attackEnraged ? 25f : 22f) : (attackEnraged ? 23f : 20f)) : ((Attack != HarborAttack.Rush) ? (attackEnraged ? 18f : 16f) : (attackEnraged ? 25f : 22f))); chargeDuration = ((Attack == HarborAttack.Rush) ? 0.7f : 0.9f); float num = Mathf.Clamp(((Vector3)(ref val2)).magnitude / chargeSpeed, 0.2f, chargeDuration); float num2 = Mathf.Clamp(val.y / num - Physics.gravity.y * num * 0.5f, (Attack == HarborAttack.Rush) ? 0.6f : 1.5f, (Attack == HarborAttack.Rush) ? 2.8f : 9f); Rigidbody[] array = bodies; foreach (Rigidbody val4 in array) { if (!val4.isKinematic) { val4.linearVelocity = ChargeDirection * chargeSpeed + Vector3.up * num2; val4.angularVelocity = Vector3.zero; } } Enter(BarracudaStage.Charge); Attacks++; if (AttackFromLand) { GroundAttacks++; } else { WaterAttacks++; } if (followUp) { FollowUps++; } } private void Enter(BarracudaStage stage) { Stage = stage; stageTime = Time.time; Lunging = stage == BarracudaStage.Charge; if (stage == BarracudaStage.Telegraph) { Telegraphs++; minimumWarningClearance = WarningSurfaceClearance; } if (stage == BarracudaStage.Recovery) { Recoveries++; } if (stage == BarracudaStage.Charge) { hitThisCharge = false; NativeContentAccess.Set(fish, "_onHitDamage", (!IsAngler) ? (attackEnraged ? 40 : 34) : (attackEnraged ? 52 : 42)); } } private void ChooseTarget() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) Player val = null; float num = 85f; foreach (Player alivePlayer in PlayerManager.AlivePlayers) { if (Object.op_Implicit((Object)(object)alivePlayer) && ((NetworkBehaviour)alivePlayer).IsSpawned && !alivePlayer.Dying.IsDead) { Vector3 val2 = alivePlayer.Transform.position - ((Item)fish).Rig.worldCenterOfMass; Vector2 val3 = new Vector2(val2.x, val2.z); float num2 = ((Vector2)(ref val3)).magnitude + Mathf.Abs(val2.y) * 0.35f; if ((Object)(object)alivePlayer == (Object)(object)lastTarget) { num2 *= 1.25f; } if ((Object)(object)alivePlayer == (Object)(object)Target) { num2 *= 0.9f; } if (!(num2 >= num)) { num = num2; val = alivePlayer; } } } Target = val; NativeContentAccess.Set(fish, "_target", val); targetTime = Time.time + 0.75f; } private void Swim(Vector3 horizontal, float acceleration) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_008f: 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) Rigidbody[] array = bodies; foreach (Rigidbody val in array) { if (!val.isKinematic) { Vector3 val2 = horizontal; val2.y = val.linearVelocity.y; float waterHeight = WaterManager.GetWaterHeight(val.worldCenterOfMass); if (val.worldCenterOfMass.y < waterHeight + 0.15f) { val2.y = Mathf.Clamp((waterHeight - 0.35f - val.worldCenterOfMass.y) * 3f, -3f, 4f); } val.linearVelocity = Vector3.MoveTowards(val.linearVelocity, val2, acceleration * Time.fixedDeltaTime); } } } private void SurfaceForWarning() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) float waterHeight = WaterManager.GetWaterHeight(WarningHeadPosition); bool flag = !AttackFromLand && WarningHeadPosition.y < waterHeight + 0.8f; float num = Mathf.Clamp((waterHeight + 0.45f - WarningHeadPosition.y) * 4f - Physics.gravity.y * Time.fixedDeltaTime, -2f, 4f); Rigidbody[] array = bodies; foreach (Rigidbody val in array) { if (!val.isKinematic) { Vector3 val2 = Vector3.up * (flag ? num : val.linearVelocity.y); val.linearVelocity = Vector3.MoveTowards(val.linearVelocity, val2, 36f * Time.fixedDeltaTime); } } } private void Face(Vector3 direction) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b4: Unknown result type (might be due to invalid IL or missing references) direction.y = 0f; if (((Vector3)(ref direction)).sqrMagnitude < 0.01f) { return; } ((Vector3)(ref direction)).Normalize(); if (IsAngler && Attack == HarborAttack.Breach && (Stage == BarracudaStage.Surfacing || Stage == BarracudaStage.Telegraph)) { Vector3 val = direction + Vector3.up * 0.35f; direction = ((Vector3)(ref val)).normalized; } Vector3 angularVelocity = Vector3.ClampMagnitude(DazedUtils.GetAngularVelocityToTarget(((Item)fish).Rig.rotation, Quaternion.LookRotation(direction, Vector3.up)) * 3f, 2.4f); Rigidbody[] array = bodies; foreach (Rigidbody val2 in array) { if (!val2.isKinematic) { val2.angularVelocity = angularVelocity; } } } private void Unstick() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if (!Grounded || !((Item)fish).IsColliding || Time.time < unstuckTime) { return; } Vector2 val = new Vector2(((Item)fish).Rig.linearVelocity.x, ((Item)fish).Rig.linearVelocity.z); if (((Vector2)(ref val)).sqrMagnitude > 2f) { return; } unstuckTime = Time.time + 1.4f; Rigidbody[] array = bodies; foreach (Rigidbody val2 in array) { if (!val2.isKinematic) { val2.linearVelocity = new Vector3(val2.linearVelocity.x, IsAngler ? 4.5f : 3.8f, val2.linearVelocity.z); } } } internal static void SetAttack(AttackingFish fish, bool enraged, bool lunge) { bool flag = ((Item)fish).ID == 191; float num = ((!flag) ? (lunge ? 26f : 14f) : (lunge ? 22f : 10f)); NativeContentAccess.Set(fish, "_towardsPlayerForce", num * (enraged ? 1.15f : 1f)); NativeContentAccess.Set(fish, "_airTowardsPlayerForce", flag ? 5f : 7f); NativeContentAccess.Set(fish, "_jumpForce", (!flag) ? (lunge ? 5f : 2.5f) : (lunge ? 7f : 4f)); NativeContentAccess.Set(fish, "_minTime", lunge ? 0.25f : (flag ? 0.8f : 0.5f)); NativeContentAccess.Set(fish, "_maxTime", lunge ? 0.45f : (flag ? 1.15f : 0.8f)); NativeContentAccess.Set(fish, "_onHitDamage", (!flag) ? (enraged ? 40 : 34) : (enraged ? 52 : 42)); } } [HarmonyPatch(typeof(AttackingFish), "UpdateMovement")] internal static class HarborServerMovementPatch { private static bool Prefix(AttackingFish __instance) { if (EncounterCatalog.Owns((Item?)(object)__instance)) { if (((NetworkBehaviour)__instance).IsServerInitialized) { return Object.op_Implicit((Object)(object)((Item)__instance).AttachedRod); } return false; } return true; } } [HarmonyPatch(typeof(AttackingFish), "DamageOnCollision")] internal static class HarborServerContactPatch { private static bool Prefix(AttackingFish __instance) { if (EncounterCatalog.Owns((Item?)(object)__instance)) { if (((NetworkBehaviour)__instance).IsServerInitialized) { return ((Component)__instance).GetComponent().CanBite; } return false; } return true; } private static void Postfix(AttackingFish __instance, bool __runOriginal) { if (__runOriginal && EncounterCatalog.Owns((Item?)(object)__instance) && ((NetworkBehaviour)__instance).IsServerInitialized) { ((Component)__instance).GetComponent().RecordContact(); } } } [HarmonyPatch(typeof(AttackingFish), "AttackTarget")] internal static class HarborAttackTargetPatch { private static bool Prefix(AttackingFish __instance) { return !EncounterCatalog.Owns((Item?)(object)__instance); } } } namespace GamblersReach.Content { internal static class AuthoredToolRig { internal static SkinnedMeshRenderer Replace(Tool item, GameObject art, Mesh mesh, Material[] palette) { //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025c: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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) //IL_0201: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: 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) //IL_0242: 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_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: 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_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0312: 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_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0327: 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_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: 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_0351: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_08a9: Unknown result type (might be due to invalid IL or missing references) //IL_07ca: Unknown result type (might be due to invalid IL or missing references) //IL_0812: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_081c: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) Tool obj = item; Weapon val = (Weapon)(object)((obj is Weapon) ? obj : null); if (val != null) { Animation val2 = NativeContentAccess.Get(val, "_anim"); AnimationClip clip = val2.GetClip("Idle"); if (!Object.op_Implicit((Object)(object)clip) || !clip.legacy) { throw new InvalidOperationException("Fit the harpoon against the native weapon's verified idle pose."); } clip.SampleAnimation(((Component)val2).gameObject, 0f); } List list = NativeContentAccess.Get>(item, "_skinRenderers"); SkinnedMeshRenderer renderer = list.OfType().Single(); Transform[] bones = renderer.bones; Transform val3 = bones.Single((Transform bone) => ((Object)bone).name == ((item is FishingRod) ? "RodBase" : "Gun")); Tool obj2 = item; FishingRod val4 = (FishingRod)(object)((obj2 is FishingRod) ? obj2 : null); Transform[] array = ((val4 != null) ? NativeContentAccess.Get(val4, "_rodParts") : Array.Empty()); Transform[] array2 = ((item is FishingRod) ? ((IEnumerable)(object)new Transform[1] { val3 }).Concat(array).Concat((IEnumerable)(object)new Transform[2] { NativeContentAccess.Get(item, "_reel"), NativeContentAccess.Get(item, "_crank") }).Distinct() .ToArray() : bones.Where((Transform bone) => ((Object)bone).name == "Gun" || ((Object)bone).name == "Bolt" || ((Object)bone).name == "Mag").ToArray()); if (array2.Length == 0 || !array2.Contains(val3)) { throw new InvalidOperationException("The verified native tool skeleton is incomplete: " + ((Object)item).name); } Renderer handsMesh = item.HandsMesh; SkinnedMeshRenderer val5 = (SkinnedMeshRenderer)(object)((handsMesh is SkinnedMeshRenderer) ? handsMesh : null); if (val5 == null) { throw new InvalidOperationException("The supported tool must retain its native skinned hands."); } Vector3 val6 = GripCenter(val5.bones, "r_"); Vector3 val7 = Marker(art, "grip_right"); Vector3 val8 = Marker(art, (item is FishingRod) ? "tip" : "muzzle"); Vector3 position; Vector3 val9; Vector3 val10; if (item is FishingRod) { position = array[^1].position; val9 = position - val3.position; val10 = ((Vector3)(ref val9)).normalized; val6 = val3.position + val10 * Vector3.Dot(val6 - val3.position, val10); } else { Weapon val11 = (Weapon)item; position = val11.Attachments.FirePoint.position; val10 = val11.Attachments.FirePoint.forward; } Quaternion val12 = Quaternion.LookRotation(position - val6, ((Component)item).transform.up) * Quaternion.Inverse(Quaternion.LookRotation(val8 - val7, Vector3.up)); val9 = position - val6; float magnitude = ((Vector3)(ref val9)).magnitude; val9 = val8 - val7; float num = magnitude / ((Vector3)(ref val9)).magnitude; if (!NativeContentAccess.Finite(num) || num < 0.15f || num > 4f) { throw new InvalidOperationException("The authored tool's grip and functional endpoint do not fit the native rig: " + ((Object)item).name); } Matrix4x4 val13 = Matrix4x4.TRS(val6 - val12 * (val7 * num), val12, Vector3.one * num); Matrix4x4 val14 = ((Component)renderer).transform.worldToLocalMatrix * val13; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; BoneWeight[] array3 = (BoneWeight[])(object)new BoneWeight[vertices.Length]; int num2 = 0; MeshFilter[] componentsInChildren = art.GetComponentsInChildren(true); foreach (MeshFilter val15 in componentsInChildren) { string name = ((Object)((Component)val15).transform.parent).name; Transform val16 = (Transform)(name switch { "anchor_reel" => NativeContentAccess.Get(item, "_reel"), "anchor_crank" => NativeContentAccess.Get(item, "_crank"), "anchor_bolt" => array2.Single((Transform bone) => ((Object)bone).name == "Bolt"), "anchor_magazine" => array2.Single((Transform bone) => ((Object)bone).name == "Mag"), _ => val3, }); Vector3 val17 = Vector3.zero; if (name == "anchor_reel" || name == "anchor_crank") { val17 = val16.position - ((Matrix4x4)(ref val13)).MultiplyPoint3x4(Marker(art, name.Substring(7))); } int num4 = 0; while (num4 < val15.sharedMesh.vertexCount) { if (num2 >= vertices.Length) { throw new InvalidOperationException("The combined tool mesh no longer matches its authored parts."); } Vector3 val18 = ((Matrix4x4)(ref val13)).MultiplyPoint3x4(vertices[num2]) + val17; int num5 = num2; BoneWeight val20; if (!(item is FishingRod) || !(name == "anchor_root")) { BoneWeight val19 = default(BoneWeight); ((BoneWeight)(ref val19)).boneIndex0 = Array.IndexOf(array2, val16); ((BoneWeight)(ref val19)).weight0 = 1f; val20 = val19; } else { val20 = BendWeights(val18, val3, array, array2, val10); } array3[num5] = val20; if (((BoneWeight)(ref array3[num2])).boneIndex0 < 0) { throw new InvalidOperationException("The authored part refers to a bone outside the native tool skeleton."); } vertices[num2] = ((Component)renderer).transform.InverseTransformPoint(val18); int num6 = num2; val9 = ((Matrix4x4)(ref val14)).MultiplyVector(normals[num2]); normals[num6] = ((Vector3)(ref val9)).normalized; num4++; num2++; } } if (num2 != vertices.Length) { throw new InvalidOperationException("The authored tool mesh has unbound vertices."); } mesh.vertices = vertices; mesh.normals = normals; mesh.boneWeights = array3; mesh.bindposes = array2.Select((Transform bone) => bone.worldToLocalMatrix * ((Component)renderer).transform.localToWorldMatrix).ToArray(); mesh.RecalculateBounds(); foreach (Renderer item2 in list) { item2.enabled = (Object)(object)item2 == (Object)(object)renderer; } Tool obj3 = item; Weapon val21 = (Weapon)(object)((obj3 is Weapon) ? obj3 : null); if (val21 != null) { Renderer[] componentsInChildren2 = ((Component)item).GetComponentsInChildren(true); foreach (Renderer val22 in componentsInChildren2) { if ((Object)(object)val22 != (Object)(object)renderer && (Object)(object)val22 != (Object)(object)val5 && (val22 is MeshRenderer || val22 is SkinnedMeshRenderer) && !HarpoonUpgradeCatalog.IsUpgradeRenderer(val21, val22)) { val22.forceRenderingOff = true; } } } renderer.sharedMesh = mesh; renderer.bones = array2; renderer.rootBone = val3; ((Renderer)renderer).sharedMaterials = palette; ((Renderer)renderer).localBounds = mesh.bounds; renderer.updateWhenOffscreen = true; string[] array4 = ((!(item is Weapon)) ? new string[3] { "grip_right", "grip_left", "tip" } : new string[7] { "grip_right", "grip_left", "muzzle", "bolt", "magazine", "sight_mount", "cocking_handle" }); foreach (string text in array4) { Transform val23 = art.transform.Find("marker_" + text); if (!Object.op_Implicit((Object)(object)val23)) { throw new InvalidOperationException("The authored tool is missing its " + text + " fit marker."); } Transform transform = new GameObject("Authored " + text).transform; transform.SetParent((item is FishingRod && text == "tip") ? array[^1] : val3, false); transform.position = ((Matrix4x4)(ref val13)).MultiplyPoint3x4(art.transform.InverseTransformPoint(val23.position)); if (item is Weapon) { transform.rotation = val12; } } NativeContentAccess.Set(item, "_skinRenderers", new List()); FitCollision((Item)(object)item, renderer); ContentRegistry.Log.LogInfo((object)$"{((Item)item).GetName()}: original mesh bound to {array2.Length} native animated bones, scale {num:0.000}; grip {val6}."); return renderer; } private static BoneWeight BendWeights(Vector3 point, Transform root, Transform[] bends, Transform[] bones, Vector3 forward) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) float num = Vector3.Dot(point - root.position, forward); Transform value = root; float num2 = 0f; BoneWeight result; foreach (Transform val in bends) { float num3 = Vector3.Dot(val.position - root.position, forward); if (num <= num3) { float num4 = Mathf.InverseLerp(num2, num3, num); result = default(BoneWeight); ((BoneWeight)(ref result)).boneIndex0 = Array.IndexOf(bones, value); ((BoneWeight)(ref result)).weight0 = 1f - num4; ((BoneWeight)(ref result)).boneIndex1 = Array.IndexOf(bones, val); ((BoneWeight)(ref result)).weight1 = num4; return result; } value = val; num2 = num3; } result = default(BoneWeight); ((BoneWeight)(ref result)).boneIndex0 = Array.IndexOf(bones, value); ((BoneWeight)(ref result)).weight0 = 1f; return result; } private static Vector3 GripCenter(Transform[] bones, string side) { //IL_0063: 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_0090: Unknown result type (might be due to invalid IL or missing references) Transform[] array = new string[4] { side + "middle_low", side + "middle_tip", side + "index_low", side + "index_tip" }.Select((string name) => bones.Single((Transform bone) => ((Object)bone).name == name)).ToArray(); return array.Aggregate(Vector3.zero, (Vector3 sum, Transform bone) => sum + bone.position) / (float)array.Length; } private static Vector3 Marker(GameObject art, string name) { //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) Transform val = art.transform.Find("marker_" + name); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("The authored tool is missing its " + name + " attachment."); } return art.transform.InverseTransformPoint(val.position); } private static void FitCollision(Item item, SkinnedMeshRenderer renderer) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_0190: 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_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_01d2: Unknown result type (might be due to invalid IL or missing references) //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_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: 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_02cb: 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) //IL_032f: 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) Matrix4x4 val = ((Component)item).transform.worldToLocalMatrix * ((Component)renderer).transform.localToWorldMatrix; Vector3[] array = ((IEnumerable)renderer.sharedMesh.vertices).Select((Func)((Matrix4x4)(object)val).MultiplyPoint3x4).ToArray(); Bounds val2 = default(Bounds); ((Bounds)(ref val2))..ctor(array[0], Vector3.zero); Vector3[] array2 = array; foreach (Vector3 val3 in array2) { ((Bounds)(ref val2)).Encapsulate(val3); } Collider[] array3 = NativeContentAccess.Get(item, "_worldColliders"); if (array3.Length != 2 || array3.Any((Collider collider) => !(collider is BoxCollider))) { throw new InvalidOperationException("The supported tool must retain its two native box colliders."); } BoxCollider[] array4 = array3.Cast().ToArray(); List[] array5 = array4.Select((BoxCollider _) => new List()).ToArray(); array2 = array; Bounds val7 = default(Bounds); Vector3 val8; foreach (Vector3 val4 in array2) { Vector3 val5 = ((Component)item).transform.TransformPoint(val4); int num = 0; float num2 = float.MaxValue; for (int num3 = 0; num3 < array4.Length; num3++) { BoxCollider val6 = array4[num3]; ((Bounds)(ref val7))..ctor(val6.center, val6.size); val8 = ((Component)val6).transform.TransformPoint(((Bounds)(ref val7)).ClosestPoint(((Component)val6).transform.InverseTransformPoint(val5))) - val5; float sqrMagnitude = ((Vector3)(ref val8)).sqrMagnitude; val8 = ((Component)val6).transform.TransformPoint(val6.center) - val5; float num4 = sqrMagnitude + 0.001f * ((Vector3)(ref val8)).sqrMagnitude; if (!(num4 >= num2)) { num = num3; num2 = num4; } } array5[num].Add(val4); } for (int num5 = 0; num5 < array4.Length; num5++) { if (array5[num5].Count < 3) { throw new InvalidOperationException("The authored model does not reach a required native physical segment."); } SetBox(array4[num5], ((Component)item).transform, array5[num5].ToArray(), 0.005f); } Collider val9 = NativeContentAccess.Get(item, "_pickUpCollider"); BoxCollider val10 = (BoxCollider)(object)((val9 is BoxCollider) ? val9 : null); if (val10 != null) { SetBox(val10, ((Component)item).transform, array, 0.035f); } else { CapsuleCollider val11 = (CapsuleCollider)(object)((val9 is CapsuleCollider) ? val9 : null); if (val11 == null) { throw new InvalidOperationException("The supported tool has an unknown native pickup volume."); } Bounds val12 = LocalBounds(((Component)val11).transform, ((Component)item).transform, array); int direction = val11.direction; val8 = ((Bounds)(ref val12)).extents; float num6 = ((Vector3)(ref val8))[(direction + 1) % 3]; val8 = ((Bounds)(ref val12)).extents; float num7 = Mathf.Max(num6, ((Vector3)(ref val8))[(direction + 2) % 3]); val11.center = ((Bounds)(ref val12)).center; val11.radius = num7 + 0.035f; val8 = ((Bounds)(ref val12)).size; val11.height = Mathf.Max(((Vector3)(ref val8))[direction] + 0.07f, val11.radius * 2f); } NativeContentAccess.Set(item, "_modelHeight", Mathf.Max(0.02f, 0f - ((Bounds)(ref val2)).min.y)); NativeContentAccess.Set(item, "_modelForwardLength", Mathf.Max(0.05f, ((Bounds)(ref val2)).max.z)); } private static void SetBox(BoxCollider box, Transform root, Vector3[] points, float margin) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Bounds val = LocalBounds(((Component)box).transform, root, points); box.center = ((Bounds)(ref val)).center; box.size = ((Bounds)(ref val)).size + Vector3.one * margin; } private static Bounds LocalBounds(Transform target, Transform root, Vector3[] points) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_003f: 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_0055: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 val = target.worldToLocalMatrix * root.localToWorldMatrix; Bounds result = default(Bounds); ((Bounds)(ref result))..ctor(((Matrix4x4)(ref val)).MultiplyPoint3x4(points[0]), Vector3.zero); foreach (Vector3 val2 in points) { ((Bounds)(ref result)).Encapsulate(((Matrix4x4)(ref val)).MultiplyPoint3x4(val2)); } return result; } } internal sealed class AuthoredToolSkin : MonoBehaviour { [SerializeField] private Renderer target; [SerializeField] private Material[] workshop = Array.Empty(); [SerializeField] private Material[] crosscurrent = Array.Empty(); [SerializeField] private Material[] sounding = Array.Empty(); [SerializeField] private Material[] stormglass = Array.Empty(); internal void Configure(Renderer renderer, Material[][] palettes) { target = renderer; workshop = palettes[0]; crosscurrent = palettes[1]; sounding = palettes[2]; stormglass = palettes[3]; Apply(0); } internal void Apply(int index) { if (!Object.op_Implicit((Object)(object)target)) { throw new InvalidOperationException("The authored tool lost its skin renderer."); } target.sharedMaterials = MaterialsFor(index); } internal Material[] MaterialsFor(int index) { return index switch { 0 => workshop, 1 => crosscurrent, 2 => sounding, 3 => stormglass, _ => throw new InvalidOperationException("The authored tool has an unknown finish."), }; } } [HarmonyPatch(typeof(Item), "ApplySkin")] internal static class AuthoredToolSkinPatch { private static void Postfix(Item __instance) { AuthoredToolSkin authoredToolSkin = default(AuthoredToolSkin); if (((Component)__instance).TryGetComponent(ref authoredToolSkin)) { authoredToolSkin.Apply(__instance.CurSkin); } } } public sealed class ContentDescriptor { public string Key { get; } public string DisplayName { get; } public string AssetKey { get; } public byte ItemId { get; } public bool IsFish { get; } public int Worth { get; } public int Cost { get; } public ItemKind Kind { get; } public byte NativeDonorId { get; } internal float CatchWeight { get; } internal int Health { get; } internal ContentDescriptor(ItemDefinition item) { //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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 Key = item.Key; DisplayName = item.Title; AssetKey = item.AssetKey; checked { ItemId = (byte)item.Id; Kind = item.Kind; NativeDonorId = (byte)item.NativeDonorId; } IsFish = (int)item.Kind == 0; Worth = item.Worth; Cost = item.Cost; CatchWeight = item.CatchWeight; Health = item.Health; } } internal static class ContentFishRig { internal const int BarracudaBodySubmesh = 0; internal static void Replace(Creature item, GameObject art, Mesh mesh, Material[] materials, Material[] dripMaterials) { //IL_0026: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_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_0217: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0351: 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_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_0806: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0721: 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_0737: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_078b: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) GameObject val = NativeContentAccess.Optional(item, "_disableOnShiny"); GameObject val2 = NativeContentAccess.Optional(item, "_enableOnShiny"); bool flag = (int)item.BossType != 0 && !Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)val2); SkinnedMeshRenderer normal = (flag ? ((Component)item).GetComponentsInChildren(true).Single() : (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null)); SkinnedMeshRenderer val3 = (Object.op_Implicit((Object)(object)val2) ? val2.GetComponent() : null); Collider[] colliders = NativeContentAccess.Get(item, "_worldColliders"); if (!Object.op_Implicit((Object)(object)normal) || (!flag && !Object.op_Implicit((Object)(object)val3)) || !Object.op_Implicit((Object)(object)normal.sharedMesh) || colliders.Length == 0 || colliders.Any((Collider collider) => !Object.op_Implicit((Object)(object)collider) || collider.isTrigger)) { throw new InvalidOperationException(((Object)item).name + " does not match its verified articulated fish rig."); } Transform root = ((Component)item).transform; Bounds val4 = TransformBounds(normal.sharedMesh.bounds, root.worldToLocalMatrix * ((Component)normal).transform.localToWorldMatrix); float z = ((Bounds)(ref val4)).size.z; Bounds bounds = mesh.bounds; float num = z / ((Bounds)(ref bounds)).size.z; if (!NativeContentAccess.Finite(num) || num <= 0f) { throw new InvalidOperationException("Invalid anatomical dimensions for " + ((Object)item).name + "."); } MeshFilter[] array = (from filter in art.GetComponentsInChildren(true) where ((Object)filter).name.EndsWith("sculpted body", StringComparison.Ordinal) select filter).ToArray(); if (array.Length == 0) { throw new InvalidOperationException("Original fish " + ((Object)item).name + " has no anatomical body mesh."); } Vector3[] source = array.SelectMany(delegate(MeshFilter filter) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 val13 = art.transform.worldToLocalMatrix * ((Component)filter).transform.localToWorldMatrix; return ((IEnumerable)filter.sharedMesh.vertices).Select((Func)((Matrix4x4)(object)val13).MultiplyPoint3x4); }).ToArray(); Vector3 forward = Vector3.forward; bounds = mesh.bounds; Vector3 val5 = forward * ((((Bounds)(ref bounds)).max.z - source.Max((Vector3 point) => point.z)) * num); Vector3 center = ((Bounds)(ref val4)).center; bounds = mesh.bounds; Matrix4x4 val6 = Matrix4x4.TRS(center - ((Bounds)(ref bounds)).center * num + val5, Quaternion.identity, Vector3.one * num); Rigidbody[] bodies = colliders.Select(NativeBody).Distinct().ToArray(); Vector3[] centers = bodies.Select(delegate(Rigidbody body) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Bounds val13 = BodyBounds(root, colliders.Where((Collider collider) => (Object)(object)NativeBody(collider) == (Object)(object)body)); return ((Bounds)(ref val13)).center; }).ToArray(); int[] order = (from num4 in Enumerable.Range(0, bodies.Length) orderby centers[num4].z descending select num4).ToArray(); Transform[] array2 = bodies.Select((Rigidbody body) => ((Component)body).transform).ToArray(); Matrix4x4 val7 = ((Component)normal).transform.worldToLocalMatrix * root.localToWorldMatrix; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; BoneWeight[] array3 = (BoneWeight[])(object)new BoneWeight[vertices.Length]; Vector3 val9; for (int num2 = 0; num2 < vertices.Length; num2++) { Vector3 val8 = ((Matrix4x4)(ref val6)).MultiplyPoint3x4(vertices[num2]); array3[num2] = Weight(val8.z, centers, order); vertices[num2] = ((Matrix4x4)(ref val7)).MultiplyPoint3x4(val8); if (num2 < normals.Length) { int num3 = num2; val9 = ((Matrix4x4)(ref val7)).MultiplyVector(normals[num2]); normals[num3] = ((Vector3)(ref val9)).normalized; } } mesh.vertices = vertices; mesh.normals = normals; mesh.boneWeights = array3; mesh.bindposes = array2.Select((Transform bone) => bone.worldToLocalMatrix * ((Component)normal).transform.localToWorldMatrix).ToArray(); mesh.RecalculateBounds(); Vector3[] array4 = ((IEnumerable)source).Select((Func)((Matrix4x4)(object)val6).MultiplyPoint3x4).ToArray(); if (((Item)item).ID == 190) { if (array.Length != 1 || (Object)(object)array[0] != (Object)(object)art.GetComponentsInChildren(true).First() || array[0].sharedMesh.subMeshCount != 1) { throw new InvalidOperationException("The barracuda's first authored submesh must be its anatomical body."); } FitBarracudaGrip(item, array4, array[0].sharedMesh.triangles, array2, centers, order); } int index; for (index = 0; index < bodies.Length; index++) { Collider[] colliders2 = colliders.Where((Collider collider) => (Object)(object)NativeBody(collider) == (Object)(object)bodies[index]).ToArray(); Vector3[] array5 = array4.Where(delegate(Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) BoneWeight val13 = Weight(point.z, centers, order); return (((BoneWeight)(ref val13)).boneIndex0 == index && ((BoneWeight)(ref val13)).weight0 >= 0.2f) || (((BoneWeight)(ref val13)).boneIndex1 == index && ((BoneWeight)(ref val13)).weight1 >= 0.2f); }).ToArray(); if (array5.Length < 2) { throw new InvalidOperationException($"Original body does not reach native segment {index} of {((Object)item).name}."); } ResizeCompound(root, colliders2, array5); } Collider pickup = NativeContentAccess.Get(item, "_pickUpCollider"); Collider obj = pickup; BoxCollider val10 = (BoxCollider)(object)((obj is BoxCollider) ? obj : null); if (val10 == null || (Object)(object)((Component)pickup).transform != (Object)(object)root || colliders.Any((Collider collider) => (Object)(object)((Component)collider).gameObject == (Object)(object)((Component)pickup).gameObject)) { throw new InvalidOperationException(((Object)item).name + " aliases its pickup and world-collision layers."); } Bounds val11 = TransformBounds(mesh.bounds, root.worldToLocalMatrix * ((Component)normal).transform.localToWorldMatrix); val10.center = ((Bounds)(ref val11)).center; val10.size = ((Bounds)(ref val11)).size + Vector3.one * 0.04f; ((Collider)val10).isTrigger = true; Bounds val12 = BodyBounds(root, colliders); NativeContentAccess.Set(item, "_modelHeight", Mathf.Max(0.02f, 0f - ((Bounds)(ref val12)).min.y)); NativeContentAccess.Set(item, "_groundCheckDist", Mathf.Max(0.25f, ((Bounds)(ref val12)).extents.y + 0.05f)); NativeContentAccess.Set(item, "_skinPreset", null); NativeContentAccess.Set(item, "_skinRenderers", new List()); NativeContentAccess.Set(item, "_dripMesh", mesh); SetRenderer(normal, mesh, array2, materials, root); if (Object.op_Implicit((Object)(object)val3)) { val9 = ((Component)normal).transform.position - ((Component)val3).transform.position; if (!(((Vector3)(ref val9)).sqrMagnitude > 1E-05f) && !(Quaternion.Angle(((Component)normal).transform.rotation, ((Component)val3).transform.rotation) > 0.1f)) { val9 = ((Component)normal).transform.lossyScale - ((Component)val3).transform.lossyScale; if (!(((Vector3)(ref val9)).sqrMagnitude > 1E-05f)) { SetRenderer(val3, mesh, array2, dripMaterials, root); val.SetActive(true); val2.SetActive(false); goto IL_07d6; } } throw new InvalidOperationException(((Object)item).name + " has incompatible normal/drip bind spaces."); } goto IL_07d6; IL_07d6: ContentRegistry.Log.LogInfo((object)($"{((Object)item).name}: original mesh bound to {array2.Length} native bodies; " + $"{colliders.Length} world colliders retained; body bounds {val12}; pickup {val10.size}.")); } private static void FitBarracudaGrip(Creature item, Vector3[] body, int[] triangles, Transform[] bones, Vector3[] centers, int[] order) { //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_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_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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_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_0184: 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) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown //IL_01af: 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_01c9: Unknown result type (might be due to invalid IL or missing references) HandTransforms handTransformsRight = ((Item)item).HandTransformsRight; if (handTransformsRight == null || !handTransformsRight.Exists || !Object.op_Implicit((Object)(object)handTransformsRight.Parent)) { throw new InvalidOperationException("The barracuda needs its native right-hand pose before anatomical fitting."); } Transform transform = ((Component)item).transform; Vector3 val = transform.InverseTransformPoint(handTransformsRight.Parent.TransformPoint(handTransformsRight.HandPos)); Vector3 val2 = BarracudaKnuckleOffset(handTransformsRight, transform); Vector3 val3 = val + val2; Vector3 val4 = default(Vector3); float num = float.PositiveInfinity; Vector3 val6; for (int i = 0; i < triangles.Length; i += 3) { Vector3 val5 = ClosestPointOnTriangle(val3, body[triangles[i]], body[triangles[i + 1]], body[triangles[i + 2]]); val6 = val5 - val3; float sqrMagnitude = ((Vector3)(ref val6)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; val4 = val5; } } if (!NativeContentAccess.Finite(num) || num < 1E-06f) { throw new InvalidOperationException("The barracuda grip cannot be fitted from its external native hand target."); } val6 = val3 - val4; Vector3 normalized = ((Vector3)(ref val6)).normalized; Vector3 val7 = val4 + normalized * 0.012f - val2; BoneWeight val8 = Weight(val4.z, centers, order); Transform val9 = bones[(((BoneWeight)(ref val8)).weight0 >= ((BoneWeight)(ref val8)).weight1) ? ((BoneWeight)(ref val8)).boneIndex0 : ((BoneWeight)(ref val8)).boneIndex1]; Quaternion val10 = handTransformsRight.Parent.rotation * handTransformsRight.HandRot; NativeContentAccess.Set(item, "_handTransformsRight", (object?)new HandTransforms(true, val9.InverseTransformPoint(transform.TransformPoint(val7)), Quaternion.Inverse(val9.rotation) * val10, handTransformsRight.FingerRots, val9)); ContentRegistry.Log.LogInfo((object)($"Barracuda anatomical grip: {val} -> {val7}, " + $"knuckle offset {val2}, surface correction {Mathf.Sqrt(num):F3}m, " + "native pose retained on " + ((Object)val9).name + ".")); } private static Vector3 BarracudaKnuckleOffset(HandTransforms grip, Transform itemRoot) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d0: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Resources.Load("other/HandRight"); if (!Object.op_Implicit((Object)(object)obj)) { throw new InvalidOperationException("The native right-hand anatomical reference is unavailable."); } Transform rootBone = obj.GetComponentInChildren(true).rootBone; Transform[] array = (from Transform bone in (IEnumerable)rootBone where ((Object)bone).name.StartsWith("r_", StringComparison.Ordinal) && ((Object)bone).name.EndsWith("_low", StringComparison.Ordinal) && !((Object)bone).name.Contains("thumb") select bone).ToArray(); if (array.Length != 4) { throw new InvalidOperationException("The native hand's four finger-base landmarks changed."); } Vector3 val = array.Aggregate(Vector3.zero, (Vector3 sum, Transform bone) => sum + bone.localPosition) / (float)array.Length; return Quaternion.Inverse(itemRoot.rotation) * grip.Parent.rotation * grip.HandRot * Vector3.Scale(val, rootBone.lossyScale); } internal static Vector3 ClosestPointOnTriangle(Vector3 point, Vector3 a, Vector3 b, Vector3 c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_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_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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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_004d: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00d1: 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_00db: 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_0071: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; Vector3 val2 = c - a; Vector3 val3 = point - a; Vector3 val4 = Vector3.Cross(val, val2); if (((Vector3)(ref val4)).sqrMagnitude < 1E-12f) { Vector3 val5 = ClosestPointOnSegment(point, a, b); Vector3 val6 = ClosestPointOnSegment(point, b, c); Vector3 val7 = ClosestPointOnSegment(point, c, a); val4 = val5 - point; float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude; val4 = val6 - point; Vector3 val8 = ((sqrMagnitude <= ((Vector3)(ref val4)).sqrMagnitude) ? val5 : val6); val4 = val8 - point; float sqrMagnitude2 = ((Vector3)(ref val4)).sqrMagnitude; val4 = val7 - point; if (!(sqrMagnitude2 <= ((Vector3)(ref val4)).sqrMagnitude)) { return val7; } return val8; } float num = Vector3.Dot(val, val3); float num2 = Vector3.Dot(val2, val3); if (num <= 0f && num2 <= 0f) { return a; } Vector3 val9 = point - b; float num3 = Vector3.Dot(val, val9); float num4 = Vector3.Dot(val2, val9); if (num3 >= 0f && num4 <= num3) { return b; } float num5 = num * num4 - num3 * num2; if (num5 <= 0f && num >= 0f && num3 <= 0f) { return a + val * (num / (num - num3)); } Vector3 val10 = point - c; float num6 = Vector3.Dot(val, val10); float num7 = Vector3.Dot(val2, val10); if (num7 >= 0f && num6 <= num7) { return c; } float num8 = num6 * num2 - num * num7; if (num8 <= 0f && num2 >= 0f && num7 <= 0f) { return a + val2 * (num2 / (num2 - num7)); } float num9 = num3 * num7 - num6 * num4; if (num9 <= 0f && num4 - num3 >= 0f && num6 - num7 >= 0f) { return b + (c - b) * ((num4 - num3) / (num4 - num3 + num6 - num7)); } float num10 = 1f / (num9 + num8 + num5); return a + val * (num8 * num10) + val2 * (num5 * num10); } private static Vector3 ClosestPointOnSegment(Vector3 point, Vector3 a, Vector3 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = b - a; if (!(((Vector3)(ref val)).sqrMagnitude < 1E-12f)) { return a + val * Mathf.Clamp01(Vector3.Dot(point - a, val) / ((Vector3)(ref val)).sqrMagnitude); } return a; } private static Rigidbody NativeBody(Collider collider) { Rigidbody componentInParent = ((Component)collider).GetComponentInParent(true); if (!Object.op_Implicit((Object)(object)componentInParent)) { throw new InvalidOperationException("The native collider has no owning rigidbody in its hierarchy."); } return componentInParent; } private static void SetRenderer(SkinnedMeshRenderer renderer, Mesh mesh, Transform[] bones, Material[] materials, Transform root) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) renderer.sharedMesh = mesh; renderer.bones = bones; renderer.rootBone = root; ((Renderer)renderer).sharedMaterials = materials; ((Renderer)renderer).localBounds = mesh.bounds; renderer.updateWhenOffscreen = true; ((Renderer)renderer).enabled = true; } private static BoneWeight Weight(float z, Vector3[] centers, int[] order) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) BoneWeight result; if (z >= centers[order[0]].z) { result = default(BoneWeight); ((BoneWeight)(ref result)).boneIndex0 = order[0]; ((BoneWeight)(ref result)).weight0 = 1f; return result; } for (int i = 1; i < order.Length; i++) { int num = order[i - 1]; int num2 = order[i]; if (!(z < centers[num2].z)) { float num3 = Mathf.InverseLerp(centers[num2].z, centers[num].z, z); result = default(BoneWeight); ((BoneWeight)(ref result)).boneIndex0 = num; ((BoneWeight)(ref result)).boneIndex1 = num2; ((BoneWeight)(ref result)).weight0 = num3; ((BoneWeight)(ref result)).weight1 = 1f - num3; return result; } } result = default(BoneWeight); ((BoneWeight)(ref result)).boneIndex0 = order[^1]; ((BoneWeight)(ref result)).weight0 = 1f; return result; } private static void ResizeCompound(Transform root, Collider[] colliders, Vector3[] points) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) Transform frame = ((Component)colliders[0]).transform; if (colliders.Any((Collider collider) => (Object)(object)((Component)collider).transform != (Object)(object)frame)) { throw new InvalidOperationException("The native compound collider does not share its expected bone frame."); } Bounds val = BodyBounds(frame, colliders); Matrix4x4 val2 = frame.worldToLocalMatrix * root.localToWorldMatrix; Bounds val3 = default(Bounds); ((Bounds)(ref val3))..ctor(((Matrix4x4)(ref val2)).MultiplyPoint3x4(points[0]), Vector3.zero); foreach (Vector3 val4 in points) { ((Bounds)(ref val3)).Encapsulate(((Matrix4x4)(ref val2)).MultiplyPoint3x4(val4)); } ((Bounds)(ref val3)).Expand(0.015f); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(((Bounds)(ref val3)).size.x / ((Bounds)(ref val)).size.x, ((Bounds)(ref val3)).size.y / ((Bounds)(ref val)).size.y, ((Bounds)(ref val3)).size.z / ((Bounds)(ref val)).size.z); foreach (Collider val6 in colliders) { CapsuleCollider val7 = (CapsuleCollider)(object)((val6 is CapsuleCollider) ? val6 : null); if (val7 != null) { val7.center = ((Bounds)(ref val3)).center + Vector3.Scale(val7.center - ((Bounds)(ref val)).center, val5); int num2 = (val7.direction + 1) % 3; int num3 = (val7.direction + 2) % 3; val7.radius *= Mathf.Max(((Vector3)(ref val5))[num2], ((Vector3)(ref val5))[num3]); val7.height = Mathf.Max(val7.radius * 2f, val7.height * ((Vector3)(ref val5))[val7.direction]); continue; } BoxCollider val8 = (BoxCollider)(object)((val6 is BoxCollider) ? val6 : null); if (val8 != null) { val8.center = ((Bounds)(ref val3)).center + Vector3.Scale(val8.center - ((Bounds)(ref val)).center, val5); val8.size = Vector3.Scale(val8.size, val5); continue; } throw new InvalidOperationException("Unexpected native fish collider " + ((object)val6).GetType().Name + "."); } } internal static Bounds BodyBounds(Transform root, IEnumerable colliders) { //IL_0004: 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_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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_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_0110: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0152: Unknown result type (might be due to invalid IL or missing references) bool flag = false; Bounds result = default(Bounds); Bounds bounds = default(Bounds); foreach (Collider collider in colliders) { CapsuleCollider val = (CapsuleCollider)(object)((collider is CapsuleCollider) ? collider : null); if (val != null) { Vector3 val2 = Vector3.one * val.radius * 2f; ((Vector3)(ref val2))[val.direction] = Mathf.Max(val.height, val.radius * 2f); ((Bounds)(ref bounds))..ctor(val.center, val2); } else { BoxCollider val3 = (BoxCollider)(object)((collider is BoxCollider) ? collider : null); if (val3 == null) { throw new InvalidOperationException("Unsupported native body collider " + ((object)collider).GetType().Name + "."); } ((Bounds)(ref bounds))..ctor(val3.center, val3.size); } Bounds val4 = TransformBounds(bounds, root.worldToLocalMatrix * ((Component)collider).transform.localToWorldMatrix); if (!flag) { result = val4; flag = true; } else { ((Bounds)(ref result)).Encapsulate(val4); } } if (!flag || ((Bounds)(ref result)).size.x <= 0f || ((Bounds)(ref result)).size.y <= 0f || ((Bounds)(ref result)).size.z <= 0f) { throw new InvalidOperationException("The native physics body has no usable collision envelope."); } return result; } private static Bounds TransformBounds(Bounds bounds, Matrix4x4 matrix) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Bounds result = default(Bounds); ((Bounds)(ref result))..ctor(((Matrix4x4)(ref matrix)).MultiplyPoint3x4(((Bounds)(ref bounds)).center), Vector3.zero); for (int i = 0; i < 8; i++) { ((Bounds)(ref result)).Encapsulate(((Matrix4x4)(ref matrix)).MultiplyPoint3x4(((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((i & 1) != 0) ? 1 : (-1)), (float)(((i & 2) != 0) ? 1 : (-1)), (float)(((i & 4) != 0) ? 1 : (-1)))))); } return result; } } [HarmonyPatch(typeof(Item), "GetName")] internal static class ContentNamePatch { private static bool Prefix(Item __instance, ref string __result) { if (!ContentRegistry.TryDescribeOwnedItem(__instance, out ContentDescriptor descriptor)) { return true; } __result = descriptor.DisplayName; return false; } } [HarmonyPatch(typeof(CreatureManager), "HookItem")] internal static class ContentFishHookedPatch { private static void Postfix(Bait bait) { ContentRegistry.Active?.NotifyFishHooked(bait); } } [HarmonyPatch(typeof(InventorySlot), "ApplySkin")] internal static class ContentInventoryPreviewPatch { private static bool Prefix(InventorySlot __instance, Item item) { bool num = ContentPreview.Apply(NativeContentAccess.Get(__instance, "_renderer"), item); if (num) { InventoryPreviewFit.Apply(__instance, item); } return !num; } } [HarmonyPatch(typeof(JournalSlot), "SetCreature")] internal static class ContentJournalPreviewPatch { [HarmonyPatch(typeof(MachineSlot), "SetIndex")] internal static class ContentMachinePreviewPatch { private static void Prefix(MachineSlot __instance) { ContentPreview.Restore(NativeContentAccess.Get(__instance, "_renderer")); } private static void Postfix(MachineSlot __instance, byte itemIndex, byte skinIndex) { if (itemIndex != byte.MaxValue) { ContentPreview.Apply(NativeContentAccess.Get(__instance, "_renderer"), GameInfo.IDToItem(itemIndex), shiny: false, skinIndex); } } } private static void Postfix(JournalSlot __instance, Creature creature) { if (ContentRegistry.Active != null) { ContentPreview.Apply(((Component)NativeContentAccess.Get(__instance, "_filter")).GetComponent(), (Item?)(object)creature, Object.op_Implicit((Object)(object)creature) && SaveManager.GetSavedCreature(creature).KilledDrip); } } } internal static class ContentPreview { internal static void Restore(Renderer renderer) { ContentRegistry.Active?.RestorePreview(renderer); EncounterCatalog.Current?.RestorePreview(renderer); } internal static bool Apply(Renderer renderer, Item? item, bool shiny = false, byte? skinIndex = null) { Restore(renderer); if (Object.op_Implicit((Object)(object)item) && EncounterCatalog.Owns(item)) { return EncounterCatalog.Current.ApplyPreview(renderer, item, shiny, skinIndex); } return ContentRegistry.Active?.ApplyPreview(renderer, item, shiny, skinIndex) ?? false; } } public sealed class ContentRegistry : IDisposable { public const ushort NetworkCollectionId = 48187; internal static readonly ManualLogSource Log = Logger.CreateLogSource("GamblersReach.Content"); private static readonly ReadOnlyCollection Definitions = Array.AsReadOnly((from item in HarborDefinition.Value.Items.Where(delegate(ItemDefinition item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 ItemKind kind = item.Kind; return (int)kind <= 2; }) select new ContentDescriptor(item)).ToArray()); private readonly Dictionary items = new Dictionary(StringComparer.Ordinal); private readonly Dictionary nativeArchetypes = new Dictionary(StringComparer.Ordinal); private readonly Dictionary byId = new Dictionary(); private readonly ContentVisuals visuals = new ContentVisuals(); private NativeItemRegistrar? registrar; private Func? fishFactory; private Func? gearFactory; private bool ownsRegistrar; private bool attempted; private bool disposed; public IReadOnlyList Descriptors => Definitions; internal IEnumerable AvailableItems => Definitions; public bool IsReady { get; private set; } internal HarpoonUpgradeCatalog HarpoonUpgrades { get; private set; } internal static ContentRegistry? Active { get; private set; } public event Action? FishHooked; internal void Begin(Func fishVisualFactory, Func gearVisualFactory) { if (disposed) { throw new ObjectDisposedException("ContentRegistry"); } if (attempted || Active != null) { throw new InvalidOperationException("Harbor content preparation may only run once."); } fishFactory = fishVisualFactory ?? throw new ArgumentNullException("fishVisualFactory"); gearFactory = gearVisualFactory ?? throw new ArgumentNullException("gearVisualFactory"); attempted = true; } public void Initialize(Func fishVisualFactory, Func gearVisualFactory) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown Begin(fishVisualFactory, gearVisualFactory); registrar = new NativeItemRegistrar("gamblers_reach", (ushort)48187, 256, Log); ownsRegistrar = true; try { for (int i = 0; i < Definitions.Count; i++) { Prepare(Definitions[i].Key, checked((ushort)i), registrar); } registrar.Commit(); Complete(registrar); } catch { Dispose(); throw; } } internal PreparedItem Prepare(ItemRecipe recipe, NativeItemRegistrar target) { ContentDescriptor contentDescriptor = Definitions.Single((ContentDescriptor value) => value.Key == ((PackRecipe)recipe).Key); if (recipe.Id != contentDescriptor.ItemId || recipe.Network.CollectionId != 48187) { throw new InvalidOperationException("The modular recipe does not match its harbor equipment identity."); } return Prepare(((PackRecipe)recipe).Key, recipe.Network.Slot, target); } private PreparedItem Prepare(string key, ushort slot, NativeItemRegistrar target) { //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (!attempted || disposed || IsReady || fishFactory == null || gearFactory == null || target.PackKey != "gamblers_reach" || target.CollectionId != 48187) { throw new InvalidOperationException("Begin harbor art preparation with its matching shared registrar first."); } ContentDescriptor descriptor = Definitions.Single((ContentDescriptor value) => value.Key == key); Item val = NativeItemRegistrar.NativeDonor(descriptor.NativeDonorId); if (descriptor.IsFish && (((object)val).GetType() != typeof(Fish) || (int)((Creature)(Fish)val).BossType != 0)) { throw new InvalidOperationException("The configured ordinary-fish donor changed: " + descriptor.NativeDonorId); } PreparedItem val2 = target.Prepare(key, descriptor.ItemId, slot, val, descriptor.DisplayName, "", (string)null); Item clone = val2.Clone; ((Object)clone).name = "GamblersReach_" + key; NativeContentAccess.Set(clone, "_worth", descriptor.Worth); NativeContentAccess.Set(clone, "_cost", descriptor.Cost); NativeContentAccess.Set(clone, "_ignoredByMoneyNPC", false); NativeContentAccess.Set(clone, "k__BackingField", false); if (descriptor.IsFish) { ConfigureFish(val2.Require(), descriptor); visuals.ConfigureFish((Creature)clone, val, key, (string _) => fishFactory(descriptor.AssetKey)); goto IL_0280; } FishingRod val3 = (FishingRod)(object)((clone is FishingRod) ? clone : null); if (val3 != null) { FishingRod val4 = (FishingRod)(object)((val is FishingRod) ? val : null); if (val4 != null) { ConfigureRod(val3, val4, key); visuals.ConfigureRod(val3, val, key, (string _) => gearFactory(descriptor.AssetKey)); goto IL_0280; } } Weapon val5 = (Weapon)(object)((clone is Weapon) ? clone : null); if (val5 != null) { Weapon val6 = (Weapon)(object)((val is Weapon) ? val : null); if (val6 != null) { ConfigureWeapon(val5, val6); visuals.ConfigureWeapon(val5, val, key, (string _) => gearFactory(descriptor.AssetKey)); HarpoonUpgrades = HarpoonUpgradeCatalog.Configure(val5, val6); goto IL_0280; } } throw new InvalidOperationException("The configured harbor tool donor has an incompatible type: " + key); IL_0280: val2.MarkCustomVisual(); items.Add(key, clone); nativeArchetypes.Add(key, val); byId.Add(descriptor.ItemId, descriptor); return val2; } internal void Complete(NativeItemRegistrar registered) { if (registered.CollectionId != 48187 || registered.PackKey != "gamblers_reach" || !registered.IsReady || IsReady || disposed) { throw new InvalidOperationException("The shared harbor item registration did not complete."); } registrar = registered; Active = this; IsReady = true; ValidateRegistry(); } public Item GetItem(string key) { RequireReady(); if (!items.TryGetValue(key, out Item value)) { throw new KeyNotFoundException("Unknown harbor item: " + key); } return value; } public Fishable GetFishable(string key) { RequireReady(); return registrar.GetFishable(key); } public Item GetNativeArchetype(string key) { RequireReady(); if (!nativeArchetypes.TryGetValue(key, out Item value)) { throw new KeyNotFoundException("Unknown harbor archetype: " + key); } return value; } public bool ValidateRegistry() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) RequireReady(); registrar.Validate(); if (items.Count != Definitions.Count || registrar.Items.Count != Definitions.Count) { throw new InvalidOperationException("The harbor equipment catalog is incomplete."); } foreach (ContentDescriptor definition in Definitions) { Item item = GetItem(definition.Key); if (item.ID != definition.ItemId || item.DefaultWorth != definition.Worth || item.Cost != definition.Cost || (Object)(object)registrar.GetItem(definition.Key) != (Object)(object)item) { throw new InvalidOperationException("The authored harbor recipe differs from its shared registration: " + definition.Key); } if (definition.IsFish) { Creature val = (Creature)(object)((item is Creature) ? item : null); if (val == null || (int)val.BossType != 0 || val.ExcludeFromJournal || !Object.op_Implicit((Object)(object)((Item)val).DripMesh) || (Object)(object)GetFishable(definition.Key).ItemToSpawn != (Object)(object)item) { throw new InvalidOperationException("The harbor fish lost its journal, shiny mesh or catch record: " + definition.Key); } } } return true; } internal bool TryDescribe(Item item, out ContentDescriptor descriptor) { return byId.TryGetValue(item.ID, out descriptor); } internal static bool TryDescribeOwnedItem(Item item, out ContentDescriptor descriptor) { descriptor = null; if (Object.op_Implicit((Object)(object)item)) { ContentRegistry? active = Active; OwnedContentIdentity val = default(OwnedContentIdentity); if (active != null && active.IsReady && OwnedContentIdentity.TryGet(item, ref val) && val.PackKey == "gamblers_reach") { return Active.byId.TryGetValue(item.ID, out descriptor); } } return false; } internal void NotifyFishHooked(Bait bait) { Item serverItemOnBait = bait.ServerItemOnBait; if (Object.op_Implicit((Object)(object)serverItemOnBait) && TryDescribe(serverItemOnBait, out ContentDescriptor descriptor) && descriptor.IsFish) { this.FishHooked?.Invoke(descriptor, serverItemOnBait, bait); } } public bool ApplyPreview(Renderer renderer, Item? item, bool showShiny = false, byte? skinIndex = null) { return visuals.ApplyPreview(renderer, item, showShiny, skinIndex); } internal void RestorePreview(Renderer renderer) { visuals.RestorePreview(renderer); } internal static bool IsOrdinaryLure(BaitInfo bait) { bool flag = Object.op_Implicit((Object)(object)bait); if (flag) { bool flag2; switch (((Object)bait).name) { case "Beginner Lure": case "Standard Lure": case "Professional Lure": case "Scientific Lure": flag2 = true; break; default: flag2 = false; break; } flag = flag2; } return flag; } private static void ConfigureFish(Fish fish, ContentDescriptor descriptor) { NativeContentAccess.Set(fish, "_excludeFromJournal", false); NativeContentAccess.Set(fish, "_isEndangered", false); NativeContentAccess.Set(fish, "_maxHp", descriptor.Health); NativeContentAccess.Set(fish, "_fullnessToRestore", 12); NativeContentAccess.Set(fish, "_hpToRestore", 8); } private static void ConfigureRod(FishingRod rod, FishingRod source, string key) { if (key != "deepwater_reel") { throw new InvalidOperationException("No rod mechanic is registered for " + key); } DeepwaterWinch.Configure(rod, source); Log.LogInfo((object)"Deepwater Winch: 45 m spool, native casting controls and automatic stronger, faster hauling under load."); } private static void ConfigureWeapon(Weapon weapon, Weapon source) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_0175: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) float num = NativeContentAccess.Get(source, "_timeBetweenShots"); WeaponInfo val = NativeContentAccess.Get(source, "_weaponInfo"); if (!NativeContentAccess.Finite(num) || num <= 0f || NativeContentAccess.Get(source, "_projectileCountPerShot") != 1 || val == null) { throw new InvalidOperationException("The native single-shot weapon parameters are outside the validated range."); } NativeContentAccess.Set(weapon, "_timeBetweenShots", 1.4f); NativeContentAccess.Set(weapon, "_projSpeed", 32f); NativeContentAccess.Set(weapon, "_spread", 0.12f); NativeContentAccess.Set(weapon, "_projectileCountPerShot", 1); NativeContentAccess.Set(weapon, "_recoilKnockback", 3); NativeContentAccess.Set(weapon, "_fullAuto", false); NativeContentAccess.Set(weapon, "_weaponInfo", (object?)new WeaponInfo { Weapon = weapon, ProjectileType = val.ProjectileType, ProjectileDamage = val.ProjectileDamage, ProjectileForce = val.ProjectileForce * 2.5f, ProjectileGravity = 2f, ShootVFX = val.ShootVFX, BoatForceOverride = val.BoatForceOverride }); NativeContentAccess.Set(weapon.Attachments, "_defaultAmmoPerMag", 1); NativeContentAccess.Set(weapon.Attachments, "_extendedAmmoPerMag", 2); foreach (Sight item in NativeContentAccess.Get>(weapon.Attachments, "_sights")) { if (!item.UseSniperUi) { NativeContentAccess.Set(item, "_adsPos", item.AdsPos + Vector3.down * 0.035f); } } Log.LogInfo((object)"Tidebreaker: one slow, heavy projectile, 1.4-second recovery, one-shot loading and amplified impact push."); } private void RequireReady() { if (disposed) { throw new ObjectDisposedException("ContentRegistry"); } if (!IsReady) { throw new InvalidOperationException("Expansion content is not ready."); } } public void Dispose() { if (disposed) { return; } disposed = true; IsReady = false; if (Active == this) { Active = null; } if (ownsRegistrar) { NativeItemRegistrar? obj = registrar; if (obj != null) { obj.Dispose(); } } visuals.Dispose(); items.Clear(); nativeArchetypes.Clear(); byId.Clear(); this.FishHooked = null; } } internal static class ContentSkinCatalog { internal static SkinPreset Create(Item source, string key) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)source.SkinPreset)) { throw new InvalidOperationException(((Object)source).name + " has no native palette to adapt."); } IReadOnlyList skins = source.SkinPreset.Skins; ItemSkin palette = Find(skins, (Rarity)1); ItemSkin palette2 = Find(skins, (Rarity)2); ItemSkin palette3 = Find(skins, (Rarity)3); bool num = key == "deepwater_reel"; bool flag = key == "tidebreaker_harpoon"; if (!num && !flag) { throw new ArgumentException("Unknown equipment skin key: " + key, "key"); } string text = (flag ? "Tidebreaker" : "Deepwater"); List value = new List { Finish(text + " Workshop", (Rarity)0, palette, (SkinNoise)0, flag ? 35 : 90, 1.4f, 0.3f), Finish(text + " Crosscurrent", (Rarity)1, palette, (SkinNoise)1, 45f, 5f, 0.4f), Finish(text + " Sounding Lines", (Rarity)2, palette2, (SkinNoise)0, 90f, 8f, 0.6f), Finish(text + " Stormglass", (Rarity)3, palette3, (SkinNoise)2, 25f, 3f, 0.8f) }; SkinPreset obj = ScriptableObject.CreateInstance(); ((Object)obj).name = "GamblersReach_" + key + "_Skins"; NativeContentAccess.Set(obj, "_skins", value); Object.DontDestroyOnLoad((Object)(object)obj); return obj; } private static ItemSkin Find(IReadOnlyList skins, Rarity rarity) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) ItemSkin[] array = skins.Where((ItemSkin skin) => ((ItemSkin)(ref skin)).Rarity == rarity && ((ItemSkin)(ref skin)).UseSkin).ToArray(); if (array.Length == 0) { throw new InvalidOperationException($"The native tool skin catalog lacks a {rarity} palette."); } return array[0]; } private static ItemSkin Finish(string name, Rarity rarity, ItemSkin palette, SkinNoise noise, float rotation, float noiseScale, float smoothness) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0049: Unknown result type (might be due to invalid IL or missing references) return new ItemSkin(name, rarity, true, false, noise, (SkinAffects)1, ((ItemSkin)(ref palette)).ColorOffset, ((ItemSkin)(ref palette)).ColorOffset2, new Vector2(0.25f, 0.75f), noiseScale, rotation, rotation, new Vector2(1f, 2f), 0.8f, smoothness, 0.1f, 0.25f); } } internal sealed class ContentVisuals : IDisposable { private readonly Dictionary normalMaterials = new Dictionary(); private readonly Dictionary shinyMaterials = new Dictionary(); private readonly Dictionary toolPalettes = new Dictionary(); private readonly Dictionary originalPreviewMaterials = new Dictionary(); private readonly List ownedAssets = new List(); private HarpoonProjectiles? harpoon; internal void ConfigureFish(Creature item, Item source, string key, Func factory) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_00f2: 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_017c: 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) GameObject visual = GetVisual(factory, key); Material[] materials; Mesh val = BuildPreview(visual, out materials); Dictionary shinyPalette = new Dictionary(); Color val2 = (Color)(key switch { "lantern_perch" => new Color(0.25f, 0.8f, 1f), "copperfin_bream" => new Color(0.8f, 0.3f, 0.45f), "velvet_eel" => new Color(0.3f, 0.95f, 0.6f), "crown_puffer" => new Color(0.65f, 0.45f, 1f), "compass_ray" => new Color(0.25f, 0.85f, 0.8f), _ => new Color(0.95f, 0.6f, 0.35f), }); foreach (Material item2 in materials.Distinct()) { Material val3 = new Material(item2) { name = ((Object)item2).name + " - " + key + " drip" }; string[] array = new string[2] { "_BaseColor", "_Color" }; foreach (string text in array) { if (val3.HasProperty(text)) { val3.SetColor(text, Color.Lerp(val3.GetColor(text), val2, 0.45f)); } } shinyPalette.Add(item2, val3); ownedAssets.Add((Object)(object)val3); } Material[] original = (((int)item.BossType == 0) ? materials.Select((Material material) => shinyPalette[material]).ToArray() : materials); try { materials = NativeFishMaterials.Create(source, materials, ownedAssets); original = (Material[])(((int)item.BossType == 0) ? ((Array)NativeFishMaterials.Create(source, original, ownedAssets)) : ((Array)materials)); ContentFishRig.Replace(item, visual, val, materials, original); SkinnedMeshRenderer[] componentsInChildren = ((Component)item).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { AuthoredCookSurface.Bind((Renderer)(object)componentsInChildren[i]); } ownedAssets.Add((Object)(object)val); SetPreview((Item)(object)item, source, val); normalMaterials.Add(((Item)item).ID, materials); shinyMaterials.Add(((Item)item).ID, original); } catch { Object.Destroy((Object)(object)val); throw; } finally { Object.Destroy((Object)(object)visual); } } internal void ConfigureRod(FishingRod item, Item source, string key, Func factory) { ConfigureAuthoredTool((Tool)(object)item, source, key, factory); } internal void ConfigureWeapon(Weapon item, Item source, string key, Func factory) { ConfigureAuthoredTool((Tool)(object)item, source, key, factory); } private void ConfigureAuthoredTool(Tool item, Item source, string key, Func factory) { //IL_010a: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_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_0191: Unknown result type (might be due to invalid IL or missing references) GameObject visual = GetVisual(factory, key); Material[] palette; Mesh val = BuildPreview(visual, out palette); Mesh val2 = Object.Instantiate(val); try { SkinnedMeshRenderer renderer = AuthoredToolRig.Replace(item, visual, val2, palette); Weapon val3 = (Weapon)(object)((item is Weapon) ? item : null); if (val3 != null) { harpoon = new HarpoonProjectiles(val3, visual); } SkinPreset val4 = ContentSkinCatalog.Create(source, key); ownedAssets.Add((Object)(object)val4); NativeContentAccess.Set(item, "_skinPreset", val4); Material[][] array = Enumerable.Range(0, 4).Select(delegate(int index) { //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_005c: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_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_00db: Unknown result type (might be due to invalid IL or missing references) if (index == 0) { return palette; } Dictionary changed = new Dictionary(); foreach (Material item2 in palette.Distinct()) { Material val9 = new Material(item2) { name = ((Object)item2).name + " - finish " + index }; Color val10 = (Color)(index switch { 2 => new Color(0.56f, 0.68f, 0.76f), 1 => new Color(0.1f, 0.48f, 0.46f), _ => new Color(0.35f, 0.21f, 0.53f), }); float num = ((item2.GetFloat("_Metallic") > 0.1f) ? 0.65f : 0.12f); val9.SetColor("_BaseColor", Color.Lerp(item2.GetColor("_BaseColor"), val10, num)); val9.SetFloat("_Smoothness", Mathf.Clamp01(item2.GetFloat("_Smoothness") + (float)index * 0.08f)); changed.Add(item2, val9); ownedAssets.Add((Object)(object)val9); } return palette.Select((Material material) => changed[material]).ToArray(); }).ToArray(); ((Component)item).gameObject.AddComponent().Configure((Renderer)(object)renderer, array); toolPalettes.Add(((Item)item).ID, array); ownedAssets.Add((Object)(object)val2); ownedAssets.Add((Object)(object)val); SetPreview((Item)(object)item, source, val); Vector3 val5 = ((item is FishingRod) ? new Vector3(0f, 90f, 30f) : new Vector3(0f, 90f, -10f)); float inventoryMeshScale = ((Item)item).InventoryMeshScale; Vector3 inventoryMeshPos = source.InventoryMeshPos; Quaternion val6 = Quaternion.Euler(source.InventoryMeshRot); Bounds bounds = source.Mesh.bounds; Vector3 val7 = inventoryMeshPos + val6 * (((Bounds)(ref bounds)).center * source.InventoryMeshScale); NativeContentAccess.Set(item, "_inventoryMeshRot", val5); Quaternion val8 = Quaternion.Euler(val5); bounds = val.bounds; NativeContentAccess.Set(item, "_inventoryMeshPos", val7 - val8 * (((Bounds)(ref bounds)).center * inventoryMeshScale)); } catch { Object.Destroy((Object)(object)val2); Object.Destroy((Object)(object)val); throw; } finally { Object.Destroy((Object)(object)visual); } } private static GameObject GetVisual(Func factory, string key) { GameObject val = factory(key); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("Art factory returned no visual for " + key + "."); } if (val.GetComponentsInChildren(true).Length != 0 || val.GetComponentsInChildren(true).Length != 0 || val.GetComponentsInChildren(true).Length != 0) { Object.Destroy((Object)(object)val); throw new InvalidOperationException("Visual " + key + " must contain only non-networked, non-physical art."); } val.SetActive(false); return val; } private static Mesh BuildPreview(GameObject visual, out Material[] materials) { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_00c6: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) List list = new List(); List list2 = new List(); MeshFilter[] componentsInChildren = visual.GetComponentsInChildren(true); foreach (MeshFilter val in componentsInChildren) { MeshRenderer component = ((Component)val).GetComponent(); Mesh sharedMesh = val.sharedMesh; if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)sharedMesh) || !sharedMesh.isReadable) { throw new InvalidOperationException("Original visual " + ((Object)visual).name + " contains an unreadable or unrendered mesh."); } Material[] sharedMaterials = ((Renderer)component).sharedMaterials; if (sharedMaterials.Length != sharedMesh.subMeshCount) { throw new InvalidOperationException("Material/submesh count differs on " + ((Object)val).name + "."); } for (int j = 0; j < sharedMesh.subMeshCount; j++) { if (!Object.op_Implicit((Object)(object)sharedMaterials[j])) { throw new InvalidOperationException("Original visual " + ((Object)visual).name + " has a missing material."); } CombineInstance item = default(CombineInstance); ((CombineInstance)(ref item)).mesh = sharedMesh; ((CombineInstance)(ref item)).subMeshIndex = j; ((CombineInstance)(ref item)).transform = visual.transform.worldToLocalMatrix * ((Component)val).transform.localToWorldMatrix; list.Add(item); list2.Add(sharedMaterials[j]); } } if (list.Count == 0) { throw new InvalidOperationException("Original visual " + ((Object)visual).name + " has no mesh."); } Mesh val2 = new Mesh { name = ((Object)visual).name + " - inventory", indexFormat = (IndexFormat)1 }; try { val2.CombineMeshes(list.ToArray(), false, true); val2.RecalculateBounds(); materials = list2.ToArray(); return val2; } catch { Object.Destroy((Object)(object)val2); throw; } } private static void SetPreview(Item item, Item source, Mesh mesh) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_00b4: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = source.Mesh.bounds; float num = Largest(((Bounds)(ref bounds)).size); bounds = mesh.bounds; float num2 = Largest(((Bounds)(ref bounds)).size); float num3 = source.InventoryMeshScale * num / num2; if (!NativeContentAccess.Finite(num3) || num3 <= 0f || num2 <= 0.0001f) { throw new InvalidOperationException("Invalid inventory dimensions for " + ((Object)item).name + "."); } NativeContentAccess.Set(item, "_mesh", mesh); NativeContentAccess.Set(item, "_inventoryMeshScale", Mathf.Clamp(num3, 0.01f, 100f)); NativeContentAccess.Set(item, "_inventoryMeshPos", source.InventoryMeshPos); NativeContentAccess.Set(item, "_inventoryMeshRot", source.InventoryMeshRot); } private static float Largest(Vector3 size) { //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 Mathf.Max(size.x, Mathf.Max(size.y, size.z)); } internal bool ApplyPreview(Renderer renderer, Item? item, bool showShiny, byte? skinIndex) { if (!Object.op_Implicit((Object)(object)renderer)) { throw new InvalidOperationException("Native item preview has no renderer."); } if (Object.op_Implicit((Object)(object)item) && toolPalettes.TryGetValue(item.ID, out Material[][] value)) { AuthoredCookSurface.Restore(renderer); if (!Object.op_Implicit((Object)(object)item.SkinPreset)) { throw new InvalidOperationException("Registered native tool " + ((Object)item).name + " lost its SkinPreset."); } int num = skinIndex ?? item.CurSkin; if (num >= item.SkinPreset.Skins.Count) { throw new ArgumentOutOfRangeException("skinIndex", "Unknown registered tool finish."); } if (!originalPreviewMaterials.ContainsKey(renderer)) { originalPreviewMaterials.Add(renderer, renderer.sharedMaterials); } renderer.sharedMaterials = value[num]; return true; } Material[] sharedMaterials; if (Object.op_Implicit((Object)(object)item) && normalMaterials.TryGetValue(item.ID, out Material[] value2)) { if (!originalPreviewMaterials.ContainsKey(renderer)) { originalPreviewMaterials.Add(renderer, renderer.sharedMaterials); } if (!showShiny) { Creature val = (Creature)(object)((item is Creature) ? item : null); if (val == null || !val.IsDrip) { sharedMaterials = value2; goto IL_0138; } } sharedMaterials = shinyMaterials[item.ID]; goto IL_0138; } RestorePreview(renderer); return false; IL_0138: renderer.sharedMaterials = sharedMaterials; AuthoredCookSurface.Bind(renderer); ShaderManager.SetItemCookness(renderer, item.Cookness); return true; } internal void RestorePreview(Renderer renderer) { if (Object.op_Implicit((Object)(object)renderer) && originalPreviewMaterials.TryGetValue(renderer, out Material[] value)) { AuthoredCookSurface.Restore(renderer); renderer.sharedMaterials = value; originalPreviewMaterials.Remove(renderer); } } public void Dispose() { harpoon?.Dispose(); harpoon = null; foreach (KeyValuePair originalPreviewMaterial in originalPreviewMaterials) { if (Object.op_Implicit((Object)(object)originalPreviewMaterial.Key)) { originalPreviewMaterial.Key.sharedMaterials = originalPreviewMaterial.Value; } } foreach (Object ownedAsset in ownedAssets) { if (Object.op_Implicit(ownedAsset)) { Object.Destroy(ownedAsset); } } ownedAssets.Clear(); originalPreviewMaterials.Clear(); toolPalettes.Clear(); normalMaterials.Clear(); shinyMaterials.Clear(); } } internal sealed class DeepwaterWinch : MonoBehaviour { internal const byte ItemId = 187; internal const float LoadedReelRate = 1.8f; internal const float LoadedSpring = 1.65f; internal const float LoadedDamper = 1.4f; internal const float CastRange = 1.5f; internal const string FreeLabel = "DEEPWATER - Long spool - 45 m line"; internal const string LoadedLabel = "DEEPWATER - Power haul - stronger line, faster reel"; internal const string Description = "A 45 m spool with automatic power haul: 65% stronger line spring, 40% more damping and 80% faster held-reel cadence on a hooked catch. Unhooked casting keeps the native controls. No bonus damage, exclusive catches, or quest requirement."; [SerializeField] private FishingRod rod; [SerializeField] private SpringJoint line; [SerializeField] private float normalSpring; [SerializeField] private float normalDamper; [SerializeField] private float normalReelRate; [SerializeField] private bool configured; internal bool LowGear { get; private set; } internal float FreeReelRate => normalReelRate; internal float FreeSpring => normalSpring; internal string Status { get { if (!LowGear) { return "DEEPWATER - Long spool - 45 m line"; } return "DEEPWATER - Power haul - stronger line, faster reel"; } } internal static DeepwaterWinch Configure(FishingRod target, FishingRod donor) { if (!Object.op_Implicit((Object)(object)target) || !Object.op_Implicit((Object)(object)donor) || (Object)(object)target == (Object)(object)donor || ((Item)target).ID != 187 || ((Item)donor).ID != 61 || !(target is FishingRodCast) || !(donor is FishingRodCast) || ((Component)target).gameObject.activeInHierarchy || Object.op_Implicit((Object)(object)((Component)target).GetComponent())) { throw new InvalidOperationException("The winch requires an inactive item-187 clone of native casting rod 61."); } SpringJoint val = NativeContentAccess.Get(target.Bait, "_joint"); SpringJoint val2 = NativeContentAccess.Get(donor.Bait, "_joint"); if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val == (Object)(object)val2 || !Positive(val2.spring) || !NativeContentAccess.Finite(val2.damper) || val2.damper < 0f) { throw new InvalidOperationException("The winch must own its native bait spring."); } float value = NativeContentAccess.Get(donor, "_holdReelSpeed"); float num = NativeContentAccess.Get(donor, "_maxLineLength") * 1.5f; if (!Positive(value) || !Positive(num) || num <= NativeContentAccess.Get(target, "_minLineLength")) { throw new InvalidOperationException("The native casting/reeling bounds are invalid."); } string[] array = new string[5] { "_lineReelStepLength", "_lineReelDamping", "_lineThrowSpeed", "_reelMultiIncreaseSpeed", "_reelMultiDecreaseSpeed" }; foreach (string name in array) { NativeContentAccess.Set(target, name, NativeContentAccess.Get(donor, name)); } NativeContentAccess.Set(target, "_maxLineLength", num); DeepwaterWinch deepwaterWinch = ((Component)target).gameObject.AddComponent(); deepwaterWinch.rod = target; deepwaterWinch.line = val; deepwaterWinch.normalSpring = val2.spring; deepwaterWinch.normalDamper = val2.damper; deepwaterWinch.normalReelRate = value; deepwaterWinch.configured = true; deepwaterWinch.Apply(loaded: false); return deepwaterWinch; } internal void RefreshLoad() { if (!configured || !Object.op_Implicit((Object)(object)rod) || !Object.op_Implicit((Object)(object)line) || ((Item)rod).ID != 187) { throw new InvalidOperationException("The spawned Deepwater Winch lost its configured native line."); } Item val = (Object.op_Implicit((Object)(object)rod.Bait.ItemOnBait) ? rod.Bait.ItemOnBait : rod.Bait.ServerItemOnBait); bool loaded = Object.op_Implicit((Object)(object)((Item)rod).Holder) && Object.op_Implicit((Object)(object)val) && !val.IsDestroying && !((NetworkBehaviour)val).IsDeinitializing; Apply(loaded); } private void Apply(bool loaded) { LowGear = loaded; line.spring = normalSpring * (loaded ? 1.65f : 1f); line.damper = normalDamper * (loaded ? 1.4f : 1f); NativeContentAccess.Set(rod, "_holdReelSpeed", normalReelRate * (loaded ? 1.8f : 1f)); } private void OnDisable() { if (configured && Object.op_Implicit((Object)(object)rod) && Object.op_Implicit((Object)(object)line)) { Apply(loaded: false); } } private static bool Positive(float value) { if (NativeContentAccess.Finite(value)) { return value > 0f; } return false; } } [HarmonyPatch(typeof(FishingRod), "FixedUpdate")] internal static class DeepwaterNativeLoadGear { private static void Prefix(FishingRod __instance) { if (((Item)__instance).ID == 187) { DeepwaterWinch component = ((Component)__instance).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { throw new InvalidOperationException("Configure DeepwaterWinch before registering rod 187."); } component.RefreshLoad(); } } } [HarmonyPatch(typeof(ItemUI), "ShowSpecificItemInfo", new Type[] { typeof(HeldInfo), typeof(bool) })] internal static class DeepwaterNativeHeldInfo { private static void Postfix(ItemUI __instance) { Item val = (Object.op_Implicit((Object)(object)Player.LocalPlayer) ? Player.LocalPlayer.Holding.HeldItem : null); if (!Object.op_Implicit((Object)(object)val) || val.ID != 187) { return; } DeepwaterWinch component = ((Component)val).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { TMP_Text val2 = NativeContentAccess.Get(__instance, "_itemInfoText"); string text = val2.text.Replace("\nDEEPWATER - Long spool - 45 m line", "").Replace("\nDEEPWATER - Power haul - stronger line, faster reel", "") + "\n" + component.Status; if (val2.text != text) { val2.text = text; } } } } internal static class HarborDefinition { internal static ExpansionDefinition Value { get; } = Load(); internal static InterludeRoutePolicy Routes { get; } = new InterludeRoutePolicy(Value.NativeUnlockCount, Value.NextIslandId); internal static ItemDefinition Item(string key) { return Value.Items.Single((ItemDefinition item) => item.Key == key); } internal static NpcDefinition Npc(string key) { return Value.Npcs.Single((NpcDefinition npc) => npc.Key == key); } private static ExpansionDefinition Load() { //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_0047: Expected O, but got Unknown using Stream stream = typeof(HarborDefinition).Assembly.GetManifestResourceStream("GamblersReach.content.json") ?? throw new InvalidDataException("The expansion content definition was not embedded in this build."); using StreamReader streamReader = new StreamReader(stream); ExpansionDefinition obj = JsonConvert.DeserializeObject(streamReader.ReadToEnd(), new JsonSerializerSettings { MissingMemberHandling = (MissingMemberHandling)1 }) ?? throw new InvalidDataException("The expansion content definition is empty."); obj.Validate(); if (obj.GameBuild != "25127368") { throw new NotSupportedException("The native adapter requires How to Fish build 25127368."); } return obj; } } internal sealed class HarborLureCatalog : IDisposable { internal static readonly string[] Keys = HarborDefinition.Value.Lures.Select((LureDefinition lure) => lure.Key).ToArray(); private NativeLureCatalog? catalog; private bool ownsCatalog; private bool disposed; internal static HarborLureCatalog? Current { get; private set; } internal bool IsReady { get { if (!disposed) { NativeLureCatalog? obj = catalog; if (obj == null) { return false; } return obj.IsReady; } return false; } } internal int OriginalBaitCount => 17; internal string RegistrationHash => RequireCatalog().RegistrationHash; internal byte HarborIndex => Index("harbor_lure"); internal byte BarracudaIndex => Index("barracuda_lure"); internal byte AnglerIndex => Index("angler_lure"); internal BaitInfo Get(string key) { return RequireCatalog().Get(key).Bait; } internal byte Index(string key) { return RequireCatalog().Index(key); } internal bool Owns(BaitInfo? bait) { if (IsReady) { return catalog.Owns(bait); } return false; } internal bool IsPurchasable(BaitInfo? bait) { if (Owns(bait)) { return bait.Cost > 0; } return false; } internal void Bind(NativeLureCatalog registered) { if (disposed || catalog != null || Current != null || registered.PackKey != "gamblers_reach" || !registered.IsReady) { throw new InvalidOperationException("Bind the completed shared harbor lure catalog exactly once."); } catalog = registered; Current = this; Validate(); } internal void Initialize(Func factory) { Initialize(EncounterCatalog.Current ?? throw new InvalidOperationException("Register encounters first."), factory); } internal void Initialize(EncounterCatalog encounters, Func factory) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_0085: 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_00a9: 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_00d3: Expected O, but got Unknown //IL_00f7: 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) if (!encounters.IsReady || factory == null) { throw new InvalidOperationException("Registered encounters and original lure art are required."); } NativeLureCatalog val = new NativeLureCatalog("gamblers_reach", (ManualLogSource)null); ownsCatalog = true; try { Fishable val4 = default(Fishable); for (int i = 0; i < HarborDefinition.Value.Lures.Count; i++) { LureDefinition val2 = HarborDefinition.Value.Lures[i]; LureDefinition val3 = new LureDefinition { Key = val2.Key, Id = checked((byte)(OriginalBaitCount + i)), Title = val2.Title, Description = val2.Description, Cost = val2.Cost, LossPercent = val2.LossPercent, CatchTimeMin = val2.CatchTimeMin, CatchTimeMax = val2.CatchTimeMax, RequireReeling = true, Art = AuthoredArt.Take(factory(val2.AssetKey), val2.Key) }; foreach (CatchDefinition @catch in val2.Catches) { if (!NativeContentDirectory.TryResolveFishable(ContentReference.Pack("gamblers_reach", @catch.Item), ref val4)) { throw new InvalidOperationException("The harbor lure catch has no registered shared prefab: " + @catch.Item); } val3.Catches.Add(new CatchEntry(val4, @catch.Weight)); } val.Add(val3); } val.Commit(); Bind(val); } catch { val.Dispose(); throw; } } internal bool TryDescribe(BaitInfo bait, out string title, out string description) { return RequireCatalog().TryDescribe(bait, ref title, ref description); } internal bool ApplyPreview(Renderer renderer, BaitInfo? bait) { if (Object.op_Implicit((Object)(object)bait)) { return RequireCatalog().ApplyPreview(renderer, bait); } RestorePreview(renderer); return false; } internal void RestorePreview(Renderer renderer) { RequireCatalog().RestorePreview(renderer); } internal void ApplyBait(Bait bait) { RequireCatalog().ApplyBait(bait); } internal void ConfigureStand(BaitPurchasable stand, string key) { RequireCatalog().ConfigureStand(stand, key); } internal void EnsureInventoryCapacity(PlayerInventory inventory) { RequireCatalog().EnsureInventoryCapacity(inventory); } internal void Validate() { RequireCatalog().Validate(); } private NativeLureCatalog RequireCatalog() { if (!IsReady) { throw new InvalidOperationException("The harbor lure catalog is not ready."); } return catalog; } public void Dispose() { if (disposed) { return; } disposed = true; if (Current == this) { Current = null; } if (ownsCatalog) { NativeLureCatalog? obj = catalog; if (obj != null) { obj.Dispose(); } } } } internal static class HarborPackDefinition { internal const string PackKey = "gamblers_reach"; internal const string IslandReference = "gamblers_reach:harbor"; internal const string ContentHook = "gamblers_reach_art"; internal const string WorldHook = "gamblers_reach_world"; internal const string QuestHook = "gamblers_reach_chapter"; internal const string LootHook = "gamblers_reach_combat"; internal const byte AnglerFoodId = 194; internal const ushort FoodCollectionId = 48189; internal static bool AcceptSavedRevision(SavedPack saved, IReadOnlyDictionary code) { return HarborSaveRevision.Accept(saved, code); } internal static PackSource Create(Vector3 position) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01c2: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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_0211: Expected O, but got Unknown //IL_0216: Expected O, but got Unknown //IL_021c: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Invalid comparison between Unknown and I4 //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Invalid comparison between Unknown and I4 //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0511: 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_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Expected O, but got Unknown //IL_0573: Expected O, but got Unknown //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_02b8: 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_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Expected I4, but got Unknown //IL_02d9: 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_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: 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_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_036b: 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_0669: Expected O, but got Unknown //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Invalid comparison between Unknown and I4 //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: 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_0703: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Expected O, but got Unknown //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Expected O, but got Unknown //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Invalid comparison between Unknown and I4 //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_07a5: Unknown result type (might be due to invalid IL or missing references) //IL_07ac: 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_07c2: Unknown result type (might be due to invalid IL or missing references) //IL_07ea: 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_07fc: Unknown result type (might be due to invalid IL or missing references) //IL_0813: Expected O, but got Unknown //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Invalid comparison between Unknown and I4 //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Expected O, but got Unknown //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Expected O, but got Unknown //IL_0850: Unknown result type (might be due to invalid IL or missing references) //IL_0855: Unknown result type (might be due to invalid IL or missing references) //IL_086c: Unknown result type (might be due to invalid IL or missing references) //IL_086f: Unknown result type (might be due to invalid IL or missing references) //IL_097d: Unknown result type (might be due to invalid IL or missing references) //IL_0982: Unknown result type (might be due to invalid IL or missing references) //IL_098d: Unknown result type (might be due to invalid IL or missing references) //IL_099d: Unknown result type (might be due to invalid IL or missing references) //IL_09a4: Unknown result type (might be due to invalid IL or missing references) //IL_09af: Unknown result type (might be due to invalid IL or missing references) //IL_09b6: Unknown result type (might be due to invalid IL or missing references) //IL_09bb: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_09d2: Unknown result type (might be due to invalid IL or missing references) //IL_09de: Expected O, but got Unknown //IL_09e8: Expected O, but got Unknown //IL_0a14: Unknown result type (might be due to invalid IL or missing references) //IL_0a1a: Expected O, but got Unknown //IL_0887: Unknown result type (might be due to invalid IL or missing references) //IL_088e: Unknown result type (might be due to invalid IL or missing references) //IL_0899: 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_08dc: Unknown result type (might be due to invalid IL or missing references) //IL_08e1: Unknown result type (might be due to invalid IL or missing references) //IL_08e8: Unknown result type (might be due to invalid IL or missing references) //IL_08fa: Unknown result type (might be due to invalid IL or missing references) //IL_0906: Expected O, but got Unknown //IL_090b: Unknown result type (might be due to invalid IL or missing references) //IL_0912: 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_091a: Unknown result type (might be due to invalid IL or missing references) //IL_092a: Unknown result type (might be due to invalid IL or missing references) //IL_092d: Unknown result type (might be due to invalid IL or missing references) //IL_0951: Expected O, but got Unknown //IL_095b: Expected O, but got Unknown ExpansionDefinition value = HarborDefinition.Value; string directoryName = Path.GetDirectoryName(typeof(Plugin).Assembly.Location); string hash = PackSource.FileHash(Path.Combine(directoryName, "gamblersreach.models")).ToLowerInvariant(); PackDefinition val = new PackDefinition { Key = "gamblers_reach", Title = value.Title, Version = "0.8.4", GameBuild = value.GameBuild, ExtensionHooks = new List { "gamblers_reach_art", "gamblers_reach_world", "gamblers_reach_chapter", "gamblers_reach_combat" }, Collections = new List { new NetworkCollectionRecipe { Key = "equipment", Id = 48187 }, new NetworkCollectionRecipe { Key = "encounters", Id = 48188 }, new NetworkCollectionRecipe { Key = "food", Id = 48189 } }, Islands = new List { new IslandRecipe { Key = "harbor", Id = checked((byte)value.IslandId), Title = value.Title, Implementation = (RecipeImplementation)1, ExtensionHook = "gamblers_reach_world", SceneBundle = value.SceneBundle, SceneSha256 = PackSource.FileHash(Path.Combine(directoryName, value.SceneBundle)).ToLowerInvariant(), SceneName = value.SceneName, SceneRoot = "IslandHolder", UnlockThreshold = value.NativeUnlockCount, PlayerSpawn = Marker("PlayerSpawnPoint"), BoatSpawn = Marker("BoatSpawnPoint"), WorldMapPosition = new VectorRecipe { X = position.x, Y = WaterManager.WaterHeight, Z = position.z }, Route = new RouteRecipe { AfterIsland = "native:4", BeforeIsland = "native:5", Priority = 0 } } } }; ushort num = 0; ushort num2 = 0; foreach (ItemDefinition item in value.Items) { bool flag = (int)item.Kind == 3 || (int)item.Kind == 4; ItemRecipe val2 = new ItemRecipe(); ((PackRecipe)val2).Key = item.Key; val2.Id = checked((byte)item.Id); val2.Title = item.Title; ItemRecipe val3 = val2; ItemKind kind = item.Kind; val3.Kind = (PackItemKind)((int)kind switch { 0 => 2, 3 => 3, 2 => 4, 1 => 5, _ => 0, }); ((PackRecipe)val2).Implementation = (RecipeImplementation)1; ((PackRecipe)val2).ExtensionHook = "gamblers_reach_art"; val2.NativeDonor = "native:" + item.NativeDonorId; val2.Worth = item.Worth; val2.Cost = item.Cost; val2.Health = (((int)item.Kind == 0) ? new float?(item.Health) : (((int)item.Kind == 3) ? new float?(value.Encounters.Single((EncounterDefinition val6) => val6.Item == item.Key).Health) : ((float?)null))); val2.Network = new NetworkBinding { CollectionId = (ushort)(flag ? 48188 : 48187), Slot = (flag ? num2++ : num++) }; val2.Art = Art(item.AssetKey, hash); ItemRecipe val4 = val2; if ((int)item.Kind == 2) { val4.Weapon = new WeaponRecipe { DamageScale = 2.5f, ShotDelaySeconds = 1.4f }; } if ((int)item.Kind == 1) { val4.Rod = new RodRecipe { LineStrengthScale = 1.65f, ReelingSpeedScale = 1.8f }; } val.Items.Add(val4); } val.Items.Add(new ItemRecipe { Key = "angler_fillet", Id = 194, Title = "Angler Fillet", Kind = (PackItemKind)1, NativeDonor = "native:84", Worth = 1800, Cost = 0, FoodValue = 25f, HealthRestored = 20f, Edible = true, Cookable = true, Network = new NetworkBinding { CollectionId = 48189, Slot = 0 } }); for (int num3 = 0; num3 < value.Lures.Count; num3++) { LureDefinition val5 = value.Lures[num3]; val.Lures.Add(new LureRecipe { Key = val5.Key, Id = checked((byte)(17 + num3)), Title = val5.Title, Description = val5.Description, NativeVisualDonor = "native:10", Art = Art(val5.AssetKey, hash), Cost = val5.Cost, LossPercent = val5.LossPercent, CatchTimeMin = val5.CatchTimeMin, CatchTimeMax = val5.CatchTimeMax, Catches = ((IEnumerable)val5.Catches).Select((Func)((CatchDefinition entry) => new CatchRecipe { Item = Ref(entry.Item), Weight = entry.Weight })).ToList() }); } foreach (NpcDefinition npc in value.Npcs) { val.Npcs.Add(new NpcRecipe { Key = npc.Key, Id = checked((byte)npc.Id), Title = npc.Title, Implementation = (RecipeImplementation)1, ExtensionHook = "gamblers_reach_world", Role = (PackNpcRole)2, Island = "gamblers_reach:harbor", Placement = Marker(value.Placements.Single((PlacementDefinition val6) => (int)val6.Kind == 2 && val6.Reference == npc.Key).Marker) }); } foreach (ShopDefinition shop in value.Shops) { val.Shops.Add(new ShopRecipe { Key = "sale_" + shop.Key, Implementation = (RecipeImplementation)1, ExtensionHook = "gamblers_reach_world", Island = "gamblers_reach:harbor", Placement = Marker(value.Placements.Single((PlacementDefinition val6) => (int)val6.Kind == 3 && val6.Reference == shop.Key).Marker), Kind = ShopKindFor(shop), Content = ShopContent(shop) }); } foreach (QuestStageDefinition quest in value.Quests) { val.Quests.Add(new QuestRecipe { Key = "quest_" + quest.Key, Title = (((int)quest.RewardKind == 0) ? "A light for the deep" : "A course beyond the harbor"), Implementation = (RecipeImplementation)1, ExtensionHook = "gamblers_reach_chapter", Requires = (string.IsNullOrEmpty(quest.Requires) ? new List() : new List { Ref("quest_" + quest.Requires) }), Objectives = new List { new QuestObjectiveRecipe { Kind = (QuestObjectiveKind)0, Item = Ref(quest.Trophy), Count = 1 } }, Rewards = new List { new QuestRewardRecipe { Kind = (QuestRewardKind)(((int)quest.RewardKind == 0) ? 1 : 2), Content = (((int)quest.RewardKind == 0) ? Ref(quest.Reward) : "native:5") } } }); } val.Loot.Add(new LootRecipe { Key = "angler_loot", Creature = Ref("deepsea_angler"), Implementation = (RecipeImplementation)1, ExtensionHook = "gamblers_reach_combat", Drops = new List { new LootDropRecipe { Item = Ref("angler_fillet"), FixedQuantity = 2, PerPlayerQuantity = 1 } } }); return new PackSource(val, directoryName, new Assembly[2] { typeof(Plugin).Assembly, typeof(ChapterProgress).Assembly }); } private static string Ref(string key) { return "gamblers_reach:" + key; } private static PlacementRecipe Marker(string name) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown return new PlacementRecipe { Marker = name }; } private static ArtRecipe Art(string key, string hash) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new ArtRecipe { Bundle = "gamblersreach.models", Sha256 = hash, Prefab = key }; } private static PackShopKind ShopKindFor(ShopDefinition shop) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected I4, but got Unknown //IL_0038: 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_0040: 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_0048: 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_0050: 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_007b: 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) ShopKind kind = shop.Kind; switch ((int)kind) { case 0: case 5: return (PackShopKind)0; case 1: case 6: return (PackShopKind)1; case 2: return (PackShopKind)2; case 3: return (PackShopKind)3; case 4: return (PackShopKind)4; case 7: return (PackShopKind)5; case 8: return (PackShopKind)6; case 9: return (PackShopKind)7; default: throw new InvalidOperationException("Unknown harbor shop family: " + ((object)shop.Kind/*cast due to .constrained prefix*/).ToString()); } } private static string ShopContent(ShopDefinition shop) { //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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected I4, but got Unknown ShopKind kind = shop.Kind; switch ((int)kind) { case 0: case 1: return Ref(shop.Reference); case 5: case 6: return "native:" + shop.NativeId; case 3: return "native:9"; case 7: return "native:12"; case 8: return "native:3"; case 4: return "native:0"; case 9: return (shop.Key == "legacy_big_motor") ? "native:1" : "native:2"; case 2: return "native:" + GameInfo.GetIndexOfAttachment(GameInfo.AllAttachments.Single((AttachmentInfo info) => "harpoon_" + new string((from character in ((Object)info).name.ToLowerInvariant() select (!char.IsLetterOrDigit(character)) ? '_' : character).ToArray()) == shop.Reference)); default: throw new InvalidOperationException("Unknown harbor shop content: " + shop.Key); } } } [HarmonyPatch(typeof(QuestInteractable), "SetQuest")] internal static class HarborRewardPreview { private static void Prefix(QuestInteractable __instance) { MeshFilter val = NativeContentAccess.Get(__instance, "_meshToUpdate"); HarborLureCatalog.Current?.ApplyPreview(((Component)val).GetComponent(), null); } private static void Postfix(QuestInteractable __instance, NPCQuest quest) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)quest.Type == 0) { MeshFilter val = NativeContentAccess.Get(__instance, "_meshToUpdate"); HarborLureCatalog.Current?.ApplyPreview(((Component)val).GetComponent(), quest.BaitToReceive); } } } internal sealed class HarborStaticVisuals : IDisposable { private readonly List meshes = new List(); private readonly Dictionary palettes = new Dictionary(); private readonly Dictionary originals = new Dictionary(); internal static GameObject GetArt(Func factory, string key) { GameObject val = factory(key); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("The authored harbor visual is missing: " + key); } if (val.GetComponentsInChildren(true).Length != 0 || val.GetComponentsInChildren(true).Length != 0 || val.GetComponentsInChildren(true).Length != 0) { Object.Destroy((Object)(object)val); throw new InvalidOperationException("Harbor art must have no behaviors or physics: " + key); } val.SetActive(false); return val; } internal static Vector3 Marker(GameObject art, string name) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) Transform val = art.transform.Find("marker_" + name); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("The authored harbor asset is missing marker_" + name); } return art.transform.InverseTransformPoint(val.position); } internal static Mesh BuildMesh(GameObject art, Matrix4x4 transform, out Material[] materials) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return AuthoredArt.Combine(art, transform, ref materials, ((Object)art).name + " - authored combined"); } internal void ConfigureTrophy(Item item, Item source, string key, Func factory) { //IL_006d: 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_00b4: 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_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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029a: 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_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) GameObject art = GetArt(factory, key); try { MeshRenderer val = NativeContentAccess.Get>(item, "_renderers").OfType().Single(); MeshFilter component = ((Component)val).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || item is Creature || item is Tool) { throw new InvalidOperationException("The verified ordinary native trophy rig changed."); } HandTransforms handTransformsRight = item.HandTransformsRight; Vector3 val2 = ((handTransformsRight != null && handTransformsRight.Exists && Object.op_Implicit((Object)(object)handTransformsRight.Parent)) ? handTransformsRight.Parent.TransformPoint(handTransformsRight.HandPos) : ((Component)item).transform.position); Vector3 val3 = Marker(art, "grip_right"); Quaternion val4 = ((key == "barracuda_jaw") ? Quaternion.Euler(0f, -90f, 0f) : Quaternion.identity); Quaternion val5 = ((Component)item).transform.rotation * Quaternion.Inverse(Quaternion.Euler(item.HeldRot)) * val4; Matrix4x4 val6 = Matrix4x4.TRS(val2 - val5 * val3, val5, Vector3.one); Material[] materials; Mesh val7 = BuildMesh(art, ((Component)val).transform.worldToLocalMatrix * val6, out materials); meshes.Add(val7); Material[] materials2; Mesh val8 = BuildMesh(art, Matrix4x4.identity, out materials2); meshes.Add(val8); component.sharedMesh = val7; ((Renderer)val).sharedMaterials = materials; ((Renderer)val).enabled = true; NativeContentAccess.Set(item, "_mesh", val8); NativeContentAccess.Set(item, "_skinPreset", null); NativeContentAccess.Set(item, "_skinRenderers", new List()); float inventoryMeshScale = source.InventoryMeshScale; Bounds bounds = source.Mesh.bounds; Vector3 val9 = ((Bounds)(ref bounds)).size; float num = inventoryMeshScale * ((Vector3)(ref val9)).magnitude; bounds = val8.bounds; val9 = ((Bounds)(ref bounds)).size; float num2 = num / ((Vector3)(ref val9)).magnitude; if (!NativeContentAccess.Finite(num2) || num2 <= 0f) { throw new InvalidOperationException("Invalid trophy dimensions."); } NativeContentAccess.Set(item, "_inventoryMeshScale", num2); NativeContentAccess.Set(item, "_inventoryMeshRot", (object)new Vector3(10f, 145f, 0f)); Quaternion val10 = Quaternion.Euler(item.InventoryMeshRot); bounds = val8.bounds; NativeContentAccess.Set(item, "_inventoryMeshPos", -(val10 * (((Bounds)(ref bounds)).center * num2))); Collider[] array = NativeContentAccess.Get(item, "_worldColliders"); if (array.Length == 1) { Collider obj = array[0]; BoxCollider val11 = (BoxCollider)(object)((obj is BoxCollider) ? obj : null); if (val11 != null) { Bounds val12 = BoundsIn(val7, ((Component)val).transform, ((Component)val11).transform); val11.center = ((Bounds)(ref val12)).center; val11.size = ((Bounds)(ref val12)).size + Vector3.one * 0.015f; Collider val13 = NativeContentAccess.Get(item, "_pickUpCollider"); SphereCollider val14 = (SphereCollider)(object)((val13 is SphereCollider) ? val13 : null); if (val14 == null || (Object)(object)val13 == (Object)(object)val11) { throw new InvalidOperationException("The native trophy pickup trigger changed."); } Bounds val15 = BoundsIn(val7, ((Component)val).transform, ((Component)val14).transform); val14.center = ((Bounds)(ref val15)).center; val9 = ((Bounds)(ref val15)).extents; val14.radius = ((Vector3)(ref val9)).magnitude + 0.03f; ((Collider)val14).isTrigger = true; Bounds val16 = BoundsIn(val7, ((Component)val).transform, ((Component)item).transform); NativeContentAccess.Set(item, "_modelHeight", Mathf.Max(0.02f, 0f - ((Bounds)(ref val16)).min.y)); palettes.Add(item.ID, materials); return; } } throw new InvalidOperationException("The native ordinary trophy collision layout changed."); } finally { Object.Destroy((Object)(object)art); } } private static Bounds BoundsIn(Mesh mesh, Transform source, Transform target) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 val = target.worldToLocalMatrix * source.localToWorldMatrix; Vector3[] vertices = mesh.vertices; Bounds result = default(Bounds); ((Bounds)(ref result))..ctor(((Matrix4x4)(ref val)).MultiplyPoint3x4(vertices[0]), Vector3.zero); Vector3[] array = vertices; foreach (Vector3 val2 in array) { ((Bounds)(ref result)).Encapsulate(((Matrix4x4)(ref val)).MultiplyPoint3x4(val2)); } return result; } internal bool ApplyPreview(Renderer renderer, Item item) { if (!Object.op_Implicit((Object)(object)renderer) || !palettes.TryGetValue(item.ID, out Material[] value)) { return false; } if (!originals.ContainsKey(renderer)) { originals.Add(renderer, renderer.sharedMaterials); } renderer.sharedMaterials = value; return true; } internal void RestorePreview(Renderer renderer) { if (Object.op_Implicit((Object)(object)renderer) && originals.TryGetValue(renderer, out Material[] value)) { renderer.sharedMaterials = value; originals.Remove(renderer); } } public void Dispose() { foreach (KeyValuePair original in originals) { if (Object.op_Implicit((Object)(object)original.Key)) { original.Key.sharedMaterials = original.Value; } } foreach (Mesh mesh in meshes) { if (Object.op_Implicit((Object)(object)mesh)) { Object.Destroy((Object)(object)mesh); } } originals.Clear(); palettes.Clear(); meshes.Clear(); } } internal sealed class HarpoonMechanism : MonoBehaviour { private readonly struct RestPose { internal readonly Transform Transform; internal readonly Vector3 Position; internal readonly Vector3 Scale; private readonly Quaternion rotation; internal RestPose(Transform transform) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) Transform = transform; Position = transform.localPosition; Scale = transform.localScale; rotation = transform.localRotation; } internal void Constant(AnimationClip clip, Transform root, float duration) { //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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) float[] times = new float[2] { 0f, 1f }; Position(clip, root, Transform, duration, times, (Vector3[])(object)new Vector3[2] { Position, Position }); Scale(clip, root, Transform, duration, times, (Vector3[])(object)new Vector3[2] { Scale, Scale }); (string, float)[] array = new(string, float)[4] { ("x", rotation.x), ("y", rotation.y), ("z", rotation.z), ("w", rotation.w) }; for (int i = 0; i < array.Length; i++) { var (text, num) = array[i]; clip.SetCurve(Path(root, Transform), typeof(Transform), "localRotation." + text, AnimationCurve.Linear(0f, num, duration, num)); } } } internal const byte ItemId = 188; internal const float ReloadDuration = 2.1f; internal const float CycleDuration = 1.4f; internal const float EmptyFireDuration = 0.32f; internal const float DrawDistance = 0.12f; internal static readonly Vector3 HipViewOffset = new Vector3(0.14f, -0.16f, 0.06f); private const float HiddenScale = 0.0001f; private static readonly string[] ClipNames = new string[6] { "Idle", "Fire", "FireLast", "Reload", "ReloadLast", "Inspect" }; [SerializeField] private Weapon weapon; [SerializeField] private Animation animationPlayer; [SerializeField] private Transform shaft; [SerializeField] private Transform cockingHandle; [SerializeField] private Transform handleSeat; [SerializeField] private Transform viewPose; [SerializeField] private Renderer handleRenderer; [SerializeField] private Vector3 shaftScale; [SerializeField] private AnimationClip[] clips = Array.Empty(); [SerializeField] private Mesh handleMesh; [SerializeField] private Material handleMaterial; [SerializeField] private Vector3 readyShaftPosition; [SerializeField] private Vector3 readyHandlePosition; private bool ownsAssets; private EntityId assetOwnerInstanceId; private EntityId bindingOwnerInstanceId; private int aliasRepairCount; private string bindingDiagnostic = ""; internal Transform Shaft => shaft; internal Transform CockingHandle => cockingHandle; internal Transform HandleSeat => handleSeat; internal float HandleWorldWidth { get { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = handleMesh.bounds; return ((Bounds)(ref bounds)).size.x * cockingHandle.lossyScale.x; } } internal float HandleTrackError { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = Vector3.ProjectOnPlane(cockingHandle.position - handleSeat.position, handleSeat.forward); return ((Vector3)(ref val)).magnitude; } } internal Vector3 AppliedViewOffset => ((Component)weapon).transform.InverseTransformDirection(viewPose.parent.TransformVector(viewPose.localPosition)); internal Vector3 ReadyShaftPosition => readyShaftPosition; internal Vector3 ReadyHandlePosition => readyHandlePosition; internal bool IsReloading => NativeContentAccess.Get(weapon, "_isReloading"); internal bool ShaftVisible { get { //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) Vector3 localScale = shaft.localScale; return ((Vector3)(ref localScale)).sqrMagnitude > ((Vector3)(ref shaftScale)).sqrMagnitude * 0.25f; } } internal float HandleGripError => Vector3.Distance(GripCenter((SkinnedMeshRenderer)((Tool)weapon).HandsMesh, "l_"), cockingHandle.position); internal string PlayingClip => ClipNames.FirstOrDefault((string name) => animationPlayer.IsPlaying(name)) ?? ""; internal Animation NativeAnimation => animationPlayer; internal int AliasRepairCount => aliasRepairCount; internal string BindingDiagnostic => bindingDiagnostic; internal bool HasVerifiedBindings { get { if (clips != null && clips.Length == ClipNames.Length && Object.op_Implicit((Object)(object)animationPlayer)) { return ClipNames.Select((string name, int index) => (Object)(object)animationPlayer.GetClip(name) == (Object)(object)clips[index] && Object.op_Implicit((Object)(object)clips[index])).All((bool valid) => valid); } return false; } } internal static HarpoonMechanism Configure(Weapon target, GameObject art) { //IL_01b9: 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_0255: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0285: 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_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: 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_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: 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_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: 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_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Expected O, but got Unknown //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_033f: 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_0351: 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_0365: 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_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Expected O, but got Unknown //IL_0498: 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_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0b67: Unknown result type (might be due to invalid IL or missing references) //IL_0b6e: Unknown result type (might be due to invalid IL or missing references) //IL_0b73: Unknown result type (might be due to invalid IL or missing references) //IL_0b78: Unknown result type (might be due to invalid IL or missing references) //IL_0b7d: Unknown result type (might be due to invalid IL or missing references) //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0687: 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_06ac: Expected O, but got Unknown //IL_0845: Unknown result type (might be due to invalid IL or missing references) //IL_0847: Unknown result type (might be due to invalid IL or missing references) //IL_0851: Unknown result type (might be due to invalid IL or missing references) //IL_0856: Unknown result type (might be due to invalid IL or missing references) //IL_085b: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_087f: Unknown result type (might be due to invalid IL or missing references) //IL_0884: Unknown result type (might be due to invalid IL or missing references) //IL_089c: Unknown result type (might be due to invalid IL or missing references) //IL_089e: Unknown result type (might be due to invalid IL or missing references) //IL_08a8: Unknown result type (might be due to invalid IL or missing references) //IL_08ad: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Unknown result type (might be due to invalid IL or missing references) //IL_0a0f: Unknown result type (might be due to invalid IL or missing references) //IL_0a11: Unknown result type (might be due to invalid IL or missing references) //IL_0a1b: Unknown result type (might be due to invalid IL or missing references) //IL_0a20: Unknown result type (might be due to invalid IL or missing references) //IL_0a25: Unknown result type (might be due to invalid IL or missing references) //IL_0a88: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)target) || ((Item)target).ID != 188 || ((Component)target).gameObject.activeInHierarchy || Object.op_Implicit((Object)(object)((Component)target).GetComponent())) { throw new InvalidOperationException("Configure the harpoon mechanism once on the inactive item-188 prefab."); } Animation val = NativeContentAccess.Get(target, "_anim"); AnimationClip clip = val.GetClip("Idle"); if (Object.op_Implicit((Object)(object)clip) && clip.legacy) { Renderer handsMesh = ((Tool)target).HandsMesh; SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((handsMesh is SkinnedMeshRenderer) ? handsMesh : null); if (val2 != null) { Transform gun = ((Tool)target).SwayRotAroundTransform; Transform val3 = ((Component)target).GetComponentsInChildren(true).Single((Transform bone) => ((Object)bone).name == "Bolt"); Transform val4 = ((Component)target).GetComponentsInChildren(true).Single((Transform bone) => ((Object)bone).name == "Mag"); Transform left = ((Item)target).HandModelLeft; Transform right = ((Item)target).HandModelRight; if (!Object.op_Implicit((Object)(object)gun) || ((Object)gun).name != "Gun" || !Object.op_Implicit((Object)(object)left) || !Object.op_Implicit((Object)(object)right) || !left.IsChildOf(gun) || !right.IsChildOf(gun) || !gun.IsChildOf(((Component)val).transform) || !val3.IsChildOf(gun) || !val4.IsChildOf(gun)) { throw new InvalidOperationException("The verified Gun/Bolt/Mag and hand-IK hierarchy is missing."); } clip.SampleAnimation(((Component)val).gameObject, 0f); Transform transform = new GameObject("Authored harpoon first-person carry").transform; transform.SetParent(gun.parent, false); gun.SetParent(transform, false); Transform val5 = ((Component)gun).GetComponentsInChildren(true).Single((Transform part) => ((Object)part).name == "Authored grip_right"); Transform val6 = ((Component)gun).GetComponentsInChildren(true).Single((Transform part) => ((Object)part).name == "Authored muzzle"); Vector3 val7 = Marker(art, "grip_right"); Vector3 val8 = Marker(art, "muzzle"); float num = Vector3.Distance(val5.position, val6.position) / Vector3.Distance(val7, val8); Quaternion val9 = Quaternion.LookRotation(val6.position - val5.position, ((Component)target).transform.up) * Quaternion.Inverse(Quaternion.LookRotation(val8 - val7, Vector3.up)); Vector3 val10 = val9 * Vector3.forward; Vector3 normalized = ((Vector3)(ref val10)).normalized; Transform val11 = ((Component)gun).GetComponentsInChildren(true).Single((Transform part) => ((Object)part).name == "Authored cocking_handle"); Vector3 position = val11.position; GameObject val12 = new GameObject("Authored harpoon cocking handle"); val12.transform.SetParent(gun, false); val12.transform.SetPositionAndRotation(position, val9); Vector3 lossyScale = gun.lossyScale; if (Mathf.Min(new float[3] { lossyScale.x, lossyScale.y, lossyScale.z }) <= 0f || Mathf.Max(new float[3] { lossyScale.x, lossyScale.y, lossyScale.z }) - Mathf.Min(new float[3] { lossyScale.x, lossyScale.y, lossyScale.z }) > 0.001f) { throw new InvalidOperationException("The native harpoon gun rig must have a positive uniform scale."); } val12.transform.localScale = Vector3.one * (num / lossyScale.x); val12.layer = ((Component)val2).gameObject.layer; Mesh sharedMesh = CreateHandle(); val12.AddComponent().sharedMesh = sharedMesh; MeshRenderer val13 = val12.AddComponent(); Material val14 = (((Renderer)val13).sharedMaterial = new Material(((Component)art.transform.Find("anchor_bolt")).GetComponentInChildren(true).sharedMaterial) { name = "Tidebreaker cocking handle" }); HarpoonMechanism harpoonMechanism = ((Component)target).gameObject.AddComponent(); harpoonMechanism.weapon = target; harpoonMechanism.animationPlayer = val; harpoonMechanism.shaft = val3; harpoonMechanism.shaftScale = val3.localScale; harpoonMechanism.cockingHandle = val12.transform; harpoonMechanism.handleSeat = val11; harpoonMechanism.viewPose = transform; harpoonMechanism.handleRenderer = (Renderer)(object)val13; harpoonMechanism.handleMesh = sharedMesh; harpoonMechanism.handleMaterial = val14; harpoonMechanism.readyShaftPosition = val3.localPosition; harpoonMechanism.readyHandlePosition = val12.transform.localPosition; harpoonMechanism.ownsAssets = true; harpoonMechanism.assetOwnerInstanceId = ((Object)harpoonMechanism).GetEntityId(); Vector3 val16 = GripCenter(val2, "l_"); Vector3 leftAtHandle = left.parent.InverseTransformPoint(left.position + position - val16); Transform[] source = val2.bones.Where((Transform bone) => Object.op_Implicit((Object)(object)bone) && (bone.IsChildOf(left) || bone.IsChildOf(right))).Distinct().ToArray(); RestPose[] array = new RestPose[4] { new RestPose(gun), new RestPose(val4), new RestPose(left), new RestPose(right) }.Concat(from bone in source where (Object)(object)bone != (Object)(object)left && (Object)(object)bone != (Object)(object)right select new RestPose(bone)).ToArray(); List list = new List(); string[] clipNames = ClipNames; foreach (string text in clipNames) { float duration = ((text == "Idle") ? 0.1f : ((text == "FireLast") ? 0.32f : (text.StartsWith("Reload", StringComparison.Ordinal) ? 2.1f : 1.4f))); AnimationClip val17 = new AnimationClip { name = text, legacy = true, frameRate = 60f, wrapMode = (WrapMode)((!(text == "Idle")) ? 1 : 2) }; RestPose[] array2 = array; foreach (RestPose restPose in array2) { restPose.Constant(val17, ((Component)val).transform, duration); } RestPose boltPose = new RestPose(val3); RestPose handlePose = new RestPose(val12.transform); boltPose.Constant(val17, ((Component)val).transform, duration); handlePose.Constant(val17, ((Component)val).transform, duration); float[] array3 = new float[9] { 0f, 0.08f, 0.18f, 0.34f, 0.48f, 0.62f, 0.8f, 0.9f, 1f }; float[] travel; float[] source2; if (text.StartsWith("Reload", StringComparison.Ordinal)) { travel = new float[9] { 0f, 0f, 0f, 1f, 1f, 1f, 0f, 0f, 0f }; source2 = new float[9] { 0.0001f, 0.0001f, 0.0001f, 0.0001f, 1f, 1f, 1f, 1f, 1f }; } else if (text == "Fire") { travel = new float[9] { -0.3f, 0f, 0f, 1f, 1f, 1f, 0f, 0f, 0f }; source2 = new float[9] { 0.0001f, 0.0001f, 0.0001f, 0.0001f, 1f, 1f, 1f, 1f, 1f }; } else if (text == "FireLast") { travel = new float[9] { -0.3f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f }; source2 = Enumerable.Repeat(0.0001f, array3.Length).ToArray(); } else { travel = new float[array3.Length]; source2 = Enumerable.Repeat(1f, array3.Length).ToArray(); } bool num4 = text == "Fire" || text.StartsWith("Reload", StringComparison.Ordinal); Vector3 drawBolt = val3.parent.InverseTransformVector(-normalized * 0.12f); Vector3 drawHandle = gun.InverseTransformVector(-normalized * 0.12f); Vector3 drawHand = left.parent.InverseTransformVector(-normalized * 0.12f); Position(val17, ((Component)val).transform, val3, duration, array3, travel.Select((float value) => boltPose.Position + drawBolt * value).ToArray()); Scale(val17, ((Component)val).transform, val3, duration, array3, source2.Select((float value) => boltPose.Scale * value).ToArray()); Position(val17, ((Component)val).transform, val12.transform, duration, array3, travel.Select((float value) => handlePose.Position + drawHandle * Mathf.Max(0f, value)).ToArray()); if (num4) { float[] reach = new float[9] { 0f, 0f, 1f, 1f, 1f, 1f, 1f, 0f, 0f }; Vector3[] values = array3.Select((float _, int index) => Vector3.Lerp(left.localPosition, leftAtHandle + drawHand * Mathf.Max(0f, travel[index]), reach[index])).ToArray(); Position(val17, ((Component)val).transform, left, duration, array3, values); } if (text == "Fire" || text == "FireLast") { float[] source3 = new float[9] { 0f, 1f, 0.55f, 0.1f, 0f, 0f, 0f, 0f, 0f }; Vector3 offset = gun.parent.InverseTransformVector(-normalized * 0.016f); Position(val17, ((Component)val).transform, gun, duration, array3, source3.Select((float value) => gun.localPosition + offset * value).ToArray()); } val17.EnsureQuaternionContinuity(); val.RemoveClip(text); val.AddClip(val17, text); val[text].wrapMode = val17.wrapMode; val[text].speed = 1f; list.Add(val17); } harpoonMechanism.clips = list.ToArray(); val.clip = harpoonMechanism.clips[0]; NativeContentAccess.Set(target, "_hasLastReloadAnim", true); NativeContentAccess.Set(target, "_hasLastFireAnim", true); NativeContentAccess.Set(target, "_noShootingDuringShootAnim", true); NativeContentAccess.Set(target, "_noQueueingShots", true); NativeContentAccess.Set(target, "_reloadAmmoRefillPercentage", 0.88f); NativeContentAccess.Set(target, "_casingParticle", null); ConfigureAudio(target); try { list[3].SampleAnimation(((Component)val).gameObject, 1.05f); val10 = val3.parent.TransformVector(val3.localPosition - harpoonMechanism.readyShaftPosition); if (Mathf.Abs(((Vector3)(ref val10)).magnitude - 0.12f) > 0.02f || harpoonMechanism.HandleGripError > 0.085f) { throw new InvalidOperationException("The original cocking clip did not bind the native shaft and left-hand grip."); } } finally { harpoonMechanism.clips[0].SampleAnimation(((Component)val).gameObject, 0f); } ContentRegistry.Log.LogInfo((object)($"Harpoon receiver-side grip: width={harpoonMechanism.HandleWorldWidth:0.000}m, " + $"track error={harpoonMechanism.HandleTrackError:0.000}m, draw={0.12f:0.00}m; original clips retain native hand/refill ownership.")); return harpoonMechanism; } } throw new InvalidOperationException("The native sniper must supply its legacy Idle clip and animated hand skeleton."); } private static void ConfigureAudio(Weapon target) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown AudioSequence val = NativeContentAccess.Get(target, "_fireAudioSeq"); if (val.Steps == null || val.Steps.Length != 2 || val.Steps.Any((AudioSequenceStep step) => step == null || step.Clips == null || step.Clips.Length == 0 || step.Clips.Any((AudioClip clip) => !Object.op_Implicit((Object)(object)clip)))) { throw new InvalidOperationException("The native sniper's open/close mechanical cues are unavailable."); } NativeContentAccess.Set(target, "_fireAudioSeq", SlideSequence(val, 1.4f)); NativeContentAccess.Set(target, "_reloadAudioSeq", SlideSequence(val, 2.1f)); NativeContentAccess.Set(target, "_reloadLastAudioSeq", SlideSequence(val, 2.1f)); NativeContentAccess.Set(target, "_fireLastAudioSeq", (object?)new AudioSequence { Steps = Array.Empty(), Distance = val.Distance, Volume = val.Volume }); } private static AudioSequence SlideSequence(AudioSequence native, float duration) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00ab: Expected O, but got Unknown AudioSequence val = new AudioSequence(); val.Distance = native.Distance; val.Volume = native.Volume * 0.65f; val.Steps = (AudioSequenceStep[])(object)new AudioSequenceStep[2] { new AudioSequenceStep { Clips = native.Steps[0].Clips.ToArray(), Timer = duration * 0.18f, Volume = native.Steps[0].Volume }, new AudioSequenceStep { Clips = native.Steps[1].Clips.ToArray(), Timer = duration * 0.62f, Volume = native.Steps[1].Volume } }; return val; } internal static void Bind(Weapon target) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)target) && ((Item)target).ID == 188) { HarpoonMechanism component = ((Component)target).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { throw new InvalidOperationException($"Harpoon instance {((Object)target).GetEntityId()} ({((Object)target).name}) has no serialized HarpoonMechanism component."); } component.RestoreOriginalAliases(target); component.handleRenderer.enabled = true; component.handleRenderer.forceRenderingOff = false; } } private void RestoreOriginalAliases(Weapon target) { //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) Animation val = NativeContentAccess.Optional(target, "_anim"); if ((Object)(object)weapon != (Object)(object)target || !Object.op_Implicit((Object)(object)animationPlayer) || (Object)(object)animationPlayer != (Object)(object)val || (Object)(object)((Component)animationPlayer).transform != (Object)(object)((Tool)target).SwayTransform || !Object.op_Implicit((Object)(object)shaft) || !shaft.IsChildOf(((Component)animationPlayer).transform) || !Object.op_Implicit((Object)(object)cockingHandle) || !cockingHandle.IsChildOf(((Component)animationPlayer).transform) || !Object.op_Implicit((Object)(object)handleSeat) || !handleSeat.IsChildOf(((Component)animationPlayer).transform) || !Object.op_Implicit((Object)(object)viewPose) || (Object)(object)viewPose != (Object)(object)((Tool)target).SwayRotAroundTransform.parent || !viewPose.IsChildOf(((Component)animationPlayer).transform) || !Object.op_Implicit((Object)(object)handleRenderer) || (Object)(object)((Component)handleRenderer).transform != (Object)(object)cockingHandle) { throw BindingFailure(target, "Serialized weapon/animation/shaft/handle references do not belong to this instance."); } if (clips == null || clips.Length != ClipNames.Length) { throw BindingFailure(target, string.Format("Expected {0} serialized original clips; received {1}.", ClipNames.Length, clips?.Length.ToString() ?? "null")); } for (int i = 0; i < ClipNames.Length; i++) { AnimationClip val2 = clips[i]; string text = ClipNames[i]; float num = ((text == "Idle") ? 0.1f : ((text == "FireLast") ? 0.32f : (text.StartsWith("Reload", StringComparison.Ordinal) ? 2.1f : 1.4f))); if (!Object.op_Implicit((Object)(object)val2) || !val2.legacy || ((Object)val2).name != text || !NativeContentAccess.Finite(val2.length) || Mathf.Abs(val2.length - num) > 0.01f) { throw BindingFailure(target, $"Serialized original clip {i} ({text}) has missing or invalid identity, duration, or legacy mode."); } } bool flag = !((EntityId)(ref bindingOwnerInstanceId)).Equals(((Object)this).GetEntityId()); string text2 = DescribeAliases(); List list = new List(); for (int j = 0; j < ClipNames.Length; j++) { string text3 = ClipNames[j]; AnimationClip val3 = clips[j]; if (!((Object)(object)animationPlayer.GetClip(text3) == (Object)(object)val3)) { if (animationPlayer.IsPlaying(text3)) { throw BindingFailure(target, "Refusing to replace an unexpected playing clip at alias " + text3 + "."); } animationPlayer.RemoveClip(text3); animationPlayer.AddClip(val3, text3); AnimationState val4 = animationPlayer[text3]; if ((TrackedReference)(object)val4 == (TrackedReference)null || (Object)(object)val4.clip != (Object)(object)val3) { throw BindingFailure(target, $"Unity did not install serialized original clip {j} at alias {text3}."); } val4.wrapMode = val3.wrapMode; val4.speed = 1f; list.Add(text3); } } if (!HasVerifiedBindings) { throw BindingFailure(target, "Original-clip alias verification failed after registration."); } if ((Object)(object)animationPlayer.clip != (Object)(object)clips[0]) { animationPlayer.clip = clips[0]; } if (flag) { aliasRepairCount = 0; } aliasRepairCount += list.Count; bindingOwnerInstanceId = ((Object)this).GetEntityId(); if (flag || list.Count != 0) { bindingDiagnostic = $"instance={((Object)target).GetEntityId()}, originals={DescribeOriginals()}, " + "before=[" + text2 + "], repaired=[" + string.Join(",", list) + "], after=[" + DescribeAliases() + "]"; ContentRegistry.Log.LogInfo((object)("Harpoon original aliases verified: " + bindingDiagnostic)); } } private InvalidOperationException BindingFailure(Weapon target, string reason) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) return new InvalidOperationException($"Harpoon binding failed for instance {((Object)target).GetEntityId()} ({((Object)target).name}): {reason} " + $"weaponMatches={(Object)(object)weapon == (Object)(object)target}, animation={ObjectName((Object?)(object)animationPlayer)}, shaft={ObjectName((Object?)(object)shaft)}, " + "handle=" + ObjectName((Object?)(object)cockingHandle) + ", renderer=" + ObjectName((Object?)(object)handleRenderer) + ", originals=[" + DescribeOriginals() + "], aliases=[" + DescribeAliases() + "]."); } private string DescribeOriginals() { if (clips != null) { return string.Join(";", clips.Select((AnimationClip clip, int index) => Object.op_Implicit((Object)(object)clip) ? $"{index}:{((Object)clip).name}#{((Object)clip).GetEntityId()}(legacy={clip.legacy},length={clip.length:0.###})" : $"{index}:missing")); } return "null"; } private string DescribeAliases() { if (Object.op_Implicit((Object)(object)animationPlayer)) { return string.Join(";", from state in ((IEnumerable)animationPlayer).Cast().Take(24) select $"{state.name}->{ObjectName((Object?)(object)state.clip)}(time={state.normalizedTime:0.###},enabled={state.enabled})"); } return "no Animation reference"; } private static string ObjectName(Object? value) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit(value)) { return "missing"; } return value.name + "#" + ((object)value.GetEntityId()/*cast due to .constrained prefix*/).ToString(); } private void LateUpdate() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)weapon) && clips.Length != 0) { float num = ((Object.op_Implicit((Object)(object)((Item)weapon).Holder) && ((NetworkBehaviour)((Item)weapon).Holder).Owner.IsLocalClient) ? (1f - Mathf.Clamp01(NativeContentAccess.Get(weapon, "_aimPercent"))) : 0f); viewPose.localPosition = viewPose.parent.InverseTransformVector(((Component)weapon).transform.TransformDirection(HipViewOffset * num)); if (!IsReloading && !animationPlayer.IsPlaying("Fire") && !animationPlayer.IsPlaying("FireLast")) { shaft.localScale = ((weapon.Ammo > 0) ? shaftScale : (shaftScale * 0.0001f)); } } } private void OnDestroy() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!ownsAssets || !((EntityId)(ref assetOwnerInstanceId)).Equals(((Object)this).GetEntityId())) { return; } AnimationClip[] array = clips; foreach (AnimationClip val in array) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } } if (Object.op_Implicit((Object)(object)handleMesh)) { Object.Destroy((Object)(object)handleMesh); } if (Object.op_Implicit((Object)(object)handleMaterial)) { Object.Destroy((Object)(object)handleMaterial); } } private static Vector3 Marker(GameObject art, string name) { //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) Transform val = art.transform.Find("marker_" + name); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("Harpoon mechanism requires authored marker_" + name + "."); } return art.transform.InverseTransformPoint(val.position); } private static Vector3 GripCenter(SkinnedMeshRenderer hands, string side) { //IL_003c: 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_0069: Unknown result type (might be due to invalid IL or missing references) Transform[] array = hands.bones.Where((Transform bone) => Object.op_Implicit((Object)(object)bone) && (((Object)bone).name == side + "middle_low" || ((Object)bone).name == side + "middle_tip" || ((Object)bone).name == side + "index_low" || ((Object)bone).name == side + "index_tip")).ToArray(); if (array.Length != 4) { throw new InvalidOperationException("The native hand grip landmarks changed."); } return array.Aggregate(Vector3.zero, (Vector3 sum, Transform finger) => sum + finger.position) / (float)array.Length; } private static string Path(Transform root, Transform target) { List list = new List(); while ((Object)(object)target != (Object)(object)root) { if (!Object.op_Implicit((Object)(object)target)) { throw new InvalidOperationException("An animated harpoon part is outside the native Animation root."); } list.Add(((Object)target).name); target = target.parent; } list.Reverse(); return string.Join("/", list); } private static void Position(AnimationClip clip, Transform root, Transform bone, float duration, float[] times, Vector3[] values) { VectorCurve(clip, root, bone, "localPosition", duration, times, values); } private static void Scale(AnimationClip clip, Transform root, Transform bone, float duration, float[] times, Vector3[] values) { VectorCurve(clip, root, bone, "localScale", duration, times, values, step: true); } private static void VectorCurve(AnimationClip clip, Transform root, Transform bone, string property, float duration, float[] times, Vector3[] values, bool step = false) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown int axis; for (axis = 0; axis < 3; axis++) { clip.SetCurve(Path(root, bone), typeof(Transform), property + "." + "xyz"[axis], new AnimationCurve(((IEnumerable)times).Select((Func)((float time, int index) => (!step) ? new Keyframe(time * duration, ((Vector3)(ref values[index]))[axis]) : new Keyframe(time * duration, ((Vector3)(ref values[index]))[axis], float.PositiveInfinity, float.PositiveInfinity))).ToArray())); } } private static Mesh CreateHandle() { //IL_0023: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0128: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_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_00dc: Unknown result type (might be due to invalid IL or missing references) List list = new List(); List list2 = new List(); (Vector3, Vector3)[] array = new(Vector3, Vector3)[2] { (new Vector3(0.018f, 0f, 0f), new Vector3(0.036f, 0.01f, 0.014f)), (Vector3.zero, new Vector3(0.016f, 0.032f, 0.038f)) }; for (int i = 0; i < array.Length; i++) { (Vector3, Vector3) tuple = array[i]; Vector3 item = tuple.Item1; Vector3 item2 = tuple.Item2; int start = list.Count; for (int j = 0; j < 8; j++) { list.Add(item + Vector3.Scale(item2 * 0.5f, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1))))); } list2.AddRange(new int[36] { 0, 2, 1, 1, 2, 3, 4, 5, 6, 5, 7, 6, 0, 4, 2, 2, 4, 6, 1, 3, 5, 3, 7, 5, 0, 1, 4, 1, 5, 4, 2, 6, 3, 3, 6, 7 }.Select((int index) => start + index)); } Mesh val = new Mesh { name = "Tidebreaker original receiver-side cocking grip", vertices = list.ToArray(), triangles = list2.ToArray() }; val.RecalculateNormals(); val.RecalculateBounds(); return val; } } [HarmonyPatch(typeof(HarpoonUpgradeCatalog), "ApplyVisualVisibility")] internal static class KeepHarpoonMechanismVisible { private static void Postfix(Weapon weapon) { HarpoonMechanism.Bind(weapon); } } [HarmonyPatch(typeof(Weapon), "OnPickUp")] internal static class RestoreHarpoonAliasesBeforePickup { private static void Prefix(Weapon __instance) { HarpoonMechanism.Bind(__instance); } } internal sealed class HarpoonProjectiles : IDisposable { private sealed class FlightVisual { internal readonly GameObject Root; internal readonly MeshRenderer Shaft; internal readonly LineRenderer Wake; internal FlightVisual(Mesh mesh, Material shaftMaterial, Material wakeMaterial) { //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_001d: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown Root = new GameObject("Tidebreaker airborne shaft") { layer = 0 }; Root.AddComponent().sharedMesh = mesh; Shaft = Root.AddComponent(); ((Renderer)Shaft).sharedMaterial = shaftMaterial; GameObject val = new GameObject("Tidebreaker short flight wake") { layer = 0 }; val.transform.SetParent(Root.transform, false); Wake = val.AddComponent(); ((Renderer)Wake).sharedMaterial = wakeMaterial; Wake.useWorldSpace = true; Wake.alignment = (LineAlignment)0; Wake.startWidth = 0.05f; Wake.endWidth = 0.012f; Wake.positionCount = 5; ((Renderer)Wake).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)Wake).receiveShadows = false; Wake.textureMode = (LineTextureMode)0; } internal void Update(Projectile projectile, Vector3 position, Vector3 velocity) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) Root.transform.SetPositionAndRotation(position, Quaternion.LookRotation(velocity)); float num = Vector3.Distance(projectile.SpawnPos, position); float num2 = Mathf.Min(1.6f, Mathf.Max(0f, num - 0.9f)); ((Renderer)Wake).enabled = num2 > 0.02f; Vector3 normalized = ((Vector3)(ref velocity)).normalized; for (int i = 0; i < Wake.positionCount; i++) { float num3 = 0.9f + num2 * (float)i / (float)(Wake.positionCount - 1); float num4 = num3 / ((Vector3)(ref velocity)).magnitude; Wake.SetPosition(i, position - normalized * num3 + Vector3.down * (projectile.GravityForce * num4 * num4 * 0.5f)); } } } [HarmonyPatch(typeof(ProjectileManager), "UpdateMatrices")] internal static class HarpoonFlightRenderingPatch { private static bool Prefix(ProjectileType type) { return !UpdateFlightVisuals(type); } } internal const float ShaftLength = 0.9f; internal const float LaunchSpeed = 32f; internal const float WakeLength = 1.6f; internal const float CollisionRadius = 0.025f; internal const float FlightCoreRadius = 0.016f; private const string FlyingName = "GamblersReach_Harpoon"; private const string LandedName = "GamblersReach_LandedHarpoon"; private static HarpoonProjectiles? active; private readonly Weapon prefab; private readonly byte originalType; private readonly Mesh mesh; private readonly Mesh flightMesh; private readonly Material material; private readonly Material flightMaterial; private readonly Material wakeMaterial; private readonly Dictionary flights = new Dictionary(); private ProjectileManager? projectiles; private InstanceManager? instances; private ProjectileType? registered; private byte typeId; internal HarpoonProjectiles(Weapon weapon, GameObject art) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //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_00e4: 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_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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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) //IL_018a: 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_020f: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: 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_02ce: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Expected O, but got Unknown //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Expected O, but got Unknown //IL_03c0: Unknown result type (might be due to invalid IL or missing references) if (active != null) { throw new InvalidOperationException("The harpoon projectile catalog is already registered."); } prefab = weapon; originalType = NativeContentAccess.Get(weapon, "_weaponInfo").ProjectileType; Transform val = art.transform.Find("anchor_bolt"); MeshFilter[] array = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponentsInChildren(true) : Array.Empty()); if (array.Length == 0) { throw new InvalidOperationException("The authored launcher is missing its original harpoon projectile."); } mesh = new Mesh { name = "Tidebreaker flying harpoon" }; mesh.CombineMeshes(array.Select(delegate(MeshFilter part) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) CombineInstance result = default(CombineInstance); ((CombineInstance)(ref result)).mesh = part.sharedMesh; ((CombineInstance)(ref result)).transform = art.transform.worldToLocalMatrix * ((Component)part).transform.localToWorldMatrix; return result; }).ToArray(), true, true); mesh.RecalculateBounds(); Bounds bounds = mesh.bounds; float x = ((Bounds)(ref bounds)).center.x; bounds = mesh.bounds; float y = ((Bounds)(ref bounds)).center.y; bounds = mesh.bounds; Vector3 tip = new Vector3(x, y, ((Bounds)(ref bounds)).max.z); bounds = mesh.bounds; if (NativeContentAccess.Finite(((Bounds)(ref bounds)).size.z)) { bounds = mesh.bounds; if (!(((Bounds)(ref bounds)).size.z <= 0.01f)) { bounds = mesh.bounds; float scale = 0.9f / ((Bounds)(ref bounds)).size.z; mesh.vertices = mesh.vertices.Select((Vector3 point) => (point - tip) * scale).ToArray(); mesh.RecalculateBounds(); Transform val2 = art.transform.Find("marker_bolt"); if (!Object.op_Implicit((Object)(object)val2)) { throw new InvalidOperationException("The flight shaft requires its authored bore marker."); } Vector3 centerline = (art.transform.InverseTransformPoint(val2.position) - tip) * scale; flightMesh = Object.Instantiate(mesh); ((Object)flightMesh).name = "Tidebreaker readable flying shaft"; float sourceCoreRadius = 0.008f * scale; flightMesh.vertices = ((IEnumerable)mesh.vertices).Select((Func)delegate(Vector3 point) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(point.x - centerline.x, point.y - centerline.y); float magnitude = ((Vector2)(ref val4)).magnitude; if (magnitude <= 1E-05f || magnitude >= 0.025f) { return point; } float num = ((magnitude <= sourceCoreRadius) ? (magnitude * 0.016f / sourceCoreRadius) : Mathf.Lerp(0.016f, 0.025f, (magnitude - sourceCoreRadius) / (0.025f - sourceCoreRadius))); Vector2 val5 = val4 * (num / magnitude); return new Vector3(centerline.x + val5.x, centerline.y + val5.y, point.z); }).ToArray(); flightMesh.RecalculateNormals(); flightMesh.RecalculateBounds(); material = new Material(((Component)array[0]).GetComponent().sharedMaterial) { name = "Tidebreaker instanced harpoon", enableInstancing = true }; material.SetColor("_BaseColor", new Color(0.82f, 0.85f, 0.86f, 1f)); material.SetFloat("_Metallic", 0.12f); material.SetFloat("_Smoothness", 0.2f); Shader val3 = Shader.Find("Universal Render Pipeline/Unlit"); if (!Object.op_Implicit((Object)(object)val3)) { throw new InvalidOperationException("The harpoon wake requires the game's URP unlit shader."); } flightMaterial = new Material(val3) { name = "Tidebreaker readable flying steel", enableInstancing = true }; flightMaterial.SetColor("_BaseColor", new Color(0.96f, 0.93f, 0.78f, 1f)); wakeMaterial = new Material(val3) { name = "Tidebreaker short ivory shaft wake" }; wakeMaterial.SetColor("_BaseColor", new Color(0.88f, 0.82f, 0.58f, 1f)); NativeContentAccess.Set(weapon, "_projSpeed", 32f); HarpoonMechanism.Configure(weapon, art); active = this; RegisterAvailable(); return; } } throw new InvalidOperationException("The authored harpoon shaft has invalid longitudinal bounds."); } internal static void RegisterAvailable() { if (active != null && Object.op_Implicit((Object)(object)ProjectileManager.Instance)) { object? value = NativeContentAccess.Field(typeof(InstanceManager), "_instance").GetValue(null); InstanceManager val = (InstanceManager)((value is InstanceManager) ? value : null); if (Object.op_Implicit((Object)(object)val)) { active.Register(ProjectileManager.Instance, val); } } } private void Register(ProjectileManager projectileManager, InstanceManager instanceManager) { //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_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_016f: 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_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_0185: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown //IL_00a8: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //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_00e2: 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: Expected O, but got Unknown if ((Object)(object)projectiles == (Object)(object)projectileManager && (Object)(object)instances == (Object)(object)instanceManager && registered != null) { return; } ProjectileType[] array = NativeContentAccess.Get(projectileManager, "_types"); if (array.Length >= 254 || originalType >= array.Length) { throw new InvalidOperationException("The native projectile catalog cannot safely register a harpoon type."); } Dictionary dictionary = NativeContentAccess.Static>(typeof(InstanceManager), "_instanceTypeDic"); InstanceType[] first = NativeContentAccess.Get(instanceManager, "_instanceTypes"); if ((Object)(object)instances != (Object)(object)instanceManager) { if (dictionary.ContainsKey("GamblersReach_Harpoon") || dictionary.ContainsKey("GamblersReach_LandedHarpoon")) { throw new InvalidOperationException("A different mod already owns the reserved harpoon visual names."); } InstanceType val = new InstanceType { Name = "GamblersReach_Harpoon", Mesh = flightMesh, Material = material }; InstanceType val2 = new InstanceType { Name = "GamblersReach_LandedHarpoon", Mesh = mesh, Material = material }; dictionary.Add("GamblersReach_Harpoon", val); dictionary.Add("GamblersReach_LandedHarpoon", val2); NativeContentAccess.Set(instanceManager, "_instanceTypes", first.Concat((IEnumerable)(object)new InstanceType[2] { val, val2 }).ToArray()); } ProjectileType val3 = array[originalType]; registered = new ProjectileType { IsHitScan = false, WidthRadius = 0.025f, PlayerForce = val3.PlayerForce * 2f, MeshInstance = "GamblersReach_Harpoon", MeshScale = Vector3.one, LandedMeshInstance = "GamblersReach_LandedHarpoon", LandedMeshScale = Vector3.one, LandedMeshFaceNormal = false, LandedDecal = val3.LandedDecal, LandedDecalSize = val3.LandedDecalSize, HitParticle = val3.HitParticle, HitSound = val3.HitSound, RandomSounds = val3.RandomSounds, HitSoundVolume = val3.HitSoundVolume }; typeId = checked((byte)array.Length); NativeContentAccess.Set(projectileManager, "_types", array.Concat((IEnumerable)(object)new ProjectileType[1] { registered }).ToArray()); NativeContentAccess.Get(prefab, "_weaponInfo").ProjectileType = typeId; projectiles = projectileManager; instances = instanceManager; ContentRegistry.Log.LogInfo((object)("Registered the original visible, travelling harpoon as native projectile type " + typeId + ".")); } internal static void Bind(Weapon weapon) { if (ContentRegistry.TryDescribeOwnedItem((Item)(object)weapon, out ContentDescriptor descriptor) && descriptor.ItemId == 188) { RegisterAvailable(); if (active?.registered == null || !Object.op_Implicit((Object)(object)active.projectiles)) { throw new InvalidOperationException("The harpoon cannot spawn before its native projectile system is ready."); } NativeContentAccess.Get(weapon, "_weaponInfo").ProjectileType = active.typeId; NativeContentAccess.Set(weapon, "_projSpeed", 32f); HarpoonUpgradeCatalog.ApplyVisualVisibility(weapon); } } internal static bool UpdateFlightVisuals(ProjectileType type) { if (active == null || type != active.registered) { return false; } active.UpdateFlights(type); return true; } private void UpdateFlights(ProjectileType type) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) InstanceManager.ReplaceBatches("GamblersReach_Harpoon", new List>()); Projectile[] array = flights.Keys.Where((Projectile projectile) => !type.Projectiles.Contains(projectile)).ToArray(); foreach (Projectile key in array) { Object.Destroy((Object)(object)flights[key].Root); flights.Remove(key); } float num2 = ((Time.fixedDeltaTime <= 0f) ? 1f : Mathf.Clamp01((Time.time - Time.fixedTime) / Time.fixedDeltaTime)); foreach (Projectile projectile in type.Projectiles) { if (!flights.TryGetValue(projectile, out FlightVisual value)) { value = new FlightVisual(flightMesh, flightMaterial, wakeMaterial); flights.Add(projectile, value); } Vector3 position = Vector3.Lerp(projectile.PreviousPosition, projectile.Position, num2); Vector3 velocity = Vector3.Lerp(projectile.PreviousVelocity, projectile.Velocity, num2); value.Update(projectile, position, velocity); } } internal static Renderer[] FlightRenderers(Projectile projectile) { if (active == null || !active.flights.TryGetValue(projectile, out FlightVisual value)) { return Array.Empty(); } return (Renderer[])(object)new Renderer[2] { (Renderer)value.Shaft, (Renderer)value.Wake }; } public void Dispose() { foreach (FlightVisual value in flights.Values) { Object.Destroy((Object)(object)value.Root); } flights.Clear(); if (Object.op_Implicit((Object)(object)projectiles) && registered != null) { ProjectileType[] array = NativeContentAccess.Get(projectiles, "_types"); if (array.Length != typeId + 1 || array[typeId] != registered) { throw new InvalidOperationException("The native projectile catalog changed after the harpoon registered."); } NativeContentAccess.Set(projectiles, "_types", array.Take(typeId).ToArray()); } if (Object.op_Implicit((Object)(object)instances)) { InstanceType[] source = NativeContentAccess.Get(instances, "_instanceTypes"); NativeContentAccess.Set(instances, "_instanceTypes", source.Where((InstanceType type) => type.Name != "GamblersReach_Harpoon" && type.Name != "GamblersReach_LandedHarpoon").ToArray()); Dictionary dictionary = NativeContentAccess.Static>(typeof(InstanceManager), "_instanceTypeDic"); dictionary.Remove("GamblersReach_Harpoon"); dictionary.Remove("GamblersReach_LandedHarpoon"); } Object.Destroy((Object)(object)mesh); Object.Destroy((Object)(object)flightMesh); Object.Destroy((Object)(object)material); Object.Destroy((Object)(object)flightMaterial); Object.Destroy((Object)(object)wakeMaterial); active = null; } } [HarmonyPatch(typeof(ProjectileManager), "Awake")] internal static class HarpoonProjectileManagerPatch { private static void Postfix() { HarpoonProjectiles.RegisterAvailable(); } } [HarmonyPatch(typeof(InstanceManager), "Awake")] internal static class HarpoonInstanceManagerPatch { private static void Postfix() { HarpoonProjectiles.RegisterAvailable(); } } [HarmonyPatch(typeof(Weapon), "Awake")] internal static class HarpoonWeaponPatch { private static void Postfix(Weapon __instance) { HarpoonProjectiles.Bind(__instance); } } internal enum HarpoonUpgradeKind { Sight, Barrel, ExtendedMagazine, Laser, Ammunition } internal sealed class HarpoonUpgradeOffer { public string Key { get; } public HarpoonUpgradeKind Kind { get; } public byte Index { get; } public int Cost { get; } public int Damage { get; } public string NativeName { get { if (!Object.op_Implicit((Object)(object)Information)) { return "Native damage tier " + Index; } return ((Object)Information).name; } } public byte? GameInfoIndex { get { if (!Object.op_Implicit((Object)(object)Information)) { return null; } return GameInfo.GetIndexOfAttachment(Information); } } internal AttachmentInfo? Information { get; } public string StandKey { get { if (Kind != HarpoonUpgradeKind.Ammunition) { return Key; } return "harpoon_ammunition"; } } internal HarpoonUpgradeOffer(string key, HarpoonUpgradeKind kind, byte index, int cost, AttachmentInfo? information = null, int damage = 0) { Key = key; Kind = kind; Index = index; Cost = cost; Information = information; Damage = damage; } } internal sealed class HarpoonUpgradeCatalog { internal const string AmmoStandKey = "harpoon_ammunition"; internal const float DamageMultiplier = 2.5f; private readonly HarpoonUpgradeOffer[] offers; internal IReadOnlyList Offers => offers; internal IReadOnlyList StandKeys => offers.Select((HarpoonUpgradeOffer offer) => offer.StandKey).Distinct().ToArray(); internal int BaseDamage { get; } internal int DamageTierCount => offers.Count((HarpoonUpgradeOffer offer) => offer.Kind == HarpoonUpgradeKind.Ammunition); private HarpoonUpgradeCatalog(Weapon weapon) { Attachments attachments = weapon.Attachments; List result = new List(); Sight[] array = Sights(weapon); BarrelAttachment[] array2 = Barrels(weapon); if (array.Length != 3 || array2.Length != 3 || !Object.op_Implicit((Object)(object)((Attachment)array[0]).Info) || Object.op_Implicit((Object)(object)((Attachment)array2[0]).Info)) { throw new InvalidOperationException("Native upgrade families: sights=" + string.Join(", ", array.Select((Sight value) => ((Object)value).name + ":" + (Object.op_Implicit((Object)(object)((Attachment)value).Info) ? ((Object)((Attachment)value).Info).name : "default"))) + "; barrels=" + string.Join(", ", array2.Select((BarrelAttachment value) => ((Object)value).name + ":" + (Object.op_Implicit((Object)(object)((Attachment)value).Info) ? ((Object)((Attachment)value).Info).name : "default"))) + "."); } for (int num = 1; num < array.Length; num++) { Add(((Attachment)array[num]).Info, HarpoonUpgradeKind.Sight, (byte)num, ((Attachment)array[num]).Cost); } for (int num2 = 1; num2 < array2.Length; num2++) { Add(((Attachment)array2[num2]).Info, HarpoonUpgradeKind.Barrel, (byte)num2, ((Attachment)array2[num2]).Cost); } LaserSight val = Laser(weapon); Add(((Attachment)val).Info, HarpoonUpgradeKind.Laser, 0, ((Attachment)val).Cost); Add(NativeContentAccess.Get(attachments, "_extendedMagInfo"), HarpoonUpgradeKind.ExtendedMagazine, 0, NativeContentAccess.Get(attachments, "_extendedMagCost")); BulletUpgrade[] array3 = Bullets(weapon); if (array3.Length < 2 || array3.Length > 256) { throw new InvalidOperationException("The native sniper ammunition tier table is missing or cannot be saved in AmmoType."); } BaseDamage = array3[0].Damage; for (int num3 = 1; num3 < array3.Length; num3++) { if (array3[num3].Cost <= array3[num3 - 1].Cost || array3[num3].Damage <= array3[num3 - 1].Damage) { throw new InvalidOperationException("Native sniper ammunition tiers must have strictly increasing damage and prices."); } result.Add(new HarpoonUpgradeOffer("harpoon_damage_" + num3, HarpoonUpgradeKind.Ammunition, (byte)num3, array3[num3].Cost, null, array3[num3].Damage)); } offers = result.ToArray(); if (StandKeys.Count != 7) { throw new InvalidOperationException("The audited sniper requires six attachment offerings and one progressive ammunition offering."); } void Add(AttachmentInfo information, HarpoonUpgradeKind kind, byte index, int cost) { RequireNativeIdentity(information); string key = "harpoon_" + new string((from character in ((Object)information).name.ToLowerInvariant() select (!char.IsLetterOrDigit(character)) ? '_' : character).ToArray()); if (cost <= 0 || result.Any((HarpoonUpgradeOffer offer) => offer.Key == key || (Object)(object)offer.Information == (Object)(object)information)) { throw new InvalidOperationException("Invalid or duplicate native attachment price/identity: " + ((Object)information).name); } result.Add(new HarpoonUpgradeOffer(key, kind, index, cost, information)); } } internal static HarpoonUpgradeCatalog Configure(Weapon weapon, Weapon donor) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)weapon) || !Object.op_Implicit((Object)(object)donor) || (Object)(object)weapon == (Object)(object)donor || ((Item)weapon).ID != 188 || ((Item)donor).ID != 70 || ((Component)weapon).gameObject.activeInHierarchy || (Object)(object)weapon.Attachments == (Object)(object)donor.Attachments) { throw new InvalidOperationException("Harpoon upgrades require the inactive weapon-188 clone of native weapon 70."); } HarpoonUpgradeCatalog harpoonUpgradeCatalog = new HarpoonUpgradeCatalog(donor); BulletUpgrade[] array = Bullets(donor); BulletUpgrade[] array2 = (BulletUpgrade[])(object)new BulletUpgrade[array.Length]; for (int i = 0; i < array.Length; i++) { array2[i] = new BulletUpgrade(); NativeContentAccess.Set(array2[i], "_damage", ScaleNativeDamage(array[i].Damage)); NativeContentAccess.Set(array2[i], "_cost", array[i].Cost); } NativeContentAccess.Set(weapon.Attachments, "_bulletUpgrades", array2); HarpoonUpgradeCatalog harpoonUpgradeCatalog2 = new HarpoonUpgradeCatalog(weapon); if (!harpoonUpgradeCatalog2.offers.Select(Describe).SequenceEqual(harpoonUpgradeCatalog.offers.Select(Describe))) { throw new InvalidOperationException("The harpoon must retain native attachment identities, ordering, tier indices and prices."); } NativeContentAccess.Get(weapon, "_weaponInfo").ProjectileDamage = harpoonUpgradeCatalog2.BaseDamage; if (weapon.Attachments.AmmoPerMag != 1 || NativeContentAccess.Get(weapon.Attachments, "_extendedAmmoPerMag") != 2) { throw new InvalidOperationException("Configure the harpoon's one/two-round magazine before its upgrade catalog."); } FitSights(weapon, donor); FitModelRecoil(weapon, donor); Attachment[] array3 = UpgradeAttachments(weapon); foreach (Attachment val in array3) { RequireOwned(weapon, ((Component)val).transform); Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); foreach (Renderer obj in componentsInChildren) { obj.forceRenderingOff = false; obj.enabled = true; } } Sight[] array4 = Sights(weapon); foreach (Sight val2 in array4) { RequireOwned(weapon, ((Component)val2).transform); if (val2.UseSniperUi) { RequireOwned(weapon, val2.SniperUiPos); } GameObject[] disableWhenSniperUi = val2.DisableWhenSniperUi; foreach (GameObject val3 in disableWhenSniperUi) { RequireOwned(weapon, val3.transform); } } BarrelAttachment[] array5 = Barrels(weapon); foreach (BarrelAttachment val4 in array5) { RequireOwned(weapon, ((Component)val4).transform); RequireOwned(weapon, val4.FirePoint); RequireOwned(weapon, NativeContentAccess.Get(val4, "_fireParticle").transform); } Plugin.Log.LogInfo((object)("Harpoon upgrades: " + string.Join("; ", harpoonUpgradeCatalog2.offers.Select((HarpoonUpgradeOffer offer) => $"{offer.Key}: ${offer.Cost}" + ((offer.Damage > 0) ? $", damage {offer.Damage}" : ""))) + ". All tiers available immediately; ammunition remains a native sequential purchase.")); return harpoonUpgradeCatalog2; } private static void FitSights(Weapon weapon, Weapon donor) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)weapon).GetComponentsInChildren(true).Single((Transform part) => ((Object)part).name == "Authored sight_mount"); Sight[] array = Sights(weapon); Sight[] array2 = Sights(donor); for (int num = 1; num < array.Length; num++) { Sight val2 = array[num]; Bounds val3 = SightBounds(val2, val); Vector3 val4 = val.TransformDirection(new Vector3(0f - ((Bounds)(ref val3)).center.x, 0f - ((Bounds)(ref val3)).min.y, 0f - ((Bounds)(ref val3)).center.z)); Transform transform = ((Component)val2).transform; transform.position += val4; NativeContentAccess.Set(val2, "_adsPos", array2[num].AdsPos - ((Component)weapon).transform.InverseTransformVector(val4)); Bounds val5 = SightBounds(val2, val); if (Mathf.Abs(((Bounds)(ref val5)).min.y) > 0.002f || Mathf.Abs(((Bounds)(ref val5)).center.x) > 0.002f || Mathf.Abs(((Bounds)(ref val5)).center.z) > 0.002f) { throw new InvalidOperationException("The native harpoon optic did not seat on its authored rail: " + ((Object)val2).name); } } } private static void FitModelRecoil(Weapon weapon, Weapon donor) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) BarrelAttachment[] array = Barrels(weapon); BarrelAttachment[] array2 = Barrels(donor); for (int i = 0; i < array.Length; i++) { Vector3 modelRecoilPos = array2[i].ModelRecoilPos; NativeContentAccess.Set(array[i], "_modelRecoilPos", (object)new Vector3(modelRecoilPos.x * 0.15f, 0f, modelRecoilPos.z * 0.1f)); NativeContentAccess.Set(array[i], "_modelRecoilRot", array2[i].ModelRecoilRot * 0.2f); } } internal static Bounds SightBounds(Sight sight, Transform reference) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) MeshFilter[] componentsInChildren = ((Component)sight).GetComponentsInChildren(true); if (componentsInChildren.Length == 0) { throw new InvalidOperationException("A native harpoon sight has no rigid optical housing: " + ((Object)sight).name); } Matrix4x4 val = Matrix4x4.TRS(reference.position, reference.rotation, Vector3.one); Matrix4x4 inverse = ((Matrix4x4)(ref val)).inverse; Bounds? val2 = null; MeshFilter[] array = componentsInChildren; foreach (MeshFilter val3 in array) { if (!Object.op_Implicit((Object)(object)val3.sharedMesh)) { throw new InvalidOperationException("A native optical housing lost its mesh: " + ((Object)val3).name); } Bounds val4 = NativeSceneMeshes.TransformBounds(val3.sharedMesh.bounds, inverse * ((Component)val3).transform.localToWorldMatrix); if (val2.HasValue) { Bounds valueOrDefault = val2.GetValueOrDefault(); ((Bounds)(ref valueOrDefault)).Encapsulate(val4); val2 = valueOrDefault; } else { val2 = val4; } } return val2.Value; } internal static bool IsUpgradeRenderer(Weapon weapon, Renderer renderer) { return UpgradeAttachments(weapon).Any((Attachment attachment) => ((Component)renderer).transform.IsChildOf(((Component)attachment).transform)); } internal static void ApplyVisualVisibility(Weapon weapon) { AuthoredToolSkin component = ((Component)weapon).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { throw new InvalidOperationException("The harpoon is missing its authored appearance."); } Renderer val = NativeContentAccess.Get(component, "target"); Renderer[] componentsInChildren = ((Component)weapon).GetComponentsInChildren(true); foreach (Renderer val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)(object)val) && !((Object)(object)val2 == (Object)(object)((Tool)weapon).HandsMesh) && (val2 is MeshRenderer || val2 is SkinnedMeshRenderer)) { bool flag = IsUpgradeRenderer(weapon, val2); val2.forceRenderingOff = !flag; if (flag) { val2.enabled = true; } } } } internal static Attachment[] UpgradeAttachments(Weapon weapon) { return Sights(weapon).Skip(1).Cast().Concat((IEnumerable)(from barrel in Barrels(weapon) where Object.op_Implicit((Object)(object)((Attachment)barrel).Info) select barrel)) .Concat((IEnumerable)(object)new LaserSight[1] { Laser(weapon) }) .ToArray(); } internal static Sight[] Sights(Weapon weapon) { return NativeContentAccess.Get>(weapon.Attachments, "_sights").ToArray(); } internal static BarrelAttachment[] Barrels(Weapon weapon) { return NativeContentAccess.Get>(weapon.Attachments, "_barrelAttachments").ToArray(); } internal static BulletUpgrade[] Bullets(Weapon weapon) { return NativeContentAccess.Get(weapon.Attachments, "_bulletUpgrades"); } internal static LaserSight Laser(Weapon weapon) { return NativeContentAccess.Get(weapon.Attachments, "_laserSight"); } internal static void RequireNativeIdentity(AttachmentInfo? information) { if (!Object.op_Implicit((Object)(object)information)) { throw new InvalidOperationException("A native attachment identity is missing."); } byte indexOfAttachment = GameInfo.GetIndexOfAttachment(information); if (indexOfAttachment >= GameInfo.AllAttachments.Count || (Object)(object)GameInfo.AllAttachments[indexOfAttachment] != (Object)(object)information) { throw new InvalidOperationException("AttachmentInfo is not the native GameInfo identity: " + ((Object)information).name); } } internal void ValidateLiveWeapon(Weapon weapon) { if (!Object.op_Implicit((Object)(object)weapon) || ((Item)weapon).ID != 188) { throw new InvalidOperationException("Expected the registered native-network harpoon weapon 188."); } BulletUpgrade[] bullets = Bullets(weapon); if (bullets.Length != DamageTierCount + 1 || bullets[0].Damage != BaseDamage || offers.Where((HarpoonUpgradeOffer offer) => offer.Kind == HarpoonUpgradeKind.Ammunition).Any((HarpoonUpgradeOffer offer) => bullets[offer.Index].Damage != offer.Damage || bullets[offer.Index].Cost != offer.Cost)) { throw new InvalidOperationException("The harpoon lost its reinforced ammunition table."); } foreach (HarpoonUpgradeOffer item in offers.Where((HarpoonUpgradeOffer offer) => Object.op_Implicit((Object)(object)offer.Information))) { if (!weapon.Attachments.CanAttach(item.Information) || weapon.Attachments.GetAttachmentCost(item.Information) != item.Cost) { throw new InvalidOperationException("Native Awake/InitAttachments did not initialize " + item.Key); } } } internal object DescribeFit(Weapon weapon) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)weapon).GetComponentsInChildren(true).Single((Transform value) => ((Object)value).name == "Authored muzzle"); Vector3 origin = val.position; Vector3 forward = Barrels(weapon)[0].FirePoint.forward; Transform rail = ((Component)weapon).GetComponentsInChildren(true).Single((Transform value) => ((Object)value).name == "Authored sight_mount"); return new { authoredMuzzle = Vector(((Component)weapon).transform.InverseTransformPoint(origin)), barrels = Barrels(weapon).Select(delegate(BarrelAttachment barrel) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) string name = ((Object)barrel).name; float[] muzzle = Vector(((Component)weapon).transform.InverseTransformPoint(barrel.FirePoint.position)); float[] forward2 = Vector(((Component)weapon).transform.InverseTransformDirection(barrel.FirePoint.forward)); float axialExtension = Vector3.Dot(barrel.FirePoint.position - origin, forward); Vector3 val2 = Vector3.ProjectOnPlane(barrel.FirePoint.position - origin, forward); return new { name = name, muzzle = muzzle, forward = forward2, axialExtension = axialExtension, transverseError = ((Vector3)(ref val2)).magnitude, WeaponRecoilMulti = barrel.WeaponRecoilMulti, screenRecoil = new float[2] { barrel.ScreenRecoilAmount.x, barrel.ScreenRecoilAmount.y }, modelRecoilPosition = Vector(barrel.ModelRecoilPos), modelRecoilRotation = new float[2] { barrel.ModelRecoilRot.x, barrel.ModelRecoilRot.y } }; }).ToArray(), sights = Sights(weapon).Select(delegate(Sight sight) { //IL_0013: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) string name = ((Object)sight).name; bool useSniperUi = sight.UseSniperUi; float adsFov = sight.AdsFov; float[] ads = Vector(sight.AdsPos); object railSeat; if (!((Object)(object)sight == (Object)(object)Sights(weapon)[0])) { Bounds val2 = SightBounds(sight, rail); float y = ((Bounds)(ref val2)).min.y; val2 = SightBounds(sight, rail); float x = ((Bounds)(ref val2)).center.x; val2 = SightBounds(sight, rail); float z = ((Bounds)(ref val2)).center.z; val2 = SightBounds(sight, rail); railSeat = new { bottom = y, lateralOffset = x, longitudinalOffset = z, size = Vector(((Bounds)(ref val2)).size) }; } else { railSeat = null; } return new { name = name, UseSniperUi = useSniperUi, AdsFov = adsFov, ads = ads, railSeat = (<>f__AnonymousType3)railSeat, opticalPoint = (Object.op_Implicit((Object)(object)sight.SniperUiPos) ? Vector(((Component)weapon).transform.InverseTransformPoint(sight.SniperUiPos.position)) : null), hiddenInOverlay = sight.DisableWhenSniperUi.Select((GameObject value) => ((Object)value).name).ToArray() }; }).ToArray(), renderers = UpgradeAttachments(weapon).SelectMany((Attachment attachment) => ((Component)attachment).GetComponentsInChildren(true)).Select(delegate(Renderer renderer) { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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) string name = ((Object)renderer).name; bool enabled = renderer.enabled; bool forceRenderingOff = renderer.forceRenderingOff; bool activeSelf = ((Component)renderer).gameObject.activeSelf; bool activeInHierarchy = ((Component)renderer).gameObject.activeInHierarchy; Transform transform = ((Component)weapon).transform; Bounds bounds = renderer.bounds; float[] center = Vector(transform.InverseTransformPoint(((Bounds)(ref bounds)).center)); bounds = renderer.bounds; return new { name = name, enabled = enabled, forceRenderingOff = forceRenderingOff, activeSelf = activeSelf, activeInHierarchy = activeInHierarchy, center = center, worldSize = Vector(((Bounds)(ref bounds)).size) }; }).ToArray(), fitRequiresVisualReview = new string[5] { "red-dot/rail seating", "scope/rail seating and overlay transition", "laser/body clearance", "suppressor and compensator seat at authored muzzle", "reload and remote held/drop views" } }; } internal static int ScaleNativeDamage(int nativeDamage) { if (nativeDamage <= 0) { throw new ArgumentOutOfRangeException("nativeDamage"); } return checked(nativeDamage * 5) / 2; } private static string Describe(HarpoonUpgradeOffer offer) { return $"{offer.Key}:{offer.Kind}:{offer.Index}:{offer.GameInfoIndex}:{offer.Cost}"; } private static float[] Vector(Vector3 value) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) return new float[3] { value.x, value.y, value.z }; } private static void RequireOwned(Weapon weapon, Transform transform) { if (!Object.op_Implicit((Object)(object)transform) || !transform.IsChildOf(((Component)weapon).transform)) { throw new InvalidOperationException("A harpoon attachment reference escapes the cloned native weapon."); } } } [HarmonyPatch(typeof(PlayerUI), "ShowInspectInfo", new Type[] { typeof(Item), typeof(string) })] internal static class HeavyRodDescription { private static void Prefix(Item item, ref string description) { if (Object.op_Implicit((Object)(object)item) && ContentRegistry.TryDescribeOwnedItem(item, out ContentDescriptor descriptor) && descriptor.ItemId == 187) { description = "A 45 m spool with automatic power haul: 65% stronger line spring, 40% more damping and 80% faster held-reel cadence on a hooked catch. Unhooked casting keeps the native controls. No bonus damage, exclusive catches, or quest requirement."; } } } internal static class InventoryPreviewFit { internal static void Apply(InventorySlot slot, Item item) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0259: 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_0262: 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_02a1: 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_02ca: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Player.LocalPlayer)) { return; } PlayerInventory inventory = Player.LocalPlayer.Inventory; if (!NativeContentAccess.Get>(inventory, "_itemSlots").Contains(slot)) { return; } MeshFilter val = NativeContentAccess.Get(slot, "_filter"); Camera val2 = NativeContentAccess.Get(inventory, "_inventoryCamera"); RawImage val3 = NativeContentAccess.Get(slot, "_itemImage"); if (Object.op_Implicit((Object)(object)val.sharedMesh) && Object.op_Implicit((Object)(object)val2) && val2.orthographic) { Rect uvRect = val3.uvRect; if (!(((Rect)(ref uvRect)).width <= 0f)) { uvRect = val3.uvRect; if (!(((Rect)(ref uvRect)).height <= 0f)) { Transform transform = ((Component)val).transform; if (item is Tool) { if (!ContentRegistry.TryDescribeOwnedItem(item, out ContentDescriptor descriptor)) { throw new InvalidOperationException("The inventory tool does not belong to the current content catalog."); } Item nativeArchetype = ContentRegistry.Active.GetNativeArchetype(descriptor.Key); transform.localRotation = Quaternion.Euler(nativeArchetype.InventoryMeshRot); Renderer val4 = NativeContentAccess.Get(slot, "_renderer"); (((Component)val4).GetComponent() ?? ((Component)val4).gameObject.AddComponent()).Apply(val4, nativeArchetype); } Bounds val5 = Project(val2, val); Rect uvRect2 = val3.uvRect; float num = ((Rect)(ref uvRect2)).width * 0.86f; float num2 = ((Rect)(ref uvRect2)).height * 0.86f; if (((Bounds)(ref val5)).size.x <= 1E-05f || ((Bounds)(ref val5)).size.y <= 1E-05f) { throw new InvalidOperationException("The original inventory mesh projects to an empty silhouette: " + ((Object)item).name); } float num3 = Mathf.Min(num / ((Bounds)(ref val5)).size.x, num2 / ((Bounds)(ref val5)).size.y); transform.localScale *= num3; val5 = Project(val2, val); float num4 = Mathf.Clamp(((Bounds)(ref val5)).center.z, val2.nearClipPlane + ((Bounds)(ref val5)).extents.z + 0.05f, val2.farClipPlane - ((Bounds)(ref val5)).extents.z - 0.05f); Vector3 val6 = val2.ViewportToWorldPoint(new Vector3(((Rect)(ref uvRect2)).center.x, ((Rect)(ref uvRect2)).center.y, num4)); transform.position += val6 - val2.ViewportToWorldPoint(((Bounds)(ref val5)).center); Bounds val7 = Project(val2, val); if (((Bounds)(ref val7)).min.x < ((Rect)(ref uvRect2)).xMin || ((Bounds)(ref val7)).max.x > ((Rect)(ref uvRect2)).xMax || ((Bounds)(ref val7)).min.y < ((Rect)(ref uvRect2)).yMin || ((Bounds)(ref val7)).max.y > ((Rect)(ref uvRect2)).yMax || ((Bounds)(ref val7)).min.z < val2.nearClipPlane || ((Bounds)(ref val7)).max.z > val2.farClipPlane) { throw new InvalidOperationException("The fitted original preview escaped its native inventory tile: " + ((Object)item).name); } return; } } } throw new InvalidOperationException("The native inventory preview no longer has its expected mesh, atlas tile and orthographic camera."); } private static Bounds Project(Camera camera, MeshFilter filter) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Vector3[] vertices = filter.sharedMesh.vertices; Bounds result = default(Bounds); ((Bounds)(ref result))..ctor(camera.WorldToViewportPoint(((Component)filter).transform.TransformPoint(vertices[0])), Vector3.zero); Vector3[] array = vertices; foreach (Vector3 val in array) { ((Bounds)(ref result)).Encapsulate(camera.WorldToViewportPoint(((Component)filter).transform.TransformPoint(val))); } return result; } } internal sealed class InventoryPreviewPalette : MonoBehaviour { private readonly Dictionary materials = new Dictionary(); private readonly List owned = new List(); internal void Apply(Renderer renderer, Item native) { Material[] sharedMaterials = renderer.sharedMaterials; Material[] array = sharedMaterials.Where((Material material) => !materials.ContainsKey(material)).Distinct().ToArray(); if (array.Length != 0) { Material[] array2 = NativeFishMaterials.Create(native, array, owned); for (int num = 0; num < array.Length; num++) { materials.Add(array[num], array2[num]); } } renderer.sharedMaterials = sharedMaterials.Select((Material material) => materials[material]).ToArray(); } private void OnDestroy() { foreach (Object item in owned) { if (Object.op_Implicit(item)) { Object.Destroy(item); } } materials.Clear(); owned.Clear(); } } internal static class NativeContentAccess { internal static FieldInfo Field(Type type, string name) { return NativeAccess.Field(type, name); } internal static T Get(object target, string name) { return NativeAccess.Get(target, name); } internal static T Static(Type type, string name) { return NativeAccess.Static(type, name); } internal static T? Optional(object target, string name) where T : class { return NativeAccess.Optional(target, name); } internal static void Set(object target, string name, object? value) { NativeAccess.Set(target, name, value); } internal static bool Finite(float value) { return NativeAccess.Finite(value); } internal static void PrepareNetworkClone(GameObject clone, GameObject source) { NativeAccess.PrepareNetworkClone(clone, source); } } internal static class NativeFishMaterials { internal static Material[] Create(Item source, Material[] original, List owned) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) Material val = ((Component)source).GetComponentsInChildren(true).SelectMany((SkinnedMeshRenderer renderer) => ((Renderer)renderer).sharedMaterials).FirstOrDefault((Func)((Material material) => Object.op_Implicit((Object)(object)material) && material.HasProperty(ShaderManager.CooknessID))) ?? throw new InvalidOperationException("The native fish has no cooking shader: " + ((Object)source).name); if (((Object)val.shader).name != "Shader Graphs/DefaultShader" || !val.HasProperty("_Colors")) { throw new InvalidOperationException("The native fish no longer uses the verified cooking/palette shader."); } Dictionary mapped = new Dictionary(); foreach (Material item in original.Distinct()) { Color color = item.GetColor("_BaseColor"); Material val2 = new Material(val) { name = ((Object)item).name + " - native cooking" }; owned.Add((Object)(object)val2); val2.SetFloat(ShaderManager.CooknessID, 0f); if (val2.HasProperty(ShaderManager.UseSkinID)) { val2.SetFloat(ShaderManager.UseSkinID, 0f); } if (val2.HasProperty(ShaderManager.RainbowSkinID)) { val2.SetFloat(ShaderManager.RainbowSkinID, 0f); } Texture2D val3 = new Texture2D(1, 1, (TextureFormat)4, false, true) { name = ((Object)item).name + " - original pigment", wrapMode = (TextureWrapMode)1 }; val3.SetPixel(0, 0, color); val3.Apply(false, true); owned.Add((Object)(object)val3); val2.SetTexture("_Colors", (Texture)(object)val3); val2.SetFloat("_Emission", 0f); val2.SetFloat(ShaderManager.MetallicMetallicnessID, item.GetFloat("_Metallic")); val2.SetFloat(ShaderManager.PlasticMetallicnessID, item.GetFloat("_Metallic")); val2.SetFloat(ShaderManager.MetallicSmoothness, item.GetFloat("_Smoothness")); val2.SetFloat(ShaderManager.PlasticSmoothnessID, item.GetFloat("_Smoothness")); mapped.Add(item, val2); } return original.Select((Material material) => mapped[material]).ToArray(); } } internal sealed class AuthoredCookSurface : MonoBehaviour { [SerializeField] private bool managed; private MaterialPropertyBlock? previous; private MaterialPropertyBlock? current; internal bool Managed => managed; internal static void Bind(Renderer renderer) { (((Component)renderer).GetComponent() ?? ((Component)renderer).gameObject.AddComponent()).managed = true; } internal void Apply(Renderer renderer, float cookness) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (previous == null) { previous = new MaterialPropertyBlock(); renderer.GetPropertyBlock(previous); } if (current == null) { current = new MaterialPropertyBlock(); } renderer.GetPropertyBlock(current); current.SetFloat(ShaderManager.CooknessID, cookness); renderer.SetPropertyBlock(current); } internal static void Restore(Renderer renderer) { AuthoredCookSurface component = ((Component)renderer).GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.managed) { if (component.previous != null) { renderer.SetPropertyBlock(component.previous); } component.previous = null; component.current = null; component.managed = false; } } } [HarmonyPatch(typeof(ShaderManager), "SetItemCookness", new Type[] { typeof(Renderer), typeof(float) })] internal static class AuthoredCooknessPatch { private static bool Prefix(Renderer rend, float to) { AuthoredCookSurface component = ((Component)rend).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !component.Managed) { return true; } component.Apply(rend, to); return false; } } internal static class NativeSceneMeshes { internal static GameObject Clone(GameObject source, Transform parent) { return NativeSceneMeshes.Clone(source, parent); } internal static Bounds TransformBounds(Bounds bounds, Matrix4x4 matrix) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return NativeSceneMeshes.TransformBounds(bounds, matrix); } } internal sealed class NativeStockOffer { internal string Key { get; } internal string Reference { get; } internal ShopKind Kind { get; } internal byte NativeId { get; } internal string NativeName { get; } internal int Cost { get; } internal Item? Item { get; } internal BaitInfo? Bait { get; } internal string DisplayName { get { if (!Object.op_Implicit((Object)(object)Item)) { return Bait.NameLocalized; } return Item.GetName(); } } internal NativeStockOffer(ShopDefinition definition, Item? item, BaitInfo? bait) { //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) Key = definition.Key; Reference = definition.Reference; Kind = definition.Kind; NativeId = checked((byte)definition.NativeId); NativeName = definition.NativeName; Item = item; Bait = bait; Cost = (Object.op_Implicit((Object)(object)item) ? item.Cost : bait.Cost); } } internal sealed class NativeStockCatalog : IDisposable { private sealed class Template { internal Purchasable Stand; internal Quaternion Tilt; internal string Source = ""; } private readonly NativeStockOffer[] offers; private readonly int nativeBaitCount; private readonly GameObject nursery; private readonly Dictionary<(ShopKind Kind, byte Id), Template> templates; private readonly Dictionary stands; private readonly Dictionary standHeadings; private GameObject? spawnedRoot; private bool disposed; internal IReadOnlyList Offers => Array.AsReadOnly(offers); internal IReadOnlyDictionary Stands => stands; internal IReadOnlyList Missing { get { Template value; return (from offer in offers where !templates.TryGetValue((offer.Kind, offer.NativeId), out value) || !Object.op_Implicit((Object)(object)value.Stand) select $"{offer.Key}: paid {offer.NativeName} ({offer.Kind} {offer.NativeId})").ToArray(); } } internal bool IsPrepared { get { if (!disposed) { return Missing.Count == 0; } return false; } } internal string MissingDiagnostic { get { if (!disposed) { if (Missing.Count != 0) { return "No verified native display captured for " + string.Join("; ", Missing); } return ""; } return "Native stock catalog disposed."; } } internal IReadOnlyDictionary Sources => offers.Where((NativeStockOffer offer) => templates.ContainsKey((offer.Kind, offer.NativeId))).ToDictionary((NativeStockOffer offer) => offer.Key, (NativeStockOffer offer) => templates[(offer.Kind, offer.NativeId)].Source, StringComparer.Ordinal); internal NativeStockCatalog(IReadOnlyList definitions) { HarborLureCatalog? current = HarborLureCatalog.Current; if (current == null || !current.IsReady) { throw new InvalidOperationException("Register expansion lures before preparing native stock."); } this..ctor(definitions, HarborLureCatalog.Current.OriginalBaitCount); } internal NativeStockCatalog(IReadOnlyList definitions, int originalNativeBaitCount) { //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown templates = new Dictionary<(ShopKind, byte), Template>(); stands = new Dictionary(StringComparer.Ordinal); standHeadings = new Dictionary(StringComparer.Ordinal); base..ctor(); NativeStockCatalog nativeStockCatalog = this; if (definitions == null || definitions.Count > 128 || definitions.Any((ShopDefinition value) => value == null)) { throw new ArgumentException("Native stock needs a bounded, non-null shop definition list."); } if (originalNativeBaitCount < 1 || originalNativeBaitCount > GameInfo.AllBaits.Count) { throw new ArgumentException("Supply the native bait count recorded before expansion lures were appended."); } nativeBaitCount = originalNativeBaitCount; ShopDefinition[] array = definitions.Where(delegate(ShopDefinition value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 ShopKind kind = value.Kind; return kind - 5 <= 1; }).ToArray(); if (array.Select((ShopDefinition value) => value.Key).Distinct(StringComparer.Ordinal).Count() != array.Length) { throw new ArgumentException("Native stock shelf keys must be unique."); } HashSet originals = new HashSet(Resources.LoadAll("Items")); HashSet nativeBaits = new HashSet(Resources.LoadAll("Baits")); if (originals.Count == 0) { throw new InvalidOperationException("Initialize native GameInfo before resolving stock."); } offers = array.Select((ShopDefinition definition) => nativeStockCatalog.Resolve(definition, originals, nativeBaits)).ToArray(); nursery = new GameObject("Inactive native stock templates"); nursery.SetActive(false); Object.DontDestroyOnLoad((Object)(object)nursery); } internal Vector3 ApproachDirection(string key) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_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_0068: 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) RequireAlive(); if (!Object.op_Implicit((Object)(object)spawnedRoot) || !standHeadings.TryGetValue(key, out var value)) { throw new InvalidOperationException("The native stock shelf has not been placed: " + key); } Vector3 val = Vector3.ProjectOnPlane(spawnedRoot.transform.TransformDirection(Quaternion.Euler(0f, value, 0f) * Vector3.forward), Vector3.up); return ((Vector3)(ref val)).normalized; } internal static IReadOnlyList FindSpawned(Transform parent) { if (!Object.op_Implicit((Object)(object)parent)) { throw new ArgumentNullException("parent"); } return (from binding in ((Component)parent).GetComponentsInChildren(true) where binding.Catalog != null && !binding.Catalog.disposed select binding.Catalog).Distinct().ToArray(); } private NativeStockOffer Resolve(ShopDefinition definition, HashSet nativeItems, HashSet nativeBaits) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Invalid comparison between Unknown and I4 //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (!ValidKey(definition.Key) || !ValidKey(definition.Reference) || string.IsNullOrWhiteSpace(definition.NativeName) || definition.NativeName.Length > 120 || definition.NativeName != definition.NativeName.Trim() || definition.NativeName.Any(char.IsControl) || definition.NativeId < 0 || definition.NativeId >= 255) { throw new ArgumentException("Invalid native stock identity: " + definition.Key); } if ((int)definition.Kind == 5) { Item val = GameInfo.IDToItem((byte)definition.NativeId); if (!Object.op_Implicit((Object)(object)val) || !nativeItems.Contains(val) || ((Object)val).name != definition.NativeName || val.Cost <= 0) { throw new InvalidOperationException($"Native item {definition.NativeId} must resolve to paid stock '{definition.NativeName}', not a replacement asset."); } if (val is Map || val.IsQuestItem || Object.op_Implicit((Object)(object)val.DeadPlayer) || (Object.op_Implicit((Object)(object)val.Creature) && (int)val.Creature.BossType != 0)) { throw new InvalidOperationException("Maps, quest items, bosses and dead players are not ordinary store stock: " + definition.NativeName); } return new NativeStockOffer(definition, val, null); } if (definition.NativeId == 0 || definition.NativeId >= nativeBaitCount) { throw new InvalidOperationException("Native lure stock must use a nonempty, pre-append bait index: " + definition.Key); } BaitInfo val2 = GameInfo.AllBaits[definition.NativeId]; if (!Object.op_Implicit((Object)(object)val2) || !nativeBaits.Contains(val2) || ((Object)val2).name != definition.NativeName || val2.Cost <= 0 || !Object.op_Implicit((Object)(object)val2.Mesh) || GameInfo.GetIndexOfBait(val2) != definition.NativeId || val2.ItemWeights == null || !val2.ItemWeights.Any(delegate(ItemInfoWeight entry) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 if (entry != null && entry.Weight > 0f && Object.op_Implicit((Object)(object)entry.Fishable)) { Item itemToSpawn = entry.Fishable.ItemToSpawn; Creature val3 = (Creature)(object)((itemToSpawn is Creature) ? itemToSpawn : null); if (val3 != null) { return (int)val3.BossType == 0; } } return false; })) { throw new InvalidOperationException($"Native bait index {definition.NativeId} must resolve to ordinary paid stock '{definition.NativeName}'."); } if (((Object)val2).name.IndexOf("Boss", StringComparison.OrdinalIgnoreCase) >= 0) { throw new InvalidOperationException("Earned or boss-specific lures are not ordinary stock: " + ((Object)val2).name); } return new NativeStockOffer(definition, null, val2); } internal void Capture(Scene scene) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) RequireAlive(); if (!((Scene)(ref scene)).IsValid() || !((Scene)(ref scene)).isLoaded || ((Scene)(ref scene)).buildIndex < 1) { throw new ArgumentException("Capture stock from a loaded native island scene."); } ValidateNativeAssets(); foreach (Purchasable candidate in ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject root) => root.GetComponentsInChildren(true))) { NativeStockOffer nativeStockOffer = offers.FirstOrDefault((NativeStockOffer value) => Matches(candidate, value)); if (nativeStockOffer == null || templates.ContainsKey((nativeStockOffer.Kind, nativeStockOffer.NativeId)) || NativeContentAccess.Get(candidate, "_isFree") || !NativeContentAccess.Get(candidate, "_customCanBuy")) { continue; } ValidateReferences(candidate); Purchasable component = NativeSceneMeshes.Clone(((Component)candidate).gameObject, nursery.transform).GetComponent(); bool flag = false; try { ((Object)component).name = "Native stock template " + nativeStockOffer.NativeName; ((Component)component).transform.localScale = ((Component)candidate).transform.lossyScale; NativeContentAccess.Set(component, "_isHovering", false); ValidateReferences(component); if (!Matches(component, nativeStockOffer)) { throw new InvalidOperationException("A native stock clone changed its asset reference."); } templates.Add((nativeStockOffer.Kind, nativeStockOffer.NativeId), new Template { Stand = component, Tilt = Quaternion.Inverse(Quaternion.Euler(0f, ((Component)candidate).transform.eulerAngles.y, 0f)) * ((Component)candidate).transform.rotation, Source = ((Scene)(ref scene)).name + ":" + Hierarchy(((Component)candidate).transform) }); flag = true; } finally { if (!flag && Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)((Component)component).gameObject); } } } } internal void Spawn(Transform parent, IReadOnlyDictionary positions, IReadOnlyDictionary headings) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) RequireAlive(); if (!IsPrepared) { throw new InvalidOperationException(MissingDiagnostic); } if (!Object.op_Implicit((Object)(object)parent) || positions == null || headings == null) { throw new ArgumentException("Native stock requires shelf positions and headings."); } if (Object.op_Implicit((Object)(object)spawnedRoot) || stands.Values.Any((Purchasable val) => Object.op_Implicit((Object)(object)val))) { throw new InvalidOperationException("Clear the previous native stock displays before rebuilding them."); } stands.Clear(); standHeadings.Clear(); ValidateNativeAssets(); NativeStockOffer[] array = offers; foreach (NativeStockOffer nativeStockOffer in array) { if (!positions.TryGetValue(nativeStockOffer.Key, out var value) || !Finite(value) || !headings.TryGetValue(nativeStockOffer.Key, out var value2) || !NativeContentAccess.Finite(value2)) { throw new InvalidOperationException("Missing or invalid native stock shelf marker: " + nativeStockOffer.Key); } } if (offers.Length == 0) { return; } spawnedRoot = new GameObject("Native store stock"); spawnedRoot.SetActive(false); spawnedRoot.transform.SetParent(parent, false); spawnedRoot.AddComponent().Catalog = this; bool flag = false; try { array = offers; foreach (NativeStockOffer nativeStockOffer2 in array) { Template template = templates[(nativeStockOffer2.Kind, nativeStockOffer2.NativeId)]; Purchasable component = NativeSceneMeshes.Clone(((Component)template.Stand).gameObject, spawnedRoot.transform).GetComponent(); stands.Add(nativeStockOffer2.Key, component); standHeadings.Add(nativeStockOffer2.Key, headings[nativeStockOffer2.Key]); ((Object)component).name = "Native stock " + nativeStockOffer2.Key; ((Component)component).transform.localPosition = positions[nativeStockOffer2.Key]; ((Component)component).transform.localRotation = Quaternion.Euler(0f, headings[nativeStockOffer2.Key], 0f) * template.Tilt; ValidateReferences(component); if (!Matches(component, nativeStockOffer2) || NativeContentAccess.Get(component, "_isFree")) { throw new InvalidOperationException("The placed stand lost its paid native stock identity: " + nativeStockOffer2.Key); } SeatOnSurface(component, spawnedRoot.transform, positions[nativeStockOffer2.Key].y); ((Component)component).gameObject.SetActive(true); } spawnedRoot.SetActive(true); flag = true; } finally { if (!flag) { ClearSpawned(); } } } internal void ValidateNativeAssets() { RequireAlive(); if (GameInfo.AllBaits.Count < nativeBaitCount) { throw new InvalidOperationException("Native stock outlived the registered bait catalog."); } NativeStockOffer[] array = offers; foreach (NativeStockOffer nativeStockOffer in array) { if (Object.op_Implicit((Object)(object)nativeStockOffer.Item)) { if ((Object)(object)GameInfo.IDToItem(nativeStockOffer.NativeId) != (Object)(object)nativeStockOffer.Item || ((Object)nativeStockOffer.Item).name != nativeStockOffer.NativeName || nativeStockOffer.Item.Cost != nativeStockOffer.Cost || nativeStockOffer.Item.IsQuestItem || nativeStockOffer.Item is Map) { throw new InvalidOperationException("The resolved native stock item changed: " + nativeStockOffer.Key); } } else if (!Object.op_Implicit((Object)(object)nativeStockOffer.Bait) || (Object)(object)GameInfo.AllBaits[nativeStockOffer.NativeId] != (Object)(object)nativeStockOffer.Bait || GameInfo.GetIndexOfBait(nativeStockOffer.Bait) != nativeStockOffer.NativeId || ((Object)nativeStockOffer.Bait).name != nativeStockOffer.NativeName || nativeStockOffer.Bait.Cost != nativeStockOffer.Cost) { throw new InvalidOperationException("The resolved native stock lure/index changed: " + nativeStockOffer.Key); } } } internal void ValidateLiveStand(NativeStockOffer offer) { ValidateNativeAssets(); if (!offers.Contains(offer) || !stands.TryGetValue(offer.Key, out Purchasable value) || !Object.op_Implicit((Object)(object)value) || !((Behaviour)value).isActiveAndEnabled || !Matches(value, offer)) { throw new InvalidOperationException("The native stock display is missing or inactive: " + offer.Key); } ValidateReferences(value); if (NativeContentAccess.Get(value, "_isFree") || NativeContentAccess.Get(value, "_customCost") != offer.Cost) { throw new InvalidOperationException("Native Awake/Hover did not initialize the default stock price: " + offer.Key); } } private static bool Matches(Purchasable stand, NativeStockOffer offer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)offer.Kind != 5) { if (((object)stand).GetType() == typeof(BaitPurchasable)) { return (Object)(object)NativeContentAccess.Optional(stand, "_bait") == (Object)(object)offer.Bait; } return false; } if (((object)stand).GetType() == typeof(ItemPurchasable)) { return (Object)(object)NativeContentAccess.Optional(stand, "_itemToPurchase") == (Object)(object)offer.Item; } return false; } private static void ValidateReferences(Purchasable stand) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) Collider val = NativeContentAccess.Get(stand, "_interactCol"); GameObject[] array = NativeContentAccess.Get(stand, "_modelsToOutline"); if (!Object.op_Implicit((Object)(object)val) || !val.enabled || !((Component)val).transform.IsChildOf(((Component)stand).transform) || !((Component)val).CompareTag("Interactable") || !Object.op_Implicit((Object)(object)((Interactable)stand).TextTarget) || !((Interactable)stand).TextTarget.IsChildOf(((Component)stand).transform) || array.Length == 0 || array.Any((GameObject model) => !Object.op_Implicit((Object)(object)model) || !model.transform.IsChildOf(((Component)stand).transform)) || ((Component)stand).GetComponentsInChildren(true).Length != 1 || ((Component)stand).GetComponentsInChildren(true).Length != 0 || ((Component)stand).GetComponentsInChildren(true).Length != 0 || !Finite(((Component)stand).transform.lossyScale) || ((Component)stand).transform.lossyScale.x <= 0f || ((Component)stand).transform.lossyScale.y <= 0f || ((Component)stand).transform.lossyScale.z <= 0f) { throw new InvalidOperationException("Native stock requires a self-contained, non-networked purchase display: " + ((Object)stand).name); } } private static void SeatOnSurface(Purchasable stand, Transform parent, float height) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) Bounds val = default(Bounds); MeshFilter[] array = (from filter in ((Component)stand).GetComponentsInChildren(true) where Object.op_Implicit((Object)(object)filter.sharedMesh) && ActiveBelow(((Component)filter).transform, ((Component)stand).transform) && ((Component)filter).TryGetComponent(ref val) && ((Renderer)val).enabled select filter).ToArray(); if (array.Length == 0) { throw new InvalidOperationException("The native stock display has no visible owned geometry."); } float num = array.Min(delegate(MeshFilter filter) { //IL_0006: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) val = NativeSceneMeshes.TransformBounds(filter.sharedMesh.bounds, parent.worldToLocalMatrix * ((Component)filter).transform.localToWorldMatrix); return ((Bounds)(ref val)).min.y; }); if (!NativeContentAccess.Finite(num)) { throw new InvalidOperationException("The native stock display has invalid bounds."); } Transform transform = ((Component)stand).transform; transform.localPosition += Vector3.up * (height - num); } private static bool ActiveBelow(Transform node, Transform root) { while ((Object)(object)node != (Object)(object)root) { if (!Object.op_Implicit((Object)(object)node) || !((Component)node).gameObject.activeSelf) { return false; } node = node.parent; } return true; } private static string Hierarchy(Transform node) { List list = new List(); while (Object.op_Implicit((Object)(object)node)) { list.Add(((Object)node).name); node = node.parent; } list.Reverse(); return string.Join("/", list); } private static bool Finite(Vector3 value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (NativeContentAccess.Finite(value.x) && NativeContentAccess.Finite(value.y)) { return NativeContentAccess.Finite(value.z); } return false; } private static bool ValidKey(string value) { if (!string.IsNullOrEmpty(value) && value.Length <= 64 && value[0] >= 'a' && value[0] <= 'z') { return value.All(delegate(char character) { switch (character) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '_': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': return true; default: return false; } }); } return false; } internal void ClearSpawned() { if (Object.op_Implicit((Object)(object)spawnedRoot)) { spawnedRoot.GetComponent().Catalog = null; spawnedRoot.SetActive(false); Object.Destroy((Object)(object)spawnedRoot); } spawnedRoot = null; stands.Clear(); standHeadings.Clear(); } private void RequireAlive() { if (disposed) { throw new ObjectDisposedException("NativeStockCatalog"); } } public void Dispose() { if (!disposed) { ClearSpawned(); disposed = true; templates.Clear(); Object.Destroy((Object)(object)nursery); } } } internal sealed class NativeStockBinding : MonoBehaviour { internal NativeStockCatalog? Catalog { get; set; } } } namespace GamblersReach.Characters { internal sealed class ChapterQuests : IDisposable { internal const byte BarracudaQuestIndex = 0; internal const byte AnglerQuestIndex = 1; internal const byte IslandFiveUnlockCount = 5; private readonly List previousQuests; private readonly QuestInteractable? previousHand; private readonly bool createdHand; private static NPCQuest? cachedBaitTemplate; private static NPCQuest? cachedCoordinatesTemplate; private static QuestInteractable? cachedRewardHand; private static readonly string[] LineFields = new string[5] { "_linesLocalized", "_onItemReceivedLinesLocalized", "_onQuestCompletedLinesLocalized", "_holdingItemLinesLocalized", "_alreadyCompletedLinesLocalized" }; internal NPC Collector { get; } internal BaitInfo AnglerLure { get; } internal Item BarracudaTrophy { get; } internal Item AnglerTrophy { get; } internal NPCQuest BarracudaQuest { get; } internal NPCQuest AnglerQuest { get; } internal QuestInteractable RewardHand { get; } internal bool IsDisposed { get; private set; } internal static void CaptureNativeTemplates(NPC npc) { //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_0075: 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_009c: Invalid comparison between Unknown and I4 //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)npc) || (Object)(object)ReachNpcMarker.For(npc) != (Object)null) { return; } Scene scene = ((Component)npc).gameObject.scene; if (((Scene)(ref scene)).buildIndex < 1) { return; } foreach (NPCQuest item in npc.Quests.Where((NPCQuest quest) => Object.op_Implicit((Object)(object)quest))) { if (!Object.op_Implicit((Object)(object)cachedBaitTemplate) && (int)item.Type == 0) { cachedBaitTemplate = CaptureQuest(item); } if (!Object.op_Implicit((Object)(object)cachedCoordinatesTemplate) && (int)item.Type == 3 && Object.op_Implicit((Object)(object)item.InteractableMesh)) { cachedCoordinatesTemplate = CaptureQuest(item); } } if (!Object.op_Implicit((Object)(object)cachedRewardHand)) { object? value = NativeNpc.QuestInteraction.GetValue(npc); QuestInteractable val = (QuestInteractable)((value is QuestInteractable) ? value : null); if (Object.op_Implicit((Object)(object)val) && !((Object)(object)((Component)val).gameObject == (Object)(object)((Component)npc).gameObject) && !Object.op_Implicit((Object)(object)((Component)val).GetComponentInChildren(true))) { GameObject val2 = new GameObject("Gambler's Reach - native reward template") { hideFlags = (HideFlags)61 }; val2.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val2); cachedRewardHand = Object.Instantiate(((Component)val).gameObject, val2.transform, false).GetComponent(); } } } private static NPCQuest CaptureQuest(NPCQuest source) { //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) NPCQuest obj = Object.Instantiate(source); ((Object)obj).name = "Gambler's Reach - native chapter template " + ((object)source.Type/*cast due to .constrained prefix*/).ToString(); ((Object)obj).hideFlags = (HideFlags)61; return obj; } internal ChapterQuests(NPC collector, BaitInfo anglerLure, Item barracudaTrophy, Item anglerTrophy, NPCQuest? baitTemplate = null, NPCQuest? coordinatesTemplate = null) { //IL_0423: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)collector) || collector.ID != 231 || (Object)(object)ReachNpcMarker.For(collector) == (Object)null) { throw new ArgumentException("Bind chapter quests only to the expansion's actual collector (231)."); } if (!((Component)collector).GetComponents().Any((Collider collider) => collider.isTrigger)) { throw new InvalidOperationException("The collector's native root intake trigger is missing."); } if (!Object.op_Implicit((Object)(object)anglerLure) || !Object.op_Implicit((Object)(object)barracudaTrophy) || !Object.op_Implicit((Object)(object)anglerTrophy) || barracudaTrophy.ID != 192 || anglerTrophy.ID != 193) { throw new ArgumentException("Chapter quests require the registered Angler lure and trophy prefabs 192/193."); } if (barracudaTrophy.IgnoredByCloseDots || anglerTrophy.IgnoredByCloseDots) { throw new ArgumentException("Chapter trophy prefabs must be eligible for native world saving."); } byte indexOfBait = GameInfo.GetIndexOfBait(anglerLure); if (indexOfBait == 0 || indexOfBait >= GameInfo.AllBaits.Count || GameInfo.AllBaits[indexOfBait] != anglerLure || !Object.op_Implicit((Object)(object)anglerLure.MeshForNpc)) { throw new InvalidOperationException("Register the Angler lure, including its native reward mesh, before binding the collector."); } NPCQuest[] array = (from quest in Resources.FindObjectsOfTypeAll() where Object.op_Implicit((Object)(object)quest) && !((Object)quest).name.StartsWith("Gambler's Reach", StringComparison.Ordinal) select quest).ToArray(); if (baitTemplate == null) { baitTemplate = (Object.op_Implicit((Object)(object)cachedBaitTemplate) ? cachedBaitTemplate : ((IEnumerable)array).FirstOrDefault((Func)((NPCQuest quest) => (int)quest.Type == 0))); } if (coordinatesTemplate == null) { coordinatesTemplate = (Object.op_Implicit((Object)(object)cachedCoordinatesTemplate) ? cachedCoordinatesTemplate : ((IEnumerable)array).FirstOrDefault((Func)((NPCQuest quest) => (int)quest.Type == 3 && Object.op_Implicit((Object)(object)quest.InteractableMesh)))); } if (!Object.op_Implicit((Object)(object)baitTemplate) || !Object.op_Implicit((Object)(object)coordinatesTemplate)) { throw new InvalidOperationException("Native GiveBait and UnlockIsland quest templates must be loaded before binding the collector."); } LocalizedString[] array2 = (from line in array.Concat((IEnumerable)(object)new NPCQuest[2] { baitTemplate, coordinatesTemplate }).SelectMany((NPCQuest quest) => quest.Lines ?? Array.Empty()) where line != null && !((LocalizedReference)line).IsEmpty && !string.IsNullOrWhiteSpace(line.GetLocalizedString()) select line).Take(1).ToArray(); if (array2.Length == 0) { throw new InvalidOperationException("Wait for the native quest localization tables before binding chapter dialogue."); } Collector = collector; AnglerLure = anglerLure; BarracudaTrophy = barracudaTrophy; AnglerTrophy = anglerTrophy; previousQuests = collector.Quests.ToList(); ref QuestInteractable? reference = ref previousHand; object? value = NativeNpc.QuestInteraction.GetValue(collector); reference = (QuestInteractable?)((value is QuestInteractable) ? value : null); RewardHand = ((Component)collector).GetComponentInChildren(true); if (!Object.op_Implicit((Object)(object)RewardHand)) { RewardHand = Object.Instantiate(((Component)(Object.op_Implicit((Object)(object)cachedRewardHand) ? cachedRewardHand : (((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)delegate(QuestInteractable hand) { if (Object.op_Implicit((Object)(object)hand)) { NPC componentInParent = ((Component)hand).GetComponentInParent(); if (componentInParent != null) { return (Object)(object)ReachNpcMarker.For(componentInParent) == (Object)null; } } return false; }) ?? throw new InvalidOperationException("The collector needs a native QuestInteractable reward hand.")))).gameObject, NativeNpc.Read(NativeNpc.HoldingHand, collector), false).GetComponent(); createdHand = true; } BarracudaQuest = Clone(baitTemplate, "Barracuda trophy", barracudaTrophy, (QuestType)0, array2); AnglerQuest = Clone(coordinatesTemplate, "Angler trophy", anglerTrophy, (QuestType)3, array2); NativeNpc.Field("_baitToReceive", typeof(BaitInfo)).SetValue(BarracudaQuest, anglerLure); NativeNpc.Field("_islandToUnlock", typeof(byte)).SetValue(AnglerQuest, (byte)5); NativeNpc.Quests.SetValue(collector, new List { BarracudaQuest, AnglerQuest }); NativeNpc.Field("_serverProgressions", typeof(byte[])).SetValue(collector, new byte[2]); NativeNpc.QuestIndex.SetValue(collector, (byte)0); NativeNpc.LineIndex.SetValue(collector, (byte)0); NativeNpc.QuestInteraction.SetValue(collector, RewardHand); RewardHand.LinkNpc(collector); ((Behaviour)RewardHand).enabled = true; ((Component)RewardHand).transform.localScale = Vector3.one; Collider obj = NativeNpc.Read(NativeNpc.InteractCollider, RewardHand); obj.enabled = true; ((Component)obj).gameObject.layer = LayerMask.NameToLayer("Interactable"); ((Component)obj).tag = "Interactable"; MeshRenderer[] componentsInChildren = ((Component)RewardHand).GetComponentsInChildren(true); for (int num = 0; num < componentsInChildren.Length; num++) { ((Renderer)componentsInChildren[num]).enabled = true; } ((Component)RewardHand).gameObject.SetActive(false); foreach (Collider item in from collider in ((Component)collector).GetComponents() where collider.isTrigger select collider) { item.enabled = true; } if (!NativeNpc.HasLiveIntake(collector)) { throw new InvalidOperationException("The collector's native root intake trigger is missing."); } } private static NPCQuest Clone(NPCQuest template, string label, Item trophy, QuestType type, LocalizedString[] fallback) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) NPCQuest val = Object.Instantiate(template); ((Object)val).name = "Gambler's Reach - " + label; ((Object)val).hideFlags = (HideFlags)52; NativeNpc.Field("_questItems", typeof(List)).SetValue(val, new List { trophy }); NativeNpc.Field("_onlyCreatures", typeof(bool)).SetValue(val, false); NativeNpc.Field("_totalItems", typeof(byte)).SetValue(val, (byte)1); NativeNpc.Field("_type", typeof(QuestType)).SetValue(val, type); string[] lineFields = LineFields; for (int i = 0; i < lineFields.Length; i++) { NativeNpc.Field(lineFields[i], typeof(LocalizedString[])).SetValue(val, fallback.ToArray()); } return val; } internal bool Owns(NPC? npc) { if (!IsDisposed && Object.op_Implicit((Object)(object)Collector)) { return Collector == npc; } return false; } internal bool Owns(NPCQuest? quest) { if (!IsDisposed) { if (quest != BarracudaQuest) { return quest == AnglerQuest; } return true; } return false; } internal ChapterReward RewardFor(NPCQuest quest) { if (quest != BarracudaQuest) { if (quest == AnglerQuest) { return (ChapterReward)2; } return (ChapterReward)0; } return (ChapterReward)1; } internal byte IndexFor(ChapterReward reward) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)reward != 1) { if ((int)reward != 2) { return byte.MaxValue; } return 1; } return 0; } internal void RestoreReward(ChapterProgress state, bool authoritative) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!IsDisposed && Object.op_Implicit((Object)(object)Collector) && Object.op_Implicit((Object)(object)NPCManager.Instance)) { byte b = IndexFor(state.PendingReward); byte b2 = default(byte); if (authoritative && (!NPCManager.Instance._idToShowingQuestIndex.TryGetValue(Collector.ID, ref b2) || b2 != b)) { NPCManager.Instance.SetShowingNpcQuest(Collector.ID, b); } Collector.OnShowingQuestIndexChange(b); } } internal static string CollectorLine(ChapterProgress state) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 if (!state.Initialized) { return "Easy. A chart's no use while the ink is still running."; } if ((int)state.PendingReward == 1) { return "My hand's getting tired. Take this little light before the dark notices us."; } if ((int)state.PendingReward == 2) { return "A stolen star for an honest course. There's a fresh mark here - take it before the tide changes its mind."; } if (state.CoordinatesClaimed) { return "Your chart has another scar now. Follow it. If the dark swallows that lure, the silver knife owes us another jaw."; } if (state.AnglerLureClaimed) { return "The deep wears a borrowed star. You've got its invitation. Bring me that lantern, and I'll show you water this harbor can't hold."; } return "The harbor has a silver knife that swims. Barracuda, to polite company. Bring me its jaw. Then we'll see what answers a light in the dark."; } internal string Line(byte questIndex, QuestLineType lineType, ChapterProgress state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)lineType == 2) { if (questIndex != 0) { return "Well. Even the deep has to pay up. Take this chart. There's more sea beyond our doorstep."; } return "There. The knife's lost its edge. Take this little light. Lower it where daylight gives up - and mind what looks back."; } return CollectorLine(state); } public void Dispose() { if (IsDisposed) { return; } ReachSession.Current?.UnbindChapterQuests(this); if (Object.op_Implicit((Object)(object)Collector) && Collector.Quests.Contains(BarracudaQuest)) { if (Object.op_Implicit((Object)(object)NPCManager.Instance) && Object.op_Implicit((Object)(object)Server.Instance) && ((NetworkBehaviour)Server.Instance).IsServerInitialized) { NPCManager.Instance.ResetItemHeld(Collector.ID); } ((Component)RewardHand).gameObject.SetActive(false); NativeNpc.Quests.SetValue(Collector, previousQuests); NativeNpc.Field("_serverProgressions", typeof(byte[])).SetValue(Collector, new byte[previousQuests.Count]); NativeNpc.QuestIndex.SetValue(Collector, (byte)0); NativeNpc.LineIndex.SetValue(Collector, (byte)0); NativeNpc.QuestInteraction.SetValue(Collector, previousHand); } IsDisposed = true; if (createdHand && Object.op_Implicit((Object)(object)RewardHand)) { Object.Destroy((Object)(object)((Component)RewardHand).gameObject); } Object.Destroy((Object)(object)BarracudaQuest); Object.Destroy((Object)(object)AnglerQuest); } } internal static class NativeNpc { internal static readonly FieldInfo Id = Field("_id", typeof(byte)); internal static readonly FieldInfo ForScreenshot = Field("_forScreenshot", typeof(bool)); internal static readonly FieldInfo Character = Field("_characterInteractable", typeof(Interactable)); internal static readonly FieldInfo QuestInteraction = Field("questInteractable", typeof(QuestInteractable)); internal static readonly FieldInfo Talk = Field("_npcInteractable", typeof(NPCInteractable)); internal static readonly FieldInfo Quests = Field("_quests", typeof(List)); internal static readonly FieldInfo Head = Field("_head", typeof(SkinnedMeshRenderer)); internal static readonly FieldInfo Outfit = Field("_outfit", typeof(SkinnedMeshRenderer)); internal static readonly FieldInfo LeftHand = Field("_handLeft", typeof(SkinnedMeshRenderer)); internal static readonly FieldInfo RightHand = Field("_handRight", typeof(SkinnedMeshRenderer)); internal static readonly FieldInfo HoldingHand = Field("_handHoldingItem", typeof(Transform)); internal static readonly FieldInfo LowerMouth = Field("_mouthLower", typeof(Transform)); internal static readonly FieldInfo UpperMouth = Field("_mouthUpper", typeof(Transform)); internal static readonly FieldInfo MouthAudio = Field("_mouthSource", typeof(AudioSource)); internal static readonly FieldInfo Eyes = Field("_eyes", typeof(Transform[])); internal static readonly FieldInfo EyePosition = Field("_eyePos", typeof(Vector3)); internal static readonly FieldInfo DefaultEyeForward = Field("_defaultEyeForward", typeof(Vector3)); internal static readonly FieldInfo DefaultEyeRotation = Field("_defaultEyeRot", typeof(Quaternion)); internal static readonly FieldInfo SkinColor = Field("_skinColor", typeof(Vector3)); internal static readonly FieldInfo ShaderSkinColor = Field("_shaderSkinColor", typeof(Vector3)); internal static readonly FieldInfo SpeakMovements = Field("_speakMovements", typeof(byte)); internal static readonly FieldInfo SpeakMovementsLeft = Field("_speakMovementsLeft", typeof(byte)); internal static readonly FieldInfo MouthState = Field("_mouthState"); private static readonly FieldInfo MouthRestRotation = Field("_mouthStartRot", typeof(float)); private static readonly FieldInfo HandRestPosition = Field("_handStartPos", typeof(Vector3)); private static readonly FieldInfo HandRestEuler = Field("_handStartEuler", typeof(Vector3)); internal static readonly FieldInfo LookingAt = Field("_targetLookingAt", typeof(Transform)); internal static readonly FieldInfo QuestIndex = Field("_curQuestIndex", typeof(byte)); internal static readonly FieldInfo LineIndex = Field("_curLineIndex", typeof(byte)); internal static readonly FieldInfo InteractCollider = Field("_interactCol", typeof(Collider)); internal static readonly FieldInfo OutlineModels = Field("_modelsToOutline", typeof(GameObject[])); internal static readonly FieldInfo IsHovering = Field("_isHovering", typeof(bool)); internal static readonly FieldInfo HoverText = Field("_hoverText", typeof(string)); private static readonly FieldInfo RegistryField = Field("_idToNpc", typeof(Dictionary)); private static readonly MethodInfo InteractMethod = Method("OnInteract"); private static readonly Func Speak = (Func)Delegate.CreateDelegate(typeof(Func), Method("SpeakEffects")); private static readonly object RestingMouth = Enum.Parse(MouthState.FieldType, "None"); private static readonly object SpeakingMouth = Enum.Parse(MouthState.FieldType, "Speaking"); private static readonly FieldInfo QuestItems = Field("_questItems", typeof(List)); private static readonly FieldInfo OnlyCreatures = Field("_onlyCreatures", typeof(bool)); private static readonly FieldInfo QuestKind = Field("_type", typeof(QuestType)); private static readonly FieldInfo TotalItems = Field("_totalItems", typeof(byte)); private static readonly FieldInfo[] QuestLines = new FieldInfo[5] { Field("_linesLocalized", typeof(LocalizedString[])), Field("_onItemReceivedLinesLocalized", typeof(LocalizedString[])), Field("_onQuestCompletedLinesLocalized", typeof(LocalizedString[])), Field("_holdingItemLinesLocalized", typeof(LocalizedString[])), Field("_alreadyCompletedLinesLocalized", typeof(LocalizedString[])) }; internal static Dictionary Registry => Read>(RegistryField, null); internal static void Verify() { _ = Registry; if (!MouthState.FieldType.IsEnum) { throw new NotSupportedException("The native NPC mouth state no longer has the expected enum type."); } } internal static FieldInfo Field(string name, Type? expectedType = null) { FieldInfo fieldInfo = AccessTools.Field(typeof(T), name) ?? throw new MissingFieldException(typeof(T).FullName, name); if (expectedType != null && fieldInfo.FieldType != expectedType) { throw new NotSupportedException("Unexpected native field type: " + typeof(T).Name + "." + name + "."); } return fieldInfo; } internal static MethodInfo Method(string name) { return AccessTools.DeclaredMethod(typeof(NPC), name, (Type[])null, (Type[])null) ?? throw new MissingMethodException(typeof(NPC).FullName, name); } internal static T Read(FieldInfo field, object? instance) { object value = field.GetValue(instance); if (value is T) { return (T)value; } throw new InvalidOperationException("Native NPC field '" + field.Name + "' is missing its required value."); } internal static NPCQuest CreateNonConsumingQuest() { NPCQuest val = ScriptableObject.CreateInstance(); ((Object)val).name = "Gambler's Reach - no native quest"; ((Object)val).hideFlags = (HideFlags)52; QuestKind.SetValue(val, (object)(QuestType)5); QuestItems.SetValue(val, new List()); OnlyCreatures.SetValue(val, true); TotalItems.SetValue(val, (byte)1); FieldInfo[] questLines = QuestLines; for (int i = 0; i < questLines.Length; i++) { questLines[i].SetValue(val, Array.Empty()); } return val; } internal static NPCQuest? CaptureMoneyQuest(Scene scene, out string diagnostic) { List candidates = new List(); HashSet seen = new HashSet(); List rejected = new List(); foreach (NPC value in Registry.Values) { ConsiderNpc(value); } GameObject[] rootGameObjects; NPC[] componentsInChildren; if (((Scene)(ref scene)).IsValid() && ((Scene)(ref scene)).isLoaded) { rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); for (int i = 0; i < rootGameObjects.Length; i++) { componentsInChildren = rootGameObjects[i].GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren.Length; j++) { ConsiderNpc(componentsInChildren[j]); } } } componentsInChildren = Resources.LoadAll("NPCs"); for (int i = 0; i < componentsInChildren.Length; i++) { ConsiderNpc(componentsInChildren[i]); } rootGameObjects = Resources.LoadAll("NPCs"); for (int i = 0; i < rootGameObjects.Length; i++) { componentsInChildren = rootGameObjects[i].GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren.Length; j++) { ConsiderNpc(componentsInChildren[j]); } } NPCQuest[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { Consider(array[i]); } if (candidates.Count == 0) { array = Resources.LoadAll(string.Empty); for (int i = 0; i < array.Length; i++) { Consider(array[i]); } } if (candidates.Count == 0) { diagnostic = ((rejected.Count == 0) ? "No native Money quest is loaded." : string.Join("; ", rejected)); return null; } candidates.Sort(delegate(NPCQuest left, NPCQuest right) { int num = LineCount(right).CompareTo(LineCount(left)); return (num == 0) ? string.Compare(((Object)left).name, ((Object)right).name, StringComparison.Ordinal) : num; }); NPCQuest val = candidates[0]; NPCQuest val2 = Object.Instantiate(val); ((Object)val2).name = "Gambler's Reach - native sale quest (from '" + ((Object)val).name + "')"; ((Object)val2).hideFlags = (HideFlags)52; if (!IsNativeMoneyQuest(val2, out string reason)) { Object.Destroy((Object)(object)val2); diagnostic = "Cloning '" + ((Object)val).name + "' lost its native sale configuration: " + reason; return null; } diagnostic = $"'{((Object)val).name}' (onlyCreatures={val.OnlyCreatures}, receivedLines={val.OnItemReceivedLines.Length}, " + $"candidates={candidates.Count})"; return val2; void Consider(NPCQuest? quest) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 if (!((Object)(object)quest == (Object)null) && seen.Add(quest)) { if (IsNativeMoneyQuest(quest, out string reason2)) { candidates.Add(quest); } else if ((int)quest.Type == 1 && rejected.Count < 5) { rejected.Add(((Object)quest).name + ": " + reason2); } } } void ConsiderNpc(NPC npc) { if ((Object)(object)npc == (Object)null || (Object)(object)((Component)npc).GetComponent() != (Object)null) { return; } foreach (NPCQuest quest in npc.Quests) { Consider(quest); } } } private static int LineCount(NPCQuest quest) { return quest.Lines.Length + quest.OnItemReceivedLines.Length + quest.HoldingItemLines.Length; } internal static bool IsNativeMoneyQuest(NPCQuest quest, out string reason) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 reason = string.Empty; if ((int)quest.Type != 1) { reason = "not a Money quest"; return false; } if (quest.QuestItems == null || quest.QuestItems.Count != 0) { reason = "restricted to specific quest items"; return false; } if (quest.IslandToUnlock != 0 || Object.op_Implicit((Object)(object)quest.BaitToReceive)) { reason = "carries an island or bait reward"; return false; } if (quest.OnItemReceivedLines == null || quest.OnItemReceivedLines.Length == 0 || Array.Exists(quest.OnItemReceivedLines, (LocalizedString line) => line == null || ((LocalizedReference)line).IsEmpty)) { reason = "missing localized thanks lines"; return false; } if (quest.Lines == null || quest.HoldingItemLines == null || quest.OnQuestCompletedLines == null || quest.AlreadyCompletedLines == null) { reason = "missing a localized line table"; return false; } return true; } internal static bool CanClone(NPC npc, out string reason) { reason = string.Empty; if (!Object.op_Implicit((Object)(object)npc) || (Object)(object)((Component)npc).GetComponent() != (Object)null || Read(ForScreenshot, npc)) { reason = "not a live native character"; return false; } if (((Component)npc).GetComponentsInChildren(true).Length != 1 || ((Component)npc).GetComponentsInChildren(true).Length != 0 || ((Component)npc).GetComponentsInChildren(true).Length != 0) { reason = "contains another NPC or a networked object"; return false; } FieldInfo[] array = new FieldInfo[8] { Character, Talk, Head, Outfit, HoldingHand, LowerMouth, UpperMouth, MouthAudio }; foreach (FieldInfo fieldInfo in array) { object? value = fieldInfo.GetValue(npc); if (!BelongsTo((Component?)((value is Component) ? value : null), npc)) { reason = "missing an owned " + fieldInfo.Name; return false; } } array = new FieldInfo[2] { LeftHand, RightHand }; foreach (FieldInfo fieldInfo2 in array) { object? value2 = fieldInfo2.GetValue(npc); Component val = (Component)((value2 is Component) ? value2 : null); if (val != null && (Object)(object)val != (Object)null && !BelongsTo(val, npc)) { reason = "an external " + fieldInfo2.Name; return false; } } if (!(Eyes.GetValue(npc) is Transform[] array2) || array2.Length == 0 || Array.Exists(array2, (Transform eye) => !BelongsTo((Component?)(object)eye, npc))) { reason = "missing native eyes"; return false; } if (!NpcPose.HasSharedArmature(npc, out string missing)) { reason = "missing the shared native armature (" + missing + ")"; return false; } Interactable val2 = Read(Character, npc); NPCInteractable val3 = Read(Talk, npc); if (!BelongsTo((Component?)(object)val2.TextTarget, npc) || !BelongsTo((Component?)(object)((Interactable)val3).TextTarget, npc) || !BelongsTo((Component?)/*isinst with value type is only supported in some contexts*/, npc) || !BelongsTo((Component?)/*isinst with value type is only supported in some contexts*/, npc)) { reason = "interaction references leave the character hierarchy"; return false; } AudioSource val4 = Read(MouthAudio, npc); if (!Object.op_Implicit((Object)(object)val4.clip) || val4.clip.length <= 0f || !Object.op_Implicit((Object)(object)Read(Head, npc).sharedMesh) || !Object.op_Implicit((Object)(object)Read(Outfit, npc).sharedMesh)) { reason = "missing the native speaking clip or character mesh"; return false; } MonoBehaviour[] componentsInChildren = ((Component)npc).GetComponentsInChildren(true); foreach (MonoBehaviour val5 in componentsInChildren) { IK val6 = (IK)(object)((val5 is IK) ? val5 : null); if (val6 != null) { object? value3 = AccessTools.Field(typeof(IK), "_pole").GetValue(val6); Transform val7 = (Transform)((value3 is Transform) ? value3 : null); if (!BelongsTo((Component?)(object)val6.Target, npc) || ((Object)(object)val7 != (Object)null && !BelongsTo((Component?)(object)val7, npc))) { reason = "an IK target or pole leaves the character hierarchy"; return false; } int num = (int)AccessTools.Field(typeof(IK), "_chainLength").GetValue(val6); Transform val8 = ((Component)val6).transform; if (num < 2 || num > 8) { reason = "an unsupported IK chain length"; return false; } for (int num2 = 0; num2 <= num; num2++) { if (!BelongsTo((Component?)(object)val8, npc)) { reason = "an IK bone chain leaves the character hierarchy"; return false; } val8 = val8.parent; } } else if ((Object)(object)val5 != (Object)null && (Object)(object)val5 != (Object)(object)npc && (Object)(object)val5 != (Object)(object)val2 && (Object)(object)val5 != (Object)(object)val3 && !(val5 is QuestInteractable) && !(val5 is TMP_Text)) { reason = "contains unsupported behaviour " + ((object)val5).GetType().Name; return false; } } return true; } private static bool BelongsTo(Component? component, NPC npc) { if ((Object)(object)component != (Object)null) { if (!((Object)(object)component.transform == (Object)(object)((Component)npc).transform)) { return component.transform.IsChildOf(((Component)npc).transform); } return true; } return false; } internal static void RestoreIdlePose(NPC source, NPC clone) { //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_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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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) Scene scene = ((Component)source).gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { return; } Quaternion val = Read(DefaultEyeRotation, source); if (!(val.x * val.x + val.y * val.y + val.z * val.z + val.w * val.w < 0.5f)) { Transform[] array = Read(Eyes, clone); for (int i = 0; i < array.Length; i++) { array[i].localRotation = val; } Transform obj = Read(LowerMouth, clone); obj.localRotation = Quaternion.Euler(Read(MouthRestRotation, source), 0f, 0f); obj.localScale = Vector3.one; Read(UpperMouth, clone).localScale = Vector3.one; Transform obj2 = Read(HoldingHand, clone); obj2.localPosition = Read(HandRestPosition, source); obj2.localEulerAngles = Read(HandRestEuler, source); } } internal static void Configure(NPC npc, byte id, NPCQuest quest) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (((Component)npc).gameObject.activeInHierarchy) { throw new InvalidOperationException("NPCs must be configured under an inactive hierarchy."); } if (!Object.op_Implicit((Object)(object)quest)) { throw new ArgumentNullException("quest"); } bool flag = (int)quest.Type != 5; int layer = ((Component)npc).gameObject.layer; Id.SetValue(npc, id); ForScreenshot.SetValue(npc, false); Quests.SetValue(npc, new List { quest }); QuestIndex.SetValue(npc, (byte)0); LineIndex.SetValue(npc, (byte)0); SpeakMovementsLeft.SetValue(npc, (byte)0); MouthState.SetValue(npc, RestingMouth); LookingAt.SetValue(npc, null); EyePosition.SetValue(npc, Vector3.zero); ((Behaviour)npc).enabled = true; Interactable val = Read(Character, npc); NPCInteractable val2 = Read(Talk, npc); Collider val3 = Read(InteractCollider, val); Collider val4 = Read(InteractCollider, val2); int num = LayerMask.NameToLayer("Interactable"); if (num < 0) { throw new InvalidOperationException("The native Interactable layer is unavailable."); } ((Behaviour)val).enabled = true; ((Behaviour)val2).enabled = true; ((Component)val).gameObject.layer = num; ((Component)val2).gameObject.layer = num; ((Component)val3).gameObject.layer = num; ((Component)val4).gameObject.layer = num; val3.enabled = true; val4.enabled = true; QuestInteractable[] componentsInChildren = ((Component)npc).GetComponentsInChildren(true); foreach (QuestInteractable val5 in componentsInChildren) { ((Behaviour)val5).enabled = false; object? value = InteractCollider.GetValue(val5); Collider val6 = (Collider)((value is Collider) ? value : null); if ((Object)(object)val6 != (Object)null && (Object)(object)val6 != (Object)(object)val3 && (Object)(object)val6 != (Object)(object)val4) { val6.enabled = false; } if ((Object)(object)((Component)val5).transform != (Object)(object)((Component)npc).transform && !((Component)val).transform.IsChildOf(((Component)val5).transform) && !((Component)val2).transform.IsChildOf(((Component)val5).transform)) { ((Component)val5).gameObject.SetActive(false); } } QuestInteraction.SetValue(npc, null); MeshRenderer[] componentsInChildren2 = ((Component)npc).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren2.Length; i++) { ((Renderer)componentsInChildren2[i]).enabled = false; } bool flag2 = false; Collider[] componentsInChildren3 = ((Component)npc).GetComponentsInChildren(true); foreach (Collider val7 in componentsInChildren3) { if (val7.isTrigger && (Object)(object)val7 != (Object)(object)val3 && (Object)(object)val7 != (Object)(object)val4) { bool flag3 = (Object)(object)((Component)val7).gameObject == (Object)(object)((Component)npc).gameObject; val7.enabled = flag && flag3; flag2 = flag2 || (flag && flag3); } } if (flag && !flag2) { throw new InvalidOperationException(((Object)npc).name + " has no native intake trigger for sales."); } if (flag && (Object)(object)((Component)npc).gameObject != (Object)(object)((Component)val3).gameObject && (Object)(object)((Component)npc).gameObject != (Object)(object)((Component)val4).gameObject && (Object)(object)((Component)npc).gameObject != (Object)(object)((Component)val).gameObject && (Object)(object)((Component)npc).gameObject != (Object)(object)((Component)val2).gameObject) { ((Component)npc).gameObject.layer = layer; } AudioSource[] componentsInChildren4 = ((Component)npc).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren4.Length; i++) { componentsInChildren4[i].playOnAwake = false; } } internal static bool HasLiveIntake(NPC npc) { Collider[] components = ((Component)npc).GetComponents(); foreach (Collider val in components) { if (val.isTrigger && val.enabled) { return true; } } return false; } internal static void AssertIdAvailable(byte id, NPC? allowed = null) { if (Registry.TryGetValue(id, out NPC value) && (allowed == null || value != allowed)) { string arg = (((Object)(object)value != (Object)null) ? ((Object)value).name : "a stale native registration"); throw new InvalidOperationException($"Gambler's Reach NPC ID {id} is already occupied by {arg}. No NPC was replaced."); } } internal static void Release(NPC npc) { object? value = Character.GetValue(npc); Interactable val = (Interactable)((value is Interactable) ? value : null); if (val != null && (Object)(object)val != (Object)null) { val.OnInteract -= (Action)Delegate.CreateDelegate(typeof(Action), npc, InteractMethod); } if (Registry.TryGetValue(npc.ID, out NPC value2) && value2 == npc) { NPCManager.RemoveNpc(npc); } } internal static void ApplySkin(NPC npc) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Read(SkinColor, npc); ShaderSkinColor.SetValue(npc, val); FieldInfo[] array = new FieldInfo[4] { Head, Outfit, LeftHand, RightHand }; for (int i = 0; i < array.Length; i++) { object? value = array[i].GetValue(npc); SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)((value is SkinnedMeshRenderer) ? value : null); if (val2 == null || !((Object)(object)val2 != (Object)null)) { continue; } Material[] sharedMaterials = ((Renderer)val2).sharedMaterials; foreach (Material val3 in sharedMaterials) { if ((Object)(object)val3 != (Object)null && val3.HasProperty(ShaderManager.PlayerSkinID)) { val3.SetVector(ShaderManager.PlayerSkinID, Vector4.op_Implicit(val)); } } } } internal static void RefreshEyes(NPC npc) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) Transform[] array = Read(Eyes, npc); Vector3 val = Vector3.zero; Transform[] array2 = array; foreach (Transform val2 in array2) { val += val2.position; } Quaternion val3 = Read(DefaultEyeRotation, npc); Transform parent = array[0].parent; Vector3 val4 = (((Object)(object)parent != (Object)null) ? parent.TransformDirection(val3 * Vector3.up) : (val3 * Vector3.up)); EyePosition.SetValue(npc, val / (float)array.Length - val4 * 0.3f); DefaultEyeForward.SetValue(npc, val4); } internal static void SpeakLocally(NPC npc, bool nativeConsumption) { int num = Math.Max(2, Math.Min(254, Read(SpeakMovements, npc) * 2)); SpeakMovementsLeft.SetValue(npc, (byte)num); object obj = MouthState.GetValue(npc) ?? RestingMouth; if (obj.Equals(SpeakingMouth)) { return; } if (!obj.Equals(RestingMouth)) { if (!nativeConsumption) { throw new InvalidOperationException("A custom NPC unexpectedly entered a native item-consumption state."); } } else { ((MonoBehaviour)npc).StartCoroutine(Speak(npc)); } } internal static string DescribeMouth(NPC npc) { return (MouthState.GetValue(npc) ?? RestingMouth).ToString(); } } internal static class NpcAppearance { internal static void CopyMaterials(ReachNpcMarker owner) { //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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown Dictionary dictionary = new Dictionary(); Renderer[] componentsInChildren = ((Component)owner.Native).GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { Material[] sharedMaterials = val.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (Object.op_Implicit((Object)(object)val2)) { if (!dictionary.TryGetValue(val2, out var value)) { value = new Material(val2) { name = "GR " + owner.Identity.Name + " - " + ((Object)val2).name, hideFlags = (HideFlags)52 }; dictionary.Add(val2, value); owner.Materials.Add(value); } sharedMaterials[j] = value; } } val.sharedMaterials = sharedMaterials; } } internal static void Dress(ReachNpcMarker owner) { NPC native = owner.Native; SkinnedMeshRenderer val = NativeNpc.Read(NativeNpc.Outfit, native); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.sharedMesh) || val.bones.Length == 0) { throw new InvalidOperationException("The resident is missing its native articulated outfit: " + owner.Identity.Name); } NativeNpc.ApplySkin(native); TMP_Text[] componentsInChildren = ((Component)native).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].text = owner.Identity.Name; } } } internal enum NpcStance { Standing, Counter } internal static class NpcPose { internal static readonly string[] RequiredBones = new string[12] { "Body", "ArmUpper_L", "ArmLower_L", "ArmUpper_R", "ArmLower_R", "LegUpper_L", "LegLower_L", "Foot_L", "LegUpper_R", "LegLower_R", "Foot_R", "Head" }; private static readonly Dictionary StandingLegs = new Dictionary(StringComparer.Ordinal) { ["LegUpper_L"] = new Vector3(0f, 270f, 180f), ["LegLower_L"] = Vector3.zero, ["Foot_L"] = new Vector3(0f, 0f, 90f), ["LegUpper_R"] = new Vector3(0f, 90f, 180f), ["LegLower_R"] = Vector3.zero, ["Foot_R"] = new Vector3(0f, 0f, 270f) }; private static readonly Dictionary RelaxedArms = new Dictionary(StringComparer.Ordinal) { ["ArmUpper_L"] = new Vector3(0.3f, 359.6f, 173f), ["ArmLower_L"] = Vector3.zero, ["ArmUpper_R"] = new Vector3(0.3f, 0.4f, 186.9f), ["ArmLower_R"] = Vector3.zero }; private static readonly Dictionary CounterArms = new Dictionary(StringComparer.Ordinal) { ["ArmUpper_L"] = new Vector3(358.1f, 7.4f, 118.2f), ["ArmLower_L"] = new Vector3(64.2f, 253.9f, 259.9f), ["ArmUpper_R"] = new Vector3(358.4f, 353.5f, 242.9f), ["ArmLower_R"] = new Vector3(67.4f, 86.3f, 80.9f) }; internal static bool HasSharedArmature(NPC npc, out string missing) { Dictionary dictionary = Bones(npc); string[] requiredBones = RequiredBones; foreach (string text in requiredBones) { if (!dictionary.ContainsKey(text)) { missing = text; return false; } } if ((Object)(object)LeftHandRoot(npc) == (Object)null || (Object)(object)RightHandRoot(npc) == (Object)null) { missing = "hand rigs"; return false; } missing = string.Empty; return true; } internal static Dictionary Bones(NPC npc) { Dictionary dictionary = new Dictionary(StringComparer.Ordinal); Transform[] componentsInChildren = ((Component)npc).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (Array.IndexOf(RequiredBones, ((Object)val).name) >= 0 && !dictionary.ContainsKey(((Object)val).name)) { dictionary.Add(((Object)val).name, val); } } return dictionary; } internal static Transform? LeftHandRoot(NPC npc) { object? value = NativeNpc.LeftHand.GetValue(npc); return HandRoot(npc, (SkinnedMeshRenderer?)((value is SkinnedMeshRenderer) ? value : null)); } internal static Transform? RightHandRoot(NPC npc) { object? value = NativeNpc.RightHand.GetValue(npc); return HandRoot(npc, (SkinnedMeshRenderer?)((value is SkinnedMeshRenderer) ? value : null)); } private static Transform? HandRoot(NPC npc, SkinnedMeshRenderer? hand) { if ((Object)(object)hand == (Object)null) { return null; } Transform val = ((Component)hand).transform; while ((Object)(object)val.parent != (Object)null && (Object)(object)val.parent != (Object)(object)((Component)npc).transform) { val = val.parent; } if (!((Object)(object)val.parent == (Object)(object)((Component)npc).transform)) { return null; } return val; } internal static bool IsSeated(NPC npc) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = Bones(npc); if (!dictionary.TryGetValue("LegUpper_L", out var value) || !dictionary.TryGetValue("Body", out var value2)) { return false; } return Mathf.Abs(value2.InverseTransformDirection(value.up).y) < 0.6f; } internal static void Apply(NPC npc, NpcStance stance) { //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_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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: 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_0210: 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_0172: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) if (((Component)npc).gameObject.activeInHierarchy) { throw new InvalidOperationException("Native rigs must be re-posed while inactive, before their IK captures a rest pose."); } Dictionary bones = Bones(npc); foreach (KeyValuePair standingLeg in StandingLegs) { Require(bones, standingLeg.Key).localRotation = Quaternion.Euler(standingLeg.Value); } foreach (KeyValuePair item in (stance == NpcStance.Counter) ? CounterArms : RelaxedArms) { Require(bones, item.Key).localRotation = Quaternion.Euler(item.Value); } string[] array = new string[4] { "ArmUpper_L", "ArmLower_L", "ArmUpper_R", "ArmLower_R" }; foreach (string name in array) { Require(bones, name).localScale = Vector3.one; } Transform val = LeftHandRoot(npc) ?? throw new InvalidOperationException("The native left hand rig is missing."); Transform val2 = RightHandRoot(npc) ?? throw new InvalidOperationException("The native right hand rig is missing."); if (stance == NpcStance.Counter) { val.localPosition = new Vector3(-0.342f, 0.864f, 0.339f); val.localEulerAngles = new Vector3(346.3f, 323.2f, 270.3f); val2.localPosition = new Vector3(0.376f, 0.861f, 0.343f); val2.localEulerAngles = new Vector3(344f, 7.1f, 94.5f); } else { val.localPosition = new Vector3(-0.2f, 0.62f, 0f); val.localEulerAngles = new Vector3(90f, 0f, 0f); val2.localPosition = new Vector3(0.2f, 0.62f, 0f); val2.localEulerAngles = new Vector3(90f, 0f, 0f); } val.localScale = Vector3.one; val2.localScale = Vector3.one; } private static Transform Require(Dictionary bones, string name) { if (!bones.TryGetValue(name, out Transform value) || !((Object)(object)value != (Object)null)) { throw new InvalidOperationException("The native rig has no '" + name + "' bone; it cannot be stood up."); } return value; } } public sealed class NpcService : IDisposable { private static readonly NpcIdentity[] Identities = checked(new NpcIdentity[3] { new NpcIdentity("tackle", (byte)HarborDefinition.Npc("tackle").Id, HarborDefinition.Npc("tackle").Title, "Tackle maker", Color32.op_Implicit(new Color32((byte)43, (byte)104, (byte)101, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)190, (byte)144, (byte)72, byte.MaxValue)), NpcStance.Standing, new string[4] { "Daughter", "Lighthouse", "Weapon", "Military" }, sellsCatches: true), new NpcIdentity("collector", (byte)HarborDefinition.Npc("collector").Id, HarborDefinition.Npc("collector").Title, "Marine collector", Color32.op_Implicit(new Color32((byte)222, (byte)219, (byte)195, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)53, (byte)113, (byte)96, byte.MaxValue)), NpcStance.Standing, new string[4] { "Whale", "Swamp NPC", "Seagull", "Puffer" }), new NpcIdentity("dealer", (byte)HarborDefinition.Npc("dealer").Id, HarborDefinition.Npc("dealer").Title, "Blackjack dealer", Color32.op_Implicit(new Color32((byte)68, (byte)44, (byte)57, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)224, (byte)210, (byte)170, byte.MaxValue)), NpcStance.Counter, new string[4] { "Roulette", "Slots", "Store", "Kiosk" }) }); private readonly Dictionary templates = new Dictionary(StringComparer.Ordinal); private readonly Dictionary residents = new Dictionary(StringComparer.Ordinal); private readonly Dictionary targets = new Dictionary(StringComparer.Ordinal); private readonly NPCQuest nonConsumingQuest; private NPCQuest? saleQuest; private GameObject? templateRoot; private GameObject? sceneRoot; private bool disposed; public IReadOnlyDictionary Targets { get; } public string SaleQuestOrigin { get; private set; } = "not captured yet"; public bool HasSaleQuest { get { if (!disposed) { return Object.op_Implicit((Object)(object)saleQuest); } return false; } } internal NPCQuest? SaleQuest { get { if (!disposed) { return saleQuest; } return null; } } public bool HasTemplates { get { if (disposed || !Object.op_Implicit((Object)(object)templateRoot) || templates.Count != Identities.Length) { return false; } foreach (ReachNpcMarker value in templates.Values) { if (!Object.op_Implicit((Object)(object)value) || !Object.op_Implicit((Object)(object)value.Native)) { return false; } } return true; } } public NpcService() { NativeNpc.Verify(); Targets = new ReadOnlyDictionary(targets); nonConsumingQuest = NativeNpc.CreateNonConsumingQuest(); } public bool HasNativeSales(string key) { ReachNpcMarker resident = GetResident(key); if (resident.NativeSales) { return resident.AllowsNativeQuests; } return false; } public string DescribeSales(string key) { //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) ReachNpcMarker resident = GetResident(key); NPC native = resident.Native; NPCQuest val = ((native.Quests.Count > 0) ? native.Quests[0] : null); NPC value; return string.Format("{0}: nativeSales={1}, quest={2}, ", resident.Identity.Name, resident.AllowsNativeQuests, Object.op_Implicit((Object)(object)val) ? ((Object)val).name : "none") + string.Format("type={0}, onlyCreatures={1}, ", Object.op_Implicit((Object)(object)val) ? ((object)val.Type/*cast due to .constrained prefix*/).ToString() : "?", Object.op_Implicit((Object)(object)val) && val.OnlyCreatures) + $"intake={NativeNpc.HasLiveIntake(native)}, registered={NativeNpc.Registry.TryGetValue(native.ID, out value) && value == native}, " + "mouth=" + NativeNpc.DescribeMouth(native) + ", origin=" + SaleQuestOrigin; } public void CaptureTemplates(Scene scene) { //IL_0007: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) ThrowIfDisposed(); CaptureSaleQuest(scene); if (HasTemplates) { return; } string diagnostic; List list = FindTemplates(scene, out diagnostic); if (list.Count == 0) { Plugin.Log.LogWarning((object)("No suitable NPC template in '" + ((Scene)(ref scene)).name + "'. " + diagnostic)); return; } list.Sort(delegate(NPC left, NPC right) { int num2 = left.ID.CompareTo(right.ID); return (num2 == 0) ? string.Compare(((Object)left).name, ((Object)right).name, StringComparison.Ordinal) : num2; }); DestroyTemplates(); templateRoot = new GameObject("Gambler's Reach - inactive NPC templates"); templateRoot.SetActive(false); ((Object)templateRoot).hideFlags = (HideFlags)52; Object.DontDestroyOnLoad((Object)(object)templateRoot); bool flag = false; try { NPC[] array = ChooseTemplates(list); for (int num = 0; num < Identities.Length; num++) { NpcIdentity npcIdentity = Identities[num]; NPC val = array[num]; GameObject obj = Object.Instantiate(((Component)val).gameObject, templateRoot.transform, false); obj.SetActive(false); ((Object)obj).name = "GR template - " + npcIdentity.Name; obj.transform.localPosition = Vector3.zero; obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = ((Component)val).transform.lossyScale; NPC component = obj.GetComponent(); ReachNpcMarker reachNpcMarker = obj.AddComponent(); reachNpcMarker.Bind(component, npcIdentity, isTemplate: true, null); reachNpcMarker.SourceRig = ((Object)val).name; templates.Add(npcIdentity.Key, reachNpcMarker); NativeNpc.RestoreIdlePose(val, component); NativeNpc.Configure(component, npcIdentity.Id, nonConsumingQuest); NpcPose.Apply(component, npcIdentity.Stance); NpcAppearance.CopyMaterials(reachNpcMarker); ((Behaviour)component).enabled = false; Plugin.Log.LogInfo((object)string.Format("NPC rig for {0}: native '{1}' (ID {2}, {3} source) -> {4}.", npcIdentity.Name, ((Object)val).name, val.ID, NpcPose.IsSeated(val) ? "seated" : "standing", npcIdentity.Stance)); } flag = true; } finally { if (!flag) { DestroyTemplates(); } } Plugin.Log.LogInfo((object)$"Cached three inactive NPC rigs from {list.Count} native character template(s)."); } private void CaptureSaleQuest(Scene scene) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)saleQuest)) { string diagnostic; NPCQuest val = NativeNpc.CaptureMoneyQuest(scene, out diagnostic); if ((Object)(object)val == (Object)null) { SaleQuestOrigin = "no native Money quest in '" + ((Scene)(ref scene)).name + "': " + diagnostic; Plugin.Log.LogWarning((object)("Native sale quest not captured yet. " + SaleQuestOrigin)); } else { saleQuest = val; SaleQuestOrigin = diagnostic; Plugin.Log.LogInfo((object)("Cloned the native sale quest " + diagnostic + " for the tackle merchant.")); } } } private static NPC[] ChooseTemplates(List candidates) { NPC[] array = (NPC[])(object)new NPC[Identities.Length]; HashSet used = new HashSet(); for (int i = 0; i < Identities.Length; i++) { NPC val = null; string[] preferredRigs = Identities[i].PreferredRigs; foreach (string fragment in preferredRigs) { val = candidates.Find((NPC npc) => !used.Contains(npc) && ((Object)npc).name.IndexOf(fragment, StringComparison.OrdinalIgnoreCase) >= 0); if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null) { int num = i * candidates.Count / Identities.Length; for (int num2 = 0; num2 < candidates.Count; num2++) { if (!((Object)(object)val == (Object)null)) { break; } NPC val2 = candidates[(num + num2) % candidates.Count]; if (!used.Contains(val2)) { val = val2; } } if (val == null) { val = candidates[i % candidates.Count]; } } used.Add(val); array[i] = val; } return array; } public void Spawn(Transform parent, IReadOnlyDictionary localPositions, Action onLocalInteract) { //IL_0067: 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_0106: Expected O, but got Unknown //IL_017f: 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) ThrowIfDisposed(); if ((Object)(object)parent == (Object)null) { throw new ArgumentNullException("parent"); } if (localPositions == null) { throw new ArgumentNullException("localPositions"); } if (onLocalInteract == null) { throw new ArgumentNullException("onLocalInteract"); } if (!HasTemplates) { throw new InvalidOperationException("Load a native island and capture NPC templates before spawning residents."); } NpcIdentity[] identities = Identities; foreach (NpcIdentity npcIdentity in identities) { if (!localPositions.TryGetValue(npcIdentity.Key, out var value) || !IsFinite(value)) { throw new ArgumentException("A finite local position is required for NPC '" + npcIdentity.Key + "'.", "localPositions"); } residents.TryGetValue(npcIdentity.Key, out ReachNpcMarker value2); NativeNpc.AssertIdAvailable(npcIdentity.Id, ((Object)(object)value2 != (Object)null) ? value2.Native : null); } ClearScene(); if (!Object.op_Implicit((Object)(object)saleQuest)) { throw new InvalidOperationException("The merchant cannot spawn without its native sale quest. " + SaleQuestOrigin); } sceneRoot = new GameObject("Gambler's Reach - residents"); sceneRoot.SetActive(false); sceneRoot.transform.SetParent(parent, false); bool flag = false; try { identities = Identities; foreach (NpcIdentity npcIdentity2 in identities) { GameObject val = Object.Instantiate(((Component)templates[npcIdentity2.Key]).gameObject, sceneRoot.transform, false); ((Object)val).name = npcIdentity2.Name; val.transform.localPosition = localPositions[npcIdentity2.Key]; val.transform.localRotation = Quaternion.identity; NPC component = val.GetComponent(); ReachNpcMarker component2 = val.GetComponent(); component2.Bind(component, npcIdentity2, isTemplate: false, onLocalInteract); component2.SourceRig = templates[npcIdentity2.Key].SourceRig; residents.Add(npcIdentity2.Key, component2); targets.Add(npcIdentity2.Key, val.transform); bool flag2 = npcIdentity2.SellsCatches && Object.op_Implicit((Object)(object)saleQuest); NativeNpc.Configure(component, npcIdentity2.Id, (NPCQuest)(flag2 ? ((object)saleQuest) : ((object)nonConsumingQuest))); component2.NativeSales = flag2; NpcPose.Apply(component, npcIdentity2.Stance); NpcAppearance.CopyMaterials(component2); NpcAppearance.Dress(component2); val.SetActive(true); } sceneRoot.SetActive(true); if (sceneRoot.activeInHierarchy) { foreach (ReachNpcMarker value3 in residents.Values) { if (!value3.Initialized) { throw new InvalidOperationException("Native initialization failed for " + value3.Identity.Name + "."); } } } flag = true; } finally { if (!flag) { ClearScene(); } } } public Vector3 GetPosition(string key) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return ((Component)GetResident(key)).transform.position; } public IReadOnlyList AuditResident(string key) { //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_0040: Expected O, but got Unknown //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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) ReachNpcMarker resident = GetResident(key); NPC native = resident.Native; List list = new List(); if (NpcPose.IsSeated(native)) { list.Add("rig is still in the seated native pose"); } Bounds bounds = ((Renderer)NativeNpc.Read(NativeNpc.Outfit, native)).bounds; Mesh val = new Mesh(); FieldInfo[] array; try { array = new FieldInfo[4] { NativeNpc.Head, NativeNpc.Outfit, NativeNpc.LeftHand, NativeNpc.RightHand }; for (int i = 0; i < array.Length; i++) { object? value = array[i].GetValue(native); SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)((value is SkinnedMeshRenderer) ? value : null); if (val2 != null && Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.sharedMesh)) { val2.BakeMesh(val); Vector3[] vertices = val.vertices; foreach (Vector3 val3 in vertices) { ((Bounds)(ref bounds)).Encapsulate(((Component)val2).transform.TransformPoint(val3)); } val.Clear(); } } } finally { Object.Destroy((Object)(object)val); } ((Bounds)(ref bounds)).Expand(0.16f); array = new FieldInfo[4] { NativeNpc.Head, NativeNpc.Outfit, NativeNpc.LeftHand, NativeNpc.RightHand }; foreach (FieldInfo fieldInfo in array) { object? value2 = fieldInfo.GetValue(native); SkinnedMeshRenderer val4 = (SkinnedMeshRenderer)((value2 is SkinnedMeshRenderer) ? value2 : null); if (val4 != null && (Object)(object)val4 != (Object)null && (!((Renderer)val4).enabled || !((Component)val4).gameObject.activeInHierarchy)) { list.Add("native " + fieldInfo.Name + " renderer is hidden"); } } MeshRenderer[] componentsInChildren = ((Component)native).GetComponentsInChildren(true); foreach (MeshRenderer val5 in componentsInChildren) { bool num = ((Object)val5).name.StartsWith("GR ", StringComparison.Ordinal); int num2; if (resident.NativeChapter) { object? value3 = NativeNpc.QuestInteraction.GetValue(native); QuestInteractable val6 = (QuestInteractable)((value3 is QuestInteractable) ? value3 : null); if (val6 != null) { num2 = (((Component)val5).transform.IsChildOf(((Component)val6).transform) ? 1 : 0); goto IL_01fd; } } num2 = 0; goto IL_01fd; IL_01fd: bool flag = (byte)num2 != 0; if (!num && !flag && ((Renderer)val5).enabled && ((Component)val5).gameObject.activeInHierarchy) { list.Add("native mesh preview still visible: " + ((Object)val5).name); } if (num && ((Renderer)val5).enabled && !((Bounds)(ref bounds)).Intersects(((Renderer)val5).bounds)) { list.Add("worn addition detached from the body: " + ((Object)val5).name); } if (num && ((Object)(object)((Renderer)val5).sharedMaterial == (Object)null || (Object)(object)((Renderer)val5).sharedMaterial.shader == (Object)null || !((Renderer)val5).sharedMaterial.shader.isSupported)) { list.Add("worn addition without a usable material: " + ((Object)val5).name); } } Transform val7 = NpcPose.LeftHandRoot(native); Transform val8 = NpcPose.RightHandRoot(native); if ((Object)(object)val7 == (Object)null || (Object)(object)val8 == (Object)null) { list.Add("hand rigs are missing"); } else if (val7.localPosition.y > 1.6f || val8.localPosition.y > 1.6f || val7.localPosition.y < 0.3f || val8.localPosition.y < 0.3f) { list.Add("hands rest at an implausible height"); } return list.AsReadOnly(); } public string DescribeResident(string key) { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) ReachNpcMarker resident = GetResident(key); NPC native = resident.Native; int num = 0; int num2 = 0; Renderer[] componentsInChildren = ((Component)native).GetComponentsInChildren(false); foreach (Renderer val in componentsInChildren) { if (val.enabled) { if (val is SkinnedMeshRenderer) { num++; } else if (((Object)val).name.StartsWith("GR ", StringComparison.Ordinal)) { num2++; } } } Transform val2 = NpcPose.RightHandRoot(native); string text = $"{resident.Identity.Name}: stance={resident.Identity.Stance}, skinned={num}, additions={num2}, "; object arg = NpcPose.IsSeated(native); object arg2; if (!((Object)(object)val2 != (Object)null)) { arg2 = "?"; } else { Vector3 localPosition = val2.localPosition; arg2 = ((Vector3)(ref localPosition)).ToString("0.00"); } return text + $"seated={arg}, rightHand={arg2}, " + string.Format("heading={0:0}, issues=[{1}]", ((Component)native).transform.localEulerAngles.y, string.Join("; ", AuditResident(key))); } public void ShowDialogue(string key, string text) { ThrowIfDisposed(); if (text == null) { throw new ArgumentNullException("text"); } ReachNpcMarker resident = GetResident(key); if (!resident.Initialized || !((Behaviour)resident.Native).isActiveAndEnabled) { throw new InvalidOperationException("NPC '" + key + "' is not active yet."); } if (Object.op_Implicit((Object)(object)Player.LocalPlayer) && Object.op_Implicit((Object)(object)GameInfo.CurCamera)) { NPCInteractable obj = NativeNpc.Read(NativeNpc.Talk, resident.Native); Interactable val = NativeNpc.Read(NativeNpc.Character, resident.Native); obj.OnNPCTalked(); PlayerUI.SetNpcText(text, val.TextTarget); PlayerUI.ForceHideLookAtText(); NativeNpc.RefreshEyes(resident.Native); NativeNpc.SpeakLocally(resident.Native, resident.NativeSales); } } public void ClearScene() { foreach (ReachNpcMarker value in residents.Values) { if ((Object)(object)value != (Object)null) { value.Retire(); } } residents.Clear(); targets.Clear(); if ((Object)(object)sceneRoot != (Object)null) { sceneRoot.SetActive(false); Object.Destroy((Object)(object)sceneRoot); } sceneRoot = null; } public void Dispose() { if (!disposed) { disposed = true; ClearScene(); DestroyTemplates(); Object.Destroy((Object)(object)nonConsumingQuest); if (Object.op_Implicit((Object)(object)saleQuest)) { Object.Destroy((Object)(object)saleQuest); } saleQuest = null; } } private ReachNpcMarker GetResident(string key) { ThrowIfDisposed(); if (key == null) { throw new ArgumentNullException("key"); } if (!residents.TryGetValue(key, out ReachNpcMarker value) || (Object)(object)value == (Object)null || !Object.op_Implicit((Object)(object)value.Native)) { throw new KeyNotFoundException("No spawned Gambler's Reach NPC has key '" + key + "'."); } return value; } private void DestroyTemplates() { foreach (ReachNpcMarker value in templates.Values) { if ((Object)(object)value != (Object)null) { value.Retire(); } } templates.Clear(); if ((Object)(object)templateRoot != (Object)null) { Object.Destroy((Object)(object)templateRoot); } templateRoot = null; } private void ThrowIfDisposed() { if (disposed) { throw new ObjectDisposedException("NpcService"); } } private static bool IsFinite(Vector3 value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0041: Unknown result type (might be due to invalid IL or missing references) if (!float.IsNaN(value.x) && !float.IsInfinity(value.x) && !float.IsNaN(value.y) && !float.IsInfinity(value.y) && !float.IsNaN(value.z)) { return !float.IsInfinity(value.z); } return false; } private static List FindTemplates(Scene scene, out string diagnostic) { List result = new List(); HashSet seen = new HashSet(); List rejected = new List(); NPC[] array = Resources.LoadAll("NPCs"); for (int i = 0; i < array.Length; i++) { Consider(array[i]); } GameObject[] array2 = Resources.LoadAll("NPCs"); for (int i = 0; i < array2.Length; i++) { array = array2[i].GetComponentsInChildren(true); for (int j = 0; j < array.Length; j++) { Consider(array[j]); } } if (result.Count == 0 && ((Scene)(ref scene)).IsValid() && ((Scene)(ref scene)).isLoaded) { array2 = ((Scene)(ref scene)).GetRootGameObjects(); for (int i = 0; i < array2.Length; i++) { array = array2[i].GetComponentsInChildren(true); for (int j = 0; j < array.Length; j++) { Consider(array[j]); } } } diagnostic = ((rejected.Count == 0) ? "The scene contains no NPCs." : string.Join("; ", rejected)); return result; void Consider(NPC npc) { if (!((Object)(object)npc == (Object)null) && seen.Add(npc)) { if (NativeNpc.CanClone(npc, out string reason)) { result.Add(npc); } else if (rejected.Count < 5) { rejected.Add(((Object)npc).name + ": " + reason); } } } } } internal sealed class NpcIdentity { internal string Key { get; } internal byte Id { get; } internal string Name { get; } internal string Occupation { get; } internal Color Coat { get; } internal Color Trim { get; } internal NpcStance Stance { get; } internal string[] PreferredRigs { get; } internal bool SellsCatches { get; } internal NpcIdentity(string key, byte id, string name, string occupation, Color coat, Color trim, NpcStance stance, string[] preferredRigs, bool sellsCatches = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Key = key; Id = id; Name = name; Occupation = occupation; Coat = coat; Trim = trim; Stance = stance; PreferredRigs = preferredRigs; SellsCatches = sellsCatches; } } internal sealed class ReachNpcMarker : MonoBehaviour { private static readonly ConditionalWeakTable Owners = new ConditionalWeakTable(); private Action? onLocalInteract; internal NPC Native { get; private set; } internal NpcIdentity Identity { get; private set; } internal bool IsTemplate { get; private set; } internal bool Initialized { get; set; } internal bool Retired { get; private set; } internal bool NativeSales { get; set; } internal bool NativeChapter { get; set; } internal bool AllowsNativeQuests { get { if ((NativeSales || NativeChapter) && !IsTemplate && !Retired) { return Initialized; } return false; } } internal string SourceRig { get; set; } = string.Empty; internal List Materials { get; private set; } = new List(); internal List Meshes { get; private set; } = new List(); internal void Bind(NPC npc, NpcIdentity identity, bool isTemplate, Action? callback) { Native = npc; Identity = identity; IsTemplate = isTemplate; Initialized = false; Retired = false; NativeSales = false; NativeChapter = false; onLocalInteract = callback; Materials = new List(); Meshes = new List(); NativeNpc.Id.SetValue(npc, identity.Id); Owners.Add(npc, this); } internal static ReachNpcMarker? For(NPC npc) { if (!Owners.TryGetValue(npc, out ReachNpcMarker value) || value == null || value.Identity.Id != npc.ID) { return null; } return value; } internal static ReachNpcMarker? For(Interactable interactable) { ReachNpcMarker componentInParent = ((Component)interactable).GetComponentInParent(true); if (!((Object)(object)componentInParent != (Object)null) || !((Object)(object)componentInParent.Native != (Object)null) || For(componentInParent.Native) != componentInParent) { return null; } return componentInParent; } internal static void Forget(NPC npc) { Owners.Remove(npc); } internal void Interact(Player player) { if (!IsTemplate && !Retired && Initialized && ((Behaviour)Native).isActiveAndEnabled && (Object)(object)player != (Object)null && (Object)(object)player == (Object)(object)Player.LocalPlayer) { onLocalInteract?.Invoke(Identity.Key); } } internal void Retire(bool deactivate = true) { if (Retired) { return; } Retired = true; Initialized = false; NativeSales = false; NativeChapter = false; onLocalInteract = null; if (Native != null) { NativeNpc.Release(Native); if ((Object)(object)Native != (Object)null) { ((MonoBehaviour)Native).StopAllCoroutines(); FieldInfo[] array = new FieldInfo[4] { NativeNpc.LowerMouth, NativeNpc.UpperMouth, NativeNpc.HoldingHand, NativeNpc.MouthAudio }; for (int i = 0; i < array.Length; i++) { object? value = array[i].GetValue(Native); Component val = (Component)((value is Component) ? value : null); if (val != null && (Object)(object)val != (Object)null) { LeanTween.cancel(val.gameObject); } } object? value2 = NativeNpc.MouthAudio.GetValue(Native); AudioSource val2 = (AudioSource)((value2 is AudioSource) ? value2 : null); if (val2 != null && (Object)(object)val2 != (Object)null) { val2.Stop(); } if (deactivate) { ((Component)Native).gameObject.SetActive(false); } } } foreach (Material material in Materials) { if ((Object)(object)material != (Object)null) { Object.Destroy((Object)(object)material); } } Materials.Clear(); foreach (Mesh mesh in Meshes) { if ((Object)(object)mesh != (Object)null) { Object.Destroy((Object)(object)mesh); } } Meshes.Clear(); } private void OnDestroy() { Retire(deactivate: false); } } [HarmonyPatch(typeof(NPC), "Awake")] internal static class ReachNpcAwakePatch { private static bool Prefix(NPC __instance) { ReachNpcMarker reachNpcMarker = ReachNpcMarker.For(__instance); if (reachNpcMarker == null) { return true; } if (reachNpcMarker.IsTemplate || reachNpcMarker.Retired) { ((Behaviour)__instance).enabled = false; return false; } NativeNpc.AssertIdAvailable(__instance.ID, __instance); return true; } private static void Postfix(NPC __instance) { ReachNpcMarker reachNpcMarker = ReachNpcMarker.For(__instance); if (reachNpcMarker != null && !reachNpcMarker.IsTemplate && !reachNpcMarker.Retired) { if (!NativeNpc.Registry.TryGetValue(__instance.ID, out NPC value) || value != __instance) { throw new InvalidOperationException("Native registration failed for " + reachNpcMarker.Identity.Name + "."); } reachNpcMarker.Initialized = true; NativeNpc.RefreshEyes(__instance); } } } [HarmonyPatch(typeof(NPC), "OnDestroy")] internal static class ReachNpcDestroyPatch { private static bool Prefix(NPC __instance) { ReachNpcMarker reachNpcMarker = ReachNpcMarker.For(__instance); if (reachNpcMarker == null) { return true; } reachNpcMarker.Retire(deactivate: false); NativeNpc.Release(__instance); ReachNpcMarker.Forget(__instance); return false; } } [HarmonyPatch(typeof(NPC), "OnInteract")] internal static class ReachNpcInteractPatch { private static bool Prefix(NPC __instance, Player player) { ReachNpcMarker reachNpcMarker = ReachNpcMarker.For(__instance); if (reachNpcMarker == null || (reachNpcMarker.NativeChapter && reachNpcMarker.AllowsNativeQuests)) { return true; } reachNpcMarker.Interact(player); return false; } } [HarmonyPatch] internal static class ReachNpcNoNativeQuestsPatch { private static IEnumerable TargetMethods() { string[] array = new string[6] { "OnTriggerStay", "OnTriggerExit", "EatItem", "OnQuestProgression", "SetNpcText", "StartEatEffects" }; foreach (string name in array) { yield return NativeNpc.Method(name); } } private static bool Prefix(NPC __instance) { return ReachNpcMarker.For(__instance)?.AllowsNativeQuests ?? true; } } [HarmonyPatch(typeof(NPC), "OnShowingQuestIndexChange")] internal static class ReachNpcNoRewardHandPatch { private static bool Prefix(NPC __instance) { ReachNpcMarker reachNpcMarker = ReachNpcMarker.For(__instance); if (reachNpcMarker != null) { if (reachNpcMarker.NativeChapter) { return reachNpcMarker.AllowsNativeQuests; } return false; } return true; } } [HarmonyPatch(typeof(NPC), "CanEat")] internal static class ReachNpcCannotEatPatch { private static bool Prefix(NPC __instance, ref bool __result) { ReachNpcMarker reachNpcMarker = ReachNpcMarker.For(__instance); if (reachNpcMarker == null || reachNpcMarker.AllowsNativeQuests) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(QuestInteractable), "Interact")] internal static class ReachNpcQuestInteractPatch { private static bool Prefix(QuestInteractable __instance) { ReachNpcMarker reachNpcMarker = ReachNpcMarker.For((Interactable)(object)__instance); if (reachNpcMarker != null) { if (reachNpcMarker.NativeChapter) { return reachNpcMarker.AllowsNativeQuests; } return false; } return true; } } [HarmonyPatch(typeof(NPC), "SetSkinColor")] internal static class ReachNpcSkinPatch { private static bool Prefix(NPC __instance) { if (ReachNpcMarker.For(__instance) == null) { return true; } NativeNpc.ApplySkin(__instance); return false; } } [HarmonyPatch(typeof(NPC), "Update")] internal static class ReachNpcEyePositionPatch { private static bool Prefix(NPC __instance) { ReachNpcMarker reachNpcMarker = ReachNpcMarker.For(__instance); if (reachNpcMarker == null) { return true; } if (!reachNpcMarker.Initialized || reachNpcMarker.Retired || reachNpcMarker.IsTemplate) { return false; } NativeNpc.RefreshEyes(__instance); return true; } } } namespace GamblersReach.Art { public sealed class IslandArtLayout { public GameObject Root { get; } public Vector3 PlayerSpawn { get; } public Vector3 BoatSpawn { get; } public float PlayerHeading { get; } public IReadOnlyDictionary NpcHeadings { get; } public IReadOnlyDictionary NpcPositions { get; } public Vector3 TackleMakerPosition => NpcPositions["tackle_maker"]; public Vector3 MarineCollectorPosition => NpcPositions["marine_collector"]; public Vector3 DealerPosition => NpcPositions["blackjack_dealer"]; public Vector3 TablePosition { get; } public Vector3 TableSize { get; } public Vector3 BlackjackPlayerPosition { get; } public float BlackjackPlayerHeading { get; } public IReadOnlyList FishingSpots { get; } public IReadOnlyDictionary ShopPositions { get; } public IReadOnlyDictionary ShopHeadings { get; } public Vector3 SlotMachinePosition { get; } public float SlotMachineHeading { get; } public Vector3 WeaponStandPosition => ShopPositions["weapon"]; public float WeaponStandHeading => ShopHeadings["weapon"]; public IReadOnlyDictionary NativeDecorPositions { get; } public IReadOnlyDictionary NativeDecorHeadings { get; } public IReadOnlyDictionary Landmarks { get; } internal IslandArtLayout(GameObject root, Vector3 player, Vector3 boat, Dictionary npcs, Vector3 table, Vector3 tableSize, Vector3 blackjackPlayer, float blackjackHeading, Vector3[] fishingSpots, Dictionary shops, Dictionary shopHeadings, Vector3 machine, float machineHeading, Dictionary decor, Dictionary decorHeadings, Dictionary landmarks, float playerHeading = 0f, Dictionary? npcHeadings = null) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) Root = root; PlayerSpawn = player; BoatSpawn = boat; PlayerHeading = playerHeading; NpcHeadings = new ReadOnlyDictionary(npcHeadings ?? new Dictionary { ["tackle_maker"] = 125f, ["marine_collector"] = 223f, ["blackjack_dealer"] = 288f }); NpcPositions = new ReadOnlyDictionary(npcs); TablePosition = table; TableSize = tableSize; BlackjackPlayerPosition = blackjackPlayer; BlackjackPlayerHeading = blackjackHeading; FishingSpots = Array.AsReadOnly(fishingSpots); ShopPositions = new ReadOnlyDictionary(shops); ShopHeadings = new ReadOnlyDictionary(shopHeadings); SlotMachinePosition = machine; SlotMachineHeading = machineHeading; NativeDecorPositions = new ReadOnlyDictionary(decor); NativeDecorHeadings = new ReadOnlyDictionary(decorHeadings); Landmarks = new ReadOnlyDictionary(landmarks); } } public delegate bool NativePropProvider(string kind, Transform parent, Vector3 localPosition, float heading, float scale); public sealed class ArtFactory : IDisposable { private sealed class Clearance { private readonly List<(Vector3 center, float radius)> circles = new List<(Vector3, float)>(); private readonly List<(Transform venue, float halfWidth, float minZ, float maxZ)> venues = new List<(Transform, float, float, float)>(); internal void Circle(Vector3 center, float radius) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) circles.Add((new Vector3(center.x, 0f, center.z), radius)); } internal void Venue(Transform venue, float halfWidth, float minZ, float maxZ) { venues.Add((venue, halfWidth, minZ, maxZ)); } internal bool IsClear(Vector3 local, bool allowTrail = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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) float num = RadiusOf(local); if (!allowTrail && num > 27.3f && num < 32f) { return false; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(local.x, 0f, local.z); foreach (var circle in circles) { Vector3 item = circle.center; float item2 = circle.radius; Vector3 val2 = val - item; if (((Vector3)(ref val2)).sqrMagnitude < item2 * item2) { return false; } } foreach (var venue in venues) { Transform item3 = venue.venue; float item4 = venue.halfWidth; float item5 = venue.minZ; float item6 = venue.maxZ; Vector3 val3 = item3.parent.InverseTransformPoint(item3.TransformPoint(Vector3.zero)); Vector3 val4 = Quaternion.Inverse(item3.localRotation) * (val - new Vector3(val3.x, 0f, val3.z)); if (Mathf.Abs(val4.x) < item4 && val4.z > item5 && val4.z < item6) { return false; } } return true; } } private readonly Dictionary meshes = new Dictionary(StringComparer.Ordinal); private readonly Dictionary materials = new Dictionary(StringComparer.Ordinal); private readonly List roots = new List(); private readonly Material prototype; private bool disposed; private const float AngleLimit = 146f; private const int Sectors = 96; private static readonly float[] ShoreBands = new float[9] { 0f, 0.1f, 0.23f, 0.38f, 0.5f, 0.62f, 0.75f, 0.88f, 1f }; private static readonly float[] ShoreHeights = new float[9] { -0.65f, 0.35f, 2f, 3.2f, 3.2f, 3.2f, 3.2f, 1f, -1.3f }; public static IReadOnlyDictionary FishLabels { get; } = new ReadOnlyDictionary(new Dictionary { ["lantern_perch"] = "Lantern Perch", ["copperfin_bream"] = "Copperfin Bream", ["velvet_eel"] = "Velvet Eel", ["crown_puffer"] = "Crown Puffer", ["compass_ray"] = "Compass Ray", ["moonwake_koi"] = "Moonwake Koi" }); public static IReadOnlyDictionary GearLabels { get; } = new ReadOnlyDictionary(new Dictionary { ["deepwater_reel"] = "Deepwater Winch" }); public int OwnedMeshCount => meshes.Count; public int OwnedMaterialCount => materials.Count + 1; public NativePropProvider? NativeProps { get; set; } public int NativePropCount { get; private set; } public ArtFactory(Material? template = null) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown string[] array; if ((Object)(object)template != (Object)null && IsUsable(template)) { prototype = new Material(template); } else { Shader val = null; array = new string[3] { "Universal Render Pipeline/Simple Lit", "Universal Render Pipeline/Lit", "Universal Render Pipeline/Unlit" }; for (int i = 0; i < array.Length; i++) { Shader val2 = Shader.Find(array[i]); if ((Object)(object)val2 != (Object)null && val2.isSupported) { val = val2; break; } } if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("Gambler's Reach art requires a supported game material with _BaseColor/_Color or a loaded URP Simple Lit, Lit, or Unlit shader. No safe shader is available."); } prototype = new Material(val); if (!IsUsable(prototype)) { Object.Destroy((Object)(object)prototype); throw new InvalidOperationException("The available URP shader cannot render the Gambler's Reach palette."); } } ((Object)prototype).name = "GR original palette prototype"; ((Object)prototype).hideFlags = (HideFlags)52; array = new string[9] { "_BaseMap", "_MainTex", "_MetallicGlossMap", "_SpecGlossMap", "_BumpMap", "_OcclusionMap", "_EmissionMap", "_DetailAlbedoMap", "_DetailNormalMap" }; foreach (string text in array) { if (prototype.HasProperty(text)) { prototype.SetTexture(text, (Texture)null); } } array = new string[9] { "_NORMALMAP", "_METALLICSPECGLOSSMAP", "_SPECGLOSSMAP", "_EMISSION", "_ALPHATEST_ON", "_ALPHAPREMULTIPLY_ON", "_SURFACE_TYPE_TRANSPARENT", "_DETAIL_MULX2", "_DETAIL_SCALED" }; foreach (string text2 in array) { prototype.DisableKeyword(text2); } SetFloat(prototype, "_Surface", 0f); SetFloat(prototype, "_Blend", 0f); SetFloat(prototype, "_AlphaClip", 0f); SetFloat(prototype, "_ZWrite", 1f); SetFloat(prototype, "_Cull", 2f); SetFloat(prototype, "_SrcBlend", 1f); SetFloat(prototype, "_DstBlend", 0f); SetFloat(prototype, "_Metallic", 0f); SetFloat(prototype, "_Smoothness", 0.12f); SetFloat(prototype, "_Glossiness", 0.12f); prototype.renderQueue = 2000; prototype.SetOverrideTag("RenderType", "Opaque"); prototype.enableInstancing = true; BuildPalette(); } private static bool IsUsable(Material material) { if ((Object)(object)material.shader != (Object)null && material.shader.isSupported && ((Object)material.shader).name != "Hidden/InternalErrorShader") { if (!material.HasProperty("_BaseColor")) { return material.HasProperty("_Color"); } return true; } return false; } private static void SetFloat(Material material, string property, float value) { if (material.HasProperty(property)) { material.SetFloat(property, value); } } private void BuildPalette() { Swatch("grass", 91, 111, 57); Swatch("grassLight", 116, 130, 67); Swatch("earth", 110, 89, 64); Swatch("sand", 178, 161, 111); Swatch("stone", 89, 103, 100); Swatch("stoneLight", 124, 134, 123); Swatch("pine", 43, 75, 61); Swatch("pineLight", 64, 94, 67); Swatch("bark", 82, 60, 45); Swatch("wood", 123, 89, 53); Swatch("woodLight", 162, 125, 74); Swatch("woodDark", 69, 55, 45); Swatch("cream", 226, 216, 174); Swatch("brass", 194, 151, 60); Swatch("copper", 192, 102, 58); Swatch("teal", 43, 121, 119); Swatch("navy", 39, 61, 78); Swatch("ink", 26, 32, 40); Swatch("red", 181, 62, 49); Swatch("felt", 31, 109, 74); Swatch("ivory", 239, 232, 202); Swatch("violet", 81, 67, 109); Swatch("lavender", 147, 124, 174); Swatch("amber", 247, 187, 61, luminous: true); Swatch("pineDark", 33, 58, 49); Swatch("leaf", 96, 132, 62); Swatch("leafDark", 70, 104, 54); Swatch("sandWet", 152, 137, 98); Swatch("driftwood", 156, 141, 118); Swatch("rope", 176, 152, 108); Swatch("canvas", 198, 184, 150); Swatch("rust", 132, 74, 46); Swatch("blush", 214, 150, 160); Swatch("white", 236, 236, 230); Swatch("glass", 118, 170, 178); Swatch("leather", 112, 74, 48); } private void Swatch(string key, byte red, byte green, byte blue, bool luminous = false) { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(prototype) { name = "GR palette - " + key, hideFlags = (HideFlags)52 }; Color val2 = Color32.op_Implicit(new Color32(red, green, blue, byte.MaxValue)); if (val.HasProperty("_BaseColor")) { val.SetColor("_BaseColor", val2); } if (val.HasProperty("_Color")) { val.SetColor("_Color", val2); } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", luminous ? (val2 * 0.3f) : Color.black); if (luminous) { val.EnableKeyword("_EMISSION"); } } materials.Add(key, val); } private void CheckAlive() { if (disposed) { throw new ObjectDisposedException("ArtFactory"); } } private GameObject Root(string name) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown CheckAlive(); roots.RemoveAll((GameObject item) => (Object)(object)item == (Object)null); GameObject val = new GameObject(name); roots.Add(val); return val; } private static GameObject Group(string name, Transform parent, Vector3 position, float heading = 0f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = Quaternion.Euler(0f, heading, 0f); return val; } private Mesh Cached(string key, Func create) { if (meshes.TryGetValue(key, out Mesh value)) { return value; } Mesh val = create(); ((Object)val).name = "GR original - " + key; ((Object)val).hideFlags = (HideFlags)52; meshes.Add(key, val); return val; } private GameObject Part(Transform parent, string name, Mesh mesh, string material, Vector3 position, Vector3 scale, Quaternion rotation, bool collision = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) GameObject val = Group(name, parent, position); val.transform.localScale = scale; val.transform.localRotation = rotation; val.AddComponent().sharedMesh = mesh; MeshRenderer obj = val.AddComponent(); ((Renderer)obj).sharedMaterial = materials[material]; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)obj).receiveShadows = true; if (collision) { val.AddComponent().sharedMesh = mesh; } return val; } private GameObject MultiPart(Transform parent, string name, Mesh mesh, string[] palette, bool collision) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) GameObject val = Part(parent, name, mesh, palette[0], Vector3.zero, Vector3.one, Quaternion.identity, collision); Material[] array = (Material[])(object)new Material[palette.Length]; for (int i = 0; i < array.Length; i++) { array[i] = materials[palette[i]]; } ((Renderer)val.GetComponent()).sharedMaterials = array; return val; } private GameObject Box(Transform parent, string name, Vector3 position, Vector3 size, string material, bool collision = false, float heading = 0f) { //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_003a: Unknown result type (might be due to invalid IL or missing references) GameObject val = Part(parent, name, Cached("unit plank", Geometry.Box), material, position, size, Quaternion.Euler(0f, heading, 0f)); if (collision) { val.AddComponent(); } return val; } private GameObject Column(Transform parent, string name, Vector3 position, Vector3 size, string material, int sides = 8, float taper = 1f, bool collision = false) { //IL_005c: 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_005f: Unknown result type (might be due to invalid IL or missing references) return Part(parent, name, Cached("column-" + sides + "-" + taper.ToString("R", CultureInfo.InvariantCulture), () => Geometry.Column(sides, taper)), material, position, size, Quaternion.identity, collision); } private void Beam(Transform parent, string name, Vector3 from, Vector3 to, float radius, string material) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; Part(parent, name, Cached("column-6-1", () => Geometry.Column(6, 1f)), material, (from + to) * 0.5f, new Vector3(radius, ((Vector3)(ref val)).magnitude, radius), Quaternion.FromToRotation(Vector3.up, val)); } private GameObject Oval(Transform parent, string name, Vector3 position, Vector3 size, string material, Quaternion? rotation = null, bool collision = false) { //IL_002f: 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_0047: 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) return Part(parent, name, Cached("faceted oval", () => Geometry.Ellipsoid(10, 5)), material, position, size, (Quaternion)(((??)rotation) ?? Quaternion.identity), collision); } internal static float Hash(int seed, int salt = 0) { int num = (seed * 374761393) ^ (salt * 668265263) ^ -1640531527; int num2 = (num ^ (num >>> 13)) * 1274126177; return (float)(uint)((num2 ^ (num2 >>> 16)) & 0xFFFFFF) / 16777215f; } internal static float Hash(int seed, int salt, float min, float max) { return Mathf.Lerp(min, max, Hash(seed, salt)); } private static void Capsule(GameObject target, Vector3 center, float radius, float height) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) CapsuleCollider obj = target.AddComponent(); obj.center = center; obj.radius = radius; obj.height = height; } private bool TryNativeProp(string kind, Transform parent, Vector3 position, float heading, float scale) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (NativeProps == null) { return false; } if (!NativeProps(kind, parent, position, heading, scale)) { return false; } NativePropCount++; return true; } public void Dispose() { if (disposed) { return; } disposed = true; foreach (GameObject root in roots) { if ((Object)(object)root != (Object)null) { root.SetActive(false); Object.Destroy((Object)(object)root); } } foreach (Mesh value in meshes.Values) { Object.Destroy((Object)(object)value); } foreach (Material value2 in materials.Values) { Object.Destroy((Object)(object)value2); } Object.Destroy((Object)(object)prototype); roots.Clear(); meshes.Clear(); materials.Clear(); } public GameObject CreateFishVisual(string key) { CheckAlive(); if (key == null) { throw new ArgumentNullException("key"); } if (!FishLabels.TryGetValue(key, out string value)) { throw new ArgumentException("Unknown Gambler's Reach fish visual: " + key, "key"); } GameObject val = Root(value + " - original visual"); try { Transform transform = val.transform; switch (key) { case "lantern_perch": LanternPerch(transform); break; case "copperfin_bream": CopperfinBream(transform); break; case "velvet_eel": VelvetEel(transform); break; case "crown_puffer": CrownPuffer(transform); break; case "compass_ray": CompassRay(transform); break; case "moonwake_koi": MoonwakeKoi(transform); break; } CenterVisual(val); return val; } catch { val.SetActive(false); Object.Destroy((Object)(object)val); roots.Remove(val); throw; } } public GameObject CreateGearVisual(string key) { CheckAlive(); if (key == null) { throw new ArgumentNullException("key"); } if (!GearLabels.TryGetValue(key, out string value)) { throw new ArgumentException("Unknown Gambler's Reach gear visual: " + key, "key"); } GameObject val = Root(value + " - original visual"); try { DeepwaterReel(val.transform); CenterVisual(val); return val; } catch { val.SetActive(false); Object.Destroy((Object)(object)val); roots.Remove(val); throw; } } private static void CenterVisual(GameObject root) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] componentsInChildren = root.GetComponentsInChildren(true); if (componentsInChildren.Length == 0) { return; } Bounds bounds = ((Renderer)componentsInChildren[0]).bounds; for (int i = 1; i < componentsInChildren.Length; i++) { ((Bounds)(ref bounds)).Encapsulate(((Renderer)componentsInChildren[i]).bounds); } Vector3 val = root.transform.InverseTransformPoint(((Bounds)(ref bounds)).center); foreach (Transform item in root.transform) { item.localPosition -= val; } } private void Body(Transform t, string key, string color, float[] z, float[] widths, float[] heights, int sides = 10, float[]? xOffsets = null, float[]? yOffsets = null) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) Part(t, key + " sculpted body", Cached(key + " body", () => Geometry.FishBody(z, widths, heights, sides, xOffsets, yOffsets)), color, Vector3.zero, Vector3.one, Quaternion.identity); } private void Fin(Transform t, string key, string color, params Vector3[] points) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Part(t, key, Cached(key, () => Geometry.Fin(points)), color, Vector3.zero, Vector3.one, Quaternion.identity); } private void SideFins(Transform t, string key, float width, float z, float length, string color) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) for (int i = -1; i <= 1; i += 2) { Fin(t, key + " pectoral " + i, color, new Vector3((float)i * width * 0.7f, -0.02f, z + 0.045f), new Vector3((float)i * (width + length), -0.035f, z - length * 0.65f), new Vector3((float)i * (width + length * 0.55f), -0.07f, z - length), new Vector3((float)i * width * 0.7f, -0.06f, z - 0.06f)); } } private void ForkTail(Transform t, string key, float neckZ, float rearZ, float height, string color) { //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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) int[] array = new int[2] { -1, 1 }; for (int i = 0; i < array.Length; i++) { int num = array[i]; Fin(t, key + " fork tail " + num, color, new Vector3(0f, 0f, neckZ + 0.03f), new Vector3(0f, (float)num * height, rearZ), new Vector3(0f, (float)num * height * 0.3f, rearZ + (neckZ - rearZ) * 0.26f), new Vector3(0f, 0f, neckZ - 0.06f)); } } private void Eyes(Transform t, float x, float y, float z, float radius, string iris = "brass") { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00d3: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) int[] array = new int[2] { -1, 1 }; foreach (int num in array) { Oval(t, "Raised eye socket", new Vector3((float)num * x, y, z), new Vector3(radius * 0.68f, radius * 2.25f, radius * 2.25f), "ink"); Oval(t, "Bright eye iris", new Vector3((float)num * (x + radius * 0.24f), y, z + radius * 0.06f), new Vector3(radius * 0.3f, radius * 1.7f, radius * 1.7f), iris); Oval(t, "Eye pupil", new Vector3((float)num * (x + radius * 0.36f), y, z + radius * 0.16f), new Vector3(radius * 0.18f, radius * 0.83f, radius * 0.83f), "ink"); Oval(t, "Eye catchlight", new Vector3((float)num * (x + radius * 0.4f), y + radius * 0.25f, z + radius * 0.3f), new Vector3(radius * 0.1f, radius * 0.22f, radius * 0.22f), "ivory"); } } private void Gill(Transform t, float x, float z, float height, string color) { //IL_002b: 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) int[] array = new int[2] { -1, 1 }; foreach (int num in array) { Beam(t, "Sculpted gill seam", new Vector3((float)num * x, height * 0.48f, z), new Vector3((float)num * x, (0f - height) * 0.42f, z - 0.015f), 0.005f, color); } } private void LanternPerch(Transform t) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0310: 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_038d: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) Body(t, "lantern perch", "navy", new float[5] { -0.25f, -0.15f, 0.02f, 0.18f, 0.285f }, new float[5] { 0.018f, 0.077f, 0.105f, 0.085f, 0.025f }, new float[5] { 0.035f, 0.11f, 0.153f, 0.105f, 0.022f }); Oval(t, "Warm amber belly", new Vector3(0f, -0.067f, 0.035f), new Vector3(0.155f, 0.153f, 0.36f), "brass"); Fin(t, "lantern perch serrated dorsal", "copper", new Vector3(0f, 0.07f, -0.19f), new Vector3(0f, 0.18f, -0.15f), new Vector3(0f, 0.15f, -0.11f), new Vector3(0f, 0.25f, -0.045f), new Vector3(0f, 0.18f, 0f), new Vector3(0f, 0.25f, 0.065f), new Vector3(0f, 0.15f, 0.13f), new Vector3(0f, 0.1f, 0.18f)); Fin(t, "lantern perch ventral fin", "teal", new Vector3(0f, -0.07f, -0.19f), new Vector3(0f, -0.2f, -0.11f), new Vector3(0f, -0.1f, 0.05f)); ForkTail(t, "lantern perch", -0.25f, -0.41f, 0.135f, "teal"); SideFins(t, "lantern perch", 0.085f, 0.055f, 0.095f, "copper"); Eyes(t, 0.083f, 0.035f, 0.191f, 0.026f, "amber"); Gill(t, 0.098f, 0.105f, 0.14f, "teal"); Vector3[] array = (Vector3[])(object)new Vector3[4] { new Vector3(0f, 0.12f, 0.12f), new Vector3(0f, 0.26f, 0.16f), new Vector3(0f, 0.295f, 0.26f), new Vector3(0f, 0.255f, 0.32f) }; for (int i = 0; i < array.Length - 1; i++) { Beam(t, "Angular lantern lure stalk", array[i], array[i + 1], 0.008f, "navy"); } Oval(t, "Golden lantern lure", array[3], new Vector3(0.058f, 0.069f, 0.055f), "amber"); for (int j = 0; j < 3; j++) { int[] array2 = new int[2] { -1, 1 }; foreach (int num in array2) { Oval(t, "Perch flank lantern spot", new Vector3((float)num * (0.094f - (float)j * 0.008f), 0.018f, 0.03f - (float)j * 0.071f), new Vector3(0.013f, 0.03f, 0.026f), "amber"); } } } private void CopperfinBream(Transform t) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_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_014d: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) Body(t, "copperfin bream", "teal", new float[5] { -0.245f, -0.13f, 0.005f, 0.14f, 0.245f }, new float[5] { 0.018f, 0.073f, 0.103f, 0.072f, 0.022f }, new float[5] { 0.035f, 0.175f, 0.215f, 0.14f, 0.018f }); Oval(t, "Bream broad copper flank", new Vector3(0f, -0.015f, -0.01f), new Vector3(0.194f, 0.315f, 0.305f), "copper"); Fin(t, "copperfin bream high sail dorsal", "copper", new Vector3(0f, 0.03f, -0.24f), new Vector3(0f, 0.23f, -0.15f), new Vector3(0f, 0.3f, -0.015f), new Vector3(0f, 0.17f, 0.15f), new Vector3(0f, 0.095f, 0.17f)); Fin(t, "copperfin bream sickle anal fin", "brass", new Vector3(0f, -0.045f, -0.22f), new Vector3(0f, -0.24f, -0.16f), new Vector3(0f, -0.26f, -0.05f), new Vector3(0f, -0.145f, 0.13f)); ForkTail(t, "copperfin bream", -0.245f, -0.42f, 0.2f, "copper"); SideFins(t, "copperfin bream", 0.084f, 0.045f, 0.09f, "brass"); Eyes(t, 0.063f, 0.045f, 0.166f, 0.025f); Gill(t, 0.076f, 0.117f, 0.18f, "navy"); int[] array = new int[2] { -1, 1 }; foreach (int num in array) { for (int j = 0; j < 3; j++) { Beam(t, "Bream diagonal scale chevron", new Vector3((float)num * 0.099f, 0.065f - (float)j * 0.045f, 0.015f), new Vector3((float)num * 0.099f, 0.028f - (float)j * 0.045f, -0.045f), 0.0055f, "brass"); } } } private void VelvetEel(Transform t) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) float[] array = new float[8] { -0.55f, -0.43f, -0.28f, -0.1f, 0.08f, 0.24f, 0.39f, 0.47f }; float[] array2 = new float[8] { -0.07f, -0.09f, -0.025f, 0.07f, 0.075f, 0.025f, 0f, 0f }; float[] array3 = new float[8] { 0.06f, 0.035f, 0f, -0.02f, 0f, 0.02f, 0.01f, 0f }; Body(t, "velvet eel", "violet", array, new float[8] { 0.003f, 0.025f, 0.037f, 0.048f, 0.055f, 0.06f, 0.05f, 0.018f }, new float[8] { 0.009f, 0.04f, 0.055f, 0.066f, 0.072f, 0.077f, 0.056f, 0.022f }, 8, array2, array3); for (int i = 0; i < array.Length - 2; i++) { float num = 0.06f + (float)i * 0.004f; Fin(t, "velvet eel ribbon dorsal " + i, "lavender", new Vector3(array2[i], array3[i] + num * 0.65f, array[i]), new Vector3(array2[i], array3[i] + num + 0.045f, array[i]), new Vector3(array2[i + 1], array3[i + 1] + num + 0.045f, array[i + 1]), new Vector3(array2[i + 1], array3[i + 1] + num * 0.65f, array[i + 1])); } SideFins(t, "velvet eel", 0.048f, 0.26f, 0.075f, "teal"); Eyes(t, 0.048f, 0.035f, 0.387f, 0.016f, "teal"); Gill(t, 0.057f, 0.315f, 0.08f, "navy"); Beam(t, "Long eel jaw seam", new Vector3(-0.025f, -0.015f, 0.455f), new Vector3(0.025f, -0.015f, 0.455f), 0.004f, "ink"); for (int j = 1; j < 6; j++) { int[] array4 = new int[2] { -1, 1 }; foreach (int num2 in array4) { Oval(t, "Eel pearl lateral pore", new Vector3(array2[j] + (float)num2 * (0.023f + (float)j * 0.006f), array3[j], array[j]), new Vector3(0.011f, 0.011f, 0.018f), "teal"); } } } private void CrownPuffer(Transform t) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_02f3: Unknown result type (might be due to invalid IL or missing references) Body(t, "crown puffer", "brass", new float[5] { -0.215f, -0.15f, 0f, 0.155f, 0.24f }, new float[5] { 0.034f, 0.17f, 0.225f, 0.17f, 0.05f }, new float[5] { 0.045f, 0.17f, 0.224f, 0.165f, 0.045f }); Oval(t, "Ivory puffer belly", new Vector3(0f, -0.085f, 0.02f), new Vector3(0.37f, 0.265f, 0.32f), "cream"); for (int i = 0; i < 5; i++) { float num = (float)(i - 2) * 0.055f; float num2 = ((i == 2) ? 0.125f : ((i % 2 == 0) ? 0.08f : 0.105f)); Column(t, "Crown dorsal point", new Vector3(num, 0.19f + num2 * 0.5f, -0.015f), new Vector3(0.031f, num2, 0.031f), "copper", 5, 0f); } Vector3 val = default(Vector3); for (int j = 0; j < 8; j++) { float num3 = (float)j * 45f * (MathF.PI / 180f); ((Vector3)(ref val))..ctor(Mathf.Cos(num3), Mathf.Sin(num3), 0f); Vector3 val2 = val * 0.203f + new Vector3(0f, 0f, -0.055f); Part(t, "Puffer ivory spine", Cached("column-5-0", () => Geometry.Column(5, 0f)), "cream", val2 + val * 0.025f, new Vector3(0.021f, 0.07f, 0.021f), Quaternion.FromToRotation(Vector3.up, val)); } ForkTail(t, "crown puffer", -0.21f, -0.34f, 0.08f, "teal"); SideFins(t, "crown puffer", 0.17f, 0.04f, 0.08f, "teal"); Eyes(t, 0.145f, 0.07f, 0.16f, 0.034f, "teal"); Oval(t, "Small puffer beak", new Vector3(0f, 0.003f, 0.238f), new Vector3(0.059f, 0.044f, 0.02f), "ink"); int[] array = new int[2] { -1, 1 }; foreach (int num5 in array) { for (int num6 = 0; num6 < 4; num6++) { Oval(t, "Puffer ink constellation", new Vector3((float)num5 * (0.213f - (float)(num6 % 2) * 0.012f), 0.045f - (float)(num6 % 2) * 0.07f, 0.045f - (float)(num6 / 2) * 0.09f), new Vector3(0.012f, 0.032f, 0.033f), "navy"); } } } private void CompassRay(Transform t) { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0341: 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_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) Mesh mesh = Cached("compass ray diamond mantle", delegate { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_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) MeshDraft meshDraft = new MeshDraft(2); Vector3[] array2 = (Vector3[])(object)new Vector3[8] { new Vector3(0f, 0f, 0.29f), new Vector3(0.15f, 0f, 0.2f), new Vector3(0.48f, -0.025f, -0.06f), new Vector3(0.2f, -0.016f, -0.23f), new Vector3(0f, -0.015f, -0.28f), new Vector3(-0.2f, -0.016f, -0.23f), new Vector3(-0.48f, -0.025f, -0.06f), new Vector3(-0.15f, 0f, 0.2f) }; for (int i = 0; i < array2.Length; i++) { Vector3 val = array2[i]; Vector3 val2 = array2[(i + 1) % array2.Length]; meshDraft.Up(new Vector3(0f, 0.095f, 0.015f), val, val2); meshDraft.Out(new Vector3(0f, -0.055f, 0.015f), val2, val, Vector3.zero, 1); } return meshDraft.Finish(); }); MultiPart(t, "compass ray sculpted body", mesh, new string[2] { "teal", "cream" }, collision: false); Body(t, "compass ray whip tail", "navy", new float[4] { -0.69f, -0.57f, -0.43f, -0.24f }, new float[4] { 0.003f, 0.007f, 0.014f, 0.032f }, new float[4] { 0.003f, 0.008f, 0.012f, 0.025f }, 6, new float[4] { 0.08f, 0.035f, -0.015f, 0f }, new float[4] { 0.02f, 0.028f, 0.012f, -0.01f }); int[] array = new int[2] { -1, 1 }; for (int num = 0; num < array.Length; num++) { int num2 = array[num]; Fin(t, "compass ray copper compass wing " + num2, "brass", new Vector3((float)num2 * 0.09f, 0.074f, 0.055f), new Vector3((float)num2 * 0.36f, 0.012f, -0.075f), new Vector3((float)num2 * 0.16f, 0.048f, -0.065f)); Oval(t, "Ray raised eye socket", new Vector3((float)num2 * 0.071f, 0.073f, 0.17f), new Vector3(0.064f, 0.05f, 0.07f), "navy"); Oval(t, "Ray amber eye", new Vector3((float)num2 * 0.071f, 0.095f, 0.182f), new Vector3(0.032f, 0.019f, 0.033f), "amber"); Oval(t, "Ray eye pupil", new Vector3((float)num2 * 0.071f, 0.106f, 0.182f), new Vector3(0.012f, 0.007f, 0.022f), "ink"); } Fin(t, "compass ray north compass arrow", "brass", new Vector3(0f, 0.099f, 0.14f), new Vector3(0.035f, 0.091f, 0.015f), new Vector3(-0.035f, 0.091f, 0.015f)); Fin(t, "compass ray south compass arrow", "copper", new Vector3(0f, 0.071f, -0.18f), new Vector3(-0.035f, 0.093f, -0.015f), new Vector3(0.035f, 0.093f, -0.015f)); Fin(t, "compass ray tail pennant", "teal", new Vector3(0.06f, 0.025f, -0.65f), new Vector3(0.11f, 0.06f, -0.72f), new Vector3(0.03f, 0.04f, -0.68f)); } private void MoonwakeKoi(Transform t) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: 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_0333: 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_0351: Unknown result type (might be due to invalid IL or missing references) Body(t, "moonwake koi", "ivory", new float[5] { -0.275f, -0.14f, 0.015f, 0.17f, 0.29f }, new float[5] { 0.023f, 0.083f, 0.115f, 0.087f, 0.039f }, new float[5] { 0.028f, 0.108f, 0.139f, 0.108f, 0.042f }); Oval(t, "Koi vermilion shoulder island", new Vector3(0f, 0.098f, 0.095f), new Vector3(0.15f, 0.066f, 0.18f), "red"); Oval(t, "Koi copper rear island", new Vector3(-0.045f, 0.066f, -0.104f), new Vector3(0.107f, 0.077f, 0.14f), "copper"); Oval(t, "Koi vermilion cheek", new Vector3(0.068f, 0.042f, 0.172f), new Vector3(0.055f, 0.076f, 0.09f), "red"); Fin(t, "moonwake koi flowing dorsal", "cream", new Vector3(0f, 0.08f, -0.21f), new Vector3(0f, 0.185f, -0.13f), new Vector3(0f, 0.22f, 0.025f), new Vector3(0f, 0.1f, 0.16f)); ForkTail(t, "moonwake koi", -0.275f, -0.49f, 0.18f, "cream"); for (int i = -1; i <= 1; i += 2) { Fin(t, "moonwake koi trailing silk fin " + i, "cream", new Vector3((float)i * 0.09f, -0.018f, 0.06f), new Vector3((float)i * 0.21f, -0.035f, -0.08f), new Vector3((float)i * 0.15f, -0.07f, -0.25f), new Vector3((float)i * 0.07f, -0.07f, -0.04f)); Beam(t, "Gold koi whisker", new Vector3((float)i * 0.025f, -0.014f, 0.28f), new Vector3((float)i * 0.056f, -0.026f, 0.34f), 0.004f, "brass"); Beam(t, "Forked koi whisker", new Vector3((float)i * 0.056f, -0.026f, 0.34f), new Vector3((float)i * 0.077f, -0.052f, 0.315f), 0.003f, "brass"); Fin(t, "moonwake koi gold tail vein " + i, "brass", new Vector3(0.008f, 0f, -0.27f), new Vector3(0.008f, (float)i * 0.13f, -0.46f), new Vector3(0.008f, (float)i * 0.11f, -0.405f)); } Eyes(t, 0.074f, 0.038f, 0.208f, 0.024f); Gill(t, 0.086f, 0.144f, 0.14f, "copper"); } private void DeepwaterReel(Transform t) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_0224: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0370: 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) Quaternion rotation = Quaternion.Euler(0f, 0f, 90f); Part(t, "Deepwater spool winding", Cached("column-12-1", () => Geometry.Column(12, 1f)), "navy", Vector3.zero, new Vector3(0.135f, 0.21f, 0.135f), rotation); int[] array = new int[2] { -1, 1 }; for (int num = 0; num < array.Length; num++) { int num2 = array[num]; Part(t, "Octagonal brass spool cheek", Cached("column-10-1", () => Geometry.Column(10, 1f)), "brass", new Vector3((float)num2 * 0.115f, 0f, 0f), new Vector3(0.165f, 0.035f, 0.165f), rotation); Ring(t, "Teal reel cheek inlay " + num2, new Vector3((float)num2 * 0.136f, 0f, 0f), 0.115f, 0.014f, "teal", rotation); Part(t, "Reel axle cap", Cached("column-8-1", () => Geometry.Column(8, 1f)), "woodDark", new Vector3((float)num2 * 0.146f, 0f, 0f), new Vector3(0.039f, 0.035f, 0.039f), rotation); } for (int num3 = 0; num3 < 4; num3++) { Ring(t, "Wound line groove " + num3, new Vector3(-0.068f + (float)num3 * 0.045f, 0f, 0f), 0.136f, 0.003f, "teal", rotation); } Beam(t, "Crank offset axle", new Vector3(0.16f, 0f, 0f), new Vector3(0.205f, 0f, 0f), 0.022f, "brass"); Beam(t, "Angular crank arm", new Vector3(0.205f, 0f, 0f), new Vector3(0.205f, -0.14f, 0.07f), 0.018f, "brass"); Part(t, "Teal crank knob", Cached("column-8-1", () => Geometry.Column(8, 1f)), "teal", new Vector3(0.25f, -0.14f, 0.07f), new Vector3(0.032f, 0.09f, 0.032f), rotation); Beam(t, "Reel mount stem", new Vector3(0f, -0.14f, 0f), new Vector3(0f, -0.24f, 0f), 0.026f, "brass"); Box(t, "Reel mount foot", new Vector3(0f, -0.25f, 0f), new Vector3(0.055f, 0.035f, 0.2f), "woodDark"); Ring(t, "Deepwater line bail", new Vector3(0f, 0f, 0.04f), 0.19f, 0.009f, "brass", Quaternion.identity); } private void Ring(Transform parent, string name, Vector3 position, float radius, float tube, string color, Quaternion rotation) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) Mesh mesh = Cached("unit annulus", delegate { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_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_0097: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(); Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); for (int i = 0; i < 12; i++) { float num = (float)i * MathF.PI * 2f / 12f; float num2 = (float)(i + 1) * MathF.PI * 2f / 12f; ((Vector3)(ref val))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num)); ((Vector3)(ref val2))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); meshDraft.Up(val, val2, val2 * 0.82f); meshDraft.Up(val, val2 * 0.82f, val * 0.82f); meshDraft.Triangle(val, val2 * 0.82f, val2); meshDraft.Triangle(val, val * 0.82f, val2 * 0.82f); } return meshDraft.Finish(); }); Part(parent, name, mesh, color, position, new Vector3(radius, Mathf.Max(tube, 0.001f), radius), rotation); } private static Vector3 Polar(float radius, float degrees, float height) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) float num = degrees * (MathF.PI / 180f); return new Vector3(Mathf.Sin(num) * radius, height, Mathf.Cos(num) * radius); } private static float AngleOf(Vector3 local) { //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) return Mathf.Atan2(local.x, local.z) * 57.29578f; } private static float RadiusOf(Vector3 local) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Vector2 val = new Vector2(local.x, local.z); return ((Vector2)(ref val)).magnitude; } public IslandArtLayout CreateIsland(Transform parent) { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_017b: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: 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_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0327: 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_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0404: 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_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_06b1: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: 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_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //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_076f: Unknown result type (might be due to invalid IL or missing references) //IL_0774: Unknown result type (might be due to invalid IL or missing references) //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Unknown result type (might be due to invalid IL or missing references) //IL_07a7: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07b3: 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_07d4: Unknown result type (might be due to invalid IL or missing references) CheckAlive(); if ((Object)(object)parent == (Object)null) { throw new ArgumentNullException("parent"); } NativePropCount = 0; GameObject val = Root("Gambler's Reach - original crescent"); val.transform.SetParent(parent, false); try { Transform root = val.transform; MultiPart(root, "Crescent - beaches, moss plateau, ridge and bluffs", Cached("crescent terrain", CrescentMesh), new string[6] { "sand", "grass", "grassLight", "earth", "stone", "sandWet" }, collision: true); Part(root, "Shell-gravel coastal trail", Cached("coastal trail", TrailMesh), "sand", Vector3.zero, Vector3.one, Quaternion.identity, collision: true); Transform transform = Group("The Bent Hook - tackle workshop", root, Polar(32f, -55f, 3.2f), -55f).transform; Transform transform2 = Group("Tideglass - collector station", root, Polar(32.5f, 43f, 3.2f), 43f).transform; Transform transform3 = Group("The Lucky Keel - grounded casino boat", root, Polar(29.5f, 108f, 1.45f), 108f).transform; Clearance clearance = new Clearance(); clearance.Venue(transform, 4.6f, -4.6f, 4.6f); clearance.Venue(transform2, 4.2f, -4.2f, 7.4f); clearance.Venue(transform3, 5.2f, -10.2f, 9f); clearance.Venue(transform3, 8.2f, -1.8f, 1.8f); clearance.Circle(new Vector3(0f, 0f, 22f), 4f); clearance.Circle(new Vector3(0f, 0f, 14f), 4.6f); clearance.Circle(new Vector3(0f, 0f, 9.4f), 5f); clearance.Circle(new Vector3(-6.5f, 0f, 7.5f), 3.2f); clearance.Circle(Polar(20f, -87f, 0f), 3.2f); clearance.Circle(Polar(24f, -87f, 0f), 3.4f); clearance.Circle(Polar(35.6f, -122f, 0f), 3.4f); clearance.Circle(Polar(35.6f, 6f, 0f), 3.4f); clearance.Circle(Polar(34.6f, 134f, 0f), 2.6f); clearance.Circle(Polar(40.5f, 136f, 0f), 5f); clearance.Circle(new Vector3(2.75f, 0f, 26.8f), 1.6f); BuildArrival(root); BuildTackleShack(transform, out Dictionary shops, out Dictionary headings); BuildCollector(transform2); BuildCasino(transform3); Dictionary dictionary = new Dictionary(StringComparer.Ordinal); BuildPaths(root, clearance, dictionary); BuildSettlement(root, clearance, dictionary); BuildNature(root, clearance); Dictionary dictionary2 = new Dictionary(StringComparer.Ordinal) { ["tackle_maker"] = Local(transform, new Vector3(0.8f, 0.27f, 0.9f)), ["marine_collector"] = Local(transform2, new Vector3(-0.8f, 0.27f, 0.7f)), ["blackjack_dealer"] = Local(transform3, new Vector3(0f, 2.02f, 1.3f)) }; Dictionary dictionary3 = new Dictionary(StringComparer.Ordinal); Dictionary dictionary4 = new Dictionary(StringComparer.Ordinal); foreach (KeyValuePair item in shops) { dictionary3[item.Key] = Local(transform, item.Value); dictionary4[item.Key] = LocalHeading(transform, headings[item.Key]); } dictionary3["radar"] = new Vector3(-3.05f, 1.66f, 9.25f); dictionary4["radar"] = 90f; Dictionary decor = new Dictionary(StringComparer.Ordinal) { ["roulette"] = Local(transform3, new Vector3(-1.5f, 2.02f, 5.9f)), ["dock_bench"] = new Vector3(-2.9f, 1.66f, 10.6f), ["lookout_bench"] = OnGround(35.6f, 6f, 0.32f) + Polar(1.1f, 186f, 0f), ["collector_bench"] = Local(transform2, new Vector3(3.9f, 0f, 0.4f)) }; Dictionary decorHeadings = new Dictionary(StringComparer.Ordinal) { ["roulette"] = LocalHeading(transform3, 180f), ["dock_bench"] = 90f, ["lookout_bench"] = 6f, ["collector_bench"] = LocalHeading(transform2, 180f) }; dictionary["tackle_entrance"] = Local(transform, new Vector3(0f, 0.27f, -2.8f)); dictionary["collector_entrance"] = Local(transform2, new Vector3(0f, 0.27f, -2.5f)); dictionary["casino_gangplank"] = Local(transform3, new Vector3(-6.6f, 1.82f, 0f)); dictionary["casino_starboard_gangplank"] = Local(transform3, new Vector3(6.6f, 1.82f, 0f)); dictionary["lighthouse_door"] = Local(transform2, new Vector3(0.38f, 0f, 3.55f)); dictionary["dealer_side"] = dictionary2["blackjack_dealer"]; return new IslandArtLayout(val, new Vector3(0f, 1.72f, 12f), new Vector3(-6.5f, 0.8f, 7.5f), dictionary2, Local(transform3, new Vector3(0f, 2.8f, 0.3f)), new Vector3(3f, 0f, 1.2f), Local(transform3, new Vector3(0f, 2.06f, -1.5f)), 108f, (Vector3[])(object)new Vector3[3] { new Vector3(2.6f, 1.72f, 9.7f), Polar(20f, -87f, 1.5f), Local(transform3, new Vector3(0f, 2.08f, -7.5f)) }, dictionary3, dictionary4, Local(transform3, new Vector3(1.5f, 2.02f, 6.15f)), LocalHeading(transform3, 180f), decor, decorHeadings, dictionary); Vector3 Local(Transform venue, Vector3 point) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) return root.InverseTransformPoint(venue.TransformPoint(point)); } } catch { val.SetActive(false); Object.Destroy((Object)(object)val); roots.Remove(val); throw; } static float LocalHeading(Transform venue, float heading) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Mathf.Repeat(venue.localEulerAngles.y + heading, 360f); } } private static float InnerRadius(float angle) { return 17f + Mathf.Sin(angle * (MathF.PI / 180f) * 2f) * 1.4f; } private static float OuterRadius(float angle) { return 42f + Mathf.Sin(angle * (MathF.PI / 180f) * 3f) * 2.2f + Mathf.Sin(angle * (MathF.PI / 180f) * 5f) * 0.9f; } private static float Taper(float angle) { return Mathf.Clamp01((146f - Mathf.Abs(angle)) / 12f); } private static float BaseHeight(float angle, float t) { float num = ShoreHeights[ShoreHeights.Length - 1]; for (int i = 0; i < ShoreBands.Length - 1; i++) { if (t <= ShoreBands[i + 1]) { num = Mathf.Lerp(ShoreHeights[i], ShoreHeights[i + 1], Mathf.InverseLerp(ShoreBands[i], ShoreBands[i + 1], t)); break; } } return Mathf.Lerp(-0.8f, num, Taper(angle)); } private static float Bump(float angle, float t, float centerAngle, float centerT, float angularRadius, float radialRadius, float height) { float num = Mathf.DeltaAngle(angle, centerAngle) / angularRadius; float num2 = (t - centerT) / radialRadius; float num3 = num * num + num2 * num2; if (!(num3 >= 1f)) { return height * (1f - num3) * (1f - num3); } return 0f; } private static float Normalized(float radius, float angle) { return Mathf.Clamp01(Mathf.InverseLerp(InnerRadius(angle), OuterRadius(angle), radius)); } private static float VenueMask(float angle, float venueAngle) { return Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((Mathf.Abs(Mathf.DeltaAngle(angle, venueAngle)) - 9f) / 6f)); } private static float Relief(float angle, float radius) { float num = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(31.8f, 35f, radius)); if (num <= 0f) { return 0f; } float num2 = Normalized(radius, angle); float num3 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((Mathf.Abs(Mathf.DeltaAngle(angle, 109f)) - 14f) / 8f)); float num4 = VenueMask(angle, -55f) * VenueMask(angle, 43f); float num5 = 0.28f * Mathf.Sin(angle * (MathF.PI / 180f) * 4f + 1f) * Mathf.Clamp01((num2 - 0.52f) / 0.08f) * (1f - Mathf.Clamp01((num2 - 0.78f) / 0.06f)) * num4; return (Bump(angle, num2, -122f, 0.7f, 16f, 0.24f, 2.2f) + Bump(angle, num2, 5f, 0.7f, 26f, 0.26f, 1.4f) + Bump(angle, num2, 136f, 0.68f, 11f, 0.22f, 2f) + num5) * num * num3 * Taper(angle); } private static float SurfaceHeight(float radius, float angle) { return BaseHeight(angle, Normalized(radius, angle)) + Relief(angle, radius); } private static float SurfaceHeight(Vector3 local) { //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) return SurfaceHeight(RadiusOf(local), AngleOf(local)); } private static Vector3 OnGround(float radius, float angle, float lift = 0f) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return Polar(radius, angle, SurfaceHeight(radius, angle) + lift); } private static Vector3 TerrainPoint(float angle, int band) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) float radius = Mathf.Lerp(InnerRadius(angle), OuterRadius(angle), ShoreBands[band]); return Polar(radius, angle, BaseHeight(angle, ShoreBands[band]) + Relief(angle, radius)); } private static Mesh CrescentMesh() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: 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_012d: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: 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_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: 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_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: 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_02fd: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(6); int num = ShoreBands.Length - 1; Vector3 d = default(Vector3); Vector3 c2 = default(Vector3); for (int i = 0; i < 96; i++) { float num2 = Mathf.Lerp(-146f, 146f, (float)i / 96f); float num3 = Mathf.Lerp(-146f, 146f, (float)(i + 1) / 96f); for (int j = 0; j < num; j++) { Vector3 a = TerrainPoint(num2, j); Vector3 val = TerrainPoint(num3, j); Vector3 val2 = TerrainPoint(num3, j + 1); Vector3 c = TerrainPoint(num2, j + 1); int material; if (j < 2) { material = 0; } else if (j == 2) { material = 3; } else if (j < 6) { material = (((i + j * 3) % 5 != 0) ? 1 : 2); } else { float angle = (num2 + num3) * 0.5f; float radius = Mathf.Lerp(InnerRadius(angle), OuterRadius(angle), (ShoreBands[j] + ShoreBands[j + 1]) * 0.5f); material = ((Relief(angle, radius) > 0.45f) ? 4 : ((j != 6) ? 5 : 0)); } if ((i + j) % 2 == 0) { meshDraft.Up(a, val, val2, material); meshDraft.Up(a, val2, c, material); } else { meshDraft.Up(a, val, c, material); meshDraft.Up(val, val2, c, material); } } int[] array = new int[2] { 0, num }; foreach (int band in array) { Vector3 val3 = TerrainPoint(num2, band); Vector3 val4 = TerrainPoint(num3, band); ((Vector3)(ref d))..ctor(val3.x, -4f, val3.z); ((Vector3)(ref c2))..ctor(val4.x, -4f, val4.z); Vector3 inside = Polar((InnerRadius(num2) + OuterRadius(num2)) * 0.5f, num2, -2f); meshDraft.OutQuad(val3, val4, c2, d, inside, 4); } Vector3 a2 = TerrainPoint(num2, 0); Vector3 d2 = TerrainPoint(num3, 0); Vector3 b = TerrainPoint(num2, num); Vector3 c3 = TerrainPoint(num3, num); a2.y = (d2.y = (b.y = (c3.y = -4f))); meshDraft.OutQuad(a2, b, c3, d2, Vector3.zero, 4); } for (int l = 0; l < 2; l++) { float angle2 = ((l == 0) ? (-146f) : 146f); Vector3 inside2 = Polar(29f, (l == 0) ? (-144f) : 144f, -2f); for (int m = 0; m < num; m++) { Vector3 val5 = TerrainPoint(angle2, m); Vector3 val6 = TerrainPoint(angle2, m + 1); meshDraft.OutQuad(val5, val6, new Vector3(val6.x, -4f, val6.z), new Vector3(val5.x, -4f, val5.z), inside2, 4); } } return meshDraft.Finish(); } private static Mesh TrailMesh() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00f7: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(); (float, float)[] array = new(float, float)[2] { (-134f, 97f), (119f, 129f) }; for (int i = 0; i < array.Length; i++) { (float, float) tuple = array[i]; float item = tuple.Item1; float item2 = tuple.Item2; int num = Mathf.Max(3, Mathf.RoundToInt((item2 - item) / 3.6f)); for (int j = 0; j < num; j++) { float degrees = Mathf.Lerp(item, item2, (float)j / (float)num); float degrees2 = Mathf.Lerp(item, item2, (float)(j + 1) / (float)num); Vector3 a = Polar(28.4f, degrees, 3.235f); Vector3 b = Polar(28.4f, degrees2, 3.235f); Vector3 val = Polar(30.95f, degrees2, 3.235f); Vector3 c = Polar(30.95f, degrees, 3.235f); meshDraft.Up(a, b, val); meshDraft.Up(a, val, c); } } return meshDraft.Finish(); } private static Mesh PathMesh(Vector2[] waypoints, float width) { //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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008f: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0284: 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_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: 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_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_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0327: 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_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_036e: 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_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_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) List list = new List(); for (int i = 0; i < waypoints.Length - 1; i++) { Vector3 val = Polar(waypoints[i].y, waypoints[i].x, 0f); Vector3 val2 = Polar(waypoints[i + 1].y, waypoints[i + 1].x, 0f); int num = Mathf.Max(2, Mathf.CeilToInt(Vector3.Distance(val, val2) / 1.1f)); for (int j = ((i != 0) ? 1 : 0); j <= num; j++) { list.Add(Vector3.Lerp(val, val2, (float)j / (float)num)); } } MeshDraft meshDraft = new MeshDraft(); Vector3[] array = (Vector3[])(object)new Vector3[list.Count]; Vector3[] array2 = (Vector3[])(object)new Vector3[list.Count]; for (int k = 0; k < list.Count; k++) { Vector3 val3 = list[Mathf.Min(k + 1, list.Count - 1)] - list[Mathf.Max(k - 1, 0)]; Vector3 normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = Vector3.Cross(Vector3.up, normalized) * (width * 0.5f); Vector3 val5 = list[k] - val4; Vector3 val6 = list[k] + val4; val5.y = SurfaceHeight(val5) + 0.07f; val6.y = SurfaceHeight(val6) + 0.07f; array[k] = val5; array2[k] = val6; } for (int l = 0; l < list.Count - 1; l++) { meshDraft.Up(array[l], array2[l], array2[l + 1]); meshDraft.Up(array[l], array2[l + 1], array[l + 1]); Vector3 inside = (array[l] + array2[l]) * 0.5f + Vector3.down * 0.5f; meshDraft.OutQuad(array[l], array[l + 1], array[l + 1] + Vector3.down * 0.55f, array[l] + Vector3.down * 0.55f, inside); meshDraft.OutQuad(array2[l + 1], array2[l], array2[l] + Vector3.down * 0.55f, array2[l + 1] + Vector3.down * 0.55f, inside); } meshDraft.OutQuad(array2[0], array[0], array[0] + Vector3.down * 0.55f, array2[0] + Vector3.down * 0.55f, (array[0] + array2[0]) * 0.5f + (list[1] - list[0])); int num2 = list.Count - 1; meshDraft.OutQuad(array[num2], array2[num2], array2[num2] + Vector3.down * 0.55f, array[num2] + Vector3.down * 0.55f, (array[num2] + array2[num2]) * 0.5f + (list[num2 - 1] - list[num2])); return meshDraft.Finish(); } private void BuildPaths(Transform root, Clearance clearance, Dictionary landmarks) { //IL_0018: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) Transform paths = Group("Gravel paths", root, Vector3.zero).transform; Path("cairn knoll", 1.6f, (Vector2[])(object)new Vector2[4] { new Vector2(-110f, 30.6f), new Vector2(-108f, 33.2f), new Vector2(-116f, 34.6f), new Vector2(-121f, 35.4f) }); Path("ridge lookout", 1.7f, (Vector2[])(object)new Vector2[4] { new Vector2(12f, 30.6f), new Vector2(14f, 33f), new Vector2(7f, 34.8f), new Vector2(6f, 35.4f) }); Path("bluff overlook", 1.6f, (Vector2[])(object)new Vector2[4] { new Vector2(123f, 30.6f), new Vector2(128f, 32.8f), new Vector2(132f, 34f), new Vector2(134f, 34.4f) }); Path("lighthouse walk", 1.5f, (Vector2[])(object)new Vector2[3] { new Vector2(52f, 30.6f), new Vector2(52.5f, 33.2f), new Vector2(49f, 35.6f) }); landmarks["cairn"] = OnGround(35.6f, -122f); landmarks["lookout"] = OnGround(35.6f, 6f); landmarks["bluff_overlook"] = OnGround(34.6f, 134f); landmarks["wreck"] = OnGround(40.5f, 136f); void Path(string name, float width, Vector2[] waypoints) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00e9: Unknown result type (might be due to invalid IL or missing references) Part(paths, name, Cached("path " + name, () => PathMesh(waypoints, width)), "sand", Vector3.zero, Vector3.one, Quaternion.identity, collision: true); for (int num = 0; num < waypoints.Length - 1; num++) { Vector3 val = Polar(waypoints[num].y, waypoints[num].x, 0f); Vector3 val2 = Polar(waypoints[num + 1].y, waypoints[num + 1].x, 0f); int num2 = Mathf.CeilToInt(Vector3.Distance(val, val2) / 1.5f); for (int num3 = 0; num3 <= num2; num3++) { clearance.Circle(Vector3.Lerp(val, val2, (float)num3 / (float)Mathf.Max(1, num2)), width * 0.5f + 0.6f); } } } } public static IslandArtReport Audit(IslandArtLayout layout, int groundMask = -1) { //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01dd: 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_01f6: 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_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0405: 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) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) if (layout == null) { throw new ArgumentNullException("layout"); } IslandArtReport islandArtReport = new IslandArtReport(); Transform root = layout.Root.transform; HashSet hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); List list = new List(); Dictionary dictionary = new Dictionary(StringComparer.Ordinal); Bounds? val = null; int num = 0; Renderer[] componentsInChildren = layout.Root.GetComponentsInChildren(true); Bounds val5 = default(Bounds); foreach (Renderer val2 in componentsInChildren) { islandArtReport.Renderers++; Transform val3 = ((Component)val2).transform; while ((Object)(object)val3.parent != (Object)null && (Object)(object)val3.parent != (Object)(object)root) { val3 = val3.parent; } dictionary[((Object)val3).name] = ((!dictionary.TryGetValue(((Object)val3).name, out var value)) ? 1 : (value + 1)); Material[] sharedMaterials = val2.sharedMaterials; foreach (Material val4 in sharedMaterials) { if ((Object)(object)val4 == (Object)null || (Object)(object)val4.shader == (Object)null || !val4.shader.isSupported || ((Object)val4.shader).name == "Hidden/InternalErrorShader") { list.Add(((Object)val2).name); } else { hashSet2.Add(val4); } } MeshFilter component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) { hashSet.Add(component.sharedMesh); for (int k = 0; k < component.sharedMesh.subMeshCount; k++) { num += (int)component.sharedMesh.GetIndexCount(k) / 3; } } Bounds bounds = val2.bounds; ((Bounds)(ref val5))..ctor(root.InverseTransformPoint(((Bounds)(ref bounds)).center), Vector3.zero); for (int l = 0; l < 8; l++) { ((Bounds)(ref val5)).Encapsulate(root.InverseTransformPoint(((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3(((l & 1) == 0) ? (-1f) : 1f, ((l & 2) == 0) ? (-1f) : 1f, ((l & 4) == 0) ? (-1f) : 1f)))); } if (val.HasValue) { Bounds value2 = val.Value; ((Bounds)(ref value2)).Encapsulate(val5); val = value2; } else { val = val5; } } islandArtReport.Colliders = layout.Root.GetComponentsInChildren(true).Length; islandArtReport.UniqueMeshes = hashSet.Count; islandArtReport.UniqueMaterials = hashSet2.Count; islandArtReport.Triangles = num; islandArtReport.LocalBounds = val.GetValueOrDefault(); islandArtReport.MissingMaterials = list.AsReadOnly(); islandArtReport.RenderersByGroup = dictionary; if (groundMask == 0) { return islandArtReport; } List ungrounded = new List(); Check("PlayerSpawn", layout.PlayerSpawn); foreach (KeyValuePair npcPosition in layout.NpcPositions) { Check("npc:" + npcPosition.Key, npcPosition.Value); } Check("BlackjackPlayerPosition", layout.BlackjackPlayerPosition); foreach (KeyValuePair shopPosition in layout.ShopPositions) { Check("shop:" + shopPosition.Key, shopPosition.Value); } Check("SlotMachinePosition", layout.SlotMachinePosition); foreach (KeyValuePair nativeDecorPosition in layout.NativeDecorPositions) { Check("decor:" + nativeDecorPosition.Key, nativeDecorPosition.Value); } foreach (KeyValuePair landmark in layout.Landmarks) { Check("landmark:" + landmark.Key, landmark.Value); } for (int m = 0; m < layout.FishingSpots.Count; m++) { Check("fishing:" + m, layout.FishingSpots[m]); } islandArtReport.UngroundedPoints = ungrounded.AsReadOnly(); List list2 = new List(); Transform[] componentsInChildren2 = ((Component)root).GetComponentsInChildren(true); foreach (Transform val6 in componentsInChildren2) { if ((Object)(object)val6.parent == (Object)null || ((Object)val6.parent).name != "Gravel paths") { continue; } MeshFilter component2 = ((Component)val6).GetComponent(); if ((Object)(object)component2 == (Object)null || (Object)(object)component2.sharedMesh == (Object)null) { continue; } Vector3[] vertices = component2.sharedMesh.vertices; Vector3[] normals = component2.sharedMesh.normals; for (int n = 0; n < normals.Length; n++) { if (!(normals[n].y < 0.2f)) { float num2 = Vector3.Angle(normals[n], Vector3.up); if (num2 > 36f) { list2.Add(((Object)val6).name + "@" + ((Vector3)(ref vertices[n])).ToString("0.0") + "=" + num2.ToString("0") + "°"); break; } } } } islandArtReport.SteepPathSamples = list2.AsReadOnly(); return islandArtReport; void Check(string name, Vector3 local) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) Vector3 val7 = root.TransformPoint(local + Vector3.up * 1.6f); bool flag = false; RaycastHit[] array = Physics.RaycastAll(val7, -root.up, 3.4f, groundMask, (QueryTriggerInteraction)1); for (int num3 = 0; num3 < array.Length; num3++) { RaycastHit val8 = array[num3]; if (((Component)((RaycastHit)(ref val8)).collider).transform.IsChildOf(root)) { flag = true; break; } } if (!flag) { ungrounded.Add(name); } } } private static void DraftColumn(MeshDraft d, Vector3 center, Vector3 size, int sides, float taper, Quaternion rotation, int material) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00d0: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_015f: 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_0163: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_0185: 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) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = center + rotation * new Vector3(0f, size.y * 0.5f, 0f); Vector3 val2 = center - rotation * new Vector3(0f, size.y * 0.5f, 0f); for (int i = 0; i < sides; i++) { float num = (float)i * MathF.PI * 2f / (float)sides; float num2 = (float)(i + 1) * MathF.PI * 2f / (float)sides; Vector3 val3 = val2 + rotation * new Vector3(Mathf.Cos(num) * size.x, 0f, Mathf.Sin(num) * size.z); Vector3 val4 = val2 + rotation * new Vector3(Mathf.Cos(num2) * size.x, 0f, Mathf.Sin(num2) * size.z); Vector3 val5 = val + rotation * new Vector3(Mathf.Cos(num2) * size.x * taper, 0f, Mathf.Sin(num2) * size.z * taper); Vector3 val6 = val + rotation * new Vector3(Mathf.Cos(num) * size.x * taper, 0f, Mathf.Sin(num) * size.z * taper); d.OutQuad(val3, val4, val5, val6, center, material); d.Out(val2, val3, val4, center, material); if (taper > 0.001f) { d.Out(val, val5, val6, center, material); } } } private static void DraftEllipsoid(MeshDraft d, Vector3 center, Vector3 size, int sides, int rings, int material, int seed = 0) { //IL_0029: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_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_015f: 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_0185: 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_019f: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < rings; i++) { float num = (float)i * MathF.PI / (float)rings; float num2 = (float)(i + 1) * MathF.PI / (float)rings; float num3 = (0f - Mathf.Cos(num)) * size.y * 0.5f; float num4 = (0f - Mathf.Cos(num2)) * size.y * 0.5f; float num5 = Mathf.Sin(num); float num6 = Mathf.Sin(num2); for (int j = 0; j < sides; j++) { float num7 = (float)j * MathF.PI * 2f / (float)sides; float num8 = (float)(j + 1) * MathF.PI * 2f / (float)sides; float num9 = 1f + (Hash(seed, i * 31 + j) - 0.5f) * 0.16f; float num10 = 1f + (Hash(seed, i * 31 + j + 1) - 0.5f) * 0.16f; float num11 = 1f + (Hash(seed, (i + 1) * 31 + j) - 0.5f) * 0.16f; float num12 = 1f + (Hash(seed, (i + 1) * 31 + j + 1) - 0.5f) * 0.16f; Vector3 a = center + new Vector3(Mathf.Cos(num7) * num5 * size.x * 0.5f * num9, num3, Mathf.Sin(num7) * num5 * size.z * 0.5f * num9); Vector3 b = center + new Vector3(Mathf.Cos(num8) * num5 * size.x * 0.5f * num10, num3, Mathf.Sin(num8) * num5 * size.z * 0.5f * num10); Vector3 c = center + new Vector3(Mathf.Cos(num8) * num6 * size.x * 0.5f * num12, num4, Mathf.Sin(num8) * num6 * size.z * 0.5f * num12); Vector3 d2 = center + new Vector3(Mathf.Cos(num7) * num6 * size.x * 0.5f * num11, num4, Mathf.Sin(num7) * num6 * size.z * 0.5f * num11); d.OutQuad(a, b, c, d2, center, material); } } } private static void DraftBlade(MeshDraft d, Vector3 root, Vector3 tip, Vector3 side, int material) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) d.Triangle(root - side, tip, root + side, material); d.Triangle(root + side, tip, root - side, material); } private static Mesh PineMesh(int variant) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_00eb: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(4); bool flag = variant % 2 == 1; float num = (flag ? 4.6f : 6.4f); Quaternion val = Quaternion.Euler(0f, 0f, flag ? 9f : 2.5f); DraftColumn(meshDraft, val * new Vector3(0f, num * 0.5f, 0f), new Vector3(0.2f, num, 0.2f), 6, 0.5f, val, 0); int num2 = (flag ? 3 : 4); for (int i = 0; i < num2; i++) { float num3 = (float)i / (float)num2; float num4 = num * (flag ? 0.42f : 0.38f) + (float)i * num * (flag ? 0.19f : 0.155f); float num5 = (flag ? 2.3f : 2f) * (1f - num3 * 0.55f); float num6 = (flag ? 1.35f : 1.75f); Vector3 val2 = val * new Vector3(0f, num4, 0f) + new Vector3((Hash(variant, i) - 0.5f) * 0.3f + (flag ? (0.3f + (float)i * 0.18f) : 0f), 0f, (Hash(variant, i + 9) - 0.5f) * 0.3f); Quaternion rotation = Quaternion.Euler(flag ? (-6f) : 0f, Hash(variant, i + 20) * 60f, flag ? 7f : 3f); int num7 = ((i % 3 == 0) ? 1 : ((i % 3 == 1) ? 2 : 3)); DraftColumn(meshDraft, val2, new Vector3(num5 * 0.5f, num6, num5 * 0.43f), 7, flag ? 0.22f : 0.1f, rotation, num7); for (int j = 0; j < 5; j++) { float num8 = ((float)j + Hash(variant, i * 7 + j)) * MathF.PI * 2f / 5f; Vector3 center = val2 + new Vector3(Mathf.Cos(num8) * num5 * 0.4f, (0f - num6) * 0.3f, Mathf.Sin(num8) * num5 * 0.34f); DraftColumn(meshDraft, center, new Vector3(0.35f, 0.5f, 0.3f), 5, 0.05f, Quaternion.Euler(Mathf.Sin(num8) * 25f, 0f, (0f - Mathf.Cos(num8)) * 25f), (num7 != 1) ? 1 : 2); } } return meshDraft.Finish(); } private static Mesh OakMesh(int variant) { //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(3); float num = 3.4f + Hash(variant, 1) * 0.8f; Quaternion val = Quaternion.Euler(0f, Hash(variant, 2) * 360f, 6f); DraftColumn(meshDraft, val * new Vector3(0f, num * 0.5f, 0f), new Vector3(0.24f, num, 0.24f), 7, 0.62f, val, 0); Vector3 val2 = val * new Vector3(0f, num, 0f); for (int i = 0; i < 3; i++) { float num2 = (float)i * MathF.PI * 2f / 3f + Hash(variant, 3); Vector3 val3 = val2 + new Vector3(Mathf.Cos(num2) * 0.9f, 0.55f, Mathf.Sin(num2) * 0.9f); DraftColumn(meshDraft, Vector3.Lerp(val2, val3, 0.5f), new Vector3(0.09f, Vector3.Distance(val2, val3), 0.09f), 5, 0.7f, Quaternion.FromToRotation(Vector3.up, val3 - val2), 0); } int num3 = 4 + variant % 2; for (int j = 0; j < num3; j++) { float num4 = (float)j * MathF.PI * 2f / (float)num3 + Hash(variant, 4 + j) * 0.8f; float num5 = ((j == 0) ? 0f : (1.05f + Hash(variant, 10 + j) * 0.5f)); Vector3 center = val2 + new Vector3(Mathf.Cos(num4) * num5, ((j == 0) ? 1.15f : 0.55f) + Hash(variant, 20 + j) * 0.5f, Mathf.Sin(num4) * num5); float num6 = ((j == 0) ? 2.7f : 2f) + Hash(variant, 30 + j) * 0.6f; DraftEllipsoid(meshDraft, center, new Vector3(num6, num6 * 0.78f, num6), 8, 4, (j % 2 == 0) ? 1 : 2, variant * 17 + j); } return meshDraft.Finish(); } private static Mesh ShrubMesh(int variant) { //IL_008c: 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) MeshDraft meshDraft = new MeshDraft(2); int num = 3 + variant % 2; for (int i = 0; i < num; i++) { float num2 = (float)i * MathF.PI * 2f / (float)num + Hash(variant, i); float num3 = ((i == 0) ? 0f : (0.38f + Hash(variant, 8 + i) * 0.2f)); float num4 = ((i == 0) ? 1.1f : 0.8f) + Hash(variant, 16 + i) * 0.3f; DraftEllipsoid(meshDraft, new Vector3(Mathf.Cos(num2) * num3, num4 * 0.34f, Mathf.Sin(num2) * num3), new Vector3(num4, num4 * 0.72f, num4), 7, 3, (i + variant) % 2, variant * 11 + i); } return meshDraft.Finish(); } private static Mesh GrassPatchMesh(int variant) { //IL_0093: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(2); Vector3 val = default(Vector3); for (int i = 0; i < 7; i++) { float num = Hash(variant, i) * MathF.PI * 2f; float num2 = Mathf.Sqrt(Hash(variant, i + 7)) * 0.95f; ((Vector3)(ref val))..ctor(Mathf.Cos(num) * num2, 0f, Mathf.Sin(num) * num2); float num3 = 0.75f + Hash(variant, i + 14) * 0.6f; float num4 = Hash(variant, i + 21) * 6f; for (int j = 0; j < 5; j++) { float num5 = num4 + (float)j * 2.4f; Vector3 val2 = val + new Vector3(Mathf.Cos(num5) * 0.2f, 0f, Mathf.Sin(num5) * 0.2f) * num3; Vector3 tip = val2 + new Vector3(Mathf.Sin(num5) * 0.28f, 0.45f + (float)j * 0.06f, Mathf.Cos(num5) * 0.22f) * num3; Vector3 side = new Vector3(Mathf.Cos(num5), 0f, 0f - Mathf.Sin(num5)) * 0.07f * num3; DraftBlade(meshDraft, val2, tip, side, ((i + j) % 3 == 0) ? 1 : 0); } } return meshDraft.Finish(); } private static Mesh FlowerPatchMesh(int variant) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00cd: 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_00fa: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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) MeshDraft meshDraft = new MeshDraft(3); Vector3 val = default(Vector3); for (int i = 0; i < 6; i++) { float num = Hash(variant, i) * MathF.PI * 2f; float num2 = Mathf.Sqrt(Hash(variant, i + 6)) * 0.55f; ((Vector3)(ref val))..ctor(Mathf.Cos(num) * num2, 0f, Mathf.Sin(num) * num2); float num3 = 0.22f + Hash(variant, i + 12) * 0.14f; DraftColumn(meshDraft, val + new Vector3(0f, num3 * 0.5f, 0f), new Vector3(0.012f, num3, 0.012f), 4, 0.8f, Quaternion.Euler(Hash(variant, i + 18) * 16f - 8f, 0f, 0f), 0); DraftEllipsoid(meshDraft, val + new Vector3(0f, num3 + 0.03f, 0f), new Vector3(0.09f, 0.06f, 0.09f), 6, 2, (i % 3 != 0) ? 1 : 2, variant + i); for (int j = 0; j < 2; j++) { float num4 = num + (float)j * 2.1f; DraftBlade(meshDraft, val, val + new Vector3(Mathf.Cos(num4) * 0.12f, 0.08f, Mathf.Sin(num4) * 0.12f), new Vector3(0f - Mathf.Sin(num4), 0f, Mathf.Cos(num4)) * 0.03f, 0); } } return meshDraft.Finish(); } private static Mesh ReedMesh(int variant) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00bc: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(2); Vector3 val = default(Vector3); for (int i = 0; i < 9; i++) { float num = Hash(variant, i) * MathF.PI * 2f; float num2 = Mathf.Sqrt(Hash(variant, i + 9)) * 0.45f; ((Vector3)(ref val))..ctor(Mathf.Cos(num) * num2, -0.4f, Mathf.Sin(num) * num2); float num3 = 1.5f + Hash(variant, i + 18) * 0.7f; Vector3 val2 = val + new Vector3(Mathf.Cos(num) * 0.18f, num3, Mathf.Sin(num) * 0.18f); Vector3 side = new Vector3(0f - Mathf.Sin(num), 0f, Mathf.Cos(num)) * 0.035f; DraftBlade(meshDraft, val, val2, side, 0); if (i % 3 == 0) { DraftEllipsoid(meshDraft, Vector3.Lerp(val, val2, 0.88f), new Vector3(0.07f, 0.3f, 0.07f), 5, 2, 1, variant + i); } } return meshDraft.Finish(); } private static Mesh RockMesh() { //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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_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) MeshDraft meshDraft = new MeshDraft(); Vector3 a = default(Vector3); ((Vector3)(ref a))..ctor(-0.12f, 0.86f, 0.06f); Vector3 a2 = default(Vector3); ((Vector3)(ref a2))..ctor(0.04f, -0.38f, -0.06f); Vector3[] array = (Vector3[])(object)new Vector3[7]; for (int i = 0; i < array.Length; i++) { float num = (float)i * MathF.PI * 2f / (float)array.Length; float num2 = 0.67f + (float)(i % 3) * 0.07f; array[i] = new Vector3(Mathf.Cos(num) * num2, (i % 2 == 0) ? 0.18f : 0.34f, Mathf.Sin(num) * num2); } for (int j = 0; j < array.Length; j++) { int num3 = (j + 1) % array.Length; meshDraft.Out(a, array[j], array[num3], Vector3.zero); meshDraft.Out(a2, array[num3], array[j], Vector3.zero); } return meshDraft.Finish(); } private static Mesh BoulderMesh() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(); Vector3[] array = (Vector3[])(object)new Vector3[9]; Vector3[] array2 = (Vector3[])(object)new Vector3[9]; for (int i = 0; i < 9; i++) { float num = (float)i * MathF.PI * 2f / 9f; float num2 = 0.78f + Hash(3, i) * 0.2f; array[i] = new Vector3(Mathf.Cos(num) * num2, -0.2f + Hash(5, i) * 0.15f, Mathf.Sin(num) * num2); array2[i] = new Vector3(Mathf.Cos(num) * num2 * 0.62f + 0.08f, 0.55f + Hash(7, i) * 0.18f, Mathf.Sin(num) * num2 * 0.62f); } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(-0.28f, 0.92f, 0.1f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0.32f, 0.8f, -0.15f); Vector3 a = default(Vector3); ((Vector3)(ref a))..ctor(0f, -0.45f, 0f); for (int j = 0; j < 9; j++) { int num3 = (j + 1) % 9; meshDraft.OutQuad(array[j], array[num3], array2[num3], array2[j], Vector3.zero); meshDraft.Out(a, array[num3], array[j], Vector3.zero); meshDraft.Out((array2[j].x < 0.1f) ? val : val2, array2[j], array2[num3], Vector3.zero); } meshDraft.Out(val, array2[3], array2[4], Vector3.zero); meshDraft.Out(val2, val, array2[0], Vector3.zero); meshDraft.Out(val, val2, array2[5], Vector3.zero); return meshDraft.Finish(); } private static Mesh DriftwoodMesh() { //IL_0017: 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_0045: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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) MeshDraft meshDraft = new MeshDraft(2); DraftColumn(meshDraft, new Vector3(0f, 0.16f, 0f), new Vector3(0.17f, 2.4f, 0.15f), 6, 0.7f, Quaternion.Euler(4f, 0f, 90f), 0); DraftColumn(meshDraft, new Vector3(1.55f, 0.3f, 0.1f), new Vector3(0.12f, 1f, 0.11f), 6, 0.6f, Quaternion.Euler(-12f, 0f, 62f), 0); DraftColumn(meshDraft, new Vector3(0.4f, 0.3f, -0.05f), new Vector3(0.07f, 0.7f, 0.07f), 5, 0.3f, Quaternion.Euler(30f, 0f, -35f), 1); for (int i = 0; i < 4; i++) { float num = (float)i * MathF.PI / 2f + 0.4f; DraftColumn(meshDraft, new Vector3(-1.25f, 0.18f + Mathf.Sin(num) * 0.16f, Mathf.Cos(num) * 0.16f), new Vector3(0.06f, 0.45f, 0.06f), 5, 0.2f, Quaternion.Euler(Mathf.Cos(num) * 60f, 0f, 80f + Mathf.Sin(num) * 40f), 1); } return meshDraft.Finish(); } private GameObject Pine(Transform parent, Vector3 position, int seed, bool windShaped) { //IL_002d: 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_00bb: 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_00e5: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) float num = Hash(seed, 1, 0.82f, 1.22f); float num2 = Hash(seed, 2) * 360f; if (TryNativeProp("pine", parent, position, num2, num)) { return ((Component)parent).gameObject; } int variant = (windShaped ? 1 : 0) + seed % 3 * 2; GameObject obj = MultiPart(parent, windShaped ? "Wind-shaped shore pine" : "Shore pine", Cached("pine " + variant, () => PineMesh(variant)), new string[4] { "bark", "pine", "pineDark", "pineLight" }, collision: false); obj.transform.localPosition = position + Vector3.down * 0.12f; obj.transform.localRotation = Quaternion.Euler(0f, num2, 0f); obj.transform.localScale = Vector3.one * num; Capsule(obj, new Vector3(0f, 2.2f, 0f), 0.28f, 4.4f); return obj; } private GameObject Oak(Transform parent, Vector3 position, int seed) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) float num = Hash(seed, 1, 0.85f, 1.2f); float num2 = Hash(seed, 2) * 360f; if (TryNativeProp("oak", parent, position, num2, num)) { return ((Component)parent).gameObject; } int variant = seed % 3; GameObject obj = MultiPart(parent, "Sea oak", Cached("oak " + variant, () => OakMesh(variant)), new string[3] { "bark", "leaf", "leafDark" }, collision: false); obj.transform.localPosition = position + Vector3.down * 0.12f; obj.transform.localRotation = Quaternion.Euler(0f, num2, 0f); obj.transform.localScale = Vector3.one * num; Capsule(obj, new Vector3(0f, 1.7f, 0f), 0.3f, 3.4f); return obj; } private void Shrub(Transform parent, Vector3 position, int seed, bool heath) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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) float num = Hash(seed, 1, 0.7f, 1.25f); float num2 = Hash(seed, 2) * 360f; if (!TryNativeProp("shrub", parent, position, num2, num)) { int variant = seed % 2; GameObject obj = MultiPart(parent, heath ? "Coastal heath" : "Bayberry shrub", Cached("shrub " + variant, () => ShrubMesh(variant)), (!heath) ? new string[2] { "leafDark", "leaf" } : new string[2] { "pineLight", "grassLight" }, collision: false); obj.transform.localPosition = position + Vector3.down * 0.1f; obj.transform.localRotation = Quaternion.Euler(0f, num2, 0f); obj.transform.localScale = Vector3.one * num; } } private void GrassPatch(Transform parent, Vector3 position, int seed) { //IL_002d: 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_0092: 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_00bc: 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_00d1: Unknown result type (might be due to invalid IL or missing references) float num = Hash(seed, 1, 0.8f, 1.3f); float num2 = Hash(seed, 2) * 360f; if (!TryNativeProp("grass", parent, position, num2, num)) { int variant = seed % 4; GameObject obj = MultiPart(parent, "Dune grass patch", Cached("grass patch " + variant, () => GrassPatchMesh(variant)), new string[2] { "grass", "grassLight" }, collision: false); obj.transform.localPosition = position - Vector3.up * 0.03f; obj.transform.localRotation = Quaternion.Euler(0f, num2, 0f); obj.transform.localScale = Vector3.one * num; } } private void FlowerPatch(Transform parent, Vector3 position, int seed) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) int variant = seed % 3; GameObject obj = MultiPart(parent, "Sea thrift", Cached("flower patch " + variant, () => FlowerPatchMesh(variant)), new string[3] { "grass", "blush", "cream" }, collision: false); obj.transform.localPosition = position - Vector3.up * 0.02f; obj.transform.localRotation = Quaternion.Euler(0f, Hash(seed, 2) * 360f, 0f); } private void Reeds(Transform parent, Vector3 position, int seed) { //IL_002d: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) float num = Hash(seed, 1, 0.8f, 1.15f); float num2 = Hash(seed, 2) * 360f; if (!TryNativeProp("reed", parent, position, num2, num)) { int variant = seed % 3; GameObject obj = MultiPart(parent, "Lagoon reeds", Cached("reeds " + variant, () => ReedMesh(variant)), new string[2] { "grassLight", "leather" }, collision: false); obj.transform.localPosition = position; obj.transform.localRotation = Quaternion.Euler(0f, num2, 0f); obj.transform.localScale = Vector3.one * num; } } private void Rock(Transform parent, Vector3 position, int seed, float size, bool boulder) { //IL_0015: 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_00a4: 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_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_00e9: 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) float num = Hash(seed, 2) * 360f; if (!TryNativeProp("rock", parent, position, num, size)) { Mesh mesh = (boulder ? Cached("granite boulder", BoulderMesh) : Cached("hewn granite", RockMesh)); string material = ((Hash(seed, 3) < 0.35f) ? "stoneLight" : "stone"); Part(parent, boulder ? "Granite boulder" : "Faceted tide rock", mesh, material, position + Vector3.down * size * 0.2f, new Vector3(size * Hash(seed, 4, 1.05f, 1.45f), size, size * Hash(seed, 5, 0.85f, 1.1f)), Quaternion.Euler(Hash(seed, 6, -8f, 8f), num, Hash(seed, 7, -9f, 9f)), size >= 0.9f); } } private void RockCluster(Transform parent, Vector3 center, int seed, int count, float size) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) for (int i = 0; i < count; i++) { float num = Hash(seed, i) * MathF.PI * 2f; float num2 = ((i == 0) ? 0f : (size * Hash(seed, i + 10, 0.9f, 1.6f))); Vector3 val = center + new Vector3(Mathf.Cos(num) * num2, 0f, Mathf.Sin(num) * num2); val.y = SurfaceHeight(val); Rock(parent, val, seed * 13 + i, size * ((i == 0) ? 1f : Hash(seed, i + 20, 0.45f, 0.8f)), i == 0 && size >= 1.2f); } } private void Driftwood(Transform parent, Vector3 position, int seed) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00b8: 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) GameObject obj = MultiPart(parent, "Bleached driftwood", Cached("driftwood", DriftwoodMesh), new string[2] { "driftwood", "bark" }, collision: false); obj.transform.localPosition = position + Vector3.down * 0.05f; obj.transform.localRotation = Quaternion.Euler(Hash(seed, 1, -6f, 6f), Hash(seed, 2) * 360f, 0f); obj.transform.localScale = Vector3.one * Hash(seed, 3, 0.7f, 1.25f); Capsule(obj, new Vector3(0f, 0.18f, 0f), 0.17f, 2.5f); obj.GetComponent().direction = 0; } private void Scatter(Clearance clearance, int seed, int count, float angleMin, float angleMax, float radiusMin, float radiusMax, float spacing, Action place, bool normalized = false, float maxT = 0.82f) { //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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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) List list = new List(); int num = 0; while (list.Count < count && num < count * 14) { int num2 = num++; float num3 = Hash(seed, num2 * 2, angleMin, angleMax); float num4 = Hash(seed, num2 * 2 + 1, radiusMin, radiusMax); if (normalized) { num4 = Mathf.Lerp(InnerRadius(num3), OuterRadius(num3), num4); } if (Normalized(num4, num3) > maxT) { continue; } Vector3 val = Polar(num4, num3, 0f); if (!clearance.IsClear(val)) { continue; } bool flag = false; foreach (Vector3 item in list) { Vector3 val2 = item - val; if (((Vector3)(ref val2)).sqrMagnitude < spacing * spacing) { flag = true; break; } } if (!flag) { val.y = SurfaceHeight(num4, num3); list.Add(val); place(val, seed * 101 + list.Count); } } } private void BuildNature(Transform root, Clearance clearance) { //IL_001b: 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_005b: 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_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) Transform woods = Group("Groves - pines and sea oaks", root, Vector3.zero).transform; Transform underbrush = Group("Shrubs, grass, thrift and reeds", root, Vector3.zero).transform; Transform stone = Group("Granite teeth and tide rocks", root, Vector3.zero).transform; Transform beach = Group("Driftwood and shore debris", root, Vector3.zero).transform; Grove(11, 7, 0, -140f, -104f, 0.58f, 0.8f, windward: true); Grove(21, 6, 3, -101f, -67f, 0.6f, 0.8f, windward: false); Grove(31, 9, 3, -30f, 30f, 0.6f, 0.8f, windward: false); Grove(41, 3, 5, 54f, 90f, 0.6f, 0.8f, windward: false); Grove(51, 4, 0, 126f, 143f, 0.56f, 0.78f, windward: true); Scatter(clearance, 61, 5, -66f, 40f, 0.22f, 0.36f, 3f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Oak(underbrush, p, s); }, normalized: true); for (int num = 0; num < 6; num++) { var (angleMin, angleMax, radiusMin, radiusMax) = num switch { 0 => (-140f, -60f, 0.58f, 0.86f), 1 => (-58f, 30f, 0.58f, 0.86f), 2 => (30f, 92f, 0.58f, 0.86f), 3 => (124f, 145f, 0.56f, 0.84f), 4 => (-140f, -20f, 0.12f, 0.36f), _ => (20f, 95f, 0.12f, 0.36f), }; Scatter(clearance, 71 + num, (num < 4) ? 8 : 6, angleMin, angleMax, radiusMin, radiusMax, 2.2f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Shrub(underbrush, p, s, Hash(s, 4) < 0.4f); }, normalized: true, 0.87f); } Scatter(clearance, 81, 26, -140f, 145f, 0.57f, 0.66f, 2.4f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) GrassPatch(underbrush, p, s); }, normalized: true); Scatter(clearance, 82, 22, -138f, 140f, 0.33f, 0.4f, 2.6f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) GrassPatch(underbrush, p, s); }, normalized: true); Scatter(clearance, 83, 14, -140f, 145f, 0.14f, 0.33f, 3f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) GrassPatch(underbrush, p, s); }, normalized: true); Scatter(clearance, 84, 12, -132f, 40f, 0.68f, 0.84f, 3f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) GrassPatch(underbrush, p, s); }, normalized: true, 0.86f); Scatter(clearance, 85, 5, -4f, 16f, 0.6f, 0.74f, 1.6f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) FlowerPatch(underbrush, p, s); }, normalized: true); Scatter(clearance, 86, 4, -128f, -114f, 0.58f, 0.72f, 1.6f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) FlowerPatch(underbrush, p, s); }, normalized: true); Scatter(clearance, 87, 4, 26f, 40f, 0.58f, 0.64f, 1.5f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) FlowerPatch(underbrush, p, s); }, normalized: true); Scatter(clearance, 88, 9, -142f, -98f, 0.02f, 0.07f, 1.8f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Reeds(underbrush, p, s); }, normalized: true); Scatter(clearance, 89, 8, 56f, 92f, 0.02f, 0.07f, 1.8f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Reeds(underbrush, p, s); }, normalized: true); Scatter(clearance, 90, 5, 12f, 40f, 0.02f, 0.06f, 1.8f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Reeds(underbrush, p, s); }, normalized: true); Scatter(clearance, 91, 16, -144f, 144f, 0f, 0.06f, 2.2f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Rock(stone, p, s, Hash(s, 8, 0.7f, 1.5f), boulder: false); }, normalized: true, 1f); for (int num2 = 0; num2 < 9; num2++) { float num3 = Mathf.Lerp(-142f, 142f, ((float)num2 + Hash(93, num2) * 0.6f) / 9f); if (!(Mathf.Abs(Mathf.DeltaAngle(num3, 109f)) < 18f)) { RockCluster(stone, Polar(OuterRadius(num3) - Hash(93, num2 + 9, 1.4f, 3.2f), num3, 0f), 93 + num2, 2 + num2 % 3, Hash(93, num2 + 18, 1.1f, 1.9f)); } } RockCluster(stone, Polar(37.4f, -131f, 0f), 120, 3, 1.6f); RockCluster(stone, Polar(38.4f, -113f, 0f), 121, 2, 1.3f); RockCluster(stone, Polar(36.8f, 140f, 0f), 122, 4, 1.7f); RockCluster(stone, Polar(35.2f, 128f, 0f), 123, 2, 1.2f); RockCluster(stone, Polar(38.2f, -20f, 0f), 124, 3, 1.4f); RockCluster(stone, Polar(38.6f, 24f, 0f), 125, 2, 1.1f); Scatter(clearance, 94, 10, -140f, 145f, 0.6f, 0.85f, 4f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Rock(stone, p, s, Hash(s, 8, 0.5f, 0.95f), boulder: false); }, normalized: true, 0.9f); Scatter(clearance, 95, 7, -104f, 100f, 0.84f, 0.94f, 4.5f, delegate(Vector3 p, int s) { //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_0024: Unknown result type (might be due to invalid IL or missing references) if (Relief(AngleOf(p), RadiusOf(p)) < 0.3f) { Driftwood(beach, p, s); } }, normalized: true, 1f); Scatter(clearance, 96, 3, -60f, 60f, 0.86f, 0.93f, 6f, delegate(Vector3 p, int s) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_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 (Hash(s, 1) < 0.5f) { Barrel(beach, p + Vector3.down * 0.05f, 0.7f, "driftwood"); } else { LobsterPot(beach, p, Hash(s, 2) * 360f); } }, normalized: true, 1f); Scatter(clearance, 97, 3, -120f, 80f, 0.86f, 0.93f, 8f, delegate(Vector3 p, int s) { //IL_0045: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) Part(beach, "Tangled net wrack", Cached("faceted oval", () => Geometry.Ellipsoid(10, 5)), "navy", p, new Vector3(1.4f, 0.22f, 0.9f), Quaternion.Euler(0f, Hash(s, 2) * 360f, 0f)); for (int num4 = 0; num4 < 3; num4++) { Oval(beach, "Wrack cork", p + new Vector3(Hash(s, num4) - 0.5f, 0.1f, Hash(s, num4 + 3) - 0.5f) * 0.8f, new Vector3(0.12f, 0.14f, 0.12f), (num4 == 1) ? "red" : "cream"); } }, normalized: true, 1f); void Grove(int seed, int pines, int oaks, float a0, float a1, float t0, float t1, bool windward) { Scatter(clearance, seed, pines, a0, a1, t0, t1, 2.6f, delegate(Vector3 p, int s) { //IL_0016: 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) Pine(woods, p, s, windward && Hash(s, 9) < 0.6f); clearance.Circle(p, 1.1f); }, normalized: true, 0.8f); Scatter(clearance, seed + 1, oaks, a0, a1, t0, t1, 3.4f, delegate(Vector3 p, int s) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Oak(woods, p, s); clearance.Circle(p, 1.3f); }, normalized: true, 0.78f); } } private void BuildSettlement(Transform root, Clearance clearance, Dictionary landmarks) { //IL_0006: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0285: 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_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) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0404: 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_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0531: 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_0545: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: 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_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_067c: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_0712: 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_0762: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_07a1: Unknown result type (might be due to invalid IL or missing references) //IL_07cb: Unknown result type (might be due to invalid IL or missing references) //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Unknown result type (might be due to invalid IL or missing references) //IL_084b: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Unknown result type (might be due to invalid IL or missing references) //IL_0889: Unknown result type (might be due to invalid IL or missing references) //IL_08a5: Unknown result type (might be due to invalid IL or missing references) //IL_08eb: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_0910: Unknown result type (might be due to invalid IL or missing references) //IL_0915: Unknown result type (might be due to invalid IL or missing references) //IL_091d: Unknown result type (might be due to invalid IL or missing references) //IL_0a31: Unknown result type (might be due to invalid IL or missing references) //IL_0a45: Unknown result type (might be due to invalid IL or missing references) //IL_0a73: Unknown result type (might be due to invalid IL or missing references) //IL_0a87: Unknown result type (might be due to invalid IL or missing references) //IL_0ae4: Unknown result type (might be due to invalid IL or missing references) //IL_0b02: Unknown result type (might be due to invalid IL or missing references) //IL_0b52: Unknown result type (might be due to invalid IL or missing references) //IL_0b54: Unknown result type (might be due to invalid IL or missing references) //IL_0b56: Unknown result type (might be due to invalid IL or missing references) //IL_0b60: Unknown result type (might be due to invalid IL or missing references) //IL_0b70: 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) //IL_0bb0: Unknown result type (might be due to invalid IL or missing references) //IL_0bb8: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09e2: Unknown result type (might be due to invalid IL or missing references) //IL_0a00: Unknown result type (might be due to invalid IL or missing references) //IL_0bf7: Unknown result type (might be due to invalid IL or missing references) //IL_0c0a: Unknown result type (might be due to invalid IL or missing references) //IL_0c0f: Unknown result type (might be due to invalid IL or missing references) //IL_0c14: Unknown result type (might be due to invalid IL or missing references) //IL_0c1e: Unknown result type (might be due to invalid IL or missing references) //IL_0c23: Unknown result type (might be due to invalid IL or missing references) //IL_0c37: Unknown result type (might be due to invalid IL or missing references) //IL_0c64: Unknown result type (might be due to invalid IL or missing references) //IL_0c7a: Unknown result type (might be due to invalid IL or missing references) //IL_0c7f: Unknown result type (might be due to invalid IL or missing references) //IL_0c84: Unknown result type (might be due to invalid IL or missing references) //IL_0c8e: Unknown result type (might be due to invalid IL or missing references) //IL_0c93: Unknown result type (might be due to invalid IL or missing references) //IL_0c98: Unknown result type (might be due to invalid IL or missing references) //IL_0cae: Unknown result type (might be due to invalid IL or missing references) //IL_0cb3: Unknown result type (might be due to invalid IL or missing references) //IL_0cb8: Unknown result type (might be due to invalid IL or missing references) //IL_0cc2: Unknown result type (might be due to invalid IL or missing references) //IL_0cc7: Unknown result type (might be due to invalid IL or missing references) //IL_0ce3: Unknown result type (might be due to invalid IL or missing references) //IL_0cf9: Unknown result type (might be due to invalid IL or missing references) //IL_0cfe: Unknown result type (might be due to invalid IL or missing references) //IL_0d03: Unknown result type (might be due to invalid IL or missing references) //IL_0d0d: Unknown result type (might be due to invalid IL or missing references) //IL_0d12: Unknown result type (might be due to invalid IL or missing references) //IL_0d17: Unknown result type (might be due to invalid IL or missing references) //IL_0d2d: Unknown result type (might be due to invalid IL or missing references) //IL_0d32: Unknown result type (might be due to invalid IL or missing references) //IL_0d37: Unknown result type (might be due to invalid IL or missing references) //IL_0d41: Unknown result type (might be due to invalid IL or missing references) //IL_0d46: Unknown result type (might be due to invalid IL or missing references) //IL_0d5d: Unknown result type (might be due to invalid IL or missing references) //IL_0d73: Unknown result type (might be due to invalid IL or missing references) //IL_0d78: Unknown result type (might be due to invalid IL or missing references) //IL_0d90: Unknown result type (might be due to invalid IL or missing references) //IL_0da6: Unknown result type (might be due to invalid IL or missing references) //IL_0dab: Unknown result type (might be due to invalid IL or missing references) //IL_0dc4: Unknown result type (might be due to invalid IL or missing references) //IL_0dc9: Unknown result type (might be due to invalid IL or missing references) //IL_0dd1: Unknown result type (might be due to invalid IL or missing references) //IL_0dd3: Unknown result type (might be due to invalid IL or missing references) //IL_0ddd: Unknown result type (might be due to invalid IL or missing references) //IL_0de2: Unknown result type (might be due to invalid IL or missing references) //IL_0e09: Unknown result type (might be due to invalid IL or missing references) //IL_0e79: Unknown result type (might be due to invalid IL or missing references) //IL_0e9a: Unknown result type (might be due to invalid IL or missing references) //IL_0eae: Unknown result type (might be due to invalid IL or missing references) //IL_0ef2: Unknown result type (might be due to invalid IL or missing references) //IL_0f1a: Unknown result type (might be due to invalid IL or missing references) //IL_0f50: Unknown result type (might be due to invalid IL or missing references) //IL_0f64: Unknown result type (might be due to invalid IL or missing references) //IL_1037: Unknown result type (might be due to invalid IL or missing references) //IL_106b: Unknown result type (might be due to invalid IL or missing references) //IL_1070: Unknown result type (might be due to invalid IL or missing references) //IL_107a: Unknown result type (might be due to invalid IL or missing references) //IL_107f: Unknown result type (might be due to invalid IL or missing references) //IL_10a3: Unknown result type (might be due to invalid IL or missing references) //IL_10a8: Unknown result type (might be due to invalid IL or missing references) //IL_10ac: Unknown result type (might be due to invalid IL or missing references) //IL_10ae: Unknown result type (might be due to invalid IL or missing references) //IL_10b8: Unknown result type (might be due to invalid IL or missing references) //IL_10bd: Unknown result type (might be due to invalid IL or missing references) //IL_10fd: Unknown result type (might be due to invalid IL or missing references) //IL_111f: Unknown result type (might be due to invalid IL or missing references) //IL_1133: Unknown result type (might be due to invalid IL or missing references) //IL_1158: Unknown result type (might be due to invalid IL or missing references) //IL_1173: Unknown result type (might be due to invalid IL or missing references) //IL_1178: Unknown result type (might be due to invalid IL or missing references) //IL_117c: Unknown result type (might be due to invalid IL or missing references) //IL_1189: Unknown result type (might be due to invalid IL or missing references) //IL_11a4: Unknown result type (might be due to invalid IL or missing references) //IL_11a9: Unknown result type (might be due to invalid IL or missing references) //IL_11ad: Unknown result type (might be due to invalid IL or missing references) //IL_11c5: Unknown result type (might be due to invalid IL or missing references) //IL_11d6: Unknown result type (might be due to invalid IL or missing references) //IL_11db: Unknown result type (might be due to invalid IL or missing references) //IL_11e0: Unknown result type (might be due to invalid IL or missing references) //IL_11f1: Unknown result type (might be due to invalid IL or missing references) //IL_11f6: Unknown result type (might be due to invalid IL or missing references) //IL_120b: Unknown result type (might be due to invalid IL or missing references) //IL_1226: Unknown result type (might be due to invalid IL or missing references) //IL_122b: Unknown result type (might be due to invalid IL or missing references) //IL_122f: Unknown result type (might be due to invalid IL or missing references) //IL_1242: Unknown result type (might be due to invalid IL or missing references) //IL_1253: Unknown result type (might be due to invalid IL or missing references) //IL_1258: Unknown result type (might be due to invalid IL or missing references) //IL_126e: Unknown result type (might be due to invalid IL or missing references) //IL_1270: Unknown result type (might be due to invalid IL or missing references) //IL_127a: Unknown result type (might be due to invalid IL or missing references) //IL_127f: Unknown result type (might be due to invalid IL or missing references) //IL_1295: Unknown result type (might be due to invalid IL or missing references) //IL_12a6: Unknown result type (might be due to invalid IL or missing references) //IL_12ab: Unknown result type (might be due to invalid IL or missing references) //IL_12bc: Unknown result type (might be due to invalid IL or missing references) //IL_12cd: Unknown result type (might be due to invalid IL or missing references) //IL_12d2: Unknown result type (might be due to invalid IL or missing references) //IL_12e2: Unknown result type (might be due to invalid IL or missing references) //IL_12fd: Unknown result type (might be due to invalid IL or missing references) //IL_1302: Unknown result type (might be due to invalid IL or missing references) //IL_130a: Unknown result type (might be due to invalid IL or missing references) //IL_1334: Unknown result type (might be due to invalid IL or missing references) //IL_1348: Unknown result type (might be due to invalid IL or missing references) //IL_1376: Unknown result type (might be due to invalid IL or missing references) //IL_138a: Unknown result type (might be due to invalid IL or missing references) //IL_13d9: Unknown result type (might be due to invalid IL or missing references) //IL_13ed: Unknown result type (might be due to invalid IL or missing references) //IL_1429: Unknown result type (might be due to invalid IL or missing references) //IL_143d: Unknown result type (might be due to invalid IL or missing references) //IL_1468: Unknown result type (might be due to invalid IL or missing references) //IL_147c: Unknown result type (might be due to invalid IL or missing references) //IL_14aa: Unknown result type (might be due to invalid IL or missing references) //IL_14be: Unknown result type (might be due to invalid IL or missing references) //IL_14d3: Unknown result type (might be due to invalid IL or missing references) //IL_14e5: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Settlement - fences, benches, racks and moorings", root, Vector3.zero).transform; Transform transform2 = Group("Reach dock totem", root, new Vector3(2.75f, 3.1f, 26.8f), -20f).transform; Column(transform2, "Totem post", new Vector3(0f, 1.7f, 0f), new Vector3(0.15f, 3.4f, 0.15f), "woodDark", 8, 0.85f, collision: true); Box(transform2, "Totem identity board", new Vector3(0f, 2.05f, -0.12f), new Vector3(1.9f, 0.55f, 0.1f), "cream"); HookGlyph(transform2, new Vector3(-0.62f, 2.05f, -0.18f), 0.42f); Oval(transform2, "Shell pictogram", new Vector3(0f, 2.05f, -0.18f), new Vector3(0.3f, 0.32f, 0.04f), "teal"); Suit(transform2, "spade", new Vector3(0.62f, 2.03f, -0.18f), 0.34f, "navy", Quaternion.Euler(90f, 0f, 0f)); Box(transform2, "Board brace", new Vector3(0f, 1.72f, -0.06f), new Vector3(2f, 0.08f, 0.06f), "woodDark"); Lantern(transform2, new Vector3(0.55f, 1.3f, -0.05f), 0.8f); Beam(transform2, "Lantern arm", new Vector3(0f, 1.95f, 0f), new Vector3(0.55f, 1.95f, -0.05f), 0.03f, "ink"); Transform transform3 = Group("Fish weathervane", transform2, new Vector3(0f, 3.55f, 0f), 35f).transform; Beam(transform3, "Vane spindle", new Vector3(0f, -0.15f, 0f), new Vector3(0f, 0.25f, 0f), 0.025f, "brass"); Beam(transform3, "Vane arrow shaft", new Vector3(-0.5f, 0.1f, 0f), new Vector3(0.5f, 0.1f, 0f), 0.018f, "brass"); Part(transform3, "Carved vane fish", Cached("vane fish", () => Geometry.Fin((Vector3[])(object)new Vector3[10] { new Vector3(0.55f, 0.1f, 0f), new Vector3(0.3f, 0.28f, 0f), new Vector3(-0.15f, 0.26f, 0f), new Vector3(-0.4f, 0.12f, 0f), new Vector3(-0.62f, 0.3f, 0f), new Vector3(-0.58f, 0.1f, 0f), new Vector3(-0.62f, -0.1f, 0f), new Vector3(-0.4f, 0.08f, 0f), new Vector3(-0.15f, -0.06f, 0f), new Vector3(0.3f, -0.08f, 0f) }, 0.015f)), "copper", Vector3.zero, Vector3.one, Quaternion.identity); landmarks["totem"] = new Vector3(2.75f, 3.2f, 26.8f); (float, float)[] array = new(float, float)[5] { (-134f, -94f), (-80f, -66f), (-44f, -8f), (8f, 34f), (52f, 92f) }; for (int num = 0; num < array.Length; num++) { (float, float) tuple = array[num]; float item = tuple.Item1; float item2 = tuple.Item2; int num2 = Mathf.Max(2, Mathf.RoundToInt((item2 - item) / 4.6f)); Vector3? val = null; for (int num3 = 0; num3 <= num2; num3++) { float angle = Mathf.Lerp(item, item2, (float)num3 / (float)num2); Vector3 val2 = OnGround(26.9f, angle); Column(transform, "Fence post", val2 + Vector3.up * 0.42f, new Vector3(0.07f, 0.95f, 0.07f), "woodDark", 6, 0.9f, collision: true); if (val.HasValue) { Beam(transform, "Fence rope", val.Value + Vector3.up * 0.82f, val2 + Vector3.up * 0.82f, 0.02f, "rope"); Beam(transform, "Fence rope", val.Value + Vector3.up * 0.48f, val2 + Vector3.up * 0.48f, 0.02f, "rope"); } val = val2; } } float[] array2 = new float[4] { -100f, -22f, 60f, 88f }; foreach (float num4 in array2) { Vector3 val3 = OnGround(31.75f, num4); Bench(transform, val3, num4 + 180f); clearance.Circle(val3, 1.4f); } array2 = new float[6] { -110f, 12f, 52f, 125f, -66f, 34f }; foreach (float angle2 in array2) { Vector3 val4 = OnGround(31.5f, angle2); LampPost(transform, val4); clearance.Circle(val4, 0.7f); } Vector3 position = OnGround(35.6f, 6f); Transform transform4 = Group("Ridge lookout", root, position, 6f).transform; Box(transform4, "Lookout deck", new Vector3(0f, 0.22f, 0f), new Vector3(3.4f, 0.16f, 3.2f), "woodLight", collision: true); array2 = new float[2] { -1.5f, 1.5f }; foreach (float num5 in array2) { float[] array3 = new float[2] { -1.4f, 1.4f }; foreach (float num7 in array3) { Column(transform4, "Lookout footing", new Vector3(num5, -0.6f, num7), new Vector3(0.1f, 1.6f, 0.1f), "woodDark", 6); } } array2 = new float[3] { -1.6f, 0f, 1.6f }; foreach (float num8 in array2) { Column(transform4, "Lookout rail post", new Vector3(num8, 0.75f, 1.55f), new Vector3(0.06f, 0.95f, 0.06f), "woodDark", 6); } Beam(transform4, "Lookout rail", new Vector3(-1.65f, 1.2f, 1.55f), new Vector3(1.65f, 1.2f, 1.55f), 0.04f, "woodDark"); Beam(transform4, "Lookout rope", new Vector3(-1.65f, 0.75f, 1.55f), new Vector3(1.65f, 0.75f, 1.55f), 0.02f, "rope"); Transform transform5 = Group("Lookout telescope", transform4, new Vector3(0.9f, 0.3f, 1f)).transform; for (int num9 = 0; num9 < 3; num9++) { Beam(transform5, "Tripod leg", Polar(0.4f, (float)num9 * 120f, 0f), new Vector3(0f, 1.2f, 0f), 0.022f, "woodDark"); } Column(transform5, "Telescope tube", new Vector3(0f, 1.3f, 0.22f), new Vector3(0.05f, 0.75f, 0.05f), "brass", 8, 0.8f).transform.localRotation = Quaternion.Euler(70f, 0f, 0f); Lantern(transform4, new Vector3(-1.5f, 1.55f, 1.5f), 0.8f); Part(transform4, "Lookout step", Cached("lookout step", () => Geometry.Ramp(new Vector3(0f, 0f, -2.3f), new Vector3(0f, 0.3f, -1.55f), 1.7f)), "wood", Vector3.zero, Vector3.one, Quaternion.identity, collision: true); Vector3 val5 = OnGround(35.6f, -122f); Transform transform6 = Group("The Three Wagers - balancing cairn", root, val5).transform; Mesh mesh = Cached("hewn granite", RockMesh); for (int num10 = 0; num10 < 4; num10++) { Part(transform6, "Cairn slab", mesh, (num10 % 2 == 1) ? "stoneLight" : "stone", new Vector3(num10 switch { 3 => -0.15f, 1 => 0.25f, _ => 0f, }, 0.45f + (float)num10 * 0.72f, (num10 == 2) ? 0.12f : 0f), new Vector3(2.5f - (float)num10 * 0.5f, 0.78f, 1.7f - (float)num10 * 0.3f), Quaternion.Euler(0f, 25f + (float)num10 * 61f, 0f), collision: true); } Column(transform6, "Cairn wager stake", new Vector3(1.3f, 0.55f, -0.9f), new Vector3(0.06f, 1.1f, 0.06f), "woodDark", 6); Box(transform6, "Wager plaque", new Vector3(1.3f, 1.05f, -0.9f), new Vector3(0.32f, 0.22f, 0.04f), "brass", collision: false, -20f); for (int num11 = 0; num11 < 3; num11++) { Suit(transform6, num11 switch { 1 => "heart", 0 => "spade", _ => "diamond", }, new Vector3(1.19f + (float)num11 * 0.11f, 1.05f, -0.95f - (float)num11 * 0.038f), 0.07f, "navy", Quaternion.Euler(90f, -20f, 0f)); } Vector3 val6 = default(Vector3); for (int num12 = 0; num12 < 5; num12++) { ((Vector3)(ref val6))..ctor(Mathf.Cos((float)num12 * 1.3f) * 1.9f, 0f, Mathf.Sin((float)num12 * 1.3f) * 1.6f); val6.y = SurfaceHeight(val5 + val6) - val5.y; Rock(transform6, val6, 300 + num12, 0.45f + (float)(num12 % 2) * 0.2f, boulder: false); } Vector3 val7 = OnGround(34.6f, 134f); Transform transform7 = Group("Bluff overlook", root, val7, 134f).transform; array2 = new float[3] { -1.2f, 0f, 1.2f }; foreach (float num13 in array2) { Column(transform7, "Overlook post", Grounded(val7, 134f, new Vector3(num13, 0f, 1.1f)) + Vector3.up * 0.5f, new Vector3(0.07f, 1f, 0.07f), "woodDark", 6, 0.9f, collision: true); } Beam(transform7, "Overlook rope", Grounded(val7, 134f, new Vector3(-1.25f, 0f, 1.1f)) + Vector3.up * 0.95f, Grounded(val7, 134f, new Vector3(1.25f, 0f, 1.1f)) + Vector3.up * 0.95f, 0.022f, "rope"); Beam(transform7, "Overlook rope", Grounded(val7, 134f, new Vector3(-1.25f, 0f, 1.1f)) + Vector3.up * 0.55f, Grounded(val7, 134f, new Vector3(1.25f, 0f, 1.1f)) + Vector3.up * 0.55f, 0.022f, "rope"); Rock(transform7, Grounded(val7, 134f, new Vector3(-1.6f, 0f, -0.4f)), 310, 1.1f, boulder: true); LampPost(transform7, Grounded(val7, 134f, new Vector3(1.6f, 0f, 0.3f))); Vector3 val8 = OnGround(40.5f, 136f); Transform transform8 = Group("Wreck of the Second Chance", root, val8 + Vector3.down * 0.35f, 205f).transform; transform8.localRotation = Quaternion.Euler(-5f, 205f, 22f); MultiPart(transform8, "Wrecked hull", Cached("lucky keel hull", HullMesh), new string[3] { "driftwood", "stone", "woodDark" }, collision: true).transform.localScale = new Vector3(0.55f, 0.55f, 0.55f); Beam(transform8, "Snapped mast", new Vector3(0f, 0.9f, -2.2f), new Vector3(0.6f, 2.9f, -2.9f), 0.06f, "driftwood"); for (int num14 = 0; num14 < 4; num14++) { Beam(transform8, "Exposed rib", new Vector3(-1.9f + (float)num14 * 0.35f, 0.35f, 2.4f + (float)num14 * 0.5f), new Vector3(-2.3f + (float)num14 * 0.35f, 1.5f, 2.6f + (float)num14 * 0.5f), 0.04f, "driftwood"); } Beam(transform8, "Frayed rigging", new Vector3(0.6f, 2.9f, -2.9f), new Vector3(2.2f, 0.2f, -1.2f), 0.012f, "rope"); (float, float, string)[] array4 = new(float, float, string)[5] { (-40f, 10f, "red"), (-118f, 12.5f, "white"), (62f, 9.5f, "red"), (98f, 13.5f, "white"), (-72f, 15.5f, "amber") }; for (int num = 0; num < array4.Length; num++) { var (num15, radius, colour) = array4[num]; Buoy(transform, Polar(radius, num15, 0f), colour, 400 + (int)num15); } Dinghy(transform, OnGround(18.8f, -32f) + Vector3.up * 0.1f, 165f, "woodLight", upturned: false); Vector3 val9 = OnGround(33.4f, 60f); Dinghy(transform, val9 + Vector3.up * 0.95f, 150f, "teal", upturned: true); array2 = new float[2] { -1.1f, 1.1f }; foreach (float num16 in array2) { Box(Group("Boat trestle", transform, val9, 150f).transform, "Trestle", new Vector3(num16, 0.45f, 0f), new Vector3(0.12f, 0.9f, 1.1f), "woodDark", collision: true); } clearance.Circle(val9, 2.2f); Vector3 val10 = OnGround(33.3f, -71f); DryingRack(transform, val10, 19f); clearance.Circle(val10, 1.6f); Vector3 val11 = OnGround(32.6f, -44f); Barrel(transform, val11, 0.95f, "woodDark"); Beam(transform, "Cistern spout", val11 + new Vector3(0f, 0.55f, 0f), val11 + Polar(0.55f, 136f, 0.45f), 0.03f, "brass"); clearance.Circle(val11, 1f); Vector3 val12 = OnGround(32.4f, 98f); Crate(transform, val12, 0.75f, 98f); Crate(transform, val12 + Polar(0.9f, 188f, 0f), 0.55f, 118f); Crate(transform, val12 + Vector3.up * 0.75f, 0.5f, 83f); LobsterPot(transform, val12 + Polar(1.1f, 98f, 0f), 138f); LobsterPot(transform, val12 + Polar(1.1f, 98f, 0.5f), 163f); clearance.Circle(val12, 1.8f); Vector3 val13 = OnGround(32.8f, 20f); Transform transform9 = Group("Rain well", transform, val13, 20f).transform; Column(transform9, "Well ring", new Vector3(0f, 0.35f, 0f), new Vector3(0.75f, 0.7f, 0.75f), "stone", 8, 1f, collision: true); Column(transform9, "Well water", new Vector3(0f, 0.62f, 0f), new Vector3(0.6f, 0.06f, 0.6f), "glass"); array2 = new float[2] { -0.7f, 0.7f }; foreach (float num17 in array2) { Column(transform9, "Well upright", new Vector3(num17, 1.15f, 0f), new Vector3(0.06f, 1.6f, 0.06f), "woodDark", 6); } Beam(transform9, "Well crossbar", new Vector3(-0.75f, 1.9f, 0f), new Vector3(0.75f, 1.9f, 0f), 0.04f, "woodDark"); Column(transform9, "Well bucket", new Vector3(0f, 1.15f, 0f), new Vector3(0.14f, 0.22f, 0.14f), "wood", 8, 0.85f); Beam(transform9, "Bucket rope", new Vector3(0f, 1.26f, 0f), new Vector3(0f, 1.9f, 0f), 0.012f, "rope"); clearance.Circle(val13, 1.2f); landmarks["well"] = val13; static Vector3 Grounded(Vector3 origin, float heading, Vector3 offset) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector3 local = origin + Quaternion.Euler(0f, heading, 0f) * offset; return new Vector3(offset.x, SurfaceHeight(local) - origin.y, offset.z); } } private void Bench(Transform parent, Vector3 position, float heading) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Driftwood bench", parent, position, heading).transform; Box(transform, "Bench seat", new Vector3(0f, 0.46f, 0f), new Vector3(1.7f, 0.08f, 0.45f), "driftwood", collision: true); Box(transform, "Bench back", new Vector3(0f, 0.82f, 0.22f), new Vector3(1.7f, 0.3f, 0.06f), "driftwood"); float[] array = new float[2] { -0.7f, 0.7f }; foreach (float num in array) { Box(transform, "Bench leg", new Vector3(num, 0.22f, -0.15f), new Vector3(0.08f, 0.44f, 0.08f), "woodDark"); Box(transform, "Bench leg", new Vector3(num, 0.5f, 0.2f), new Vector3(0.08f, 1f, 0.08f), "woodDark"); } } private void LampPost(Transform parent, Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Trail lamp post", parent, position).transform; Column(transform, "Lamp post", new Vector3(0f, 1.15f, 0f), new Vector3(0.08f, 2.3f, 0.08f), "woodDark", 6, 0.85f, collision: true); Beam(transform, "Lamp arm", new Vector3(0f, 2.2f, 0f), new Vector3(0.4f, 2.3f, 0f), 0.03f, "ink"); Lantern(transform, new Vector3(0.42f, 1.75f, 0f), 0.85f); } private void DryingRack(Transform parent, Vector3 position, float heading) { //IL_0006: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Fish drying rack", parent, position, heading).transform; float[] array = new float[2] { -1.2f, 1.2f }; foreach (float num in array) { Column(transform, "Rack post", new Vector3(num, 0.95f, 0f), new Vector3(0.06f, 1.9f, 0.06f), "woodDark", 6, 1f, collision: true); } Beam(transform, "Rack rail", new Vector3(-1.25f, 1.85f, 0f), new Vector3(1.25f, 1.85f, 0f), 0.03f, "woodDark"); Beam(transform, "Rack rail", new Vector3(-1.25f, 1.25f, 0f), new Vector3(1.25f, 1.25f, 0f), 0.03f, "woodDark"); for (int j = 0; j < 5; j++) { HangingFish(transform, new Vector3(-0.9f + (float)j * 0.45f, 1.82f, 0f), (j % 2 == 0) ? "stoneLight" : "sandWet", 0.85f + (float)(j % 3) * 0.1f); } for (int k = 0; k < 4; k++) { HangingFish(transform, new Vector3(-0.65f + (float)k * 0.45f, 1.22f, 0.02f), (k % 2 == 0) ? "copper" : "stoneLight", 0.7f); } } private void Buoy(Transform parent, Vector3 position, string colour, int seed) { //IL_0006: 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_0073: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Lagoon marker buoy", parent, position, Hash(seed, 1) * 360f).transform; transform.localRotation = Quaternion.Euler(Hash(seed, 2, -7f, 7f), Hash(seed, 1) * 360f, Hash(seed, 3, -7f, 7f)); Oval(transform, "Buoy float", new Vector3(0f, 0.05f, 0f), new Vector3(0.75f, 0.6f, 0.75f), colour); Column(transform, "Buoy waterline band", new Vector3(0f, 0f, 0f), new Vector3(0.36f, 0.08f, 0.36f), "ink", 10); Column(transform, "Buoy mast", new Vector3(0f, 0.65f, 0f), new Vector3(0.03f, 0.8f, 0.03f), "woodDark", 6); Part(transform, "Buoy flag", Cached("bunting flag", () => Geometry.Fin((Vector3[])(object)new Vector3[3] { new Vector3(-0.13f, 0f, 0f), new Vector3(0.13f, 0f, 0f), new Vector3(0f, -0.3f, 0f) }, 0.004f)), (colour == "red") ? "cream" : "red", new Vector3(0.13f, 1.02f, 0f), Vector3.one, Quaternion.Euler(0f, 90f, 90f)); Beam(transform, "Mooring pennant line", new Vector3(0f, -0.25f, 0f), new Vector3(0.3f, -1.3f, 0.2f), 0.012f, "rope"); } private void Dinghy(Transform parent, Vector3 position, float heading, string paint, bool upturned) { //IL_0011: 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_00ad: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group(upturned ? "Dinghy under repair" : "Beached dinghy", parent, position, heading).transform; transform.localRotation = Quaternion.Euler(upturned ? 180f : (-4f), heading, upturned ? 0f : 6f); GameObject obj = MultiPart(transform, "Dinghy hull", Cached("lucky keel hull", HullMesh), new string[3] { paint, "woodDark", "woodLight" }, collision: true); obj.transform.localScale = new Vector3(0.3f, 0.38f, 0.28f); obj.transform.localPosition = new Vector3(0f, 0.2f, 0f); if (!upturned) { float[] array = new float[2] { -0.6f, 0.6f }; foreach (float num in array) { Box(transform, "Thwart", new Vector3(0f, 0.45f, num), new Vector3(1.6f, 0.06f, 0.25f), "woodLight"); } Beam(transform, "Oar", new Vector3(-0.7f, 0.5f, -1.5f), new Vector3(0.9f, 0.48f, 1.6f), 0.025f, "woodLight"); Beam(transform, "Oar", new Vector3(0.75f, 0.52f, -1.4f), new Vector3(-0.85f, 0.5f, 1.5f), 0.025f, "woodLight"); Beam(transform, "Painter line", new Vector3(0f, 0.6f, -2.6f), new Vector3(0.4f, 0f, -4.4f), 0.012f, "rope"); } } private void BuildArrival(Transform root) { //IL_0006: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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_0222: 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_02f6: 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_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0351: 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_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: 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) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: 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_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0661: 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_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_07d1: Unknown result type (might be due to invalid IL or missing references) //IL_07e5: Unknown result type (might be due to invalid IL or missing references) //IL_0812: Unknown result type (might be due to invalid IL or missing references) //IL_0826: Unknown result type (might be due to invalid IL or missing references) //IL_0852: Unknown result type (might be due to invalid IL or missing references) //IL_0866: Unknown result type (might be due to invalid IL or missing references) //IL_0893: 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_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_08e7: Unknown result type (might be due to invalid IL or missing references) //IL_090e: Unknown result type (might be due to invalid IL or missing references) //IL_0937: Unknown result type (might be due to invalid IL or missing references) //IL_0962: Unknown result type (might be due to invalid IL or missing references) //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_09c2: Unknown result type (might be due to invalid IL or missing references) //IL_09c7: Unknown result type (might be due to invalid IL or missing references) //IL_09cc: Unknown result type (might be due to invalid IL or missing references) //IL_09ee: Unknown result type (might be due to invalid IL or missing references) //IL_0a02: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_0a4f: Unknown result type (might be due to invalid IL or missing references) //IL_0a63: Unknown result type (might be due to invalid IL or missing references) //IL_0a9e: Unknown result type (might be due to invalid IL or missing references) //IL_0ab2: Unknown result type (might be due to invalid IL or missing references) //IL_0afd: Unknown result type (might be due to invalid IL or missing references) //IL_0b11: Unknown result type (might be due to invalid IL or missing references) //IL_0b47: Unknown result type (might be due to invalid IL or missing references) //IL_0b71: Unknown result type (might be due to invalid IL or missing references) //IL_0b85: Unknown result type (might be due to invalid IL or missing references) //IL_0bb2: Unknown result type (might be due to invalid IL or missing references) //IL_0bc6: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("South landing - safe arrival", root, Vector3.zero).transform; Box(transform, "Dock continuous walkable base", new Vector3(0f, 1.43f, 14f), new Vector3(2.9f, 0.3f, 12f), "woodDark"); Box(transform, "Wide mooring head", new Vector3(0f, 1.44f, 9.6f), new Vector3(7.4f, 0.3f, 3f), "woodDark"); for (int i = 0; i < 24; i++) { Box(transform, "Landing cross plank", new Vector3(0f, 1.6f, 8.25f + (float)i * 0.49f), new Vector3((i < 6) ? 7.4f : 3f, 0.1f, 0.465f), (i % 3 == 0) ? "woodLight" : ((i % 5 == 0) ? "driftwood" : "wood")); } BlockingVolume(transform, "Continuous landing collision", new Vector3(-1.5f, 1.25f, 8.0175f), new Vector3(1.5f, 1.65f, 20.03f)); BlockingVolume(transform, "Mooring head collision", new Vector3(-3.7f, 1.25f, 8.0175f), new Vector3(3.7f, 1.65f, 10.9325f)); float[] array; for (int j = 0; j < 4; j++) { array = new float[2] { -1.62f, 1.62f }; foreach (float num in array) { Column(transform, "Octagonal mooring pile", new Vector3(num, 0.15f, 9.3f + (float)j * 3.2f), new Vector3(0.17f, 3.7f, 0.17f), "woodDark"); Column(transform, "Brass pile band", new Vector3(num, 1.73f, 9.3f + (float)j * 3.2f), new Vector3(0.19f, 0.12f, 0.19f), "brass"); if (j > 0) { Beam(transform, "Pile safety rope", new Vector3(num, 1.95f, 9.3f + (float)(j - 1) * 3.2f), new Vector3(num, 1.95f, 9.3f + (float)j * 3.2f), 0.02f, "rope"); } } } array = new float[2] { -3.5f, 3.5f }; foreach (float num2 in array) { Column(transform, "Mooring head pile", new Vector3(num2, 0.15f, 8.3f), new Vector3(0.17f, 3.7f, 0.17f), "woodDark"); } Part(transform, "Accessible landing ramp", Cached("landing ramp", () => Geometry.Ramp(new Vector3(0f, 1.65f, 20f), new Vector3(0f, 3.25f, 26.5f), 3f)), "wood", Vector3.zero, Vector3.one, Quaternion.identity, collision: true); Box(transform, "Trail connection", new Vector3(0f, 3.15f, 27.7f), new Vector3(3f, 0.2f, 2.6f), "wood", collision: true); Beam(transform, "Ramp left handrail", new Vector3(-1.65f, 2.6f, 20f), new Vector3(-1.65f, 4.2f, 26.5f), 0.065f, "woodDark"); Beam(transform, "Ramp right handrail", new Vector3(1.65f, 2.6f, 20f), new Vector3(1.65f, 4.2f, 26.5f), 0.065f, "woodDark"); for (int num3 = 0; num3 < 3; num3++) { float num4 = (float)num3 / 2f; array = new float[2] { -1.65f, 1.65f }; foreach (float num5 in array) { Beam(transform, "Ramp rail support", new Vector3(num5, Mathf.Lerp(1.5f, 3.1f, num4), Mathf.Lerp(20f, 26.5f, num4)), new Vector3(num5, Mathf.Lerp(2.6f, 4.2f, num4), Mathf.Lerp(20f, 26.5f, num4)), 0.065f, "woodDark"); } } Lantern(transform, new Vector3(3.05f, 2.2f, 9.7f), 0.85f); Lantern(transform, new Vector3(-1.62f, 2.45f, 18.9f), 0.8f); array = new float[2] { -3.3f, 3.3f }; foreach (float num6 in array) { Column(transform, "Iron bollard", new Vector3(num6, 1.95f, 8.5f), new Vector3(0.13f, 0.6f, 0.13f), "ink", 8, 0.85f, collision: true); Column(transform, "Bollard cap", new Vector3(num6, 2.27f, 8.5f), new Vector3(0.17f, 0.07f, 0.17f), "ink"); } RopeCoil(transform, new Vector3(2.4f, 1.65f, 8.55f), 0.5f); RopeCoil(transform, new Vector3(-1.1f, 1.65f, 8.6f), 0.38f); Beam(transform, "Bow line to bollard", new Vector3(-3.3f, 2.2f, 8.5f), new Vector3(-6.2f, 0.95f, 7.6f), 0.022f, "rope"); LobsterPot(transform, new Vector3(-3f, 1.65f, 10.9f), 0f); LobsterPot(transform, new Vector3(-3f, 2.17f, 10.9f), 14f); LobsterPot(transform, new Vector3(-2.15f, 1.65f, 10.75f), -22f); Transform transform2 = Group("Fish cleaning table", transform, new Vector3(2.75f, 1.65f, 10.7f), 90f).transform; Box(transform2, "Cleaning table top", new Vector3(0f, 0.82f, 0f), new Vector3(1.4f, 0.08f, 0.65f), "woodLight", collision: true); array = new float[2] { -0.6f, 0.6f }; foreach (float num7 in array) { float[] array2 = new float[2] { -0.25f, 0.25f }; foreach (float num9 in array2) { Box(transform2, "Cleaning table leg", new Vector3(num7, 0.4f, num9), new Vector3(0.08f, 0.8f, 0.08f), "woodDark"); } } Column(transform2, "Galvanised bucket", new Vector3(-0.45f, 0.19f, 0.55f), new Vector3(0.19f, 0.36f, 0.19f), "stoneLight", 8, 0.82f); Box(transform2, "Gutting board", new Vector3(0.2f, 0.88f, 0f), new Vector3(0.55f, 0.03f, 0.35f), "cream"); Column(transform2, "Fish scaler", new Vector3(-0.35f, 0.89f, 0.12f), new Vector3(0.025f, 0.3f, 0.025f), "ink", 6); Box(transform2, "Cleaning knife handle", new Vector3(-0.3f, 0.88f, -0.2f), new Vector3(0.12f, 0.025f, 0.03f), "woodDark", collision: false, 20f); Box(transform2, "Cleaning knife blade", new Vector3(-0.13f, 0.88f, -0.24f), new Vector3(0.2f, 0.012f, 0.028f), "white", collision: false, 20f); Barrel(transform, new Vector3(-3.35f, 1.65f, 9.5f), 0.78f, "wood"); Transform transform3 = Group("West cove angling ledge", root, Polar(20f, -87f, 0f), -87f).transform; Box(transform3, "Angling ledge", new Vector3(0f, 1.3f, 0f), new Vector3(4f, 0.25f, 3.2f), "wood", collision: true); Part(transform3, "Angling ledge access ramp", Cached("angling ramp", () => Geometry.Ramp(new Vector3(0f, 1.43f, 1.5f), new Vector3(0f, 3.25f, 7.4f), 2.2f)), "wood", Vector3.zero, Vector3.one, Quaternion.identity, collision: true); Box(transform3, "Angling trail join", new Vector3(0f, 3.15f, 8.6f), new Vector3(2.2f, 0.2f, 2.6f), "wood", collision: true); array = new float[2] { -1.8f, 1.8f }; foreach (float num10 in array) { Column(transform3, "Angling pier footing", new Vector3(num10, 0.1f, -0.8f), new Vector3(0.2f, 2.7f, 0.2f), "woodDark"); } Beam(transform3, "Ledge rope rail", new Vector3(-1.9f, 2.1f, -1.5f), new Vector3(1.9f, 2.1f, -1.5f), 0.022f, "rope"); array = new float[2] { -1.9f, 1.9f }; foreach (float num11 in array) { Column(transform3, "Ledge rail post", new Vector3(num11, 1.75f, -1.5f), new Vector3(0.07f, 0.8f, 0.07f), "woodDark", 6); } Crate(transform3, new Vector3(1.4f, 1.42f, 1f), 0.55f); Column(transform3, "Bait tin", new Vector3(-1.3f, 1.5f, 0.6f), new Vector3(0.14f, 0.16f, 0.14f), "rust"); Beam(transform3, "Rested spare rod", new Vector3(-1.75f, 1.45f, 1.2f), new Vector3(-1.25f, 3.2f, -1.4f), 0.02f, "woodLight"); } private static void BlockingVolume(Transform parent, string name, Vector3 minimum, Vector3 maximum) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) Group(name, parent, (minimum + maximum) * 0.5f).AddComponent().size = maximum - minimum; } private void BuildTackleShack(Transform t, out Dictionary shops, out Dictionary headings) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0332: 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_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_028d: 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_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: 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_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_066d: 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_06d1: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: 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_0734: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Unknown result type (might be due to invalid IL or missing references) //IL_0845: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_0885: Unknown result type (might be due to invalid IL or missing references) //IL_0899: Unknown result type (might be due to invalid IL or missing references) //IL_08e6: Unknown result type (might be due to invalid IL or missing references) //IL_08f7: Unknown result type (might be due to invalid IL or missing references) //IL_092f: 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_0990: Unknown result type (might be due to invalid IL or missing references) //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_09d9: Unknown result type (might be due to invalid IL or missing references) //IL_09ed: Unknown result type (might be due to invalid IL or missing references) //IL_0a3a: Unknown result type (might be due to invalid IL or missing references) //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) //IL_0a8d: Unknown result type (might be due to invalid IL or missing references) //IL_0aac: Unknown result type (might be due to invalid IL or missing references) //IL_0acb: Unknown result type (might be due to invalid IL or missing references) //IL_0aea: Unknown result type (might be due to invalid IL or missing references) //IL_0b09: Unknown result type (might be due to invalid IL or missing references) //IL_0b28: Unknown result type (might be due to invalid IL or missing references) //IL_0b47: Unknown result type (might be due to invalid IL or missing references) //IL_0be3: Unknown result type (might be due to invalid IL or missing references) //IL_0bff: Unknown result type (might be due to invalid IL or missing references) //IL_0c13: Unknown result type (might be due to invalid IL or missing references) //IL_0c3a: Unknown result type (might be due to invalid IL or missing references) //IL_0c80: Unknown result type (might be due to invalid IL or missing references) //IL_0c91: Unknown result type (might be due to invalid IL or missing references) //IL_0cc4: Unknown result type (might be due to invalid IL or missing references) //IL_0ce4: Unknown result type (might be due to invalid IL or missing references) //IL_0d09: Unknown result type (might be due to invalid IL or missing references) //IL_0d32: Unknown result type (might be due to invalid IL or missing references) //IL_0d7d: Unknown result type (might be due to invalid IL or missing references) //IL_0d91: Unknown result type (might be due to invalid IL or missing references) //IL_0da5: Unknown result type (might be due to invalid IL or missing references) //IL_0dc7: Unknown result type (might be due to invalid IL or missing references) //IL_0ddb: Unknown result type (might be due to invalid IL or missing references) //IL_0e14: Unknown result type (might be due to invalid IL or missing references) //IL_0e28: Unknown result type (might be due to invalid IL or missing references) //IL_0e6c: Unknown result type (might be due to invalid IL or missing references) //IL_0e91: Unknown result type (might be due to invalid IL or missing references) //IL_0eb6: Unknown result type (might be due to invalid IL or missing references) //IL_0edb: Unknown result type (might be due to invalid IL or missing references) //IL_0f00: Unknown result type (might be due to invalid IL or missing references) //IL_0f29: Unknown result type (might be due to invalid IL or missing references) //IL_0f75: Unknown result type (might be due to invalid IL or missing references) //IL_0f86: Unknown result type (might be due to invalid IL or missing references) //IL_0fad: Unknown result type (might be due to invalid IL or missing references) //IL_0fbe: Unknown result type (might be due to invalid IL or missing references) //IL_0ff9: Unknown result type (might be due to invalid IL or missing references) //IL_100d: Unknown result type (might be due to invalid IL or missing references) //IL_1046: Unknown result type (might be due to invalid IL or missing references) //IL_1064: Unknown result type (might be due to invalid IL or missing references) Box(t, "Workshop raised plank floor", new Vector3(0f, 0.1f, 0.65f), new Vector3(7.2f, 0.3f, 5.8f), "wood", collision: true); for (int i = 0; i < 9; i++) { Box(t, "Floor board seam", new Vector3(-3.2f + (float)i * 0.8f, 0.252f, 0.65f), new Vector3(0.02f, 0.01f, 5.7f), "woodDark"); } Part(t, "Shop threshold ramp", Cached("shop ramp", () => Geometry.Ramp(new Vector3(0f, 0.04f, -3.4f), new Vector3(0f, 0.26f, -2.2f), 3.1f)), "wood", Vector3.zero, Vector3.one, Quaternion.identity, collision: true); for (int num = 0; num < 12; num++) { Box(t, "Uneven back-wall plank", new Vector3(-3.22f + (float)num * 0.59f, 1.8f, 3.35f), new Vector3(0.56f, 3.25f + (float)(num % 3) * 0.07f, 0.16f), (num % 3 == 0) ? "woodLight" : ((num % 4 == 0) ? "driftwood" : "wood")); } BlockingVolume(t, "Back wall collision", new Vector3(-3.6f, 0.15f, 3.265f), new Vector3(3.6f, 3.25f, 3.435f)); float[] array = new float[2] { -3.42f, 3.42f }; foreach (float num3 in array) { Box(t, "Workshop corner post", new Vector3(num3, 1.85f, -1.9f), new Vector3(0.24f, 3.5f, 0.24f), "woodDark", collision: true); for (int num4 = 0; num4 < 5; num4++) { Box(t, "Workshop side slat", new Vector3(num3, 0.6f + (float)num4 * 0.5f, 1.1f), new Vector3(0.15f, 0.44f, 4.4f), (num4 % 2 == 0) ? "wood" : "woodLight"); } BlockingVolume(t, "Side wall collision", new Vector3(num3 - 0.09f, 0.05f, -1.55f), new Vector3(num3 + 0.09f, 2.75f, 3.35f)); } PitchedRoof(t, new Vector3(0f, 3.55f, 0.65f), 8.1f, 6.8f, 1.4f, "teal", "navy"); Box(t, "Brass roof ridge", new Vector3(0f, 4.98f, 0.65f), new Vector3(0.12f, 0.12f, 6.9f), "brass"); Column(t, "Stove chimney", new Vector3(-2.4f, 4.6f, 2.2f), new Vector3(0.22f, 1.3f, 0.22f), "ink", 6); Column(t, "Chimney cap", new Vector3(-2.4f, 5.3f, 2.2f), new Vector3(0.3f, 0.08f, 0.3f), "rust", 6); Box(t, "Repair bench", new Vector3(-1.45f, 0.83f, 0.7f), new Vector3(2.25f, 0.15f, 1f), "woodLight", collision: true); array = new float[2] { -2.3f, -0.6f }; foreach (float num5 in array) { Box(t, "Repair bench leg", new Vector3(num5, 0.5f, 0.7f), new Vector3(0.15f, 0.7f, 0.7f), "woodDark"); } Box(t, "Bench vice jaw", new Vector3(-0.75f, 0.98f, 0.35f), new Vector3(0.18f, 0.16f, 0.12f), "ink"); Column(t, "Vice screw", new Vector3(-0.75f, 0.96f, 0.18f), new Vector3(0.03f, 0.22f, 0.03f), "brass", 6); Column(t, "Line spool", new Vector3(-1.2f, 0.96f, 1f), new Vector3(0.1f, 0.12f, 0.1f), "cream"); Column(t, "Line spool", new Vector3(-1.02f, 0.96f, 1.05f), new Vector3(0.09f, 0.1f, 0.09f), "teal"); Box(t, "Lead sinker tray", new Vector3(-2.2f, 0.93f, 0.35f), new Vector3(0.32f, 0.04f, 0.22f), "woodDark"); for (int num6 = 0; num6 < 4; num6++) { Oval(t, "Lead sinker", new Vector3(-2.3f + (float)(num6 % 2) * 0.12f, 0.97f, 0.3f + (float)(num6 / 2) * 0.1f), new Vector3(0.05f, 0.05f, 0.07f), "stone"); } Beam(t, "Wall rod rack", new Vector3(-3.1f, 1.62f, 3.13f), new Vector3(3.1f, 1.62f, 3.13f), 0.065f, "brass"); array = new float[4] { -3.1f, -1.05f, 1.05f, 3.1f }; foreach (float num7 in array) { Box(t, "Rod rack bracket", new Vector3(num7, 1.62f, 3.22f), new Vector3(0.08f, 0.1f, 0.18f), "woodDark"); } for (int num8 = 0; num8 < 2; num8++) { float num9 = 0.35f + (float)num8 * 0.55f; Beam(t, "Handmade display rod", new Vector3(num9, 0.5f, 2.9f), new Vector3(num9 - 0.15f, 3f, 3.04f), 0.022f, (num8 == 0) ? "brass" : "teal"); Oval(t, "Bright cork float", new Vector3(num9 - 0.05f, 1.6f, 2.84f), new Vector3(0.11f, 0.26f, 0.11f), (num8 == 0) ? "red" : "cream"); } for (int num10 = 0; num10 < 6; num10++) { Oval(t, "Hanging net float", new Vector3(-2.9f + (float)num10 * 0.42f, 2.55f + (float)(num10 % 2) * 0.12f, 3.2f), new Vector3(0.16f, 0.2f, 0.16f), (num10 % 3 == 0) ? "red" : ((num10 % 3 == 1) ? "cream" : "teal")); } Beam(t, "Float line", new Vector3(-3.1f, 2.85f, 3.2f), new Vector3(-0.6f, 2.85f, 3.2f), 0.015f, "rope"); Box(t, "Harpoon display shelf", new Vector3(3.08f, 1.56f, 1f), new Vector3(0.62f, 0.08f, 1.4f), "woodLight", collision: true); Box(t, "Harpoon rack back board", new Vector3(3.3f, 1.7f, 1f), new Vector3(0.06f, 0.5f, 1.4f), "woodDark"); array = new float[2] { 0.5f, 1.5f }; foreach (float num11 in array) { Beam(t, "Harpoon shelf bracket", new Vector3(3.33f, 1.25f, num11), new Vector3(2.84f, 1.54f, num11), 0.03f, "ink"); } Box(t, "Ammunition shelf", new Vector3(3.1f, 1.05f, 1f), new Vector3(0.55f, 0.05f, 0.8f), "woodLight", collision: true); array = new float[2] { 0.65f, 1.35f }; foreach (float num12 in array) { Beam(t, "Shelf bracket", new Vector3(3.33f, 0.85f, num12), new Vector3(2.9f, 1.02f, num12), 0.025f, "ink"); } Box(t, "Advanced lure shelf", new Vector3(-1.15f, 1.37f, 2.97f), new Vector3(2.3f, 0.08f, 0.5f), "woodLight", collision: true); array = new float[2] { -2.05f, -0.25f }; foreach (float num13 in array) { Beam(t, "Lure shelf bracket", new Vector3(num13, 1.08f, 3.26f), new Vector3(num13, 1.35f, 2.74f), 0.025f, "ink"); } shops = new Dictionary(StringComparer.Ordinal) { ["deepwater_reel"] = new Vector3(2.7f, 0.26f, 3.02f), ["weapon"] = new Vector3(3.06f, 1.605f, 1f), ["ammo"] = new Vector3(3.08f, 1.075f, 1f), ["bait"] = new Vector3(-2.05f, 0.905f, 0.8f), ["bait_standard"] = new Vector3(-1.95f, 1.415f, 2.97f), ["bait_professional"] = new Vector3(-1.15f, 1.415f, 2.97f), ["bait_scientific"] = new Vector3(-0.35f, 1.415f, 2.97f) }; headings = new Dictionary(StringComparer.Ordinal) { ["deepwater_reel"] = 0f, ["weapon"] = 0f, ["ammo"] = 270f, ["bait"] = 180f, ["bait_standard"] = 180f, ["bait_professional"] = 180f, ["bait_scientific"] = 180f }; Transform transform = Group("Bent Hook hanging pictogram", t, new Vector3(1.4f, 3.55f, -2.85f)).transform; Box(transform, "Carved tackle sign", Vector3.zero, new Vector3(1.55f, 0.85f, 0.12f), "cream"); HookGlyph(transform, new Vector3(0f, 0f, -0.075f), 0.65f); array = new float[2] { -0.6f, 0.6f }; foreach (float num14 in array) { Beam(transform, "Sign chain", new Vector3(num14, 0.42f, 0f), new Vector3(num14, 0.95f, 0.55f), 0.015f, "ink"); } Lantern(t, new Vector3(-2.85f, 2.65f, -2.1f), 0.9f); Crate(t, new Vector3(2.55f, 0.27f, 2.3f), 0.7f); Crate(t, new Vector3(2.3f, 0.27f, -1.2f), 0.55f); Transform transform2 = Group("Drying seine net", t, new Vector3(-3.62f, 1.55f, 0.9f)).transform; Part(transform2, "Net mesh sheet", Cached("net sheet", () => NetMesh(4f, 2.1f)), "navy", Vector3.zero, new Vector3(1f, 1f, 1f), Quaternion.Euler(0f, 90f, 0f)); Beam(transform2, "Net drying pole", new Vector3(0f, 1.05f, -2f), new Vector3(0f, 1.05f, 2f), 0.035f, "woodDark"); for (int num15 = 0; num15 < 5; num15++) { Oval(transform2, "Net cork", new Vector3(0f, 1f, -1.8f + (float)num15 * 0.9f), new Vector3(0.1f, 0.12f, 0.1f), (num15 % 2 == 0) ? "cream" : "red"); } Barrel(t, new Vector3(-4.2f, 0f, -1.4f), 0.85f, "wood"); Barrel(t, new Vector3(-4.35f, 0f, -0.4f), 0.7f, "woodDark"); Crate(t, new Vector3(4.3f, 0f, 1.1f), 0.8f); Crate(t, new Vector3(4.35f, 0.8f, 1.1f), 0.6f); Crate(t, new Vector3(4.2f, 0f, 2.1f), 0.6f); Transform transform3 = Group("Rod drying A-frame", t, new Vector3(4.3f, 0f, -1.4f), 30f).transform; array = new float[2] { -0.7f, 0.7f }; foreach (float num16 in array) { Beam(transform3, "A-frame leg", new Vector3(num16, 0f, -0.35f), new Vector3(num16, 1.7f, 0f), 0.04f, "woodDark"); Beam(transform3, "A-frame leg", new Vector3(num16, 0f, 0.35f), new Vector3(num16, 1.7f, 0f), 0.04f, "woodDark"); } Beam(transform3, "A-frame rail", new Vector3(-0.75f, 1.7f, 0f), new Vector3(0.75f, 1.7f, 0f), 0.035f, "woodDark"); for (int num17 = 0; num17 < 3; num17++) { Beam(transform3, "Drying rod", new Vector3(-0.45f + (float)num17 * 0.45f, 0.05f, 0.5f), new Vector3(-0.4f + (float)num17 * 0.45f, 1.75f, 0.02f), 0.018f, (num17 == 1) ? "brass" : "woodLight"); } } private void BuildCollector(Transform t) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_033a: 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_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_0607: 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_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_0714: 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) //IL_0763: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_084c: Unknown result type (might be due to invalid IL or missing references) //IL_0890: Unknown result type (might be due to invalid IL or missing references) //IL_08b4: Unknown result type (might be due to invalid IL or missing references) //IL_08d0: Unknown result type (might be due to invalid IL or missing references) //IL_08e4: Unknown result type (might be due to invalid IL or missing references) //IL_0910: Unknown result type (might be due to invalid IL or missing references) //IL_0924: Unknown result type (might be due to invalid IL or missing references) //IL_095a: Unknown result type (might be due to invalid IL or missing references) //IL_0978: Unknown result type (might be due to invalid IL or missing references) //IL_09ac: Unknown result type (might be due to invalid IL or missing references) //IL_09f8: Unknown result type (might be due to invalid IL or missing references) //IL_0a0c: Unknown result type (might be due to invalid IL or missing references) //IL_0a47: Unknown result type (might be due to invalid IL or missing references) //IL_0a5b: Unknown result type (might be due to invalid IL or missing references) //IL_0a85: Unknown result type (might be due to invalid IL or missing references) //IL_0a99: Unknown result type (might be due to invalid IL or missing references) //IL_0acd: Unknown result type (might be due to invalid IL or missing references) //IL_0b25: Unknown result type (might be due to invalid IL or missing references) //IL_0b55: Unknown result type (might be due to invalid IL or missing references) //IL_0b7a: Unknown result type (might be due to invalid IL or missing references) //IL_0b9f: Unknown result type (might be due to invalid IL or missing references) //IL_0bc8: Unknown result type (might be due to invalid IL or missing references) //IL_0bf5: Unknown result type (might be due to invalid IL or missing references) //IL_0bfa: Unknown result type (might be due to invalid IL or missing references) //IL_0c03: Unknown result type (might be due to invalid IL or missing references) //IL_0c14: Unknown result type (might be due to invalid IL or missing references) //IL_0c49: Unknown result type (might be due to invalid IL or missing references) //IL_0c5d: Unknown result type (might be due to invalid IL or missing references) //IL_0c8a: Unknown result type (might be due to invalid IL or missing references) //IL_0c9e: Unknown result type (might be due to invalid IL or missing references) //IL_0cc8: Unknown result type (might be due to invalid IL or missing references) //IL_0ce7: Unknown result type (might be due to invalid IL or missing references) //IL_0d14: Unknown result type (might be due to invalid IL or missing references) //IL_0d28: Unknown result type (might be due to invalid IL or missing references) //IL_0d56: Unknown result type (might be due to invalid IL or missing references) //IL_0d6a: Unknown result type (might be due to invalid IL or missing references) //IL_0d98: Unknown result type (might be due to invalid IL or missing references) //IL_0dac: Unknown result type (might be due to invalid IL or missing references) //IL_0dda: Unknown result type (might be due to invalid IL or missing references) //IL_0dee: Unknown result type (might be due to invalid IL or missing references) //IL_0e25: Unknown result type (might be due to invalid IL or missing references) //IL_0e3d: Unknown result type (might be due to invalid IL or missing references) //IL_0e73: Unknown result type (might be due to invalid IL or missing references) //IL_0e87: Unknown result type (might be due to invalid IL or missing references) //IL_0eb5: Unknown result type (might be due to invalid IL or missing references) //IL_0ec9: Unknown result type (might be due to invalid IL or missing references) //IL_0f00: Unknown result type (might be due to invalid IL or missing references) //IL_0f14: Unknown result type (might be due to invalid IL or missing references) //IL_0f4d: Unknown result type (might be due to invalid IL or missing references) //IL_0f61: Unknown result type (might be due to invalid IL or missing references) //IL_0f8f: Unknown result type (might be due to invalid IL or missing references) //IL_0fa3: Unknown result type (might be due to invalid IL or missing references) //IL_0fee: Unknown result type (might be due to invalid IL or missing references) //IL_0ff3: Unknown result type (might be due to invalid IL or missing references) //IL_0ff8: Unknown result type (might be due to invalid IL or missing references) //IL_101b: Unknown result type (might be due to invalid IL or missing references) //IL_102f: Unknown result type (might be due to invalid IL or missing references) //IL_105c: Unknown result type (might be due to invalid IL or missing references) //IL_1070: Unknown result type (might be due to invalid IL or missing references) //IL_109d: Unknown result type (might be due to invalid IL or missing references) //IL_10b1: Unknown result type (might be due to invalid IL or missing references) //IL_10de: Unknown result type (might be due to invalid IL or missing references) //IL_10f2: Unknown result type (might be due to invalid IL or missing references) Box(t, "Collector shelter floor", new Vector3(0f, 0.1f, 0.5f), new Vector3(6.2f, 0.3f, 5f), "wood", collision: true); Part(t, "Collector threshold ramp", Cached("collector ramp", () => Geometry.Ramp(new Vector3(0f, -0.36f, -3.4f), new Vector3(0f, 0.26f, -2f), 3f)), "wood", Vector3.zero, Vector3.one, Quaternion.identity, collision: true); Part(t, "Lighthouse step", Cached("collector back step", () => Geometry.Ramp(new Vector3(0.4f, 0.26f, 3f), new Vector3(0.4f, 0.06f, 3.75f), 1.6f)), "wood", Vector3.zero, Vector3.one, Quaternion.identity, collision: true); float[] array = new float[2] { -2.8f, 2.8f }; foreach (float num2 in array) { float[] array2 = new float[2] { -1.7f, 2.7f }; foreach (float num4 in array2) { Column(t, "Shelter spar", new Vector3(num2, 1.9f, num4), new Vector3(0.12f, 3.6f, 0.12f), "woodDark", 6, 1f, collision: true); } } array = new float[2] { -1.7f, 2.7f }; foreach (float num5 in array) { Beam(t, "Shelter tie beam", new Vector3(-2.8f, 3.45f, num5), new Vector3(2.8f, 3.45f, num5), 0.06f, "woodDark"); } PitchedRoof(t, new Vector3(0f, 3.5f, 0.5f), 6.9f, 5.7f, 0.85f, "cream", "teal"); Box(t, "Specimen dresser", new Vector3(1.45f, 0.8f, 1.7f), new Vector3(2.1f, 1.1f, 0.9f), "teal", collision: true); Box(t, "Specimen dresser top", new Vector3(1.45f, 1.4f, 1.7f), new Vector3(2.25f, 0.13f, 1.05f), "woodLight"); for (int num6 = 0; num6 < 4; num6++) { Box(t, "Dresser drawer pull", new Vector3(0.95f + (float)num6 * 0.34f, 0.95f - (float)(num6 % 2) * 0.35f, 1.24f), new Vector3(0.1f, 0.03f, 0.03f), "brass"); } for (int num7 = 0; num7 < 3; num7++) { Column(t, "Faceted specimen vessel", new Vector3(0.75f + (float)num7 * 0.67f, 1.72f, 1.72f), new Vector3(0.19f, 0.5f, 0.19f), (num7 == 1) ? "glass" : "navy", 8, 0.8f); Column(t, "Specimen cork", new Vector3(0.75f + (float)num7 * 0.67f, 2f, 1.72f), new Vector3(0.16f, 0.1f, 0.16f), "brass"); Box(t, "Specimen ivory label", new Vector3(0.75f + (float)num7 * 0.67f, 1.72f, 1.51f), new Vector3(0.21f, 0.18f, 0.02f), "cream"); } Transform transform = Group("Tide-pool observation tank", t, new Vector3(-1.75f, 0.25f, 1.6f)).transform; array = new float[2] { -0.55f, 0.55f }; foreach (float num8 in array) { Box(transform, "Tank trestle", new Vector3(num8, 0.38f, 0f), new Vector3(0.1f, 0.76f, 0.7f), "woodDark"); } Box(transform, "Tank shelf", new Vector3(0f, 0.78f, 0f), new Vector3(1.5f, 0.06f, 0.8f), "woodLight", collision: true); Box(transform, "Tank water", new Vector3(0f, 1.08f, 0f), new Vector3(1.3f, 0.5f, 0.6f), "glass"); array = new float[2] { 0.84f, 1.34f }; foreach (float num9 in array) { float[] array2 = new float[2] { -0.31f, 0.31f }; foreach (float num10 in array2) { Beam(transform, "Tank brass frame", new Vector3(-0.66f, num9, num10), new Vector3(0.66f, num9, num10), 0.015f, "brass"); } } array = new float[2] { -0.66f, 0.66f }; foreach (float num11 in array) { float[] array2 = new float[2] { -0.31f, 0.31f }; foreach (float num12 in array2) { Beam(transform, "Tank corner post", new Vector3(num11, 0.82f, num12), new Vector3(num11, 1.36f, num12), 0.015f, "brass"); } } Part(transform, "Tank gravel", Cached("hewn granite", RockMesh), "sandWet", new Vector3(-0.3f, 0.88f, 0.05f), new Vector3(0.35f, 0.12f, 0.3f), Quaternion.identity); Part(transform, "Tank stone", Cached("hewn granite", RockMesh), "stoneLight", new Vector3(0.35f, 0.95f, -0.08f), new Vector3(0.25f, 0.22f, 0.22f), Quaternion.Euler(0f, 40f, 0f)); for (int num13 = 0; num13 < 3; num13++) { Column(transform, "Kelp frond", new Vector3(-0.1f + (float)num13 * 0.2f, 1.1f, 0.12f - (float)num13 * 0.1f), new Vector3(0.03f, 0.4f, 0.03f), "leafDark", 5, 0.3f); } Box(t, "Collection chart backing", new Vector3(-1.15f, 2.3f, 2.72f), new Vector3(2.55f, 1.45f, 0.13f), "woodDark"); Box(t, "Collection chart field", new Vector3(-1.15f, 2.3f, 2.635f), new Vector3(2.35f, 1.25f, 0.025f), "cream"); for (int num14 = 0; num14 < 6; num14++) { Oval(t, "Six specimen chart medallions", new Vector3(-1.95f + (float)(num14 % 3) * 0.8f, 2.04f + (float)(num14 / 3) * 0.52f, 2.59f), new Vector3(0.3f, 0.21f, 0.035f), (num14 % 2 == 0) ? "copper" : "teal"); } Lantern(t, new Vector3(-2.45f, 2.7f, -1.7f), 0.8f); Transform transform2 = Group("Collector shell board", t, new Vector3(-2.2f, 2.9f, -1.85f)).transform; Box(transform2, "Shell board", Vector3.zero, new Vector3(0.9f, 0.6f, 0.1f), "teal"); Oval(transform2, "Shell emblem", new Vector3(0f, 0f, -0.06f), new Vector3(0.42f, 0.44f, 0.05f), "cream"); for (int num15 = 0; num15 < 5; num15++) { Beam(transform2, "Shell rib", new Vector3(0f, -0.2f, -0.085f), new Vector3(-0.16f + (float)num15 * 0.08f, 0.18f, -0.085f), 0.012f, "copper"); } Transform transform3 = Group("Specimen drying rack", t, new Vector3(-4.1f, 0f, 1f), 90f).transform; array = new float[2] { -1.1f, 1.1f }; foreach (float num16 in array) { Column(transform3, "Rack post", new Vector3(num16, 0.9f, 0f), new Vector3(0.06f, 1.8f, 0.06f), "woodDark", 6); } Beam(transform3, "Rack rail", new Vector3(-1.15f, 1.75f, 0f), new Vector3(1.15f, 1.75f, 0f), 0.03f, "woodDark"); Beam(transform3, "Rack rail", new Vector3(-1.15f, 1.15f, 0f), new Vector3(1.15f, 1.15f, 0f), 0.03f, "woodDark"); for (int num17 = 0; num17 < 4; num17++) { HangingFish(transform3, new Vector3(-0.75f + (float)num17 * 0.5f, 1.72f, 0f), (num17 % 2 == 0) ? "stoneLight" : "sandWet", 0.9f + (float)(num17 % 3) * 0.08f); } for (int num18 = 0; num18 < 3; num18++) { HangingFish(transform3, new Vector3(-0.5f + (float)num18 * 0.5f, 1.12f, 0.02f), "copper", 0.7f); } Crate(t, new Vector3(-3.9f, 0f, 3f), 0.65f); Crate(t, new Vector3(-3.6f, 0f, 3.7f), 0.5f); Barrel(t, new Vector3(3.9f, 0f, 2.6f), 0.8f, "woodDark"); Transform transform4 = Group("Brass survey telescope", t, new Vector3(3.6f, 0f, -2.6f), 170f).transform; for (int num19 = 0; num19 < 3; num19++) { Vector3 val = Polar(0.45f, (float)num19 * 120f, 0f); Beam(transform4, "Tripod leg", val, new Vector3(0f, 1.25f, 0f), 0.022f, "woodDark"); } Column(transform4, "Tripod head", new Vector3(0f, 1.27f, 0f), new Vector3(0.08f, 0.08f, 0.08f), "brass"); Column(transform4, "Telescope tube", new Vector3(0f, 1.36f, 0.28f), new Vector3(0.055f, 0.8f, 0.055f), "brass", 8, 0.8f).transform.localRotation = Quaternion.Euler(78f, 0f, 0f); Transform transform5 = Group("Tideglass daymark lighthouse", t, new Vector3(1f, 0f, 5.2f), 22.5f).transform; Column(transform5, "Lighthouse stone plinth", new Vector3(0f, 0.3f, 0f), new Vector3(2.25f, 0.8f, 2.25f), "stone", 8, 0.92f, collision: true); Column(transform5, "Tapered ivory tower", new Vector3(0f, 3.6f, 0f), new Vector3(1.7f, 6f, 1.7f), "cream", 8, 0.62f, collision: true); Column(transform5, "Teal tower belt", new Vector3(0f, 4.1f, 0f), new Vector3(1.36f, 0.85f, 1.36f), "teal", 8, 0.93f); Column(transform5, "Lantern room balcony", new Vector3(0f, 6.75f, 0f), new Vector3(1.8f, 0.25f, 1.8f), "woodDark"); for (int num20 = 0; num20 < 8; num20++) { Beam(transform5, "Balcony rail post", Polar(0.85f, (float)num20 * 45f, 6.85f), Polar(0.85f, (float)num20 * 45f, 7.35f), 0.02f, "ink"); } Column(transform5, "Balcony rail ring", new Vector3(0f, 7.36f, 0f), new Vector3(0.87f, 0.03f, 0.87f), "ink"); Column(transform5, "Daymark amber lens", new Vector3(0f, 7.5f, 0f), new Vector3(0.74f, 1.2f, 0.74f), "amber", 8, 0.9f); for (int num21 = 0; num21 < 6; num21++) { Column(transform5, "Lantern room mullion", Polar(1.15f, (float)num21 * 60f, 7.5f), new Vector3(0.055f, 1.4f, 0.055f), "woodDark", 6); } Column(transform5, "Copper lantern cap", new Vector3(0f, 8.55f, 0f), new Vector3(1.85f, 1.1f, 1.85f), "copper", 8, 0f); Beam(transform5, "Daymark pennant mast", new Vector3(0f, 8.9f, 0f), new Vector3(0f, 10.2f, 0f), 0.055f, "brass"); Part(transform5, "Forked teal daymark pennant", Cached("forked pennant", () => Geometry.Fin((Vector3[])(object)new Vector3[5] { new Vector3(0f, 10.1f, 0f), new Vector3(1.35f, 9.95f, 0f), new Vector3(0.9f, 9.7f, 0f), new Vector3(1.35f, 9.45f, 0f), new Vector3(0f, 9.45f, 0f) })), "teal", Vector3.zero, Vector3.one, Quaternion.identity); Box(transform5, "Tower dark door", new Vector3(0f, 1.45f, -1.62f), new Vector3(0.85f, 1.7f, 0.15f), "navy"); Box(transform5, "Door lintel", new Vector3(0f, 2.36f, -1.6f), new Vector3(1.05f, 0.14f, 0.2f), "stone"); Box(transform5, "Tower window", new Vector3(0f, 4.9f, -1.32f), new Vector3(0.4f, 0.55f, 0.1f), "ink"); Box(transform5, "Window frame", new Vector3(0f, 4.9f, -1.35f), new Vector3(0.5f, 0.65f, 0.04f), "woodDark"); } private void BuildCasino(Transform t) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_0352: 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_0391: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_0602: 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_064e: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_068e: 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_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_06de: 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_071b: Unknown result type (might be due to invalid IL or missing references) //IL_072f: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_07a1: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07e0: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_0845: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_0885: Unknown result type (might be due to invalid IL or missing references) //IL_0899: Unknown result type (might be due to invalid IL or missing references) //IL_08c0: Unknown result type (might be due to invalid IL or missing references) //IL_08e0: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0926: Unknown result type (might be due to invalid IL or missing references) //IL_093a: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_09c5: Unknown result type (might be due to invalid IL or missing references) //IL_09dc: Unknown result type (might be due to invalid IL or missing references) //IL_0a06: Unknown result type (might be due to invalid IL or missing references) //IL_0a1a: Unknown result type (might be due to invalid IL or missing references) //IL_0a37: Unknown result type (might be due to invalid IL or missing references) //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) //IL_0a6d: Unknown result type (might be due to invalid IL or missing references) //IL_0a81: Unknown result type (might be due to invalid IL or missing references) //IL_0acb: Unknown result type (might be due to invalid IL or missing references) //IL_0ad0: Unknown result type (might be due to invalid IL or missing references) //IL_0ad5: Unknown result type (might be due to invalid IL or missing references) //IL_0af2: Unknown result type (might be due to invalid IL or missing references) //IL_0b13: Unknown result type (might be due to invalid IL or missing references) //IL_0b18: Unknown result type (might be due to invalid IL or missing references) //IL_0b2e: Unknown result type (might be due to invalid IL or missing references) //IL_0b33: Unknown result type (might be due to invalid IL or missing references) //IL_0b49: Unknown result type (might be due to invalid IL or missing references) //IL_0b4e: Unknown result type (might be due to invalid IL or missing references) //IL_0b64: Unknown result type (might be due to invalid IL or missing references) //IL_0b69: Unknown result type (might be due to invalid IL or missing references) //IL_0b79: Unknown result type (might be due to invalid IL or missing references) //IL_0b7e: Unknown result type (might be due to invalid IL or missing references) //IL_0b82: Unknown result type (might be due to invalid IL or missing references) //IL_0ba8: Unknown result type (might be due to invalid IL or missing references) //IL_0bc8: Unknown result type (might be due to invalid IL or missing references) //IL_0bec: Unknown result type (might be due to invalid IL or missing references) //IL_0c08: Unknown result type (might be due to invalid IL or missing references) //IL_0c1c: Unknown result type (might be due to invalid IL or missing references) //IL_0c48: Unknown result type (might be due to invalid IL or missing references) //IL_0c66: Unknown result type (might be due to invalid IL or missing references) //IL_0ce8: Unknown result type (might be due to invalid IL or missing references) //IL_0d0d: Unknown result type (might be due to invalid IL or missing references) //IL_0d37: Unknown result type (might be due to invalid IL or missing references) //IL_0d4b: Unknown result type (might be due to invalid IL or missing references) //IL_0d75: Unknown result type (might be due to invalid IL or missing references) //IL_0d89: Unknown result type (might be due to invalid IL or missing references) //IL_0db6: Unknown result type (might be due to invalid IL or missing references) //IL_0dca: Unknown result type (might be due to invalid IL or missing references) //IL_0ca1: Unknown result type (might be due to invalid IL or missing references) //IL_0cb5: Unknown result type (might be due to invalid IL or missing references) MultiPart(t, "Original lapstrake hull", Cached("lucky keel hull", HullMesh), new string[3] { "navy", "teal", "woodDark" }, collision: false); Vector2[] outline = (Vector2[])(object)new Vector2[9] { new Vector2(-3.6f, 7.8f), new Vector2(3.6f, 7.8f), new Vector2(4.1f, 4f), new Vector2(4.1f, -3.5f), new Vector2(2.7f, -7f), new Vector2(0f, -9f), new Vector2(-2.7f, -7f), new Vector2(-4.1f, -3.5f), new Vector2(-4.1f, 4f) }; Part(t, "Continuous walkable casino deck", Cached("casino deck", () => Geometry.Slab(outline, 1.82f, 2f)), "wood", Vector3.zero, Vector3.one, Quaternion.identity, collision: true); for (int num = 0; num < 15; num++) { Box(t, "Deck caulking seam", new Vector3(0f, 2.007f, -6.5f + (float)num * 0.93f), new Vector3((num < 2) ? 4.8f : 7.35f, 0.012f, 0.028f), "woodDark"); } float[] array = new float[2] { -1f, 1f }; foreach (float side in array) { Part(t, (side < 0f) ? "Walk-in port gangplank" : "Starboard gangplank to the east shore", Cached("casino gangplank " + ((side < 0f) ? "port" : "starboard"), () => Geometry.Ramp(new Vector3(side * 6.9f, 1.8f, 0f), new Vector3(side * 4f, 2.01f, 0f), 2.8f)), "woodLight", Vector3.zero, Vector3.one, Quaternion.identity, collision: true); float[] array2 = new float[2] { -1.35f, 1.35f }; foreach (float num4 in array2) { Beam(t, "Gangplank rope rail", new Vector3(side * 6.8f, 2.6f, num4), new Vector3(side * 4.1f, 2.85f, num4), 0.022f, "rope"); Column(t, "Gangplank post", new Vector3(side * 6.7f, 2.2f, num4), new Vector3(0.06f, 0.85f, 0.06f), "woodDark", 6); } } Transform transform = Group("Boarding crest post", t, new Vector3(-7.4f, 1.8f, 1.7f)).transform; Column(transform, "Crest post", new Vector3(0f, 1.1f, 0f), new Vector3(0.11f, 2.2f, 0.11f), "woodDark", 6, 0.85f, collision: true); Box(transform, "Crest board", new Vector3(0f, 1.95f, 0f), new Vector3(0.75f, 0.7f, 0.08f), "navy"); Suit(transform, "spade", new Vector3(0f, 1.95f, -0.05f), 0.4f, "brass", Quaternion.Euler(90f, 0f, 0f)); Suit(transform, "spade", new Vector3(0f, 1.95f, 0.05f), 0.4f, "brass", Quaternion.Euler(-90f, 0f, 0f)); for (int num5 = 0; num5 < 2; num5++) { float num6 = ((num5 == 0) ? (-4.05f) : 4.05f); for (int num7 = 0; num7 < 5; num7++) { float num8 = -3.4f + (float)num7 * 2.3f; if (!(Mathf.Abs(num8) < 1.5f)) { Column(t, "Deck stanchion", new Vector3(num6, 2.53f, num8), new Vector3(0.07f, 1.05f, 0.07f), "brass"); } } Box(t, (num5 == 0) ? "Port aft bulwark" : "Starboard aft bulwark", new Vector3(num6, 2.43f, 4.7f), new Vector3(0.12f, 0.8f, 4.3f), "teal", collision: true); Box(t, (num5 == 0) ? "Port bow bulwark" : "Starboard bow bulwark", new Vector3(num6, 2.43f, -2.6f), new Vector3(0.12f, 0.8f, 1.7f), "teal", collision: true); } for (int num9 = -1; num9 <= 1; num9 += 2) { Beam(t, "Swept bow handrail", new Vector3((float)num9 * 4f, 2.95f, -3.5f), new Vector3((float)num9 * 2.65f, 2.95f, -6.9f), 0.065f, "brass"); Beam(t, "Prow handrail", new Vector3((float)num9 * 2.65f, 2.95f, -6.9f), new Vector3(0f, 2.95f, -8.8f), 0.065f, "brass"); } Box(t, "Stern safety bulwark", new Vector3(0f, 2.42f, 7.7f), new Vector3(7.2f, 0.8f, 0.14f), "teal", collision: true); Box(t, "Wheelhouse back wall", new Vector3(0f, 3.4f, 6.95f), new Vector3(5.7f, 2.8f, 0.18f), "wood", collision: true); array = new float[2] { -2.75f, 2.75f }; foreach (float num10 in array) { Box(t, "Wheelhouse side", new Vector3(num10, 3.1f, 5.7f), new Vector3(0.18f, 2.1f, 2.6f), "wood", collision: true); Box(t, "Wheelhouse front post", new Vector3(num10, 3.5f, 4.3f), new Vector3(0.2f, 3f, 0.2f), "woodDark", collision: true); Box(t, "Wheelhouse porthole", new Vector3(num10 * 1.045f, 3.5f, 5.7f), new Vector3(0.06f, 0.5f, 0.5f), "glass"); Column(t, "Porthole ring", new Vector3(num10 * 1.055f, 3.5f, 5.7f), new Vector3(0.32f, 0.05f, 0.32f), "brass", 10).transform.localRotation = Quaternion.Euler(0f, 0f, 90f); } PitchedRoof(t, new Vector3(0f, 4.9f, 5.7f), 6.5f, 3.7f, 0.8f, "copper", "navy"); Box(t, "Wheelhouse machine rug", new Vector3(1.5f, 2.012f, 6.15f), new Vector3(1.4f, 0.012f, 1.4f), "red"); Box(t, "Wheelhouse roulette rug", new Vector3(-1.5f, 2.012f, 5.9f), new Vector3(1.9f, 0.012f, 1.3f), "felt"); Lantern(t, new Vector3(1.5f, 4.35f, 5.2f), 0.8f); Lantern(t, new Vector3(-1.5f, 4.35f, 5.2f), 0.8f); array = new float[2] { -3.25f, 3.25f }; foreach (float num11 in array) { Column(t, "Card deck awning spar", new Vector3(num11, 3.6f, -1.8f), new Vector3(0.1f, 3.2f, 0.1f), "woodDark", 8, 1f, collision: true); } PitchedRoof(t, new Vector3(0f, 5.15f, 0.7f), 7.4f, 5.8f, 0.55f, "cream", "teal"); array = new float[2] { -3.25f, 3.25f }; foreach (float num12 in array) { Bunting(t, new Vector3(num12, 5.25f, -1.8f), new Vector3(num12 * 0.92f, 5.55f, 4.3f), 7); } Bunting(t, new Vector3(-3.25f, 5.25f, -1.8f), new Vector3(0f, 8f, 5.7f), 9); Bunting(t, new Vector3(3.25f, 5.25f, -1.8f), new Vector3(0f, 8f, 5.7f), 9); Beam(t, "Wheelhouse mast", new Vector3(0f, 5.6f, 5.7f), new Vector3(0f, 8.4f, 5.7f), 0.06f, "woodDark"); Part(t, "Casino spade pennant", Cached("casino pennant", () => Geometry.Fin((Vector3[])(object)new Vector3[3] { new Vector3(0f, 8.35f, 5.7f), new Vector3(1.5f, 8.1f, 5.7f), new Vector3(0f, 7.75f, 5.7f) })), "red", Vector3.zero, Vector3.one, Quaternion.identity); BlackjackTable(t, new Vector3(0f, 2f, 0.3f)); Vector3[] array3 = (Vector3[])(object)new Vector3[4] { new Vector3(-1.65f, 2f, -4f), new Vector3(1.65f, 2f, -4f), new Vector3(-2.8f, 2f, -3.4f), new Vector3(2.45f, 2f, 0.4f) }; foreach (Vector3 position in array3) { Stool(t, position); } Lantern(t, new Vector3(-3.15f, 4.35f, -1.75f), 0.85f); Lantern(t, new Vector3(3.15f, 4.35f, -1.75f), 0.85f); Transform transform2 = Group("Lucky Keel suit crest", t, new Vector3(0f, 4.1f, 6.82f)).transform; Box(transform2, "Crest shield backing", Vector3.zero, new Vector3(1.5f, 1.35f, 0.09f), "navy"); Suit(transform2, "spade", new Vector3(0f, 0f, -0.06f), 0.7f, "brass", Quaternion.Euler(90f, 0f, 0f)); for (int num13 = 0; num13 < 2; num13++) { Column(t, "Keel resting crib", new Vector3((num13 == 1) ? 1.5f : (-1.5f), -0.3f, -1f + (float)num13 * 2.5f), new Vector3(0.65f, 0.6f, 0.65f), "stone", 6, 0.85f); } Crate(t, new Vector3(-3.45f, 2.02f, 3.2f), 0.6f); Barrel(t, new Vector3(3.5f, 2f, 3.4f), 0.62f, "woodDark"); Beam(t, "Stern mooring line", new Vector3(3.2f, 2.5f, 7.6f), new Vector3(5f, 0.9f, 8.5f), 0.025f, "rope"); Column(t, "Stern mooring piling", new Vector3(5f, 0f, 8.5f), new Vector3(0.14f, 1.8f, 0.14f), "woodDark"); Column(t, "Piling brass band", new Vector3(5f, 0.8f, 8.5f), new Vector3(0.16f, 0.1f, 0.16f), "brass"); } private void Bunting(Transform parent, Vector3 from, Vector3 to, int flags) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) Beam(parent, "Bunting line", from, to, 0.012f, "rope"); Mesh mesh = Cached("bunting flag", () => Geometry.Fin((Vector3[])(object)new Vector3[3] { new Vector3(-0.13f, 0f, 0f), new Vector3(0.13f, 0f, 0f), new Vector3(0f, -0.3f, 0f) }, 0.004f)); Vector3 val = to - from; Quaternion rotation = Quaternion.LookRotation(Vector3.Cross(((Vector3)(ref val)).normalized, Vector3.up), Vector3.up); for (int num = 1; num <= flags; num++) { float num2 = (float)num / (float)(flags + 1); Vector3 position = Vector3.Lerp(from, to, num2) + Vector3.down * (Mathf.Sin(num2 * MathF.PI) * 0.18f); Part(parent, "Bunting flag", mesh, (num % 3 == 0) ? "red" : ((num % 3 == 1) ? "cream" : "teal"), position, Vector3.one, rotation); } } private static Mesh HullMesh() { //IL_016b: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_0110: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(3); float[] array = new float[5] { -9f, -7f, -3.5f, 4f, 7.8f }; float[] array2 = new float[5] { 0.04f, 2.7f, 4.1f, 4.1f, 3.6f }; float[] array3 = new float[4] { -0.7f, 0.15f, 1.15f, 1.83f }; float[] array4 = new float[4] { 0.3f, 0.66f, 0.9f, 1f }; Vector3 a = default(Vector3); Vector3 b = default(Vector3); Vector3 c = default(Vector3); Vector3 d = default(Vector3); for (int i = -1; i <= 1; i += 2) { for (int j = 0; j < array.Length - 1; j++) { for (int k = 0; k < array3.Length - 1; k++) { ((Vector3)(ref a))..ctor((float)i * array2[j] * array4[k], array3[k], array[j]); ((Vector3)(ref b))..ctor((float)i * array2[j + 1] * array4[k], array3[k], array[j + 1]); ((Vector3)(ref c))..ctor((float)i * array2[j + 1] * array4[k + 1], array3[k + 1], array[j + 1]); ((Vector3)(ref d))..ctor((float)i * array2[j] * array4[k + 1], array3[k + 1], array[j]); meshDraft.OutQuad(a, b, c, d, new Vector3(0f, 1f, (array[j] + array[j + 1]) * 0.5f), (k == 2) ? 1 : 0); } } } for (int l = 0; l < array.Length - 1; l++) { meshDraft.OutQuad(new Vector3((0f - array2[l]) * 0.3f, -0.7f, array[l]), new Vector3(array2[l] * 0.3f, -0.7f, array[l]), new Vector3(array2[l + 1] * 0.3f, -0.7f, array[l + 1]), new Vector3((0f - array2[l + 1]) * 0.3f, -0.7f, array[l + 1]), Vector3.up, 2); } meshDraft.OutQuad(new Vector3(-3.6f, 1.83f, 7.8f), new Vector3(3.6f, 1.83f, 7.8f), new Vector3(1.08f, -0.7f, 7.8f), new Vector3(-1.08f, -0.7f, 7.8f), Vector3.zero); return meshDraft.Finish(); } private void BlackjackTable(Transform parent, Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0081: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Blackjack - native-height table", parent, position).transform; Box(transform, "Solid tabletop", new Vector3(0f, 0.755f, 0f), new Vector3(3f, 0.09f, 1.2f), "woodDark", collision: true); Box(transform, "Green felt", new Vector3(0f, 0.801f, 0f), new Vector3(2.9f, 0.004f, 1.1f), "felt"); float[] array = new float[2] { -1.25f, 1.25f }; foreach (float num in array) { float[] array2 = new float[2] { -0.43f, 0.43f }; foreach (float num2 in array2) { Beam(transform, "Splayed table leg", new Vector3(num, 0.71f, num2 * 0.7f), new Vector3(num, 0.04f, num2), 0.065f, "woodDark"); } Beam(transform, "Table foot brace", new Vector3(num, 0.09f, -0.48f), new Vector3(num, 0.09f, 0.48f), 0.05f, "woodDark"); } Beam(transform, "Table stretcher", new Vector3(-1.25f, 0.25f, 0f), new Vector3(1.25f, 0.25f, 0f), 0.055f, "woodDark"); Box(transform, "Dealer chip rack", new Vector3(-1.1f, 0.835f, 0.44f), new Vector3(0.7f, 0.06f, 0.2f), "woodDark"); for (int k = 0; k < 4; k++) { Column(transform, "Chip stack", new Vector3(-1.35f + (float)k * 0.17f, 0.91f, 0.44f), new Vector3(0.055f, 0.12f, 0.055f), (k % 2 == 0) ? "red" : "ivory", 10); } Box(transform, "Card shoe", new Vector3(-0.44f, 0.84f, 0.45f), new Vector3(0.25f, 0.08f, 0.18f), "ink"); } private void Suit(Transform parent, string suit, Vector3 position, float size, string material, Quaternion rotation) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_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) Mesh mesh = Cached("original suit " + suit, delegate { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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_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) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) Vector2[] array = (Vector2[])(object)((suit == "diamond") ? new Vector2[4] { new Vector2(0f, 0.6f), new Vector2(0.4f, 0f), new Vector2(0f, -0.6f), new Vector2(-0.4f, 0f) } : ((!(suit == "heart")) ? new Vector2[11] { new Vector2(0f, 0.6f), new Vector2(0.45f, 0.15f), new Vector2(0.46f, -0.1f), new Vector2(0.24f, -0.22f), new Vector2(0.075f, -0.1f), new Vector2(0.2f, -0.5f), new Vector2(-0.2f, -0.5f), new Vector2(-0.075f, -0.1f), new Vector2(-0.24f, -0.22f), new Vector2(-0.46f, -0.1f), new Vector2(-0.45f, 0.15f) } : new Vector2[8] { new Vector2(0f, 0.27f), new Vector2(0.25f, 0.52f), new Vector2(0.5f, 0.35f), new Vector2(0.48f, 0.03f), new Vector2(0f, -0.55f), new Vector2(-0.48f, 0.03f), new Vector2(-0.5f, 0.35f), new Vector2(-0.25f, 0.52f) })); MeshDraft meshDraft = new MeshDraft(); Vector3 a = (Vector3)((suit == "heart") ? new Vector3(0f, 0f, 0.03f) : Vector3.zero); for (int i = 0; i < array.Length; i++) { Vector2 val = array[i]; Vector2 val2 = array[(i + 1) % array.Length]; meshDraft.Up(a, new Vector3(val.x, 0f, val.y), new Vector3(val2.x, 0f, val2.y)); } return meshDraft.Finish(); }); Part(parent, suit + " suit mark", mesh, material, position, Vector3.one * size, rotation); } private void PitchedRoof(Transform parent, Vector3 position, float width, float depth, float rise, string left, string right) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) string key = "pitched roof " + width.ToString("R", CultureInfo.InvariantCulture) + "-" + depth.ToString("R", CultureInfo.InvariantCulture) + "-" + rise.ToString("R", CultureInfo.InvariantCulture); Mesh mesh = Cached(key, delegate { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(2); float num = width * 0.5f; float num2 = depth * 0.5f; Vector3 a = default(Vector3); ((Vector3)(ref a))..ctor(0f - num, 0f, 0f - num2); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f - num, 0f, num2); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(num, 0f, 0f - num2); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(num, 0f, num2); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(0f, rise, 0f - num2); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(0f, rise, num2); meshDraft.Up(a, val, val5); meshDraft.Up(a, val5, val4); meshDraft.Up(val4, val5, val3, 1); meshDraft.Up(val4, val3, val2, 1); meshDraft.Quad(a, val4, val5, val); meshDraft.Quad(val4, val2, val3, val5, 1); return meshDraft.Finish(); }); MultiPart(parent, "Faceted pitched roof", mesh, new string[2] { left, right }, collision: false).transform.localPosition = position; } private void Lantern(Transform parent, Vector3 position, float scale) { //IL_0006: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_00b1: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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) Transform transform = Group("Warm octagonal lantern - no light component", parent, position).transform; transform.localScale = Vector3.one * scale; Column(transform, "Amber lantern lens", Vector3.zero, new Vector3(0.16f, 0.43f, 0.16f), "amber", 6); Column(transform, "Lantern base", new Vector3(0f, -0.24f, 0f), new Vector3(0.23f, 0.09f, 0.23f), "woodDark", 6); Column(transform, "Lantern rain hood", new Vector3(0f, 0.29f, 0f), new Vector3(0.28f, 0.22f, 0.28f), "brass", 6, 0.15f); for (int i = 0; i < 4; i++) { Beam(transform, "Lantern mullion", Polar(0.185f, 45f + (float)i * 90f, -0.22f), Polar(0.185f, 45f + (float)i * 90f, 0.23f), 0.018f, "woodDark"); } Beam(transform, "Lantern hanger", new Vector3(0f, 0.4f, 0f), new Vector3(0f, 0.65f, 0f), 0.025f, "woodDark"); } private void Stool(Transform parent, Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Brass-footed casino stool", parent, position).transform; Column(transform, "Red upholstered seat", new Vector3(0f, 0.65f, 0f), new Vector3(0.33f, 0.18f, 0.33f), "red", 8, 1f, collision: true); Column(transform, "Seat pedestal", new Vector3(0f, 0.32f, 0f), new Vector3(0.08f, 0.58f, 0.08f), "brass"); Column(transform, "Seat base", new Vector3(0f, 0.07f, 0f), new Vector3(0.31f, 0.1f, 0.31f), "woodDark"); } private void Crate(Transform parent, Vector3 position, float size, float heading = 0f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Coopered tackle crate", parent, position, heading).transform; transform.localScale = Vector3.one * size; Box(transform, "Crate body", new Vector3(0f, 0.5f, 0f), Vector3.one, "wood", collision: true); float[] array = new float[2] { 0.16f, 0.83f }; foreach (float num in array) { Box(transform, "Crate strap", new Vector3(0f, num, -0.51f), new Vector3(1.025f, 0.1f, 0.035f), "brass"); } Beam(transform, "Crate diagonal slat", new Vector3(-0.42f, 0.12f, -0.54f), new Vector3(0.42f, 0.89f, -0.54f), 0.06f, "woodLight"); } private void Barrel(Transform parent, Vector3 position, float height, string wood) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Coopered barrel", parent, position).transform; Column(transform, "Barrel staves", new Vector3(0f, height * 0.5f, 0f), new Vector3(height * 0.62f, height, height * 0.62f), wood, 10, 1f, collision: true); Column(transform, "Barrel belly", new Vector3(0f, height * 0.5f, 0f), new Vector3(height * 0.66f, height * 0.34f, height * 0.66f), wood, 10); float[] array = new float[2] { 0.18f, 0.82f }; foreach (float num in array) { Column(transform, "Barrel hoop", new Vector3(0f, height * num, 0f), new Vector3(height * 0.64f, 0.04f, height * 0.64f), "ink", 10); } Column(transform, "Barrel lid", new Vector3(0f, height + 0.015f, 0f), new Vector3(height * 0.56f, 0.03f, height * 0.56f), "woodLight", 10); } private void RopeCoil(Transform parent, Vector3 position, float diameter) { //IL_0006: 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_0064: 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_00b2: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Coiled mooring line", parent, position).transform; for (int i = 0; i < 3; i++) { Column(transform, "Rope coil turn", new Vector3(0f, 0.03f + (float)i * 0.05f, 0f), new Vector3(diameter * (1f - (float)i * 0.06f), 0.05f, diameter * (1f - (float)i * 0.06f)), "rope", 10, 0.97f); } Column(transform, "Rope coil eye", new Vector3(0f, 0.1f, 0f), new Vector3(diameter * 0.45f, 0.2f, diameter * 0.45f), "woodDark", 10); } private void LobsterPot(Transform parent, Vector3 position, float heading) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Lobster pot", parent, position, heading).transform; Box(transform, "Pot frame", new Vector3(0f, 0.25f, 0f), new Vector3(0.7f, 0.5f, 0.45f), "woodDark", collision: true); Part(transform, "Pot netting", Cached("pot netting", () => NetMesh(0.7f, 0.5f)), "rope", new Vector3(0f, 0.25f, -0.23f), Vector3.one, Quaternion.identity); Part(transform, "Pot netting", Cached("pot netting", () => NetMesh(0.7f, 0.5f)), "rope", new Vector3(0f, 0.25f, 0.23f), Vector3.one, Quaternion.identity); Column(transform, "Pot marker float", new Vector3(0.3f, 0.56f, 0f), new Vector3(0.08f, 0.12f, 0.08f), "red", 6); } private void HangingFish(Transform parent, Vector3 position, string material, float scale) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) Transform transform = Group("Salted drying fish", parent, position).transform; Beam(transform, "Drying cord", Vector3.zero, new Vector3(0f, -0.1f, 0f), 0.008f, "rope"); Part(transform, "Split fish", Cached("drying fish", () => Geometry.Fin((Vector3[])(object)new Vector3[7] { new Vector3(0f, 0f, 0f), new Vector3(0.09f, -0.12f, 0f), new Vector3(0.1f, -0.42f, 0f), new Vector3(0.04f, -0.55f, 0f), new Vector3(-0.04f, -0.55f, 0f), new Vector3(-0.1f, -0.42f, 0f), new Vector3(-0.09f, -0.12f, 0f) }, 0.012f)), material, new Vector3(0f, -0.1f, 0f), Vector3.one * scale, Quaternion.Euler(0f, 0f, 0f)); } private static Mesh NetMesh(float width, float height) { //IL_006a: 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_0097: 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_00ca: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(); int num = Mathf.Max(2, Mathf.RoundToInt(width / 0.22f)); int num2 = Mathf.Max(2, Mathf.RoundToInt(height / 0.22f)); float num3 = width / (float)num; float num4 = height / (float)num2; float num5 = 0.012f; for (int i = 0; i <= num; i++) { float num6 = (0f - width) * 0.5f + (float)i * num3; meshDraft.Quad(new Vector3(num6 - num5, (0f - height) * 0.5f, 0f), new Vector3(num6 + num5, (0f - height) * 0.5f, 0f), new Vector3(num6 + num5, height * 0.5f, 0f), new Vector3(num6 - num5, height * 0.5f, 0f)); meshDraft.Quad(new Vector3(num6 - num5, height * 0.5f, 0f), new Vector3(num6 + num5, height * 0.5f, 0f), new Vector3(num6 + num5, (0f - height) * 0.5f, 0f), new Vector3(num6 - num5, (0f - height) * 0.5f, 0f)); } for (int j = 0; j <= num2; j++) { float num7 = (0f - height) * 0.5f + (float)j * num4; meshDraft.Quad(new Vector3((0f - width) * 0.5f, num7 - num5, 0f), new Vector3(width * 0.5f, num7 - num5, 0f), new Vector3(width * 0.5f, num7 + num5, 0f), new Vector3((0f - width) * 0.5f, num7 + num5, 0f)); meshDraft.Quad(new Vector3((0f - width) * 0.5f, num7 + num5, 0f), new Vector3(width * 0.5f, num7 + num5, 0f), new Vector3(width * 0.5f, num7 - num5, 0f), new Vector3((0f - width) * 0.5f, num7 - num5, 0f)); } return meshDraft.Finish(); } private void HookGlyph(Transform parent, Vector3 position, float size) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3[] array = (Vector3[])(object)new Vector3[6] { new Vector3(0.12f, 0.43f, 0f), new Vector3(0.12f, -0.22f, 0f), new Vector3(-0.02f, -0.38f, 0f), new Vector3(-0.23f, -0.34f, 0f), new Vector3(-0.3f, -0.1f, 0f), new Vector3(-0.23f, -0.18f, 0f) }; for (int i = 0; i < array.Length - 1; i++) { Beam(parent, "Hook pictogram stroke", position + array[i] * size, position + array[i + 1] * size, 0.028f * size, "navy"); } } } internal sealed class AuthoredAssets : IDisposable { internal const string BundleName = "gamblersreach.models"; private readonly AssetBundle bundle; private readonly Dictionary prefabs = new Dictionary(StringComparer.Ordinal); private readonly List materials = new List(); private bool disposed; internal AuthoredAssets() { AuthoredAssets authoredAssets = this; string text = Path.Combine(Path.GetDirectoryName(typeof(Plugin).Assembly.Location), "gamblersreach.models"); if (!File.Exists(text)) { throw new FileNotFoundException("The original model bundle is missing. Install the complete expansion package.", text); } if (Application.unityVersion != "6000.4.4f1") { throw new NotSupportedException("The authored model bundle requires the supported game engine 6000.4.4f1."); } bundle = AssetBundle.LoadFromFile(text); if (!Object.op_Implicit((Object)(object)bundle)) { throw new InvalidDataException("Unity could not load the original model bundle. Reinstall the complete expansion package."); } try { Shader shader = Shader.Find("Universal Render Pipeline/Lit"); if (!Object.op_Implicit((Object)(object)shader) || !shader.isSupported) { throw new InvalidOperationException("The game's supported lit material shader is unavailable."); } foreach (string key in HarborDefinition.Value.AssetKeys) { string text2 = "assets/reach/" + key + "/"; GameObject val = bundle.LoadAsset(text2 + key + ".prefab"); TextAsset val2 = bundle.LoadAsset(text2 + "source.json"); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2) || val2.bytes.Length > 24000000) { throw new InvalidDataException("The bundle is missing original model data for " + key); } AuthoredAsset val3 = JsonConvert.DeserializeObject(val2.text) ?? throw new InvalidDataException("The original model metadata is empty for " + key); val3.Validate(key); MeshFilter[] componentsInChildren = val.GetComponentsInChildren(true); if (componentsInChildren.Length != val3.Parts.Count || componentsInChildren.Any((MeshFilter filter) => !Object.op_Implicit((Object)(object)filter.sharedMesh) || !filter.sharedMesh.isReadable) || val.GetComponentsInChildren(true).Length != 0 || val.GetComponentsInChildren(true).Length != 0) { throw new InvalidDataException("The original model contains unexpected behavior or unreadable geometry: " + key); } Material[] array = val3.Materials.Select(delegate(AuthoredMaterial value) { //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_002d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) Material val5 = new Material(shader) { name = key + " - " + value.Name }; val5.SetColor("_BaseColor", new Color(value.Color[0], value.Color[1], value.Color[2], value.Color[3])); val5.SetFloat("_Metallic", value.Metallic); val5.SetFloat("_Smoothness", value.Smoothness); authoredAssets.materials.Add(val5); return val5; }).ToArray(); foreach (AuthoredPart part in val3.Parts) { MeshFilter val4 = componentsInChildren.Single((MeshFilter candidate) => ((Object)candidate).name == part.Name); if (val4.sharedMesh.vertexCount != part.Vertices.Length || ((Object)((Component)val4).transform.parent).name != "anchor_" + part.Anchor) { throw new InvalidDataException("The original model's rig metadata does not match its geometry: " + key); } ((Component)val4).GetComponent().sharedMaterial = array[part.Material]; } prefabs.Add(key, val); } Plugin.Log.LogInfo((object)$"Loaded {prefabs.Count} original Blender models from the game-matching Unity asset bundle."); } catch { Dispose(); throw; } } internal GameObject CreateVisual(string key) { if (disposed) { throw new ObjectDisposedException("AuthoredAssets"); } if (!prefabs.TryGetValue(key, out GameObject value)) { throw new KeyNotFoundException("No original authored model is registered for " + key); } GameObject obj = Object.Instantiate(value); ((Object)obj).name = key + " - authored model"; obj.SetActive(false); return obj; } public void Dispose() { if (disposed) { return; } disposed = true; foreach (Material material in materials) { if (Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)material); } } materials.Clear(); prefabs.Clear(); if (Object.op_Implicit((Object)(object)bundle)) { bundle.Unload(true); } } } internal sealed class MeshDraft { private readonly List vertices = new List(); private readonly List uv = new List(); private readonly List[] triangles; internal MeshDraft(int submeshes = 1) { triangles = new List[submeshes]; for (int i = 0; i < submeshes; i++) { triangles[i] = new List(); } } internal void Triangle(Vector3 a, Vector3 b, Vector3 c, int material = 0) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_004d: 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_005f: 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_007b: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Cross(b - a, c - a); if (!(((Vector3)(ref val)).sqrMagnitude < 1E-10f)) { int count = vertices.Count; vertices.Add(a); vertices.Add(b); vertices.Add(c); uv.Add(new Vector2(a.x, a.z)); uv.Add(new Vector2(b.x, b.z)); uv.Add(new Vector2(c.x, c.z)); triangles[material].Add(count); triangles[material].Add(count + 1); triangles[material].Add(count + 2); } } internal void Up(Vector3 a, Vector3 b, Vector3 c, int material = 0) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Cross(b - a, c - a).y >= 0f) { Triangle(a, b, c, material); } else { Triangle(a, c, b, material); } } internal void Out(Vector3 a, Vector3 b, Vector3 c, Vector3 inside, int material = 0) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Dot(Vector3.Cross(b - a, c - a), (a + b + c) / 3f - inside) >= 0f) { Triangle(a, b, c, material); } else { Triangle(a, c, b, material); } } internal void Quad(Vector3 a, Vector3 b, Vector3 c, Vector3 d, int material = 0) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) Triangle(a, b, c, material); Triangle(a, c, d, material); } internal void OutQuad(Vector3 a, Vector3 b, Vector3 c, Vector3 d, Vector3 inside, int material = 0) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) Out(a, b, c, inside, material); Out(a, c, d, inside, material); } internal Mesh Finish() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown Mesh val = new Mesh(); if (vertices.Count > 65535) { val.indexFormat = (IndexFormat)1; } val.SetVertices(vertices); val.SetUVs(0, uv); val.subMeshCount = triangles.Length; for (int i = 0; i < triangles.Length; i++) { val.SetTriangles(triangles[i], i); } val.RecalculateNormals(); val.RecalculateBounds(); return val; } } internal static class Geometry { internal static Mesh Box() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(); Vector3[] array = (Vector3[])(object)new Vector3[8] { new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, -0.5f, -0.5f), new Vector3(0.5f, -0.5f, 0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(-0.5f, 0.5f, 0.5f) }; int[,] array2 = new int[6, 4] { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 0, 1, 5, 4 }, { 1, 2, 6, 5 }, { 2, 3, 7, 6 }, { 3, 0, 4, 7 } }; for (int i = 0; i < 6; i++) { meshDraft.OutQuad(array[array2[i, 0]], array[array2[i, 1]], array[array2[i, 2]], array[array2[i, 3]], Vector3.zero); } return meshDraft.Finish(); } internal static Mesh Column(int sides, float taper) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00ea: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(); Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); Vector3 val3 = default(Vector3); Vector3 val4 = default(Vector3); for (int i = 0; i < sides; i++) { float num = (float)i * MathF.PI * 2f / (float)sides; float num2 = (float)(i + 1) * MathF.PI * 2f / (float)sides; ((Vector3)(ref val))..ctor(Mathf.Cos(num), -0.5f, Mathf.Sin(num)); ((Vector3)(ref val2))..ctor(Mathf.Cos(num2), -0.5f, Mathf.Sin(num2)); ((Vector3)(ref val3))..ctor(val2.x * taper, 0.5f, val2.z * taper); ((Vector3)(ref val4))..ctor(val.x * taper, 0.5f, val.z * taper); meshDraft.OutQuad(val, val2, val3, val4, Vector3.zero); meshDraft.Triangle(new Vector3(0f, -0.5f, 0f), val, val2); meshDraft.Triangle(new Vector3(0f, 0.5f, 0f), val3, val4); } return meshDraft.Finish(); } internal static Mesh Ellipsoid(int sides, int rings) { float[] array = new float[rings + 1]; float[] array2 = new float[rings + 1]; for (int i = 0; i <= rings; i++) { float num = (float)i * MathF.PI / (float)rings; array[i] = -0.5f * Mathf.Cos(num); array2[i] = 0.5f * Mathf.Sin(num); } array2[0] = (array2[rings] = 0f); return FishBody(array, array2, array2, sides); } internal static Mesh FishBody(float[] z, float[] widths, float[] heights, int sides = 8, float[]? xOffsets = null, float[]? yOffsets = null) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_0153: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0270: 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_025f: 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) MeshDraft meshDraft = new MeshDraft(); Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); for (int i = 0; i < z.Length - 1; i++) { ((Vector3)(ref val))..ctor((xOffsets != null) ? xOffsets[i] : 0f, (yOffsets != null) ? yOffsets[i] : 0f, z[i]); ((Vector3)(ref val2))..ctor((xOffsets != null) ? xOffsets[i + 1] : 0f, (yOffsets != null) ? yOffsets[i + 1] : 0f, z[i + 1]); for (int j = 0; j < sides; j++) { float num = ((float)j + 0.5f) * MathF.PI * 2f / (float)sides; float num2 = ((float)j + 1.5f) * MathF.PI * 2f / (float)sides; Vector3 a = val + new Vector3(Mathf.Cos(num) * widths[i], Mathf.Sin(num) * heights[i], 0f); Vector3 b = val + new Vector3(Mathf.Cos(num2) * widths[i], Mathf.Sin(num2) * heights[i], 0f); Vector3 c = val2 + new Vector3(Mathf.Cos(num2) * widths[i + 1], Mathf.Sin(num2) * heights[i + 1], 0f); Vector3 d = val2 + new Vector3(Mathf.Cos(num) * widths[i + 1], Mathf.Sin(num) * heights[i + 1], 0f); meshDraft.OutQuad(a, b, c, d, (val + val2) * 0.5f); } } Vector3 val3 = default(Vector3); for (int k = 0; k < 2; k++) { int num3 = ((k != 0) ? (z.Length - 1) : 0); ((Vector3)(ref val3))..ctor((xOffsets != null) ? xOffsets[num3] : 0f, (yOffsets != null) ? yOffsets[num3] : 0f, z[num3]); for (int l = 0; l < sides; l++) { float num4 = ((float)l + 0.5f) * MathF.PI * 2f / (float)sides; float num5 = ((float)l + 1.5f) * MathF.PI * 2f / (float)sides; Vector3 val4 = val3 + new Vector3(Mathf.Cos(num4) * widths[num3], Mathf.Sin(num4) * heights[num3], 0f); Vector3 val5 = val3 + new Vector3(Mathf.Cos(num5) * widths[num3], Mathf.Sin(num5) * heights[num3], 0f); if (k == 0) { meshDraft.Triangle(val3, val5, val4); } else { meshDraft.Triangle(val3, val4, val5); } } } return meshDraft.Finish(); } internal static Mesh Fin(Vector3[] outline, float thickness = 0.006f) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(); Vector3 val = Vector3.zero; foreach (Vector3 val2 in outline) { val += val2; } val /= (float)outline.Length; Vector3 val3 = Vector3.Cross(outline[1] - outline[0], outline[2] - outline[0]); Vector3 normalized = ((Vector3)(ref val3)).normalized; for (int j = 0; j < outline.Length; j++) { Vector3 val4 = outline[j]; Vector3 val5 = outline[(j + 1) % outline.Length]; meshDraft.Out(val4, val5, val + normalized * thickness, val - normalized); meshDraft.Out(val5, val4, val - normalized * thickness, val + normalized); } return meshDraft.Finish(); } internal static Mesh Slab(Vector2[] polygon, float bottom, float top) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0041: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00ed: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) MeshDraft meshDraft = new MeshDraft(); Vector2 val = Vector2.zero; foreach (Vector2 val2 in polygon) { val += val2; } val /= (float)polygon.Length; Vector3 inside = default(Vector3); ((Vector3)(ref inside))..ctor(val.x, (top + bottom) * 0.5f, val.y); Vector3 val5 = default(Vector3); Vector3 b = default(Vector3); Vector3 val6 = default(Vector3); Vector3 c = default(Vector3); for (int j = 0; j < polygon.Length; j++) { Vector2 val3 = polygon[j]; Vector2 val4 = polygon[(j + 1) % polygon.Length]; ((Vector3)(ref val5))..ctor(val3.x, bottom, val3.y); ((Vector3)(ref b))..ctor(val4.x, bottom, val4.y); ((Vector3)(ref val6))..ctor(val3.x, top, val3.y); ((Vector3)(ref c))..ctor(val4.x, top, val4.y); meshDraft.OutQuad(val5, b, c, val6, inside); meshDraft.Out(new Vector3(val.x, bottom, val.y), b, val5, inside); meshDraft.Up(new Vector3(val.x, top, val.y), val6, c); } return meshDraft.Finish(); } internal static Mesh Ramp(Vector3 start, Vector3 end, float width, float thickness = 0.15f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //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) Vector3 val = Vector3.Cross(end - start, Vector3.up); Vector3 val2 = ((Vector3)(ref val)).normalized * (width * 0.5f); MeshDraft meshDraft = new MeshDraft(); Vector3 val3 = start - val2; Vector3 val4 = start + val2; Vector3 val5 = end + val2; Vector3 val6 = end - val2; meshDraft.Up(val3, val4, val5); meshDraft.Up(val3, val5, val6); Vector3 val7 = Vector3.down * thickness; Vector3 inside = (start + end) * 0.5f + val7 * 0.5f; meshDraft.OutQuad(val3, val3 + val7, val4 + val7, val4, inside); meshDraft.OutQuad(val4, val4 + val7, val5 + val7, val5, inside); meshDraft.OutQuad(val5, val5 + val7, val6 + val7, val6, inside); meshDraft.OutQuad(val6, val6 + val7, val3 + val7, val3, inside); meshDraft.OutQuad(val3 + val7, val6 + val7, val5 + val7, val4 + val7, inside); return meshDraft.Finish(); } } internal sealed class HarborSceneAssets : IDisposable { internal const string BundleName = "gamblersreach.harbor"; internal const string SceneName = "GamblersReachHarbor"; private readonly AssetBundle bundle; private readonly NativeSceneMaterials materials = new NativeSceneMaterials(); internal string ScenePath { get; } internal HarborSceneAssets() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown string text = Path.Combine(Path.GetDirectoryName(typeof(Plugin).Assembly.Location), "gamblersreach.harbor"); if (!File.Exists(text)) { throw new FileNotFoundException("The authored harbor scene bundle is missing.", text); } bundle = AssetBundle.LoadFromFile(text); if (!Object.op_Implicit((Object)(object)bundle)) { throw new InvalidDataException("Unity could not load the authored harbor bundle."); } string[] allScenePaths = bundle.GetAllScenePaths(); if (allScenePaths.Length != 1 || !allScenePaths[0].EndsWith("/GamblersReachHarbor.unity", StringComparison.OrdinalIgnoreCase)) { bundle.Unload(true); throw new InvalidDataException("The harbor bundle does not contain its single expected scene."); } ScenePath = allScenePaths[0]; } internal IslandArtLayout Bind(GameObject root) { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_041d: 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_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root) || ((Object)root).name != "IslandHolder" || root.GetComponentsInChildren(true).Length != 0 || root.GetComponentsInChildren(true).Length != 0) { throw new InvalidDataException("The authored harbor must contain only original static scenery and placement markers."); } Transform markerRoot = root.transform.Find("Markers"); if (!Object.op_Implicit((Object)(object)markerRoot)) { throw new InvalidDataException("The authored harbor has no placement markers."); } Dictionary markers = (from value in ((Component)markerRoot).GetComponentsInChildren(true) where (Object)(object)value != (Object)(object)markerRoot select value).ToDictionary((Transform value) => ((Object)value).name, StringComparer.Ordinal); ExpansionDefinition definition = HarborDefinition.Value; definition.ValidateMarkers((IEnumerable)markers.Keys); AdaptMaterials(root); Dictionary npcs = new Dictionary { ["tackle_maker"] = At(Named((PlacementKind)2, "tackle")), ["marine_collector"] = At(Named((PlacementKind)2, "collector")), ["blackjack_dealer"] = At(Named((PlacementKind)2, "dealer")) }; Dictionary npcHeadings = new Dictionary { ["tackle_maker"] = Heading(Named((PlacementKind)2, "tackle")), ["marine_collector"] = Heading(Named((PlacementKind)2, "collector")), ["blackjack_dealer"] = Heading(Named((PlacementKind)2, "dealer")) }; Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); foreach (PlacementDefinition item in definition.Placements.Where((PlacementDefinition value) => (int)value.Kind == 3)) { dictionary.Add(item.Reference, At(item.Marker)); dictionary2.Add(item.Reference, Heading(item.Marker)); } Dictionary landmarks = definition.Placements.Where((PlacementDefinition value) => (int)value.Kind == 6).ToDictionary((PlacementDefinition value) => value.Reference, (PlacementDefinition value) => At(value.Marker), StringComparer.Ordinal); Dictionary decor = definition.Placements.Where((PlacementDefinition value) => (int)value.Kind == 4 && value.Reference != "slot_machine").ToDictionary((PlacementDefinition value) => value.Reference, (PlacementDefinition value) => At(value.Marker), StringComparer.Ordinal); Dictionary decorHeadings = definition.Placements.Where((PlacementDefinition value) => (int)value.Kind == 4 && value.Reference != "slot_machine").ToDictionary((PlacementDefinition value) => value.Reference, (PlacementDefinition value) => Heading(value.Marker), StringComparer.Ordinal); string marker = definition.Placements.Single((PlacementDefinition value) => (int)value.Kind == 0).Marker; string marker2 = definition.Placements.Single((PlacementDefinition value) => (int)value.Kind == 1).Marker; string key = Named((PlacementKind)7, "blackjack"); string key2 = Named((PlacementKind)4, "slot_machine"); return new IslandArtLayout(root, At(marker), At(marker2), npcs, At(key), new Vector3(3f, 0f, 1.2f), At(Named((PlacementKind)8, "blackjack")), Heading(key), (from value in definition.Placements where (int)value.Kind == 5 select At(value.Marker)).ToArray(), dictionary, dictionary2, At(key2), Heading(key2), decor, decorHeadings, landmarks, Heading(marker), npcHeadings); Vector3 At(string key3) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) return root.transform.InverseTransformPoint(Marker(key3).position); } float Heading(string key3) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_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_0024: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.LookRotation(root.transform.InverseTransformDirection(Marker(key3).forward)); return ((Quaternion)(ref val)).eulerAngles.y; } Transform Marker(string text) { if (!markers.TryGetValue(text, out var value)) { throw new InvalidDataException("The harbor is missing placement marker " + text); } return value; } string Named(PlacementKind kind, string reference) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return definition.Placements.Single((PlacementDefinition placement) => placement.Kind == kind && placement.Reference == reference).Marker; } } private void AdaptMaterials(GameObject root) { materials.Apply(root); } public void Dispose() { materials.Dispose(); if (Object.op_Implicit((Object)(object)bundle)) { bundle.Unload(false); } } } public sealed class IslandArtReport { public int Renderers { get; internal set; } public int Colliders { get; internal set; } public int UniqueMeshes { get; internal set; } public int UniqueMaterials { get; internal set; } public int Triangles { get; internal set; } public Bounds LocalBounds { get; internal set; } public IReadOnlyList MissingMaterials { get; internal set; } = Array.Empty(); public IReadOnlyList UngroundedPoints { get; internal set; } = Array.Empty(); public IReadOnlyList SteepPathSamples { get; internal set; } = Array.Empty(); public IReadOnlyDictionary RenderersByGroup { get; internal set; } = new Dictionary(); public bool IsClean { get { if (MissingMaterials.Count == 0 && UngroundedPoints.Count == 0) { return SteepPathSamples.Count == 0; } return false; } } public string Describe() { //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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder2 = stringBuilder.Append("renderers=").Append(Renderers).Append(", colliders=") .Append(Colliders) .Append(", meshes=") .Append(UniqueMeshes) .Append(", materials=") .Append(UniqueMaterials) .Append(", triangles=") .Append(Triangles) .Append(", size="); Bounds localBounds = LocalBounds; StringBuilder stringBuilder3 = stringBuilder2.Append(((Bounds)(ref localBounds)).size.x.ToString("0.#")).Append('x'); localBounds = LocalBounds; StringBuilder stringBuilder4 = stringBuilder3.Append(((Bounds)(ref localBounds)).size.z.ToString("0.#")).Append(", peak="); localBounds = LocalBounds; stringBuilder4.Append(((Bounds)(ref localBounds)).max.y.ToString("0.##")); foreach (KeyValuePair item in RenderersByGroup) { stringBuilder.Append("; ").Append(item.Key).Append('=') .Append(item.Value); } if (MissingMaterials.Count > 0) { stringBuilder.Append("; MISSING MATERIALS: ").Append(string.Join(", ", MissingMaterials)); } if (UngroundedPoints.Count > 0) { stringBuilder.Append("; UNGROUNDED: ").Append(string.Join(", ", UngroundedPoints)); } if (SteepPathSamples.Count > 0) { stringBuilder.Append("; STEEP: ").Append(string.Join(", ", SteepPathSamples)); } return stringBuilder.ToString(); } } }