Decompiled source of LongshipUpgrades v1.0.4
LongshipUpgrades.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LongshipUpgrades")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LongshipUpgrades")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9273280b-9a2b-4143-a5d8-0723a4036a85")] [assembly: AssemblyFileVersion("1.0.4")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.0")] [module: UnverifiableCode] namespace LongshipUpgrades { public class LongshipCustomizableParts : MonoBehaviour { public static bool prefabInit = false; private Ship m_ship; private ZNetView m_nview; private ZDO m_zdo; private Container m_container; private bool m_customMast; private WearNTear m_wnt; private GameObject m_beamMast; private GameObject m_beamTent; private GameObject m_beamMesh; private GameObject m_beamTentCollider; private GameObject m_beamSailCollider; private GameObject m_insects; private GameObject m_fireWarmth; private GameObject m_tent; private GameObject m_lantern; private GameObject m_holdersRight; private GameObject m_holdersLeft; private GameObject m_mastUpgrade; private GameObject m_storageUpgrade; private GameObject m_healthUpgrade; private GameObject m_shieldsStyles; private GameObject m_headStyles; private GameObject m_turrets; private GameObject m_turretsUpgrade; private GameObject m_itemstandObject; private GameObject m_mast; private GameObject m_ropes; private GameObject m_sail; private MeshRenderer m_lampRenderer; private Light m_light; private ParticleSystem m_flare; private ShipTrophyStand m_trophyStand; private GameObject[] m_containerPartsLvl1; private GameObject[] m_containerPartsLvl2; private GameObject[] m_protectiveParts; private GameObject[] m_heads; private bool m_containerUpgradedLvl1; private bool m_containerUpgradedLvl2; private bool m_healthUpgraded; private bool m_ashlandsUpgraded; private bool m_isLampLightDisabled; private int m_headStyle; private int m_shieldsStyle; private int m_tentStyle; private int m_sailStyle; private GameObject m_destroyedLootPrefab; public const string prefabName = "VikingShip"; public const string turretName = "piece_turret"; public const string moderBossStone = "BossStone_DragonQueen"; private static bool prefabFixed = false; private static Shader shaderStandard; private static Material standSharedMaterial; private static Material storageSharedMaterial; private static Material plankSharedMaterial; private static Color flareColor; private static bool isNightTime; private static bool isTimeToLight = true; public static readonly int s_mastUpgraded = StringExtensionMethods.GetStableHashCode("MastUpgraded"); public static readonly int s_mastRemoved = StringExtensionMethods.GetStableHashCode("MastRemoved"); public static readonly int s_lanternUpgraded = StringExtensionMethods.GetStableHashCode("LanternUpgraded"); public static readonly int s_lanternDisabled = StringExtensionMethods.GetStableHashCode("LanternDisabled"); public static readonly int s_tentUpgraded = StringExtensionMethods.GetStableHashCode("TentUpgraded"); public static readonly int s_tentDisabled = StringExtensionMethods.GetStableHashCode("TentDisabled"); public static readonly int s_lightsDisabled = StringExtensionMethods.GetStableHashCode("LightDisabled"); public static readonly int s_containerUpgradedLvl1 = StringExtensionMethods.GetStableHashCode("ContainerUpgradedLvl1"); public static readonly int s_containerUpgradedLvl2 = StringExtensionMethods.GetStableHashCode("ContainerUpgradedLvl2"); public static readonly int s_healthUpgraded = StringExtensionMethods.GetStableHashCode("HealthUpgraded"); public static readonly int s_ashlandsUpgraded = StringExtensionMethods.GetStableHashCode("AshlandsUpgraded"); public static readonly int s_turretsUpgraded = StringExtensionMethods.GetStableHashCode("TurretsUpgraded"); public static readonly int s_turretsDisabled = StringExtensionMethods.GetStableHashCode("TurretsDisabled"); public static readonly int s_headStyle = StringExtensionMethods.GetStableHashCode("HeadStyle"); public static readonly int s_shieldsStyle = StringExtensionMethods.GetStableHashCode("ShieldsStyle"); public static readonly int s_tentStyle = StringExtensionMethods.GetStableHashCode("TentStyle"); public static readonly int s_sailStyle = StringExtensionMethods.GetStableHashCode("SailStyle"); public bool blocksIsDirty; public readonly Dictionary<Renderer, MaterialPropertyBlock> s_propertyBlocks = new Dictionary<Renderer, MaterialPropertyBlock>(); public static Texture2D s_ashlandsHull = new Texture2D(2, 2); public const int piece_nonsolid = 16; public const int vehicle = 28; public static List<Texture2D> customTents = new List<Texture2D>(); public static List<Texture2D> customSails = new List<Texture2D>(); public static List<Texture2D> customShields = new List<Texture2D>(); public static EffectList fabricSwitchEffects = new EffectList(); public static EffectList woodSwitchEffects = new EffectList(); public static EffectList lampEnableEffects = new EffectList(); public static EffectList lampDisableEffects = new EffectList(); public static EffectList turretsEnableEffects = new EffectList(); public static EffectList turretsDisableEffects = new EffectList(); private static readonly Dictionary<GameObject, LongshipCustomizableParts> s_allInstances = new Dictionary<GameObject, LongshipCustomizableParts>(); private void Awake() { if (!prefabInit) { m_ship = ((Component)this).GetComponent<Ship>(); m_wnt = ((Component)this).GetComponent<WearNTear>(); m_nview = ((Component)this).GetComponent<ZNetView>(); ZNetView nview = m_nview; m_zdo = ((nview != null) ? nview.GetZDO() : null); ((Behaviour)this).enabled = m_zdo != null; m_container = (from container in ((Component)this).GetComponentsInChildren<Container>() where ((Object)((Component)container).gameObject).name == "piece_chest" select container).FirstOrDefault(); m_destroyedLootPrefab = m_container?.m_destroyedLootPrefab; if (Object.op_Implicit((Object)(object)m_wnt)) { m_wnt.m_onDestroyed = (Action)Delegate.Combine(m_wnt.m_onDestroyed, new Action(OnDestroyed)); } CheckEffects(); s_allInstances.Add(((Component)this).gameObject, this); } } private void Start() { if (!prefabInit) { InitializeParts(); } } public void OnDestroy() { if (!prefabInit) { s_allInstances.Remove(((Component)this).gameObject); } } private void FixedUpdate() { //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0493: 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_051f: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Unknown result type (might be due to invalid IL or missing references) //IL_0900: Unknown result type (might be due to invalid IL or missing references) //IL_0905: Unknown result type (might be due to invalid IL or missing references) if (prefabInit || m_zdo == null || !Object.op_Implicit((Object)(object)m_ship)) { return; } m_customMast = LongshipUpgrades.mastEnabled.Value && m_zdo.GetBool(s_mastUpgraded, false); GameObject mastUpgrade = m_mastUpgrade; if (mastUpgrade != null) { mastUpgrade.SetActive((LongshipUpgrades.mastEnabled.Value && !m_customMast) || LongshipUpgrades.mastRemovable.Value); } GameObject mast = m_mast; if (mast != null) { mast.SetActive(!m_zdo.GetBool(s_mastRemoved, false)); } GameObject ropes = m_ropes; if (ropes != null) { ropes.SetActive(m_mast.activeSelf); } GameObject beamTent = m_beamTent; if (beamTent != null) { beamTent.SetActive(m_customMast && (LongshipUpgrades.lanternEnabled.Value || LongshipUpgrades.tentEnabled.Value)); } GameObject beamMast = m_beamMast; if (beamMast != null) { beamMast.SetActive(!m_mast.activeSelf && (Object)(object)m_beamTent != (Object)null && m_beamTent.activeInHierarchy); } GameObject beamSailCollider = m_beamSailCollider; if (beamSailCollider != null) { beamSailCollider.SetActive((!Object.op_Implicit((Object)(object)m_beamMast) || !m_beamMast.activeSelf) && m_mast.activeSelf); } GameObject tent = m_tent; if (tent != null) { tent.SetActive(m_customMast && LongshipUpgrades.tentEnabled.Value && m_zdo.GetBool(s_tentUpgraded, false) && !m_zdo.GetBool(s_tentDisabled, false)); } GameObject lantern = m_lantern; if (lantern != null) { lantern.SetActive(LongshipUpgrades.lanternEnabled.Value && m_customMast && m_zdo.GetBool(s_lanternUpgraded, false) && !m_zdo.GetBool(s_lanternDisabled, false)); } GameObject holdersRight = m_holdersRight; if (holdersRight != null) { holdersRight.SetActive(Object.op_Implicit((Object)(object)m_tent) && m_tent.activeInHierarchy); } GameObject holdersLeft = m_holdersLeft; if (holdersLeft != null) { holdersLeft.SetActive(Object.op_Implicit((Object)(object)m_tent) && m_tent.activeInHierarchy); } GameObject fireWarmth = m_fireWarmth; if (fireWarmth != null) { fireWarmth.SetActive(LongshipUpgrades.tentHeat.Value && Object.op_Implicit((Object)(object)m_lantern) && m_lantern.activeInHierarchy && Object.op_Implicit((Object)(object)m_tent) && m_tent.activeInHierarchy); } GameObject turretsUpgrade = m_turretsUpgrade; if (turretsUpgrade != null) { turretsUpgrade.SetActive(LongshipUpgrades.turretsEnabled.Value); } GameObject turrets = m_turrets; if (turrets != null) { turrets.SetActive(LongshipUpgrades.turretsEnabled.Value && m_zdo.GetBool(s_turretsUpgraded, false)); } GameObject itemstandObject = m_itemstandObject; if (itemstandObject != null) { itemstandObject.SetActive(LongshipUpgrades.itemStandEnabled.Value); } bool flag = false; if ((Object)(object)m_light != (Object)null && Object.op_Implicit((Object)(object)m_lantern) && m_lantern.activeInHierarchy && (m_isLampLightDisabled != m_zdo.GetBool(s_lightsDisabled, false) || (flag = isTimeToLight != IsTimeToLight()) || isNightTime != IsNightTime())) { isNightTime = IsNightTime(); isTimeToLight = IsTimeToLight(); if (LongshipUpgrades.lanternAutoSwtich.Value && flag) { m_zdo.Set(s_lightsDisabled, !isTimeToLight); } m_isLampLightDisabled = m_zdo.GetBool(s_lightsDisabled, false); UpdateLights(); } if (Object.op_Implicit((Object)(object)m_beamMesh)) { m_beamMesh.transform.localPosition = new Vector3(0f, 0f, (Object.op_Implicit((Object)(object)m_tent) && m_tent.activeInHierarchy) ? 0f : (-0.9f)); m_beamMesh.transform.localScale = new Vector3(1f, 1f, (Object.op_Implicit((Object)(object)m_tent) && m_tent.activeInHierarchy) ? 1f : 0.5f); m_beamTentCollider.transform.localPosition = new Vector3(0f, 1.58f, (Object.op_Implicit((Object)(object)m_tent) && m_tent.activeInHierarchy) ? 0.23f : (-0.49f)); m_beamTentCollider.transform.localScale = new Vector3(0.16f, 0.16f, (Object.op_Implicit((Object)(object)m_tent) && m_tent.activeInHierarchy) ? 2.05f : 0.6f); } if (LongshipUpgrades.containerEnabled.Value && Object.op_Implicit((Object)(object)m_storageUpgrade) && m_containerUpgradedLvl2 != m_zdo.GetBool(s_containerUpgradedLvl2, false)) { m_containerUpgradedLvl2 = m_zdo.GetBool(s_containerUpgradedLvl2, false); GameObject[] containerPartsLvl = m_containerPartsLvl2; if (containerPartsLvl != null) { CollectionExtensions.Do<GameObject>((IEnumerable<GameObject>)containerPartsLvl, (Action<GameObject>)delegate(GameObject part) { if (part != null) { part.SetActive(m_containerUpgradedLvl2); } }); } if (m_containerUpgradedLvl2 && m_container.m_height < LongshipUpgrades.containerHeight.Value) { m_container.m_height = LongshipUpgrades.containerHeight.Value; } if (m_containerUpgradedLvl2 && m_container.GetInventory().GetHeight() < LongshipUpgrades.containerHeight.Value) { m_container.GetInventory().m_height = LongshipUpgrades.containerHeight.Value; } } if (LongshipUpgrades.containerEnabled.Value && Object.op_Implicit((Object)(object)m_storageUpgrade) && m_containerUpgradedLvl1 != m_zdo.GetBool(s_containerUpgradedLvl1, false)) { m_containerUpgradedLvl1 = m_zdo.GetBool(s_containerUpgradedLvl1, false); GameObject[] containerPartsLvl2 = m_containerPartsLvl1; if (containerPartsLvl2 != null) { CollectionExtensions.Do<GameObject>((IEnumerable<GameObject>)containerPartsLvl2, (Action<GameObject>)delegate(GameObject part) { if (part != null) { part.SetActive(m_containerUpgradedLvl1); } }); } if (m_containerUpgradedLvl1 && m_container.m_width < LongshipUpgrades.containerWidth.Value) { m_container.m_width = LongshipUpgrades.containerWidth.Value; } if (m_containerUpgradedLvl1 && m_container.GetInventory().GetWidth() < LongshipUpgrades.containerWidth.Value) { m_container.GetInventory().m_width = LongshipUpgrades.containerWidth.Value; } } GameObject storageUpgrade = m_storageUpgrade; if (storageUpgrade != null) { storageUpgrade.SetActive(LongshipUpgrades.containerEnabled.Value && !m_containerUpgradedLvl2); } if (LongshipUpgrades.healthEnabled.Value && m_protectiveParts != null && Object.op_Implicit((Object)(object)m_wnt) && m_healthUpgraded != m_zdo.GetBool(s_healthUpgraded, false)) { m_healthUpgraded = m_zdo.GetBool(s_healthUpgraded, false); CollectionExtensions.Do<GameObject>((IEnumerable<GameObject>)m_protectiveParts, (Action<GameObject>)delegate(GameObject part) { if (part != null) { part.SetActive(m_healthUpgraded); } }); if (m_healthUpgraded && m_wnt.m_health < (float)LongshipUpgrades.healthUpgradeLvl1.Value) { m_wnt.m_health = LongshipUpgrades.healthUpgradeLvl1.Value; } } if (LongshipUpgrades.healthEnabled.Value && Object.op_Implicit((Object)(object)m_wnt) && m_ashlandsUpgraded != m_zdo.GetBool(s_ashlandsUpgraded, false)) { m_ashlandsUpgraded = m_zdo.GetBool(s_ashlandsUpgraded, false); if (m_ashlandsUpgraded && LongshipUpgrades.healthUpgradeLvl2.Value > 0) { if (m_wnt.m_health < (float)LongshipUpgrades.healthUpgradeLvl2.Value) { m_wnt.m_health = LongshipUpgrades.healthUpgradeLvl2.Value; } if (LongshipUpgrades.ashlandsProtection.Value) { m_ship.m_ashlandsReady = true; m_wnt.m_ashDamageResist = true; ((DamageModifiers)(ref m_wnt.m_damages)).Apply(new List<DamageModPair> { new DamageModPair { m_type = (DamageType)32, m_modifier = (DamageModifier)5 } }); } } UpdateHullPropertyBlocks(); } GameObject healthUpgrade = m_healthUpgrade; if (healthUpgrade != null) { healthUpgrade.SetActive(LongshipUpgrades.healthEnabled.Value && !m_ashlandsUpgraded); } if (LongshipUpgrades.changeShields.Value && LongshipUpgrades.healthEnabled.Value && m_protectiveParts != null && m_healthUpgraded && m_shieldsStyle != m_zdo.GetInt(s_shieldsStyle, 0)) { m_shieldsStyle = m_zdo.GetInt(s_shieldsStyle, 0); if (LongshipUpgrades.maxShields.Value != 0 && m_shieldsStyle > LongshipUpgrades.maxShields.Value) { m_shieldsStyle %= LongshipUpgrades.maxShields.Value; m_zdo.Set(s_shieldsStyle, m_shieldsStyle, false); } UpdateShieldsPropertyBlocks(); } GameObject shieldsStyles = m_shieldsStyles; if (shieldsStyles != null) { shieldsStyles.SetActive(m_healthUpgraded); } if (LongshipUpgrades.changeTent.Value && (Object)(object)m_tent != (Object)null && m_tent.activeInHierarchy && m_tentStyle != m_zdo.GetInt(s_tentStyle, 0)) { m_tentStyle = m_zdo.GetInt(s_tentStyle, 0); UpdateTentPropertyBlocks(); } if (LongshipUpgrades.changeSail.Value && (Object)(object)m_sail != (Object)null && m_sail.activeInHierarchy && m_sailStyle != m_zdo.GetInt(s_sailStyle, 0)) { m_sailStyle = m_zdo.GetInt(s_sailStyle, 0); UpdateSailPropertyBlocks(); } if (LongshipUpgrades.changeHead.Value && m_heads != null && Object.op_Implicit((Object)(object)m_wnt) && m_headStyle != m_zdo.GetInt(s_headStyle, 0)) { m_headStyle = m_zdo.GetInt(s_headStyle, 0); for (int i = 0; i < m_heads.Length; i++) { m_heads[i].SetActive(m_headStyle == i + 1); } GameObject[] array = (GameObject[])(object)new GameObject[2] { ((Component)m_wnt.m_new.transform.Find("skull_head")).gameObject, ((Component)m_wnt.m_worn.transform.Find("skull_head")).gameObject }; foreach (GameObject val in array) { val.SetActive(m_headStyle == 0); } } GameObject headStyles = m_headStyles; if (headStyles != null) { headStyles.SetActive(LongshipUpgrades.changeHead.Value); } SetPropertyBlocks(); } private void UpdateSailPropertyBlocks() { GameObject sail = m_sail; Renderer val = ((sail != null) ? sail.GetComponentInChildren<Renderer>() : null); if (!((Object)(object)val == (Object)null)) { if (m_sailStyle == 0 || customSails.Count == 0) { ResetPropertyBlock(val); } else { SetPropertyBlock(val, ShaderProps._MainTex, customSails[(m_sailStyle - 1) % ((LongshipUpgrades.maxSails.Value == 0) ? customSails.Count : Math.Min(LongshipUpgrades.maxSails.Value, customSails.Count))]); } } } private void UpdateTentPropertyBlocks() { GameObject tent = m_tent; Renderer val = ((tent != null) ? tent.GetComponentInChildren<Renderer>() : null); if (!((Object)(object)val == (Object)null)) { if (m_tentStyle == 0 || customTents.Count == 0) { ResetPropertyBlock(val); } else { SetPropertyBlock(val, ShaderProps._MainTex, customTents[(m_tentStyle - 1) % ((LongshipUpgrades.maxTents.Value == 0) ? customTents.Count : Math.Min(LongshipUpgrades.maxTents.Value, customTents.Count))]); } } } private void UpdateHullPropertyBlocks() { if (!m_ashlandsUpgraded || LongshipUpgrades.healthUpgradeLvl2.Value <= 0 || !LongshipUpgrades.ashlandsProtection.Value) { return; } foreach (Renderer item in new List<Renderer> { ((Component)m_wnt.m_new.transform.Find("hull")).gameObject.GetComponent<Renderer>(), ((Component)m_wnt.m_worn.transform.Find("hull")).gameObject.GetComponent<Renderer>(), ((Component)m_wnt.m_new.transform.Find("skull_head")).gameObject.GetComponent<Renderer>(), ((Component)m_wnt.m_worn.transform.Find("skull_head")).gameObject.GetComponent<Renderer>() }) { SetPropertyBlock(item, ShaderProps._MainTex, s_ashlandsHull); } if (m_heads == null) { return; } foreach (Renderer item2 in m_heads.Select((GameObject head) => head.GetComponent<Renderer>())) { SetPropertyBlock(item2, ShaderProps._MainTex, s_ashlandsHull); } } private void UpdateShieldsPropertyBlocks() { if (!LongshipUpgrades.changeShields.Value || !LongshipUpgrades.healthEnabled.Value || m_protectiveParts == null || !m_healthUpgraded) { return; } int style = ((m_shieldsStyle > 3) ? ((m_shieldsStyle - 1) % 3 + 1) : m_shieldsStyle); int num = ((m_shieldsStyle > 3) ? ((m_shieldsStyle - 4) / 3) : (-1)); foreach (Renderer item in m_protectiveParts.Select((GameObject head) => head.GetComponent<Renderer>())) { ResetPropertyBlock(item); SetPropertyBlock(item, ShaderProps._Style, style); if (-1 < num && num < customShields.Count) { SetPropertyBlock(item, LongshipPropertyBlocks._StyleTex, customShields[num]); } } } private void UpdatePropertyBlocks() { CollectionExtensions.Do<Renderer>((IEnumerable<Renderer>)s_propertyBlocks.Keys, (Action<Renderer>)delegate(Renderer renderer) { renderer.SetPropertyBlock((MaterialPropertyBlock)null); }); s_propertyBlocks.Clear(); UpdateHullPropertyBlocks(); UpdateShieldsPropertyBlocks(); UpdateTentPropertyBlocks(); UpdateSailPropertyBlocks(); SetPropertyBlocks(); } private void UpdateLights() { //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_005b: 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_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_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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) GameObject insects = m_insects; if (insects != null) { insects.SetActive(isNightTime && !m_isLampLightDisabled); } if (Object.op_Implicit((Object)(object)m_light)) { ((Component)m_light).gameObject.SetActive(!m_isLampLightDisabled); m_light.color = LongshipUpgrades.lanternLightColor.Value; } Color value = LongshipUpgrades.lanternLightColor.Value; value.a = 0f; if (Object.op_Implicit((Object)(object)m_flare)) { ((Component)m_flare).gameObject.SetActive(!m_isLampLightDisabled); MainModule main = m_flare.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Color.Lerp(flareColor, value, 0.5f)); } if (Object.op_Implicit((Object)(object)m_lampRenderer)) { SetPropertyBlock((Renderer)(object)m_lampRenderer, ShaderProps._EmissionColor, m_isLampLightDisabled ? Color.grey : (Color.white + value)); } } private void SetPropertyBlock(Renderer renderer, int nameID, Texture2D tex) { if (!((Object)(object)renderer == (Object)null)) { GetPropertyBlock(renderer).SetTexture(nameID, (Texture)(object)tex); } } private void SetPropertyBlock(Renderer renderer, int nameID, int style) { if (!((Object)(object)renderer == (Object)null)) { GetPropertyBlock(renderer).SetInt(nameID, style); } } private void SetPropertyBlock(Renderer renderer, int nameID, Color color) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)renderer == (Object)null)) { GetPropertyBlock(renderer).SetColor(nameID, color); } } private void ResetPropertyBlock(Renderer renderer) { if (s_propertyBlocks.ContainsKey(renderer)) { renderer.SetPropertyBlock((MaterialPropertyBlock)null); s_propertyBlocks.Remove(renderer); blocksIsDirty = true; } } private MaterialPropertyBlock GetPropertyBlock(Renderer renderer) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown blocksIsDirty = true; if (!s_propertyBlocks.TryGetValue(renderer, out var value)) { value = new MaterialPropertyBlock(); s_propertyBlocks[renderer] = value; } return value; } private void CombinePropertyBlocks(MaterialPropertyBlock propertyBlockToCombine) { //IL_003a: 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) foreach (MaterialPropertyBlock value in s_propertyBlocks.Values) { if (propertyBlockToCombine.HasColor(ShaderProps._Color)) { value.SetColor(ShaderProps._Color, propertyBlockToCombine.GetColor(ShaderProps._Color)); blocksIsDirty = true; } if (propertyBlockToCombine.HasColor(ShaderProps._EmissionColor)) { value.SetColor(ShaderProps._EmissionColor, propertyBlockToCombine.GetColor(ShaderProps._EmissionColor)); blocksIsDirty = true; } } SetPropertyBlocks(); } private void SetPropertyBlocks() { if (blocksIsDirty) { CollectionExtensions.Do<KeyValuePair<Renderer, MaterialPropertyBlock>>((IEnumerable<KeyValuePair<Renderer, MaterialPropertyBlock>>)s_propertyBlocks, (Action<KeyValuePair<Renderer, MaterialPropertyBlock>>)delegate(KeyValuePair<Renderer, MaterialPropertyBlock> rendererBlock) { rendererBlock.Key.SetPropertyBlock(rendererBlock.Value.isEmpty ? null : rendererBlock.Value); }); } blocksIsDirty = false; } private void InitializeParts() { //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_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: 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_0607: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_070c: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Unknown result type (might be due to invalid IL or missing references) //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_09de: Unknown result type (might be due to invalid IL or missing references) //IL_0a27: Unknown result type (might be due to invalid IL or missing references) //IL_0a43: Unknown result type (might be due to invalid IL or missing references) //IL_0a5f: Unknown result type (might be due to invalid IL or missing references) //IL_0a93: Unknown result type (might be due to invalid IL or missing references) //IL_0aaf: 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_0aff: Unknown result type (might be due to invalid IL or missing references) //IL_0b1b: Unknown result type (might be due to invalid IL or missing references) //IL_0b37: 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_01db: 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_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_0fec: Unknown result type (might be due to invalid IL or missing references) //IL_0ff3: Expected O, but got Unknown //IL_0c30: Unknown result type (might be due to invalid IL or missing references) //IL_0c35: Unknown result type (might be due to invalid IL or missing references) //IL_0c43: Expected O, but got Unknown //IL_0c5c: 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_0c9f: Unknown result type (might be due to invalid IL or missing references) //IL_0cd1: Unknown result type (might be due to invalid IL or missing references) //IL_0cf3: Unknown result type (might be due to invalid IL or missing references) //IL_0cf8: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0d72: Unknown result type (might be due to invalid IL or missing references) //IL_0db8: Unknown result type (might be due to invalid IL or missing references) //IL_0dd4: Unknown result type (might be due to invalid IL or missing references) //IL_0df0: Unknown result type (might be due to invalid IL or missing references) //IL_0d0e: Unknown result type (might be due to invalid IL or missing references) //IL_0d13: 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_0d1c: Unknown result type (might be due to invalid IL or missing references) //IL_0d20: Unknown result type (might be due to invalid IL or missing references) //IL_0d25: Unknown result type (might be due to invalid IL or missing references) //IL_053d: 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_0f35: 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_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_03da: 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_0512: 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_0407: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0484: 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_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_1052: Unknown result type (might be due to invalid IL or missing references) //IL_106e: Unknown result type (might be due to invalid IL or missing references) //IL_0e8f: Unknown result type (might be due to invalid IL or missing references) //IL_11ac: Unknown result type (might be due to invalid IL or missing references) //IL_11c8: Unknown result type (might be due to invalid IL or missing references) //IL_11e4: Unknown result type (might be due to invalid IL or missing references) //IL_1209: Unknown result type (might be due to invalid IL or missing references) //IL_1218: Unknown result type (might be due to invalid IL or missing references) //IL_132e: Unknown result type (might be due to invalid IL or missing references) //IL_1338: Expected O, but got Unknown //IL_1425: Unknown result type (might be due to invalid IL or missing references) //IL_142f: Expected O, but got Unknown //IL_1470: Unknown result type (might be due to invalid IL or missing references) //IL_148c: Unknown result type (might be due to invalid IL or missing references) //IL_14a8: Unknown result type (might be due to invalid IL or missing references) //IL_14dc: Unknown result type (might be due to invalid IL or missing references) //IL_14f8: Unknown result type (might be due to invalid IL or missing references) //IL_1514: Unknown result type (might be due to invalid IL or missing references) //IL_1548: Unknown result type (might be due to invalid IL or missing references) //IL_1564: Unknown result type (might be due to invalid IL or missing references) //IL_1580: Unknown result type (might be due to invalid IL or missing references) //IL_15b4: Unknown result type (might be due to invalid IL or missing references) //IL_15d0: Unknown result type (might be due to invalid IL or missing references) //IL_15ec: Unknown result type (might be due to invalid IL or missing references) //IL_1620: Unknown result type (might be due to invalid IL or missing references) //IL_163c: Unknown result type (might be due to invalid IL or missing references) //IL_1658: Unknown result type (might be due to invalid IL or missing references) //IL_168c: Unknown result type (might be due to invalid IL or missing references) //IL_16a8: Unknown result type (might be due to invalid IL or missing references) //IL_16c4: Unknown result type (might be due to invalid IL or missing references) //IL_1790: Unknown result type (might be due to invalid IL or missing references) //IL_1797: Expected O, but got Unknown //IL_18fd: Unknown result type (might be due to invalid IL or missing references) //IL_1919: Unknown result type (might be due to invalid IL or missing references) //IL_1935: Unknown result type (might be due to invalid IL or missing references) //IL_189d: Unknown result type (might be due to invalid IL or missing references) //IL_1a0b: Unknown result type (might be due to invalid IL or missing references) //IL_1a10: Unknown result type (might be due to invalid IL or missing references) //IL_1a1e: Expected O, but got Unknown //IL_1a5e: Unknown result type (might be due to invalid IL or missing references) //IL_1a7a: Unknown result type (might be due to invalid IL or missing references) //IL_1bb3: Unknown result type (might be due to invalid IL or missing references) //IL_1bbd: Unknown result type (might be due to invalid IL or missing references) //IL_1bde: Unknown result type (might be due to invalid IL or missing references) //IL_1bff: Unknown result type (might be due to invalid IL or missing references) //IL_1c24: Unknown result type (might be due to invalid IL or missing references) //IL_1c40: Unknown result type (might be due to invalid IL or missing references) //IL_1c7a: Unknown result type (might be due to invalid IL or missing references) //IL_1c9b: Unknown result type (might be due to invalid IL or missing references) //IL_1d9b: Unknown result type (might be due to invalid IL or missing references) //IL_1da0: Unknown result type (might be due to invalid IL or missing references) //IL_1dae: Expected O, but got Unknown //IL_1e51: Unknown result type (might be due to invalid IL or missing references) //IL_1e5b: Unknown result type (might be due to invalid IL or missing references) //IL_1edd: Unknown result type (might be due to invalid IL or missing references) //IL_1eea: Unknown result type (might be due to invalid IL or missing references) //IL_1ef4: Unknown result type (might be due to invalid IL or missing references) //IL_1f32: Unknown result type (might be due to invalid IL or missing references) //IL_1f53: Unknown result type (might be due to invalid IL or missing references) //IL_1f5d: Unknown result type (might be due to invalid IL or missing references) //IL_1f7e: Unknown result type (might be due to invalid IL or missing references) //IL_1f9f: Unknown result type (might be due to invalid IL or missing references) //IL_1fc0: Unknown result type (might be due to invalid IL or missing references) //IL_1ea4: Unknown result type (might be due to invalid IL or missing references) //IL_1ea9: Unknown result type (might be due to invalid IL or missing references) //IL_1eba: Expected O, but got Unknown Transform obj = ((Component)this).transform.Find("ship/visual/Mast"); m_mast = ((obj != null) ? ((Component)obj).gameObject : null); Transform obj2 = ((Component)this).transform.Find("ship/visual/ropes"); m_ropes = ((obj2 != null) ? ((Component)obj2).gameObject : null); Transform obj3 = ((Component)this).transform.Find("ship/visual/Mast/Sail/sail_full"); m_sail = ((obj3 != null) ? ((Component)obj3).gameObject : null); Transform val = ((Component)this).transform.Find("ship/visual/Customize"); if (!Object.op_Implicit((Object)(object)val)) { return; } ((Component)val).gameObject.SetActive(true); Transform obj4 = val.Find("ShipTentHolders"); m_holdersRight = ((obj4 != null) ? ((Component)obj4).gameObject : null); Transform obj5 = val.Find("ShipTentHolders (1)"); m_holdersLeft = ((obj5 != null) ? ((Component)obj5).gameObject : null); GameObject holdersRight = m_holdersRight; if (holdersRight != null) { holdersRight.SetActive(false); } GameObject holdersLeft = m_holdersLeft; if (holdersLeft != null) { holdersLeft.SetActive(false); } Transform val2 = val.Find("storage"); if (Object.op_Implicit((Object)(object)val2)) { List<GameObject> list = new List<GameObject>(); List<GameObject> list2 = new List<GameObject>(); List<GameObject> list3 = new List<GameObject>(); for (int j = 0; j < val2.childCount; j++) { GameObject gameObject = ((Component)val2.GetChild(j)).gameObject; if (((Object)gameObject).name.StartsWith("barrel")) { list.Add(gameObject); } else if (((Object)gameObject).name.StartsWith("Shield")) { list3.Add(gameObject); } else { list2.Add(gameObject); } gameObject.SetActive(false); } m_containerPartsLvl1 = list.ToArray(); m_containerPartsLvl2 = list2.ToArray(); m_protectiveParts = list3.ToArray(); State state = Random.state; Random.InitState((int)((ZDOID)(ref m_zdo.m_uid)).ID); for (int k = 0; k < list.Count; k++) { Transform transform = list[k].transform; transform.localEulerAngles += new Vector3(0f, Random.Range(0f, 360f), 0f); switch (k) { case 0: list[k].transform.localPosition = new Vector3(-0.69f, 0.18f, -0.88f); break; case 1: list[k].transform.localPosition = new Vector3(-0.36f, 0.18f, -0.87f); break; } BoxCollider componentInChildren = list[k].GetComponentInChildren<BoxCollider>(); GameObject gameObject2 = ((Component)componentInChildren).gameObject; Object.Destroy((Object)(object)componentInChildren); gameObject2.AddComponent<CapsuleCollider>(); } for (int l = 0; l < list2.Count; l++) { switch (l) { case 0: case 5: { Transform transform2 = new GameObject("ladder_TargetPoint").transform; transform2.SetParent(list2[l].transform, false); transform2.localPosition = new Vector3(0.4f, 0.82f, 0f); transform2.localEulerAngles = new Vector3(0f, 270f, 0f); Ladder val3 = list2[l].AddComponent<Ladder>(); val3.m_useDistance = 1.5f; val3.m_targetPos = transform2; val3.m_name = "$lu_box_name"; continue; } case 1: list2[l].transform.localPosition = new Vector3(0.08f, 0f, -0.45f); break; case 3: list2[l].transform.localPosition = new Vector3(0f, 0f, -0.84f); list2[l].transform.localScale = new Vector3(0.35f, 0.4f, 0.35f); break; case 4: list2[l].transform.localPosition = new Vector3(0.36f, -0.02f, -0.82f); list2[l].transform.localScale = new Vector3(0.35f, 0.4f, 0.35f); break; case 6: list2[l].transform.localPosition = new Vector3(0f, 0.26f, -0.57f); break; case 8: list2[l].transform.localScale = new Vector3(0.35f, 0.4f, 0.35f); break; } Transform transform3 = list2[l].transform; transform3.localEulerAngles += new Vector3(0f, Random.Range(0f, 360f), 0f); } Random.state = state; } Transform val4 = val.Find("ShipTen2_beam"); if (Object.op_Implicit((Object)(object)val4)) { m_beamMast = Object.Instantiate<GameObject>(((Component)val4).gameObject, val4.parent); ((Object)m_beamMast).name = "ShipTen2_mast"; Transform transform4 = m_beamMast.transform; transform4.localEulerAngles += new Vector3(90f, 0.1f, 0f); m_beamMast.transform.localPosition = new Vector3(0.58f, 0.35f, 0f); m_beamMast.SetActive(false); val4.localPosition += new Vector3(0.1f, 0f, 0f); m_beamTent = ((Component)val4).gameObject; m_beamTent.SetActive(false); m_beamMesh = ((Component)((Component)val4).GetComponentInChildren<Renderer>()).gameObject; Transform val5 = AddCollider(m_beamMast.transform, "mast_beam", typeof(BoxCollider)); val5.localPosition = new Vector3(0f, 1.58f, -0.48f); val5.localScale = new Vector3(0.16f, 0.16f, 2.5f); Transform val6 = AddCollider(val4, "lantern_beam", typeof(BoxCollider)); val6.localPosition = new Vector3(0f, 1.58f, -1.41f); val6.localScale = new Vector3(0.16f, 0.16f, 0.8f); Transform val7 = AddCollider(val4, "tent_beam", typeof(BoxCollider)); val7.localPosition = new Vector3(0f, 1.58f, 0.23f); val7.localScale = new Vector3(0.16f, 0.16f, 2.05f); Transform val8 = AddCollider(val4, "sail_beam", typeof(BoxCollider)); val8.localPosition = new Vector3(0f, 1.4f, -0.9f); val8.localScale = new Vector3(0.23f, 0.55f, 0.2f); m_beamTentCollider = ((Component)val7).gameObject; m_beamSailCollider = ((Component)val8).gameObject; if (LongshipUpgrades.lanternEnabled.Value) { LongshipPartController longshipPartController = ((Component)val6).gameObject.AddComponent<LongshipPartController>(); longshipPartController.m_name = "$lu_part_lantern_name"; longshipPartController.m_zdoPartDisabled = (LongshipUpgrades.lanternRemovable.Value ? s_lanternDisabled : 0); longshipPartController.m_messageEnable = "$lu_part_lantern_enable"; longshipPartController.m_enableEffects = woodSwitchEffects; longshipPartController.m_messageDisable = "$lu_part_lantern_disable"; longshipPartController.m_disableEffects = woodSwitchEffects; longshipPartController.m_nview = m_nview; longshipPartController.m_useDistance = 3f; longshipPartController.AddUpgradeRequirement(s_lanternUpgraded, "$lu_part_lantern_upgrade", LongshipUpgrades.ParseRequirements(LongshipUpgrades.lanternUpgradeRecipe.Value), LongshipUpgrades.lanternStation.Value, LongshipUpgrades.lanternStationLvl.Value, LongshipUpgrades.lanternStationRange.Value); } if (LongshipUpgrades.tentEnabled.Value) { LongshipPartController longshipPartController2 = ((Component)val7).gameObject.AddComponent<LongshipPartController>(); longshipPartController2.m_name = "$lu_part_tent_name"; longshipPartController2.m_zdoPartDisabled = (LongshipUpgrades.tentRemovable.Value ? s_tentDisabled : 0); longshipPartController2.m_messageEnable = "$lu_part_tent_enable"; longshipPartController2.m_enableEffects = fabricSwitchEffects; longshipPartController2.m_messageDisable = "$lu_part_tent_disable"; longshipPartController2.m_disableEffects = fabricSwitchEffects; longshipPartController2.m_nview = m_nview; longshipPartController2.m_useDistance = 3f; longshipPartController2.AddUpgradeRequirement(s_tentUpgraded, "$lu_part_tent_upgrade", LongshipUpgrades.ParseRequirements(LongshipUpgrades.tentUpgradeRecipe.Value), LongshipUpgrades.tentStation.Value, LongshipUpgrades.tentStationLvl.Value, LongshipUpgrades.tentStationRange.Value); } if (LongshipUpgrades.changeSail.Value) { LongshipPartController longshipPartController3 = ((Component)val8).gameObject.AddComponent<LongshipPartController>(); longshipPartController3.m_name = "$lu_part_sail_name"; longshipPartController3.m_nview = m_nview; longshipPartController3.m_messageSwitch = "$lu_part_sail_switch"; longshipPartController3.m_zdoPartVariant = s_sailStyle; longshipPartController3.m_variants = customSails.Count + 1; longshipPartController3.m_switchEffects = fabricSwitchEffects; } } Transform val9 = val.Find("ShipTen2 (1)"); if (Object.op_Implicit((Object)(object)val9)) { m_tent = ((Component)val9).gameObject; Transform transform5 = new GameObject("colliders").transform; transform5.SetParent(m_tent.transform, false); Transform val10 = AddCollider(transform5, "collider_right", typeof(BoxCollider)); val10.localPosition = new Vector3(1.58f, 1.18f, -0.65f); val10.localScale = new Vector3(1.9f, 0.01f, 2.6f); val10.localEulerAngles = new Vector3(0f, 0f, -6f); Transform val11 = AddCollider(transform5, "collider_left", typeof(BoxCollider)); val11.localPosition = new Vector3(-1.05f, 0.95f, -0.65f); val11.localScale = new Vector3(1f, 0.01f, 2.5f); val11.localEulerAngles = new Vector3(0f, 0f, 23f); Transform val12 = AddCollider(transform5, "collider_left (1)", typeof(BoxCollider)); val12.localPosition = new Vector3(-2.1f, 0.7f, -0.55f); val12.localScale = new Vector3(1.15f, 0.01f, 3f); val12.localEulerAngles = new Vector3(0f, 0f, 6f); m_tent.SetActive(false); if (LongshipUpgrades.changeTent.Value) { for (int m = 0; m < transform5.childCount; m++) { LongshipPartController longshipPartController4 = ((Component)transform5.GetChild(m)).gameObject.AddComponent<LongshipPartController>(); longshipPartController4.m_name = "$lu_part_tent_name"; longshipPartController4.m_nview = m_nview; longshipPartController4.m_messageSwitch = "$lu_part_tent_switch"; longshipPartController4.m_zdoPartVariant = s_tentStyle; longshipPartController4.m_variants = customTents.Count + 1; longshipPartController4.m_switchEffects = fabricSwitchEffects; } } } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Lantern"); object obj6; if (itemPrefab == null) { obj6 = null; } else { Transform obj7 = itemPrefab.transform.Find("attach/equiped"); obj6 = ((obj7 != null) ? ((Component)obj7).gameObject : null); } GameObject val13 = (GameObject)obj6; if (Object.op_Implicit((Object)(object)val13)) { m_lantern = new GameObject("Lantern") { layer = 28 }; Transform transform6 = m_lantern.transform; transform6.SetParent(val, false); transform6.localScale = Vector3.one * 0.45f; Transform transform7 = Object.Instantiate<GameObject>(val13, transform6).transform; ((Object)transform7).name = "Lamp"; transform7.localPosition = new Vector3(0.23f, 1.9f, 0f); ((Component)transform7).gameObject.layer = 28; m_light = ((Component)transform7).GetComponentInChildren<Light>(); m_light.color = LongshipUpgrades.lanternLightColor.Value; m_flare = ((Component)transform7.Find("flare")).GetComponent<ParticleSystem>(); if (flareColor == Color.clear) { MainModule main = m_flare.main; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; flareColor = ((MinMaxGradient)(ref startColor)).color; } m_lampRenderer = ((Component)transform7.Find("default")).GetComponent<MeshRenderer>(); ConfigurableJoint component = ((Component)transform7).GetComponent<ConfigurableJoint>(); ((Joint)component).autoConfigureConnectedAnchor = false; ((Joint)component).connectedBody = ((Component)this).GetComponent<Rigidbody>(); ((Joint)component).connectedAnchor = new Vector3(0f, 3.01f, -0.45f); ((Component)transform7).GetComponent<CapsuleCollider>().height = 0.44f; Transform val14 = AddCollider(transform6, "collider", typeof(BoxCollider)); val14.localPosition = new Vector3(0.2f, 2f, 0f); val14.localScale = new Vector3(0.02f, 0.02f, 0.5f); val14.localEulerAngles = new Vector3(90f, 0f, 0f); Transform val15 = val.Find("TraderLamp"); if (Object.op_Implicit((Object)(object)val15)) { ((Component)val15).gameObject.SetActive(false); Transform val16 = val15.Find("insects"); if (Object.op_Implicit((Object)(object)val16)) { m_insects = Object.Instantiate<GameObject>(((Component)val16).gameObject, transform6); ((Object)m_insects).name = "insects"; m_insects.SetActive(false); m_insects.transform.localPosition = new Vector3(0.42f, 1.85f, 0f); m_insects.layer = 8; } } m_fireWarmth = ((Component)AddCollider(transform6, "FireWarmth", typeof(SphereCollider))).gameObject; m_fireWarmth.layer = 14; m_fireWarmth.transform.localPosition = new Vector3(-1f, 0f, 0f); SphereCollider component2 = m_fireWarmth.GetComponent<SphereCollider>(); component2.radius = 3f; ((Collider)component2).isTrigger = true; EffectArea val17 = m_fireWarmth.gameObject.AddComponent<EffectArea>(); val17.m_type = (Type)3; val17.m_isHeatType = true; val17.m_playerOnly = true; if (LongshipUpgrades.lanternSwitchable.Value) { LongshipPartController longshipPartController5 = ((Component)transform6).gameObject.AddComponent<LongshipPartController>(); longshipPartController5.m_name = "$lu_part_lamp_name"; longshipPartController5.m_zdoPartDisabled = s_lightsDisabled; longshipPartController5.m_messageEnable = "$lu_part_lamp_enable"; longshipPartController5.m_messageDisable = "$lu_part_lamp_disable"; longshipPartController5.m_enableEffects = lampEnableEffects; longshipPartController5.m_disableEffects = lampDisableEffects; longshipPartController5.m_nview = m_nview; longshipPartController5.m_useDistance = 2f; } ((Component)transform7).gameObject.SetActive(true); m_lantern.SetActive(false); } GameObject val18 = new GameObject("interactive"); Transform transform8 = val18.transform; transform8.SetParent(val, false); if (LongshipUpgrades.mastEnabled.Value || LongshipUpgrades.mastRemovable.Value) { Transform val19 = AddCollider(transform8, "mast_controller", typeof(BoxCollider)); val19.localPosition = new Vector3(-0.05f, 0.08f, 0f); val19.localScale = new Vector3(0.6f, 0.17f, 0.26f); m_mastUpgrade = ((Component)val19).gameObject; m_mastUpgrade.layer = 16; m_mastUpgrade.SetActive(true); LongshipPartController longshipPartController6 = ((Component)val19).gameObject.AddComponent<LongshipPartController>(); longshipPartController6.m_name = "$lu_part_mast_name"; longshipPartController6.m_zdoPartDisabled = (LongshipUpgrades.mastRemovable.Value ? s_mastRemoved : 0); longshipPartController6.m_messageEnable = "$lu_part_mast_enable"; longshipPartController6.m_messageDisable = "$lu_part_mast_disable"; longshipPartController6.m_enableEffects = woodSwitchEffects; longshipPartController6.m_disableEffects = woodSwitchEffects; longshipPartController6.m_nview = m_nview; longshipPartController6.m_useDistance = 2.5f; longshipPartController6.AddUpgradeRequirement(LongshipUpgrades.mastEnabled.Value ? s_mastUpgraded : 0, "$lu_part_mast_upgrade", LongshipUpgrades.ParseRequirements(LongshipUpgrades.mastUpgradeRecipe.Value), LongshipUpgrades.mastStation.Value, LongshipUpgrades.mastStationLvl.Value, LongshipUpgrades.mastStationRange.Value); } if (Object.op_Implicit((Object)(object)m_container)) { Transform val20 = AddCollider(transform8, "storage_controller", typeof(BoxCollider)); val20.localPosition = new Vector3(-1.9f, -0.02f, 0f); val20.localScale = new Vector3(0.45f, 0.45f, 0.18f); val20.localEulerAngles = new Vector3(0f, 270f, 0f); BoxCollider component3 = ((Component)m_container).GetComponent<BoxCollider>(); BoxCollider component4 = ((Component)val20).GetComponent<BoxCollider>(); component4.center = component3.center; component4.size = component3.size; LongshipPartController longshipPartController7 = ((Component)val20).gameObject.AddComponent<LongshipPartController>(); longshipPartController7.m_name = (m_container.m_name.StartsWith("$") ? m_container.m_name : "$msg_cart_storage"); longshipPartController7.m_nview = m_nview; longshipPartController7.AddUpgradeRequirement(s_containerUpgradedLvl1, "$lu_part_container_upgrade1", LongshipUpgrades.ParseRequirements(LongshipUpgrades.containerLvl1UpgradeRecipe.Value), LongshipUpgrades.containerLvl1Station.Value, LongshipUpgrades.containerLvl1StationLvl.Value, LongshipUpgrades.containerLvl1StationRange.Value); longshipPartController7.AddUpgradeRequirement(s_containerUpgradedLvl2, "$lu_part_container_upgrade2", LongshipUpgrades.ParseRequirements(LongshipUpgrades.containerLvl2UpgradeRecipe.Value), LongshipUpgrades.containerLvl2Station.Value, LongshipUpgrades.containerLvl2StationLvl.Value, LongshipUpgrades.containerLvl2StationRange.Value); m_storageUpgrade = ((Component)val20).gameObject; m_storageUpgrade.layer = 16; m_storageUpgrade.SetActive(false); } Transform healthParent; if (m_protectiveParts != null) { m_healthUpgrade = new GameObject("health"); healthParent = m_healthUpgrade.transform; healthParent.SetParent(transform8, false); Transform val21 = ((Component)this).transform.Find("ship/colliders/left_side"); if (Object.op_Implicit((Object)(object)val21)) { for (int n = 1; n < Mathf.Min(val21.childCount, 5); n++) { AddHealthController(val21, n, "health_controller_left", 0.01f); } } Transform val22 = ((Component)this).transform.Find("ship/colliders/left_side (1)"); if (Object.op_Implicit((Object)(object)val22)) { for (int num = 1; num < Mathf.Min(val22.childCount, 5); num++) { AddHealthController(val22, num, "health_controller_right", -0.01f); } } } if (m_protectiveParts != null) { m_shieldsStyles = new GameObject("shields"); Transform transform9 = m_shieldsStyles.transform; transform9.SetParent(transform8, false); Transform val23 = AddCollider(transform9, "shield_controller_right", typeof(BoxCollider)); val23.localPosition = new Vector3(-1.16f, 0.2f, 1.11f); val23.localScale = new Vector3(0.95f, 0.45f, 0.05f); val23.localEulerAngles = new Vector3(3f, 355f, 0f); Transform val24 = AddCollider(transform9, "shield_controller_right (1)", typeof(BoxCollider)); val24.localPosition = new Vector3(-0.23f, 0.2f, 1.16f); val24.localScale = new Vector3(0.91f, 0.43f, 0.05f); val24.localEulerAngles = new Vector3(3f, 0f, 0f); Transform val25 = AddCollider(transform9, "shield_controller_right (2)", typeof(BoxCollider)); val25.localPosition = new Vector3(1.35f, 0.16f, 1.05f); val25.localScale = new Vector3(1.5f, 0.45f, 0.05f); val25.localEulerAngles = new Vector3(3f, 8f, 0f); Transform val26 = AddCollider(transform9, "shield_controller_left", typeof(BoxCollider)); val26.localPosition = new Vector3(-1.18f, 0.27f, -1.11f); val26.localScale = new Vector3(0.95f, 0.45f, 0.05f); val26.localEulerAngles = new Vector3(0f, 4f, 0f); Transform val27 = AddCollider(transform9, "shield_controller_left (1)", typeof(BoxCollider)); val27.localPosition = new Vector3(-0.25f, 0.27f, -1.16f); val27.localScale = new Vector3(0.89f, 0.45f, 0.05f); val27.localEulerAngles = new Vector3(0f, 2f, 0f); Transform val28 = AddCollider(transform9, "shield_controller_left (2)", typeof(BoxCollider)); val28.localPosition = new Vector3(1.33f, 0.23f, -1.1f); val28.localScale = new Vector3(1.37f, 0.45f, 0.05f); val28.localEulerAngles = new Vector3(0f, 352f, 0f); if (LongshipUpgrades.changeShields.Value) { for (int num2 = 0; num2 < transform9.childCount; num2++) { LongshipPartController longshipPartController8 = ((Component)transform9.GetChild(num2)).gameObject.AddComponent<LongshipPartController>(); longshipPartController8.m_name = "$lu_part_shields_name"; longshipPartController8.m_nview = m_nview; longshipPartController8.m_messageSwitch = "$lu_part_shields_switch"; longshipPartController8.m_zdoPartVariant = s_shieldsStyle; longshipPartController8.m_variants = 4 + 3 * customShields.Count; longshipPartController8.m_switchEffects = woodSwitchEffects; } } } Transform val29 = val.parent.Find("unused"); if (Object.op_Implicit((Object)(object)val29)) { GameObject val30 = new GameObject("heads"); Transform transform10 = val30.transform; transform10.SetParent(val, false); List<GameObject> list4 = new List<GameObject>(); Transform val31 = val29.Find("carnyx_head"); if (Object.op_Implicit((Object)(object)val31)) { GameObject val32 = Object.Instantiate<GameObject>(((Component)val31).gameObject, transform10, true); ((Object)val32).name = ((Object)val31).name; val32.SetActive(false); list4.Add(val32); } Transform val33 = val29.Find("dragon_head"); if (Object.op_Implicit((Object)(object)val33)) { GameObject val34 = Object.Instantiate<GameObject>(((Component)val33).gameObject, transform10, true); ((Object)val34).name = ((Object)val33).name; val34.SetActive(false); list4.Add(val34); } Transform val35 = val29.Find("oseberg_head"); if (Object.op_Implicit((Object)(object)val35)) { GameObject val36 = Object.Instantiate<GameObject>(((Component)val35).gameObject, transform10, true); ((Object)val36).name = ((Object)val35).name; val36.SetActive(false); val36.transform.localPosition = Vector3.zero; list4.Add(val36); } m_heads = list4.ToArray(); } if (m_heads != null) { Transform val37 = AddCollider(transform8, "heads_controller", typeof(BoxCollider)); val37.localPosition = new Vector3(-3.9f, 0.53f, 0f); val37.localScale = new Vector3(0.1f, 0.45f, 0.4f); val37.localEulerAngles = new Vector3(0f, 0f, 63f); m_headStyles = ((Component)val37).gameObject; m_headStyles.layer = 16; m_headStyles.SetActive(true); LongshipPartController longshipPartController9 = ((Component)val37).gameObject.AddComponent<LongshipPartController>(); longshipPartController9.m_name = "$lu_part_head_name"; longshipPartController9.m_nview = m_nview; longshipPartController9.m_messageSwitch = "$lu_part_head_switch"; longshipPartController9.m_zdoPartVariant = s_headStyle; longshipPartController9.m_variants = 4; longshipPartController9.m_switchEffects = woodSwitchEffects; } Turret? obj8 = ((IEnumerable<Turret>)Resources.FindObjectsOfTypeAll<Turret>()).FirstOrDefault((Func<Turret, bool>)((Turret ws) => ((Object)ws).name == "piece_turret")); GameObject val38 = ((obj8 != null) ? ((Component)obj8).gameObject : null); if ((Object)(object)val38 != (Object)null) { m_turrets = new GameObject("turrets") { layer = 28 }; Transform transform11 = m_turrets.transform; transform11.SetParent(val, false); Transform val39 = AddCollider(transform8, "turrets_controller", typeof(BoxCollider)); val39.localPosition = new Vector3(-3.35f, 0.1f, 0f); val39.localScale = new Vector3(0.04f, 0.35f, 0.45f); m_turretsUpgrade = ((Component)val39).gameObject; m_turretsUpgrade.layer = 16; m_turretsUpgrade.SetActive(true); LongshipPartController longshipPartController10 = ((Component)val39).gameObject.AddComponent<LongshipPartController>(); longshipPartController10.m_name = "$lu_part_turrets_name"; longshipPartController10.m_nview = m_nview; longshipPartController10.m_zdoPartDisabled = s_turretsDisabled; longshipPartController10.m_messageEnable = "$lu_part_turrets_enable"; longshipPartController10.m_enableEffects = turretsEnableEffects; longshipPartController10.m_messageDisable = "$lu_part_turrets_disable"; longshipPartController10.m_disableEffects = turretsDisableEffects; longshipPartController10.AddUpgradeRequirement(s_turretsUpgraded, "$lu_part_turrets_upgrade", LongshipUpgrades.ParseRequirements(LongshipUpgrades.turretsUpgradeRecipe.Value), LongshipUpgrades.turretsStation.Value, LongshipUpgrades.turretsStationLvl.Value, LongshipUpgrades.turretsStationRange.Value); GameObject val40 = Object.Instantiate<GameObject>(((Component)val38.transform.Find("New")).gameObject, transform11, false); ((Object)val40).name = "turret_right"; val40.layer = 16; val40.SetActive(true); ((Component)val40.transform.Find("Base")).gameObject.SetActive(false); val40.transform.localScale = Vector3.one * 0.25f; val40.transform.localPosition = new Vector3(-3.3f, -0.01f, 0.53f); val40.transform.localEulerAngles = new Vector3(0f, 350f, 0f); BoxCollider val41 = val40.AddComponent<BoxCollider>(); val41.center = new Vector3(0f, 0.7f, 0.1f); val41.size = new Vector3(1f, 2f, 1f); GameObject val42 = Object.Instantiate<GameObject>(val40, transform11, true); ((Object)val42).name = "turret_left"; val42.transform.localPosition = new Vector3(-3.3f, -0.01f, -0.53f); val42.transform.localEulerAngles = new Vector3(0f, 190f, 0f); Turret component5 = val38.GetComponent<Turret>(); ShipTurret.m_shootEffect = component5.m_shootEffect; ShipTurret.m_addAmmoEffect = component5.m_addAmmoEffect; ShipTurret.m_reloadEffect = component5.m_reloadEffect; ShipTurret.m_warmUpStartEffect = component5.m_warmUpStartEffect; ShipTurret.m_newTargetEffect = component5.m_newTargetEffect; ShipTurret.m_lostTargetEffect = component5.m_lostTargetEffect; ShipTurret.m_setTargetEffect = component5.m_setTargetEffect; val40.AddComponent<ShipTurret>().SetPositionAtShip(isLeft: false).FillAllowedAmmo(component5.m_allowedAmmo) .m_destroyedLootPrefab = m_destroyedLootPrefab; val42.AddComponent<ShipTurret>().SetPositionAtShip(isLeft: true).FillAllowedAmmo(component5.m_allowedAmmo) .m_destroyedLootPrefab = m_destroyedLootPrefab; } ItemStand? obj9 = ((IEnumerable<ItemStand>)Resources.FindObjectsOfTypeAll<ItemStand>()).FirstOrDefault((Func<ItemStand, bool>)((ItemStand ws) => ((Object)((Component)((Component)ws).transform.root).gameObject).name == "BossStone_DragonQueen")); GameObject val43 = ((obj9 != null) ? ((Component)obj9).gameObject : null); if (!((Object)(object)val43 != (Object)null)) { return; } m_itemstandObject = new GameObject("ItemStand_Bow") { layer = 28 }; Transform transform12 = m_itemstandObject.transform; transform12.SetParent(val, false); m_itemstandObject.SetActive(false); GameObject val44 = Object.Instantiate<GameObject>(val43, transform12, false); ((Object)val44).name = "itemstand"; val44.layer = 16; Object.Destroy((Object)(object)((Component)val44.transform.Find("model/wood_pole (2)")).gameObject); Transform val45 = val44.transform.Find("model"); ((Component)val45).gameObject.layer = 16; ((Component)val45).gameObject.SetActive(true); Transform val46 = val45.Find("plate"); val46.localScale = Vector3.one * 0.3f; ((Component)val46).gameObject.layer = 16; Object.Destroy((Object)(object)((Component)val46).GetComponent<MeshCollider>()); MeshRenderer component6 = ((Component)val46).GetComponent<MeshRenderer>(); if ((Object)(object)standSharedMaterial == (Object)null) { standSharedMaterial = new Material(((Renderer)component6).sharedMaterial) { shader = shaderStandard }; } ((Renderer)component6).sharedMaterial = standSharedMaterial; Transform val47 = val44.transform.Find("attach_trophie"); val47.localPosition = Vector3.zero; val47.localScale = Vector3.one * 0.75f; ((Component)val47).gameObject.layer = 16; Transform val48 = val44.transform.Find("dropspawn"); val48.localPosition = new Vector3(0.01f, 0.5f, -0.69f); ((Component)val48).gameObject.layer = 16; val44.transform.localScale = Vector3.one * 0.45f; val44.transform.localPosition = new Vector3(-4.6f, 0.7f, 0f); val44.transform.localEulerAngles = new Vector3(0f, 270f, 0f); val44.GetComponent<BoxCollider>().size = new Vector3(0.75f, 1f, 0.5f); ItemStand component7 = val44.GetComponent<ItemStand>(); m_trophyStand = val44.AddComponent<ShipTrophyStand>(); m_trophyStand.m_activatePowerEffects = component7.m_activatePowerEffects; m_trophyStand.m_activatePowerEffectsPlayer = component7.m_activatePowerEffectsPlayer; m_trophyStand.m_attachOther = component7.m_attachOther; m_trophyStand.m_dropSpawnPoint = component7.m_dropSpawnPoint; m_trophyStand.m_effects = component7.m_effects; m_trophyStand.m_destroyEffects = component7.m_destroyEffects; Object.Destroy((Object)(object)component7); if (LongshipUpgrades.itemStandDisableSpeaking.Value) { RandomSpeak componentInChildren2 = m_itemstandObject.GetComponentInChildren<RandomSpeak>(); if (componentInChildren2 != null) { ((Component)componentInChildren2).gameObject.SetActive(false); } } m_itemstandObject.SetActive(true); void AddHealthController(Transform parent, int i, string name, float offset) { //IL_0040: 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) GameObject val49 = Object.Instantiate<GameObject>(((Component)parent.GetChild(i)).gameObject, healthParent, true); ((Object)val49).name = ((i == 0) ? name : $"{name} ({i})"); Transform transform13 = val49.transform; transform13.localPosition += new Vector3(0f, 0f, offset); LongshipPartController longshipPartController11 = val49.gameObject.AddComponent<LongshipPartController>(); longshipPartController11.m_nview = m_nview; longshipPartController11.m_name = "$lu_part_hull_name"; longshipPartController11.AddUpgradeRequirement(s_healthUpgraded, "$lu_part_hull_upgrade1", LongshipUpgrades.ParseRequirements(LongshipUpgrades.healthUpgradeRecipe.Value), LongshipUpgrades.healthLvl1Station.Value, LongshipUpgrades.healthLvl1StationLvl.Value, LongshipUpgrades.healthLvl1StationRange.Value); if (LongshipUpgrades.healthUpgradeLvl2.Value != 0) { longshipPartController11.AddUpgradeRequirement(s_ashlandsUpgraded, Localization.instance.Localize("$lu_part_hull_upgrade2", new string[1] { LongshipUpgrades.ashlandsProtection.Value ? "\n$lu_part_hull_upgrade2_ashlands" : "" }), LongshipUpgrades.ParseRequirements(LongshipUpgrades.ashlandsUpgradeRecipe.Value), LongshipUpgrades.healthLvl2Station.Value, LongshipUpgrades.healthLvl2StationLvl.Value, LongshipUpgrades.healthLvl2StationRange.Value); } val49.gameObject.SetActive(true); val49.gameObject.layer = 16; } } public void OnDestroyed() { if (m_nview.IsOwner()) { DropItemStand(); DropSpentUpgrades(); } } private void DropItemStand() { //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_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_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_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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) if (!Object.op_Implicit((Object)(object)m_trophyStand) || !m_trophyStand.HaveAttachment()) { return; } string @string = m_trophyStand.m_nview.GetZDO().GetString(ZDOVars.s_item, ""); GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(@string); if (!Object.op_Implicit((Object)(object)itemPrefab)) { return; } Vector3 val = Vector3.zero; Quaternion val2 = Quaternion.identity; Transform val3 = itemPrefab.transform.Find("attach"); if (Object.op_Implicit((Object)(object)itemPrefab.transform.Find("attachobj")) && Object.op_Implicit((Object)(object)val3)) { val2 = ((Component)val3).transform.localRotation; val = ((Component)val3).transform.localPosition; } GameObject val4 = Object.Instantiate<GameObject>(itemPrefab, m_trophyStand.m_dropSpawnPoint.position + val, m_trophyStand.m_dropSpawnPoint.rotation * val2); ItemDrop component = val4.GetComponent<ItemDrop>(); component.LoadFromExternalZDO(m_trophyStand.m_nview.GetZDO()); val4.GetComponent<Rigidbody>().velocity = Vector3.up * 4f; if (Object.op_Implicit((Object)(object)m_destroyedLootPrefab)) { Inventory val5 = SpawnContainer(m_destroyedLootPrefab); if (val5.AddItem(component.m_itemData)) { ZNetScene.instance.Destroy(val4); } } } public void DropSpentUpgrades() { if (ZoneSystem.instance.GetGlobalKey((GlobalKeys)18)) { return; } Dictionary<int, Requirement[]> dictionary = new Dictionary<int, Requirement[]>(); LongshipPartController[] componentsInChildren = ((Component)this).GetComponentsInChildren<LongshipPartController>(true); foreach (LongshipPartController longshipPartController in componentsInChildren) { longshipPartController.AddSpentUpgrades(dictionary); } if (dictionary.Count != 0) { CollectionExtensions.Do<Requirement[]>((IEnumerable<Requirement[]>)dictionary.Values, (Action<Requirement[]>)delegate(Requirement[] itemsToDrop) { DropRequirements(itemsToDrop.ToList()); }); } } public void DropRequirements(List<Requirement> itemsToDrop) { //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_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_00ec: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (Object.op_Implicit((Object)(object)m_destroyedLootPrefab)) { Inventory val = SpawnContainer(m_destroyedLootPrefab); while (itemsToDrop.Count > 0) { Requirement val2 = itemsToDrop[0]; if (val2.m_amount <= 0) { itemsToDrop.RemoveAt(0); } else if (val.AddItem(ObjectDB.instance.GetItemPrefab(((Object)val2.m_resItem).name), 1)) { val2.m_amount--; } else if (!val.HaveEmptySlot()) { val = SpawnContainer(m_destroyedLootPrefab); } else { itemsToDrop.RemoveAt(0); } } return; } while (itemsToDrop.Count > 0) { Requirement val3 = itemsToDrop[0]; while (val3.m_amount > 0) { Vector3 val4 = ((Component)this).transform.position + Vector3.up * 0.5f + Random.insideUnitSphere * 0.3f; Quaternion val5 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); ItemDrop component = Object.Instantiate<GameObject>(ObjectDB.instance.GetItemPrefab(((Object)val3.m_resItem).name), val4, val5).GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { break; } component.SetStack(val3.m_amount); val3.m_amount -= component.m_itemData.m_stack; } itemsToDrop.RemoveAt(0); } } public Inventory SpawnContainer(GameObject lootContainerPrefab) { //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_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_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) Vector3 val = ((Component)this).transform.position + Random.insideUnitSphere * 1f; return Object.Instantiate<GameObject>(lootContainerPrefab, val, Random.rotation).GetComponent<Container>().GetInventory(); } private static bool IsNightTime() { return EnvMan.IsNight(); } private static bool IsTimeToLight() { if (!EnvMan.IsDaylight() || !Object.op_Implicit((Object)(object)EnvMan.instance)) { return true; } float dayFraction = EnvMan.instance.GetDayFraction(); if (!(dayFraction <= 0.28f)) { return dayFraction >= 0.71f; } return true; } internal static void OnGlobalStart() { standSharedMaterial = null; storageSharedMaterial = null; plankSharedMaterial = null; isNightTime = false; isTimeToLight = true; FixPrefab(); } internal static void OnGlobalDestroy() { Object.Destroy((Object)(object)standSharedMaterial); Object.Destroy((Object)(object)storageSharedMaterial); Object.Destroy((Object)(object)plankSharedMaterial); standSharedMaterial = null; storageSharedMaterial = null; plankSharedMaterial = null; } private static void FixPrefab() { //IL_01c5: 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_020a: 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_0243: 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_026a: 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_02d0: 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_02e9: 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_0319: 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_033e: 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_0357: 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_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f7: Expected O, but got Unknown //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_0184: Expected O, but got Unknown Ship? obj = ((IEnumerable<Ship>)Resources.FindObjectsOfTypeAll<Ship>()).FirstOrDefault((Func<Ship, bool>)((Ship ws) => ((Object)ws).name == "VikingShip")); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val == (Object)null) { return; } shaderStandard = ((Renderer)((Component)val.transform.Find("piece_chest/visual/Cube")).GetComponent<MeshRenderer>()).sharedMaterial.shader; if (prefabFixed) { return; } prefabFixed = true; Transform val2 = val.transform.Find("ship/visual/Customize/storage"); for (int i = 0; i < val2.childCount; i++) { Transform child = val2.GetChild(i); if (((Object)child).name.StartsWith("default")) { MeshRenderer component = ((Component)child).GetComponent<MeshRenderer>(); if ((Object)(object)storageSharedMaterial == (Object)null) { storageSharedMaterial = new Material(((Renderer)component).sharedMaterial) { shader = shaderStandard }; } ((Renderer)component).sharedMaterial = storageSharedMaterial; } } if (LongshipUpgrades.fixPlanksFlickering.Value) { MeshRenderer component2 = ((Component)val.transform.Find("ship/visual/hull_worn/plank")).GetComponent<MeshRenderer>(); if ((Object)(object)plankSharedMaterial == (Object)null || plankSharedMaterial == null) { plankSharedMaterial = new Material(((Renderer)component2).sharedMaterial) { shader = shaderStandard }; } ((Renderer)component2).sharedMaterial = plankSharedMaterial; ((Renderer)((Component)val.transform.Find("ship/visual/hull_worn/plank (1)")).GetComponent<MeshRenderer>()).sharedMaterial = plankSharedMaterial; } Transform val3 = val.transform.Find("ship/visual/Customize/ShipTen2_beam"); val3.localPosition += new Vector3(0f, 0.1f, 0f); ((Component)val3).gameObject.layer = 28; Transform val4 = val.transform.Find("ship/visual/Customize/ShipTen2 (1)"); val4.localPosition += new Vector3(0f, 0.08f, 0f); Transform val5 = val.transform.Find("OnboardTrigger"); val5.localScale += new Vector3(0.1f, 2f, 0f); val5.localPosition += new Vector3(-0.05f, 1f, 0f); Material sharedMaterial = ((Renderer)((Component)val4).GetComponentInChildren<MeshRenderer>()).sharedMaterial; sharedMaterial.SetFloat("_RippleSpeed", 75f); sharedMaterial.SetFloat("_RippleDistance", 1.25f); Transform obj2 = val.transform.Find("ship/visual/Mast"); obj2.localPosition += new Vector3(0f, 0.21f, 0f); Transform obj3 = val.transform.Find("ship/visual/Customize/ShipTentHolders"); obj3.localPosition += new Vector3(0f, 0.01f, 0f); Transform val6 = val.transform.Find("ship/visual/Customize/ShipTentHolders (1)"); val6.localPosition += new Vector3(0.1f, -0.18f, 0.11f); val6.localEulerAngles += new Vector3(0f, 5f, 6.6f); Transform val7 = val.transform.Find("ship/visual/Customize/TraderLamp"); ((Component)val7).gameObject.SetActive(false); prefabInit = true; val.AddComponent<LongshipCustomizableParts>(); prefabInit = false; } private static Transform AddCollider(Transform transform, string name, Type type) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Transform transform2 = new GameObject(name, new Type[1] { type }).transform; transform2.SetParent(transform, false); ((Component)transform2).gameObject.layer = 28; return transform2; } internal static void AddCustomTent(string filename) { AddCustomTexture(customTents, filename); } internal static void AddCustomSail(string filename) { AddCustomTexture(customSails, filename); } internal static void AddCustomShields(string filename) { AddCustomTexture(customShields, filename); } private static void AddCustomTexture(List<Texture2D> list, string filename) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown Texture2D tex = new Texture2D(2, 2); if (LongshipUpgrades.LoadTextureFromConfigDirectory(filename, ref tex)) { list.Add(tex); } } private static void CheckEffects() { CheckEffect(fabricSwitchEffects, "vfx_Place_HildirFabricRoll"); CheckEffect(woodSwitchEffects, "sfx_gui_repairitem_workbench"); CheckEffect(lampEnableEffects, "sfx_FireAddFuel"); CheckEffect(lampDisableEffects, "sfx_fishingrod_linebreak"); CheckEffect(turretsEnableEffects, "fx_guardstone_permitted_add"); CheckEffect(turretsDisableEffects, "fx_guardstone_permitted_removed"); static void CheckEffect(EffectList effect, string prefabName) { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown if (effect.m_effectPrefabs == null || effect.m_effectPrefabs.Length == 0) { GameObject prefab = ZNetScene.instance.GetPrefab(prefabName); effect.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = ((Object)(object)prefab != (Object)null) } }; } } } internal static void UpdatePropertyBlocks(GameObject go) { if (s_allInstances.TryGetValue(go, out var value)) { value.UpdatePropertyBlocks(); } } internal static void CombinePropertyBlocks(GameObject go, MaterialPropertyBlock propertyBlockToCombine) { if (s_allInstances.TryGetValue(go, out var value)) { value.CombinePropertyBlocks(propertyBlockToCombine); } } internal static bool HasComponent(GameObject go) { return s_allInstances.ContainsKey(go); } } public class LongshipPartController : MonoBehaviour, Hoverable, Interactable { public class UpgradeRequirements { public int m_zdoVar; public Requirement[] m_requirements = (Requirement[])(object)new Requirement[0]; public string m_messageUpgrade = ""; public string m_stationName; public int m_stationLevel; public int m_stationRange; public UpgradeRequirements(int zdoVar, string message, Requirement[] requirements, string station, int level, int range) { m_zdoVar = zdoVar; m_requirements = requirements; m_messageUpgrade = message; m_stationName = station; m_stationLevel = level; m_stationRange = range; } public bool FillUpgradeHover(ZDO zdo, string name) { if (m_zdoVar == 0 || zdo.GetBool(m_zdoVar, false)) { return false; } sb.Clear(); if (!Player.m_localPlayer.NoCostCheat() && !string.IsNullOrWhiteSpace(m_stationName) && !Player.m_localPlayer.KnowStationLevel(m_stationName, m_stationLevel)) { AddUpgradeHintToHover("$lu_controller_message_unknownupgrade"); return true; } sb.Append(name); if (HaveCraftinStationInRange(out var lvlMet)) { if (lvlMet) { sb.Append("\n[<color=yellow><b>$KEY_Use</b></color>] $inventory_upgradebutton"); } AddUpgradeHintToHover(m_messageUpgrade); AddUpgradeRequirementsToHint(lvlMet); } else { AddUpgradeHintToHover(m_messageUpgrade); sb.Append("\n\n$msg_missingrequirement:"); AddRequiredStationToHover(); } return true; } public bool CheckConsume(ZDO zdo, Player player, out bool result) { //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) result = false; if (m_zdoVar == 0 || zdo.GetBool(m_zdoVar, false)) { return false; } if (!RemoveRequiredItems(player)) { ((Character)player).Message((MessageType)2, "$msg_missingrequirement", 0, (Sprite)null); return true; } zdo.Set(m_zdoVar, true); if (!string.IsNullOrWhiteSpace(m_stationName)) { EffectList obj = buildEffects[m_stationName]; if (obj != null) { obj.Create(((Component)player).transform.position, Quaternion.identity, (Transform)null, 1f, -1); } } PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); playerProfile.IncrementStat((PlayerStatType)1, 1f); playerProfile.IncrementStat((PlayerStatType)14, 1f); result = true; return true; } public void AddSpentUpgrades(ZDO zdo, Dictionary<int, Requirement[]> upgradeReqs) { if (m_zdoVar != 0 && zdo.GetBool(m_zdoVar, false) && m_requirements.Length != 0) { upgradeReqs[m_zdoVar] = m_requirements; } } private void AddUpgradeRequirementsToHint(bool lvlMet) { //IL_0058: 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_008d: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (m_requirements == null || m_requirements.Length == 0 || string.IsNullOrWhiteSpace(m_stationName)) { return; } sb.Append("\n"); if (ZoneSystem.instance.GetGlobalKey((GlobalKeys)18)) { sb.AppendFormat("\n<color=#{0}>$menu_nobuildcost</color>", ColorUtility.ToHtmlStringRGBA(LongshipUpgrades.hintStationColor.Value)); } sb.Append("\n$hud_require"); if (lvlMet) { AddRequiredStationToHover(LongshipUpgrades.hintStationColor.Value, LongshipUpgrades.hintStationColor.Value); } else if (Mathf.Sin(Time.time * 10f) > 0f) { AddRequiredStationToHover(LongshipUpgrades.hintStationColor.Value, Color.red); } else { AddRequiredStationToHover(LongshipUpgrades.hintStationColor.Value); } sb.Append(":"); Requirement[] requirements = m_requirements; if (requirements != null) { CollectionExtensions.Do<Requirement>((IEnumerable<Requirement>)requirements, (Action<Requirement>)delegate(Requirement req) { AddItemRequirementToHover(req); }); } } private void AddRequiredStationToHover() { if (!string.IsNullOrWhiteSpace(m_stationName)) { sb.AppendFormat(" {0}", m_stationName); if (m_stationLevel > 1) { sb.AppendFormat(" $msg_level {0}", m_stationLevel); } } } private void AddRequiredStationToHover(Color station, Color level) { //IL_001c: 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) if (!string.IsNullOrWhiteSpace(m_stationName)) { sb.AppendFormat(" <color=#{0}>{1}</color>", ColorUtility.ToHtmlStringRGBA(station), m_stationName); if (m_stationLevel > 1) { sb.AppendFormat(" $msg_level <color=#{0}>{1}</color>", ColorUtility.ToHtmlStringRGBA(level), m_stationLevel); } } } private void AddRequiredStationToHover(Color station) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrWhiteSpace(m_stationName)) { sb.AppendFormat(" <color=#{0}>{1}</color>", ColorUtility.ToHtmlStringRGBA(station), m_stationName); if (m_stationLevel > 1) { sb.AppendFormat(" $msg_level {0}", m_stationLevel); } } } private void AddUpgradeHintToHover(string message) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrWhiteSpace(message)) { sb.AppendFormat("\n<color=#{0}>{1}</color>", ColorUtility.ToHtmlStringRGBA(LongshipUpgrades.hintColor.Value), message); } } private bool HaveCraftinStationInRange(out bool lvlMet) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) lvlMet = true; if (string.IsNullOrWhiteSpace(m_stationName) || Player.m_localPlayer.NoCostCheat()) { return true; } lvlMet = false; craftingStations.Clear(); CraftingStation.FindStationsInRange(m_stationName, ((Component)Player.m_localPlayer).transform.position, (float)m_stationRange, craftingStations); if (craftingStations.Count == 0) { return false; } lvlMet = craftingStations.Any((CraftingStation station) => station.GetLevel(true) >= m_stationLevel); return true; } private void AddItemRequirementToHover(Requirement requirement) { //IL_0043: 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) if (!((Object)(object)requirement.m_resItem == (Object)null)) { string name = requirement.m_resItem.m_itemData.m_shared.m_name; sb.AppendFormat("\n<color=#{0}>{1}</color> <color=#{2}>{3}</color>", ColorUtility.ToHtmlStringRGBA(LongshipUpgrades.hintAmountColor.Value), requirement.GetAmount(1), ColorUtility.ToHtmlStringRGBA(LongshipUpgrades.hintItemColor.Value), (Player.m_localPlayer.NoCostCheat() || Player.m_localPlayer.IsMaterialKnown(name)) ? name : "$lu_controller_message_unknownitem"); } } private bool RemoveRequiredItems(Player player) { if (player.NoCostCheat()) { return true; } if (!string.IsNullOrWhiteSpace(m_stationName) && m_stationLevel > 0 && !player.KnowStationLevel(m_stationName, m_stationLevel)) { return false; } if (!HaveCraftinStationInRange(out var lvlMet) || !lvlMet) { return false; } if (ZoneSystem.instance.GetGlobalKey((GlobalKeys)18)) { return true; } if (m_requirements.Length == 0) { return true; } tempRecipe.m_resources = m_requirements; if (!player.HaveRequirementItems(tempRecipe, false, 1, 1)) { return false; } player.ConsumeResources(m_requirements, 1, -1, 1); return true; } } public ZNetView m_nview; public Ship m_ship; public Piece m_piece; public string m_name = "Part"; public bool m_checkGuardStone = true; public float m_useDistance = 0f; public string m_messageEnable = "$lu_controller_message_enable"; public string m_messageSwitch = "$lu_controller_message_switch"; public string m_messageDisable = "$lu_controller_message_disable"; public UpgradeRequirements[] m_upgradeRequirements = new UpgradeRequirements[0]; public int m_zdoPartDisabled; public int m_zdoPartVariant; public int m_variants; public EffectList m_switchEffects = new EffectList(); public EffectList m_enableEffects = new EffectList(); public EffectList m_disableEffects = new EffectList(); private static readonly StringBuilder sb = new StringBuilder(20); private static Recipe tempRecipe; private static readonly List<CraftingStation> craftingStations = new List<CraftingStation>(); private static readonly Dictionary<string, EffectList> buildEffects = new Dictionary<string, EffectList>(); public void Awake() { if ((Object)(object)tempRecipe == (Object)null) { tempRecipe = ScriptableObject.CreateInstance<Recipe>(); ((Object)tempRecipe).name = "LongshipPartUpgradeTempRecipe"; } if (buildEffects.Count == 0) { ObjectDB instance = ObjectDB.instance; if (instance != null) { CollectionExtensions.Do<Recipe>(instance.m_recipes.Where((Recipe recipe) => (Object)(object)recipe.m_craftingStation != (Object)null && recipe.m_craftingStation.m_craftItemEffects.HasEffects()), (Action<Recipe>)delegate(Recipe recipe) { buildEffects[recipe.m_craftingStation.m_name] = recipe.m_craftingStation.m_craftItemEffects; }); } } if ((Object)(object)m_nview == (Object)null) { m_nview = ((Component)this).GetComponentInParent<ZNetView>(); } m_ship = ((Component)this).GetComponentInParent<Ship>(); m_piece = ((Component)this).GetComponentInParent<Piece>(); } public string GetHoverText() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) if (LongshipUpgrades.onlyCreatorUpgrades.Value && (Object)(object)m_piece != (Object)null && !m_piece.IsCreator()) { return ""; } if (!IsPositionToInteract()) { return ""; } if (!InUseDistance((Humanoid)(object)Player.m_localPlayer)) { return Localization.instance.Localize("<color=#888888>$piece_toofar</color>"); } if (m_checkGuardStone && !PrivateArea.CheckAccess(((Component)this).transform.position, 0f, false, false)) { return Localization.instance.Localize(m_name + "\n$piece_noaccess"); } if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return ""; } ZDO zDO = m_nview.GetZDO(); UpgradeRequirements[] upgradeRequirements = m_upgradeRequirements; foreach (UpgradeRequirements upgradeRequirements2 in upgradeRequirements) { if (upgradeRequirements2.FillUpgradeHover(zDO, m_name)) { return Localization.instance.Localize(sb.ToString()); } } if (m_zdoPartVariant != 0 && m_variants > 1) { sb.Clear(); sb.Append(m_name); sb.Append("\n[<color=yellow><b>$KEY_Use</b></color>] "); sb.Append(m_messageSwitch); return Localization.instance.Localize(sb.ToString()); } if (m_zdoPartDisabled != 0) { sb.Clear(); sb.Append(m_name); sb.Append("\n[<color=yellow><b>$KEY_Use</b></color>] "); sb.Append(zDO.GetBool(m_zdoPartDisabled, false) ? m_messageEnable : m_messageDisable); return Localization.instance.Localize(sb.ToString()); } return ""; } public string GetHoverName() { return m_name; } public bool Interact(Humanoid human, bool hold, bool alt) { //IL_0051: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) if (hold) { return false; } if (LongshipUpgrades.onlyCreatorUpgrades.Value && (Object)(object)m_piece != (Object)null && !m_piece.IsCreator()) { return false; } if (m_checkGuardStone && !PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return false; } if (!InUseDistance(human)) { return false; } if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return false; } if (!IsPositionToInteract()) { return false; } ZDO zDO = m_nview.GetZDO(); UpgradeRequirements[] upgradeRequirements = m_upgradeRequirements; foreach (UpgradeRequirements upgradeRequirements2 in upgradeRequirements) { if (upgradeRequirements2.CheckConsume(zDO, (Player)(object)((human is Player) ? human : null), out var result)) { return result; } } if (m_zdoPartVariant != 0 && m_variants > 1) { zDO.Set(m_zdoPartVariant, (zDO.GetInt(m_zdoPartVariant, 0) + 1) % m_variants, false); EffectList switchEffects = m_switchEffects; if (switchEffects != null) { switchEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } return true; } if (m_zdoPartDisabled == 0) { return false; } zDO.Set(m_zdoPartDisabled, !zDO.GetBool(m_zdoPartDisabled, false)); EffectList obj = (zDO.GetBool(m_zdoPartDisabled, false) ? m_disableEffects : m_enableEffects); if (obj != null) { obj.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } public bool InUseDistance(Humanoid human) { //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) return m_useDistance == 0f || Vector3.Distance(((Component)human).transform.position, ((Component)this).transform.position) < m_useDistance; } public void AddUpgradeRequirement(int zdoVar, string message, Requirement[] requirements, string station, int level, int range) { if (zdoVar != 0) { m_upgradeRequirements = CollectionExtensions.AddItem<UpgradeRequirements>((IEnumerable<UpgradeRequirements>)m_upgradeRequirements, new UpgradeRequirements(zdoVar, message, requirements, station, level, range)).ToArray(); } } public void AddSpentUpgrades(Dictionary<int, Requirement[]> upgradeReqs) { ZDO zDO = m_nview.GetZDO(); UpgradeRequirements[] upgradeRequirements = m_upgradeRequirements; foreach (UpgradeRequirements upgradeRequirements2 in upgradeRequirements) { upgradeRequirements2.AddSpentUpgrades(zDO, upgradeReqs); } } private bool IsPositionToInteract() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) return (Object)(object)Ship.GetLocalShip() == (Object)(object)m_ship && Vector3.Dot(((Component)this).transform.position - ((Character)Player.m_localPlayer).GetEyePoint(), ((Component)this).transform.position - ((Component)Utils.GetMainCamera()).transform.position) > 0f && Vector3.Dot(((Component)this).transform.position - ((Component)Player.m_localPlayer).transform.position, ((Component)this).transform.position - ((Component)Utils.GetMainCamera()).transform.position) > 0f; } } public static class LongshipPropertyBlocks { [HarmonyPatch(typeof(MaterialMan), "RegisterRenderers")] public static class MaterialMan_RegisterRenderers_KeepPropertyBlocks { public static void Postfix(MaterialMan __instance, GameObject gameObject) { if (LongshipCustomizableParts.HasComponent(gameObject) && __instance.m_blocks.TryGetValue(((Object)ga