using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BalrondBiomes; using BepInEx; using HarmonyLib; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SailorBag")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SailorBag")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d18d2a38-6578-40b5-a296-30f8a379d6ab")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace BalrondBiomes { public class SE_WetImmunity : StatusEffect { public void Awake() { base.m_name = "Waterproof"; ((Object)this).name = "Waterproof"; base.m_tooltip = "Immune to wet effect"; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (base.m_character.GetSEMan().HaveStatusEffect("Wet".GetHashCode())) { base.m_character.GetSEMan().RemoveStatusEffect("Wet".GetHashCode(), false); } } } } namespace BalrondShipyard { public sealed class AnchorSwitch : MonoBehaviour, Hoverable, Interactable { private const string ZdoKeyEnabled = "enabledAnchor"; private const string RpcSetState = "RPC_SetAnchorState"; [Header("UI")] [SerializeField] public string m_name = "Anchor"; [Header("Effects")] [SerializeField] public EffectList m_activateEffect = new EffectList(); [SerializeField] public EffectList m_deactivateEffect = new EffectList(); [SerializeField] private string turnOffMessage = ""; [SerializeField] private string turnOnMessage = ""; [Header("Network")] [SerializeField] public ZNetView m_nview; [SerializeField] public Ship m_ship; [Header("Visuals")] [SerializeField] public GameObject m_disabled; [SerializeField] public GameObject m_enabled; [SerializeField] private GameObject m_resetPoint; [SerializeField] private GameObject m_anchor; [Header("Physics")] [Tooltip("If true, also freezes ship rotation while anchor is down. Off is safer for buoyancy.")] [SerializeField] private bool m_freezeRotationWhileAnchored = false; private Rigidbody _rb; private RigidbodyConstraints _defaultConstraints; private bool _cachedDefaultConstraints; private bool _appliedState; private bool _hasAppliedOnce; private void Awake() { BindToParentShip(); if (!((Object)(object)m_nview == (Object)null) && m_nview.IsValid() && m_nview.GetZDO() != null) { m_nview.Register("RPC_SetAnchorState", (Action)RPC_SetAnchorState); ApplyState(GetEnabledFromZdo(), playEffects: false); } } private void OnEnable() { BindToParentShip(); if ((Object)(object)m_nview != (Object)null && m_nview.IsValid() && m_nview.GetZDO() != null) { ApplyState(GetEnabledFromZdo(), playEffects: false); } } private void BindToParentShip() { //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) Ship componentInParent = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { m_ship = null; m_nview = null; _rb = null; return; } m_ship = componentInParent; m_nview = ((Component)componentInParent).GetComponent(); _rb = ((Component)componentInParent).GetComponent(); if ((Object)(object)_rb != (Object)null && !_cachedDefaultConstraints) { _defaultConstraints = _rb.constraints; _cachedDefaultConstraints = true; } } public string GetHoverText() { return Localization.instance.Localize(IsEnabled() ? "\n[$KEY_Use] Pull Anchor" : "\n[$KEY_Use] Drop Anchor"); } public string GetHoverName() { return m_name; } public bool Interact(Humanoid character, bool repeat, bool alt) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (repeat) { return false; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid() || m_nview.GetZDO() == null) { return false; } if (!m_nview.IsOwner()) { return true; } bool flag = !GetEnabledFromZdo(); SetEnabledAndBroadcast(flag); if (!string.IsNullOrEmpty(turnOnMessage) || !string.IsNullOrEmpty(turnOffMessage)) { ((Character)character).Message((MessageType)2, flag ? turnOnMessage : turnOffMessage, 0, (Sprite)null); } else { ((Character)character).Message((MessageType)2, m_name + (flag ? " dropped" : " picked up"), 0, (Sprite)null); } return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } public bool IsEnabled() { if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid() || m_nview.GetZDO() == null) { return false; } return GetEnabledFromZdo(); } private bool GetEnabledFromZdo() { return m_nview.GetZDO().GetBool("enabledAnchor", false); } private void SetEnabledAndBroadcast(bool enabled) { m_nview.GetZDO().Set("enabledAnchor", enabled); m_nview.InvokeRPC(ZNetView.Everybody, "RPC_SetAnchorState", new object[1] { enabled }); ApplyState(enabled, playEffects: true); } private void RPC_SetAnchorState(long sender, bool enabled) { ApplyState(enabled, playEffects: true); if ((Object)(object)m_nview != (Object)null && m_nview.IsOwner() && m_nview.GetZDO() != null) { m_nview.GetZDO().Set("enabledAnchor", enabled); } } private void ApplyState(bool enabled, bool playEffects) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) if (_hasAppliedOnce && _appliedState == enabled) { return; } _hasAppliedOnce = true; _appliedState = enabled; if (playEffects) { if (enabled) { m_activateEffect.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } else { m_deactivateEffect.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } } if (Object.op_Implicit((Object)(object)m_disabled)) { m_disabled.SetActive(!enabled); } if (Object.op_Implicit((Object)(object)m_enabled)) { m_enabled.SetActive(enabled); } if (!((Object)(object)_rb != (Object)null)) { return; } if (!_cachedDefaultConstraints) { _defaultConstraints = _rb.constraints; _cachedDefaultConstraints = true; } if (enabled) { RigidbodyConstraints val = (RigidbodyConstraints)(_defaultConstraints | 2 | 8); if (m_freezeRotationWhileAnchored) { val = (RigidbodyConstraints)(val | 0x70); } _rb.constraints = val; } else { _rb.constraints = _defaultConstraints; } } } [Serializable] public class FishnetTrap : MonoBehaviour { [Serializable] public class ItemConversion { public Biome m_biome; public ItemDrop m_from; public ItemDrop m_to; public int m_seconds; public List m_options; } public string m_name = "FishnetTrap"; public string m_addOreTooltip = "Add Fishbait"; public string m_emptyOreTooltip = "Empty the basket"; public Switch m_addOreSwitch; public Switch m_emptyOreSwitch; public Transform m_outputPoint; public GameObject m_enabledObject; public GameObject m_disabledObject; public GameObject m_haveFuelObject; public GameObject m_haveOreObject; public GameObject m_noOreObject; public Animator[] m_animators; public int m_maxOre = 20; public float m_secPerProduct = 120f; public float m_addOreAnimationDuration; public List m_conversion; public EffectList m_oreAddedEffects = new EffectList(); public EffectList m_fuelAddedEffects = new EffectList(); public EffectList m_produceEffects = new EffectList(); private ZNetView m_nview; private float m_addedOreTime = -1000f; private StringBuilder m_sb = new StringBuilder(); public Container m_container; public GameObject m_full; public int m_maxFish = 50; private void Awake() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown m_nview = ((Component)this).GetComponent(); if ((Object)(object)m_nview == (Object)null || m_nview.GetZDO() == null) { return; } if (Object.op_Implicit((Object)(object)m_addOreSwitch)) { Switch addOreSwitch = m_addOreSwitch; addOreSwitch.m_onUse = (Callback)Delegate.Combine((Delegate?)(object)addOreSwitch.m_onUse, (Delegate?)new Callback(OnAddOre)); m_addOreSwitch.m_onHover = new TooltipCallback(OnHoverAddOre); } if (Object.op_Implicit((Object)(object)m_emptyOreSwitch)) { Switch emptyOreSwitch = m_emptyOreSwitch; emptyOreSwitch.m_onUse = (Callback)Delegate.Combine((Delegate?)(object)emptyOreSwitch.m_onUse, (Delegate?)new Callback(OnEmpty)); Switch emptyOreSwitch2 = m_emptyOreSwitch; emptyOreSwitch2.m_onHover = (TooltipCallback)Delegate.Combine((Delegate?)(object)emptyOreSwitch2.m_onHover, (Delegate?)new TooltipCallback(OnHoverEmptyOre)); } m_nview.Register("AddOre", (Action)RPC_AddOre); m_nview.Register("EmptyProcessed", (Action)RPC_EmptyProcessed); if ((Object)(object)m_container == (Object)null) { Debug.LogWarning((object)"There is no container"); return; } WearNTear component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed)); } ((MonoBehaviour)this).InvokeRepeating("UpdateFishnetTrap", 1f, 1f); } private void DropAllItems() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) while (GetQueueSize() > 0) { string queuedOre = GetQueuedOre(); RemoveOneOre(); ItemConversion itemConversion = GetItemConversion(queuedOre); if (itemConversion != null) { Vector3 val = ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f; Quaternion val2 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); ItemDrop.OnCreateNew(Object.Instantiate(((Component)itemConversion.m_from).gameObject, val, val2)); } } } private void OnDestroyed() { if (m_nview.IsOwner()) { DropAllItems(); } } private bool IsItemAllowed(ItemData item) { return IsItemAllowed(((Object)item.m_dropPrefab).name); } private bool IsItemAllowed(string itemName) { foreach (ItemConversion item in m_conversion) { if (((Object)((Component)item.m_from).gameObject).name == itemName) { return true; } } return false; } private ItemData FindCookableItem(Inventory inventory) { foreach (ItemConversion item2 in m_conversion) { ItemData item = inventory.GetItem(item2.m_from.m_itemData.m_shared.m_name, -1, false); if (item != null) { return item; } } return null; } private bool OnAddOre(Switch sw, Humanoid user, ItemData item) { if (item == null) { item = FindCookableItem(user.GetInventory()); if (item == null) { ((Character)user).Message((MessageType)2, "$msg_noprocessableitems", 0, (Sprite)null); return false; } } if (!IsItemAllowed(((Object)item.m_dropPrefab).name)) { ((Character)user).Message((MessageType)2, "$msg_wontwork", 0, (Sprite)null); return false; } ZLog.Log((object)("trying to add " + item.m_shared.m_name)); if (GetQueueSize() >= m_maxOre) { ((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null); return false; } ((Character)user).Message((MessageType)2, "$msg_added " + item.m_shared.m_name, 0, (Sprite)null); user.GetInventory().RemoveItem(item, 1); m_nview.InvokeRPC("AddOre", new object[1] { ((Object)item.m_dropPrefab).name }); m_addedOreTime = Time.time; if ((double)m_addOreAnimationDuration > 0.0) { SetAnimation(active: true); } return true; } private float GetBakeTimer() { return (!m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_bakeTimer, 0f); } private void SetBakeTimer(float t) { if (m_nview.IsValid()) { m_nview.GetZDO().Set(ZDOVars.s_bakeTimer, t); } } private float GetFuel() { return (!m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f); } private void SetFuel(float fuel) { if (m_nview.IsValid()) { m_nview.GetZDO().Set(ZDOVars.s_fuel, fuel); } } private int GetQueueSize() { return m_nview.IsValid() ? m_nview.GetZDO().GetInt(ZDOVars.s_queued, 0) : 0; } private void RPC_AddOre(long sender, string name) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (m_nview.IsOwner()) { if (!IsItemAllowed(name)) { ZLog.Log((object)("Item not allowed " + name)); return; } QueueOre(name); m_oreAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); ZLog.Log((object)("Added ore " + name)); } } private void QueueOre(string name) { int queueSize = GetQueueSize(); m_nview.GetZDO().Set("item" + queueSize, name); m_nview.GetZDO().Set(ZDOVars.s_queued, queueSize + 1, false); } private string GetQueuedOre() { return (GetQueueSize() == 0) ? "" : m_nview.GetZDO().GetString(ZDOVars.s_item0, ""); } private void RemoveOneOre() { int queueSize = GetQueueSize(); if (queueSize != 0) { for (int i = 0; i < queueSize; i++) { string @string = m_nview.GetZDO().GetString("item" + (i + 1), ""); m_nview.GetZDO().Set("item" + i, @string); } m_nview.GetZDO().Set(ZDOVars.s_queued, queueSize - 1, false); } } private bool OnEmpty(Switch sw, Humanoid user, ItemData item) { if (GetProcessedQueueSize() <= 0) { return false; } m_nview.InvokeRPC("EmptyProcessed", Array.Empty()); return true; } private void RPC_EmptyProcessed(long sender) { if (m_nview.IsOwner()) { } } private double GetDeltaTime() { DateTime time = ZNet.instance.GetTime(); DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong("StartTime", time.Ticks)); double totalSeconds = (time - dateTime).TotalSeconds; m_nview.GetZDO().Set(ZDOVars.s_startTime, time.Ticks); return totalSeconds; } private float GetAccumulator() { return (!m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_accTime, 0f); } private void SetAccumulator(float t) { if (m_nview.IsValid()) { m_nview.GetZDO().Set(ZDOVars.s_accTime, t); } } private void UpdateFishnetTrap() { if (!m_nview.IsValid()) { return; } UpdateState(); if (!m_nview.IsOwner() || !m_container.m_inventory.HaveEmptySlot()) { return; } double deltaTime = GetDeltaTime(); float num = GetAccumulator() + (float)deltaTime; if ((double)num > 3600.0) { num = 3600f; } float num2 = 1f; while ((double)num >= 1.0) { num -= 1f; string queuedOre = GetQueuedOre(); if ((m_maxOre != 0 && !(queuedOre != "")) || !((double)m_secPerProduct > 0.0)) { continue; } float num3 = 1f * num2; if (queuedOre != "") { float num4 = GetBakeTimer() + num3; SetBakeTimer(num4); if ((double)num4 >= (double)m_secPerProduct) { SetBakeTimer(0f); RemoveOneOre(); QueueProcessed(queuedOre); } } } SetAccumulator(num); } private void QueueProcessed(string ore) { AddToContainer(ore, 1); } private void SpawnProcessed() { if (m_nview.IsValid()) { int @int = m_nview.GetZDO().GetInt(ZDOVars.s_spawnAmount, 0); if (@int > 0) { Spawn(m_nview.GetZDO().GetString(ZDOVars.s_spawnOre, ""), @int); m_nview.GetZDO().Set(ZDOVars.s_spawnOre, ""); m_nview.GetZDO().Set(ZDOVars.s_spawnAmount, 0, false); } } } private int GetProcessedQueueSize() { return m_nview.IsValid() ? m_nview.GetZDO().GetInt(ZDOVars.s_spawnAmount, 0) : 0; } private void Spawn(string ore, int stack) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) ItemConversion itemConversion = GetItemConversion(ore); if (itemConversion != null) { m_produceEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); ItemDrop component = Object.Instantiate(((Component)itemConversion.m_to).gameObject, m_outputPoint.position, m_outputPoint.rotation).GetComponent(); component.m_itemData.m_stack = stack; ItemDrop.OnCreateNew(component); } } private void AddToContainer(string ore, int stack) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) ItemConversion itemConversion = GetItemConversion(ore); if (itemConversion != null) { m_produceEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); ItemDrop fish = getFish(itemConversion); if ((Object)(object)fish == (Object)null) { Debug.LogWarning((object)"Something went wrong no fish found!"); } if (m_container.GetInventory().CanAddItem(((Component)fish).gameObject, stack)) { m_container.GetInventory().AddItem(((Component)fish).gameObject, stack); } } } private ItemDrop getFish(ItemConversion itemConversion) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!CheckBiome(itemConversion.m_biome)) { int num = Random.Range(0, 100); if (num <= 10) { ItemConversion itemConversionByBiomes = GetItemConversionByBiomes(GetBiome()); if (itemConversionByBiomes != null) { return itemConversionByBiomes.m_to; } } return itemConversion.m_options[Random.Range(0, itemConversion.m_options.Count)]; } int num2 = Random.Range(0, 100); if (num2 >= 75) { return itemConversion.m_to; } return itemConversion.m_options[Random.Range(0, itemConversion.m_options.Count)]; } private bool CheckBiome(Biome m_biome) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 return (Heightmap.FindBiome(((Component)this).transform.position) & m_biome) > 0; } private Biome GetBiome() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return Heightmap.FindBiome(((Component)this).transform.position); } private ItemConversion GetItemConversion(string itemName) { foreach (ItemConversion item in m_conversion) { if (((Object)((Component)item.m_from).gameObject).name == itemName) { return item; } } return null; } private ItemConversion GetItemConversionByBiomes(Biome m_biome) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) foreach (ItemConversion item in m_conversion) { if (item.m_biome == m_biome) { return item; } } return null; } private void SetNetState() { if (!IsActive()) { m_full.SetActive(false); return; } m_full.SetActive(true); int num = m_container.m_inventory.NrOfItemsIncludingStacks(); if (num > 1) { ((Component)m_full.transform.Find("low")).gameObject.SetActive(true); } else { ((Component)m_full.transform.Find("low")).gameObject.SetActive(false); } if ((double)num >= (double)m_maxFish * 0.5) { ((Component)m_full.transform.Find("mid")).gameObject.SetActive(true); } else { ((Component)m_full.transform.Find("mid")).gameObject.SetActive(false); } if ((double)num >= (double)m_maxFish * 0.75) { ((Component)m_full.transform.Find("max")).gameObject.SetActive(true); } else { ((Component)m_full.transform.Find("max")).gameObject.SetActive(false); } if (num >= m_maxFish) { m_full.SetActive(false); } } private void UpdateState() { bool flag = IsActive(); m_enabledObject.SetActive(flag); if (Object.op_Implicit((Object)(object)m_disabledObject)) { m_disabledObject.SetActive(!flag); } if (Object.op_Implicit((Object)(object)m_haveFuelObject)) { m_haveFuelObject.SetActive((double)GetFuel() > 0.0); } if (Object.op_Implicit((Object)(object)m_haveOreObject)) { m_haveOreObject.SetActive(GetQueueSize() > 0); } if (Object.op_Implicit((Object)(object)m_noOreObject)) { m_noOreObject.SetActive(GetQueueSize() == 0); } if ((double)m_addOreAnimationDuration > 0.0 && (double)Time.time - (double)m_addedOreTime < (double)m_addOreAnimationDuration) { flag = true; } SetAnimation(flag); SetNetState(); } private void SetAnimation(bool active) { Animator[] animators = m_animators; foreach (Animator val in animators) { if (((Component)val).gameObject.activeInHierarchy) { val.SetBool("active", active); val.SetFloat("activef", active ? 1f : 0f); } } } public bool IsActive() { return m_maxOre == 0 || GetQueueSize() > 0; } private string OnHoverEmptyOre() { return Localization.instance.Localize($"{m_name} ({GetProcessedQueueSize()} $piece_FishnetTrap_ready) \n[$KEY_Use] {m_emptyOreTooltip}"); } private string OnHoverAddOre() { m_sb.Clear(); m_sb.Append($"{m_name} ({GetQueueSize()}/{m_maxOre}) "); m_sb.Append("\n[$KEY_Use] " + m_addOreTooltip); return Localization.instance.Localize(m_sb.ToString()); } } [BepInPlugin("balrond.astafaraios.BalrondShipyard", "BalrondShipyard", "1.6.5")] public class Launch : BaseUnityPlugin { [HarmonyPatch(typeof(ShipyardStation), "Awake")] public static class ShipyardStation_Awake_Path { public static void Prefix(ShipyardStation __instance) { __instance.m_conversions = list; } } [HarmonyPatch(typeof(FishnetTrap), "Awake")] public static class FishnetTrap_Awake_Path { public static void Prefix(FishnetTrap __instance) { __instance.m_conversion = fishConversions; } } [HarmonyPatch(typeof(ShipExtensionManager), "Awake")] public static class ShipExtensionManager_Awake_Path { public static void Prefix(ShipExtensionManager __instance) { if (((Object)((Component)__instance).gameObject).name == "Karve(Clone)") { setupKarvePath(__instance); } if (((Object)((Component)__instance).gameObject).name == "Snekke(Clone)") { setupSnekkePath(__instance); } if (((Object)((Component)__instance).gameObject).name == "VikingShip(Clone)") { setupDrakkarPath(__instance); } if (((Object)((Component)__instance).gameObject).name == "Knarr(Clone)") { setupKnarrPath(__instance); } if (((Object)((Component)__instance).gameObject).name == "Snekke(Clone)") { setupSnekkePath(__instance); } if (((Object)((Component)__instance).gameObject).name == "Holk(Clone)") { setupHolkPath(__instance); } if (((Object)((Component)__instance).gameObject).name == "VikingShip_Ashlands(Clone)") { setupAshlandsDrakkarPath(__instance); } } } [HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[] { typeof(int), typeof(bool), typeof(int), typeof(float) })] public class AddStatusEffectPatch { public static bool Prefix(SEMan __instance, ref int nameHash) { return !__instance.HaveStatusEffect("Waterproof".GetHashCode()) || nameHash != "Wet".GetHashCode(); } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public static class ZNetScene_Awake_Path { public static void Prefix(ZNetScene __instance) { //IL_09ff: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } if ((Object)(object)shipyard == (Object)null) { Debug.Log((object)"THERE IS NO SHIPYARD"); return; } objectRecipes.initPieces(__instance.m_prefabs); GameObject val = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "Hammer"); PieceTable buildPieces = val.GetComponent().m_itemData.m_shared.m_buildPieces; setupRavenGuide(shipyard, __instance.m_prefabs); setupRavenGuide(scribeTable, __instance.m_prefabs); ashlandsUpdateFix(); foreach (GameObject scroll in scrolls) { GameObject val2 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)scroll).name); if ((Object)(object)val2 != (Object)null) { Debug.Log((object)("[SHIP] Scroll already exists in Znet skipping: " + ((Object)scroll).name)); continue; } if (((Object)scroll).name.Contains("Drakkar")) { scroll.GetComponent().m_itemData.m_shared.m_name.Replace("Drakkar", "Longship"); } __instance.m_prefabs.Add(scroll); } foreach (GameObject item in items) { GameObject val3 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)item).name); if ((Object)(object)val3 != (Object)null) { Debug.Log((object)("[SHIP] Item already exists in Znet skipping: " + ((Object)item).name)); continue; } if (((Object)item).name == "CapeSailor") { item.GetComponent().m_itemData.m_shared.m_equipStatusEffect = ObjectDB.instance.GetStatusEffect("Waterproof".GetHashCode()); } __instance.m_prefabs.Add(item); } if (!wasLoaded) { shipExtensionFactory.init(__instance, scrolls); list = shipExtensionFactory.list; shipProcessor.list = shipExtensionFactory.list; listKarve = shipExtensionFactory.listKarve; listSnekke = shipExtensionFactory.listSnekke; listKnarr = shipExtensionFactory.listKnarr; listDrakkar = shipExtensionFactory.listDrakkar; listHolk = shipExtensionFactory.listHolk; listAshlandsDrakkar = shipExtensionFactory.listAshlandsDrakkar; objectRecipes.createHolkRecipe(dvergercarve); objectRecipes.createKnarrRecipe(karr); objectRecipes.createSnekkeRecipe(snekke); objectRecipes.createShipyardRecipe(shipyard); objectRecipes.createScribeTableRecipe(scribeTable); shipProcessor.setupShipyard(__instance, shipyard); buildPieces.m_pieces.Add(shipyard); buildPieces.m_pieces.Add(scribeTable); GameObject val4 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "Karve"); GameObject val5 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "Raft"); GameObject val6 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "VikingShip"); GameObject val7 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "VikingShip_Ashlands"); objectRecipes.createKarveRecipe(val4); objectRecipes.createDrakkarRecipe(val6); objectRecipes.createAshlandsDrakkarRecipe(val7); GameObject val8 = buildPieces.m_pieces.Find((GameObject x) => ((Object)x).name == ((Object)dvergercarve).name); if ((Object)(object)val8 == (Object)null) { buildPieces.m_pieces.Add(dvergercarve); } GameObject val9 = buildPieces.m_pieces.Find((GameObject x) => ((Object)x).name == ((Object)karr).name); if ((Object)(object)val9 == (Object)null) { buildPieces.m_pieces.Add(karr); } GameObject val10 = buildPieces.m_pieces.Find((GameObject x) => ((Object)x).name == ((Object)snekke).name); if ((Object)(object)val9 == (Object)null) { buildPieces.m_pieces.Add(snekke); } objectRecipes.editBuildPieceRecipes(pieces); foreach (GameObject piece2 in pieces) { GameObject val11 = buildPieces.m_pieces.Find((GameObject x) => ((Object)x).name == ((Object)piece2).name); if ((Object)(object)val11 != (Object)null) { Debug.Log((object)("[SHIP] Piece already exists in Hammer: " + ((Object)piece2).name)); } else { buildPieces.m_pieces.Add(piece2); } } if ((Object)(object)val5 != (Object)null) { val5.GetComponent().m_canBeRemoved = true; shipProcessor.addRaftExtensions(raftExtension, val5, __instance); } else { Debug.LogWarning((object)"[SHIP] NO KARVE TO EDIT"); } if ((Object)(object)val4 != (Object)null) { GameObject gameObject = ((Component)val4.transform.Find("piece_chest")).gameObject; gameObject.GetComponent().m_width = 3; gameObject.GetComponent().m_height = 2; shipProcessor.addKarveExtensions(karveExtension, val4, __instance); } else { Debug.Log((object)"[SHIP] NO KARVE TO EDIT"); } if ((Object)(object)karr != (Object)null) { shipProcessor.addKnarrExtensions(knarrExtension, karr, __instance); } else { Debug.Log((object)"[SHIP] NO KNARR TO EDIT"); } if ((Object)(object)snekke != (Object)null) { shipProcessor.addSnekkeExtensions(snekkeExtension, snekke, __instance); } else { Debug.Log((object)"[SHIP] NO SNEKKE TO EDIT"); } if ((Object)(object)dvergercarve != (Object)null) { shipProcessor.addHolkExtensions(holkExtensions, dvergercarve, __instance); } else { Debug.Log((object)"[SHIP] NO HOLK TO EDIT"); } if ((Object)(object)val7 != (Object)null) { GameObject gameObject2 = ((Component)val7.transform.Find("piece_chest")).gameObject; gameObject2.GetComponent().m_width = 8; gameObject2.GetComponent().m_height = 5; shipProcessor.addAshlandsDrakkarExtensions(ashlandsDrakkarExtensions, val7, __instance); } else { Debug.Log((object)"[SHIP] NO DRAKKAR TO EDIT"); } if ((Object)(object)val6 != (Object)null) { GameObject gameObject3 = ((Component)val6.transform.Find("piece_chest")).gameObject; gameObject3.GetComponent().m_width = 6; gameObject3.GetComponent().m_height = 4; shipProcessor.addDrakkarExtensions(drakkarExtensions, val6, __instance); } else { Debug.Log((object)"[SHIP] NO LONGSHIP TO EDIT"); } wasLoaded = true; } foreach (GameObject piece in pieces) { GameObject val12 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)piece).name); if ((Object)(object)val12 != (Object)null) { Debug.Log((object)("[SHIP] Piece already exists in Znet: " + ((Object)piece).name)); } else { __instance.m_prefabs.Add(piece); } } __instance.m_prefabs.Add(projectileAnchor); __instance.m_prefabs.Add(shipyard); __instance.m_prefabs.Add(scribeTable); ((Component)dvergercarve.transform.Find("piece_chest")).GetComponent().m_destroyedLootPrefab = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "CargoCrate"); __instance.m_prefabs.Add(dvergercarve); ((Component)karr.transform.Find("piece_chest")).GetComponent().m_destroyedLootPrefab = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "CargoCrate"); __instance.m_prefabs.Add(karr); ((Component)snekke.transform.Find("piece_chest")).GetComponent().m_destroyedLootPrefab = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "CargoCrate"); __instance.m_prefabs.Add(snekke); if (!new ZNet().IsDedicated()) { ShaderReplacment.runMaterialFix(); } } } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] public static class Object_CopyOtherDB_Path { public static void Postfix() { if (!IsObjectDBValid()) { return; } StatusEffect stat = (StatusEffect)(object)createWateproofStatusEffect(); if ((Object)(object)ObjectDB.instance.m_StatusEffects.Find((StatusEffect x) => ((Object)x).name == ((Object)stat).name) == (Object)null) { ObjectDB.instance.m_StatusEffects.Add(stat); } objectRecipes.recipes = recipes; objectRecipes.initItems(ObjectDB.instance.m_items); foreach (GameObject scroll in scrolls) { AddNewPrefab(scroll); } foreach (GameObject item in items) { AddNewPrefab(item); } List collection = recipeBuilder.createRecipes(ObjectDB.instance.m_items, scrolls, scribeTable, items); recipes.AddRange(collection); foreach (Recipe recipe in recipes) { AddRecipeToObjectDB(recipe); } } } [HarmonyPatch(typeof(ObjectDB), "Awake")] public static class Object_Awake_Path { public static void Postfix() { if (!IsObjectDBValid()) { return; } StatusEffect stat = (StatusEffect)(object)createWateproofStatusEffect(); if ((Object)(object)ObjectDB.instance.m_StatusEffects.Find((StatusEffect x) => ((Object)x).name == ((Object)stat).name) == (Object)null) { ObjectDB.instance.m_StatusEffects.Add(stat); } objectRecipes.initItems(ObjectDB.instance.m_items); objectRecipes.recipes = recipes; foreach (GameObject scroll in scrolls) { AddNewPrefab(scroll); } foreach (GameObject item in items) { AddNewPrefab(item); } foreach (Recipe recipe in recipes) { AddRecipeToObjectDB(recipe); } } } private readonly Harmony harmony = new Harmony("balrond.astafaraios.BalrondShipyard"); public const string PluginGUID = "balrond.astafaraios.BalrondShipyard"; public const string PluginName = "BalrondShipyard"; public const string PluginVersion = "1.6.5"; private static AssetBundle assetBundle; public static GameObject snekkeExtension; public static GameObject karveExtension; public static GameObject knarrExtension; public static GameObject raftExtension; public static GameObject drakkarExtensions; public static GameObject ashlandsDrakkarExtensions; public static GameObject holkExtensions; public static GameObject shipyard; public static bool wasLoaded = false; public static ShipExtensionFactory shipExtensionFactory = new ShipExtensionFactory(); public static List list = new List(); public static List listSnekke = new List(); public static List listKarve = new List(); public static List listKnarr = new List(); public static List listDrakkar = new List(); public static List listAshlandsDrakkar = new List(); public static List listHolk = new List(); public static List texturesKarve = new List(); public static List texturesDrakkar = new List(); public static List texturesRaft = new List(); public static List scrolls = new List(); public static GameObject scribeTable; public static List recipes = new List(); public static ShipProcessor shipProcessor = new ShipProcessor(); public static ObjectRecipes objectRecipes = new ObjectRecipes(); public static List fishConversions = new List(); public static RecipeBuilder recipeBuilder = new RecipeBuilder(); public static Sprite waterProofIco; public static List items = new List(); public static string[] itemNames = new string[8] { "SailInk", "CoalPaste", "HelmetPirateBandana", "HelmetPirateHat", "SledgeAnchor", "CapeSailor", "ShieldSteering", "SwordSaber" }; public static string[] scrollNames = new string[113] { "SchematicDrakkarAnchor", "SchematicDrakkarArmor", "SchematicDrakkarBarrels", "SchematicDrakkarCrates", "SchematicDrakkarLights", "SchematicDrakkarOar", "SchematicDrakkarShields", "SchematicDrakkarTent", "SchematicDrakkarHeadCernyx", "SchematicDrakkarHeadDragon", "SchematicDrakkarHeadOsberg", "SchematicDrakkarHeadSkull", "SchematicDrakkarSailBlack", "SchematicDrakkarSailBlue", "SchematicDrakkarSailGreen", "SchematicDrakkarSailDefault", "SchematicDrakkarSailTransparent", "SchematicDrakkarSailWhite", "SchematicDrakkarSailHound", "SchematicDrakkarSailDruid", "SchematicDrakkarSailWolf", "SchematicDrakkarSailRaven", "SchematicKarveAnchor", "SchematicKarveArmor", "SchematicKarveBag", "SchematicKarveLights", "SchematicKarveOars", "SchematicKarveShields", "SchematicKarveSailBlack", "SchematicKarveSailBlue", "SchematicKarveSailDefault", "SchematicKarveSailGreen", "SchematicKarveSailTransparent", "SchematicKarveSailWhite", "SchematicKarveSailHound", "SchematicKarveSailDruid", "SchematicKarveSailWolf", "SchematicKarveSailRaven", "SchematicKnarrAnchor", "SchematicKnarrArmor", "SchematicKnarrBag", "SchematicKnarrLights", "SchematicKnarrOars", "SchematicKnarrShields", "SchematicKnarrTent", "SchematicKnarrSailBlack", "SchematicKnarrSailBlue", "SchematicKnarrSailDefault", "SchematicKnarrSailDruid", "SchematicKnarrSailGreen", "SchematicKnarrSailHound", "SchematicKnarrSailRaven", "SchematicKnarrSailTransparent", "SchematicKnarrSailWhite", "SchematicKnarrSailWolf", "SchematicHolkAnchor", "SchematicHolkArmor", "SchematicHolkLights", "SchematicHolkOars", "SchematicHolkShields", "SchematicHolkTent", "SchematicHolkBag", "SchematicHolkRopes", "SchematicHolkSailBlack", "SchematicHolkSailBlue", "SchematicHolkSailGreen", "SchematicHolkSailDefault", "SchematicHolkSailTransparent", "SchematicHolkSailWhite", "SchematicHolkSailHound", "SchematicHolkSailDruid", "SchematicHolkSailWolf", "SchematicHolkSailRaven", "SchematicAshlandsDrakkarAnchor", "SchematicAshlandsDrakkarCrates", "SchematicAshlandsDrakkarLights", "SchematicAshlandsDrakkarOar", "SchematicAshlandsDrakkarShields", "SchematicAshlandsDrakkarTent", "SchematicAshlandsDrakkarRopes", "SchematicAshlandsDrakkarSailBlack", "SchematicAshlandsDrakkarSailBlue", "SchematicAshlandsDrakkarSailGreen", "SchematicAshlandsDrakkarSailDefault", "SchematicAshlandsDrakkarSailTransparent", "SchematicAshlandsDrakkarSailWhite", "SchematicAshlandsDrakkarSailHound", "SchematicAshlandsDrakkarSailDruid", "SchematicAshlandsDrakkarSailWolf", "SchematicAshlandsDrakkarSailRaven", "SchematicKnarrNamePlate", "SchematicKarveNamePlate", "SchematicHolkNamePlate", "SchematicAshlandsDrakkarNamePlate", "SchematicDrakkarNamePlate", "SchematicSnekkeAnchor", "SchematicSnekkeArmor", "SchematicSnekkeLights", "SchematicSnekkeOars", "SchematicSnekkeShields", "SchematicSnekkeTent", "SchematicSnekkeBag", "SchematicSnekkeNamePlate", "SchematicSnekkeSailBlack", "SchematicSnekkeSailBlue", "SchematicSnekkeSailGreen", "SchematicSnekkeSailDefault", "SchematicSnekkeSailTransparent", "SchematicSnekkeSailWhite", "SchematicSnekkeSailHound", "SchematicSnekkeSailDruid", "SchematicSnekkeSailWolf", "SchematicSnekkeSailRaven" }; public static List pieces = new List(); public static string[] piecesNames = new string[28] { "tar_wood_wall_log4", "tar_wood_wall_log2", "tar_wood_pole_log4", "tar_wood_pole_log2", "tar_wood_floor", "tar_ladder", "tar_wood_log_26", "tar_wood_log_45", "tar_wood_pole_log1", "tar_wood_ramp", "piece_chest_tarred", "piece_chest_cargo", "piece_iron_wall_torch", "decor_dragon", "bridge_rope", "bridge_rope_support", "bridge_rope_support_side", "cloth_roof", "cloth_roof_corner", "cloth_roof_corner2", "cloth_roof_triangle_sloope", "fishnet_wall", "piece_banner_sail1", "piece_banner_sail2", "piece_ropewall", "piece_ropewall_big", "piece_wisplampceiling", "FishnetTrap" }; public static string[] sailNames = new string[10] { "default_drakkar", "blue_drakkar", "torn_drakkar", "green_drakkar", "transparent_drakkar", "white_drakkar", "sailCross", "yellow_drakkar", "sailDark", "sailVegvisir" }; public static GameObject dvergercarve; public static GameObject karr; public static GameObject snekke; public static GameObject projectileAnchor; private static FieldInfo AttachAnimField = AccessTools.Field(typeof(Player), "m_attachAnimation"); private void Awake() { init(); } private void init() { LoadAllAssetBundles(); shipProcessor.shipyard = shipyard; shipProcessor.texturesDrakkar = texturesDrakkar; shipProcessor.list = shipExtensionFactory.list; harmony.PatchAll(); } private void OnDestroy() { harmony.UnpatchSelf(); } private static bool IsObjectDBValid() { return (Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items.Count != 0 && ObjectDB.instance.m_recipes.Count != 0 && (Object)(object)ObjectDB.instance.GetItemPrefab("Amber") != (Object)null; } public static void LoadAllAssetBundles() { assetBundle = GetAssetBundleFromResources("shipyardnew"); LoadPrefabs(); } public static AssetBundle GetAssetBundleFromResources(string filename) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(filename)); using Stream stream = executingAssembly.GetManifestResourceStream(name); return AssetBundle.LoadFromStream(stream); } private static void LoadPrefabs() { string text = "Assets/Custom/BalrondShipyard/"; waterProofIco = assetBundle.LoadAsset(text + "wateproof_ico.png"); dvergercarve = assetBundle.LoadAsset(text + "prefabs/Holk.prefab"); karr = assetBundle.LoadAsset(text + "prefabs/KnarrBal.prefab"); ((Object)karr).name = "Knarr"; snekke = assetBundle.LoadAsset(text + "prefabs/SnekkeShip_bal.prefab"); ((Object)snekke).name = "Snekke"; setupGateDoor(dvergercarve); ShaderReplacment.Replace(snekke); ShaderReplacment.Replace(karr); ShaderReplacment.Replace(dvergercarve); raftExtension = assetBundle.LoadAsset(text + "prefabs/RaftExtension/RaftExtension.prefab"); projectileAnchor = assetBundle.LoadAsset(text + "prefabs/projectile_anchor.prefab"); karveExtension = assetBundle.LoadAsset(text + "prefabs/KarveExtensions/karveExtension.prefab"); knarrExtension = ((Component)karr.transform.Find("knarrExtension")).gameObject; snekkeExtension = ((Component)snekke.transform.Find("snekkeExtension")).gameObject; holkExtensions = ((Component)dvergercarve.transform.Find("DvergerExtension")).gameObject; ShaderReplacment.Replace(snekkeExtension); ShaderReplacment.Replace(knarrExtension); ShaderReplacment.Replace(holkExtensions); shipyard = assetBundle.LoadAsset(text + "prefabs/pieces/ShipyardStation.prefab"); drakkarExtensions = assetBundle.LoadAsset(text + "prefabs/DrakkarExtensions/DrakkarExtensions.prefab"); ashlandsDrakkarExtensions = assetBundle.LoadAsset(text + "prefabs/AshlandsDrakkarExtensions.prefab"); scribeTable = assetBundle.LoadAsset(text + "prefabs/pieces/piece_scribetable.prefab"); ShaderReplacment.Replace(scribeTable); ShaderReplacment.Replace(karveExtension); ShaderReplacment.Replace(shipyard); ShaderReplacment.Replace(drakkarExtensions); ShaderReplacment.Replace(ashlandsDrakkarExtensions); string[] array = sailNames; foreach (string text2 in array) { Texture val = assetBundle.LoadAsset(text + "sails/" + text2 + ".png"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Sail not found: " + text2)); } else { texturesDrakkar.Add(val); } } string[] array2 = piecesNames; foreach (string text3 in array2) { GameObject val2 = assetBundle.LoadAsset(text + "prefabs/pieces/" + text3 + ".prefab"); if ((Object)(object)val2 == (Object)null) { Debug.LogWarning((object)("Not found: " + text3)); } if (text3 == "FishnetTrap") { Object.DestroyImmediate((Object)(object)val2.GetComponent()); } ShaderReplacment.Replace(val2); pieces.Add(val2); } string[] array3 = scrollNames; foreach (string text4 in array3) { GameObject val3 = assetBundle.LoadAsset(text + "prefabs/schematics/" + text4 + ".prefab"); if ((Object)(object)val3 == (Object)null) { Debug.LogWarning((object)("Not found: " + text4)); } ShaderReplacment.Replace(val3); scrolls.Add(val3); } string[] array4 = itemNames; foreach (string text5 in array4) { GameObject val4 = assetBundle.LoadAsset(text + "prefabs/items/" + text5 + ".prefab"); if ((Object)(object)val4 == (Object)null) { Debug.LogWarning((object)("Not found: " + text5)); } ShaderReplacment.Replace(val4); items.Add(val4); } } public static void setupGateDoor(GameObject gameObject) { GameObject gameObject2 = ((Component)gameObject.transform.Find("DvergerExtension/ramp_door")).gameObject; if ((Object)(object)gameObject2 == (Object)null) { Debug.LogWarning((object)"Cant find ramp !"); return; } Door component = gameObject2.GetComponent(); ShipRamp shipRamp = gameObject2.AddComponent(); shipRamp.m_nview = gameObject.GetComponent(); shipRamp.m_name = component.m_name; shipRamp.m_openEffects = component.m_openEffects; shipRamp.m_openEnable = component.m_openEnable; shipRamp.m_closeEffects = component.m_closeEffects; } public static void setupRavenGuide(GameObject gameObject, List gameObjects) { GameObject gameObject2 = ((Component)gameObject.transform.Find("GuidePoint")).gameObject; GameObject val = gameObjects.Find((GameObject x) => ((Object)x).name == "piece_workbench"); GameObject gameObject3 = ((Component)val.transform.Find("GuidePoint")).gameObject; GameObject ravenPrefab = gameObject3.GetComponent().m_ravenPrefab; if ((Object)(object)ravenPrefab == (Object)null) { Debug.LogWarning((object)"Ravens not found"); } else { gameObject2.GetComponent().m_ravenPrefab = ravenPrefab; } } public static void setupDrakkarPath(ShipExtensionManager __instance) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) GameObject val = ((Component)((Component)__instance).transform.Find("DrakkarExtensions")).gameObject; if ((Object)(object)val == (Object)null) { val = ((Component)((Component)__instance).transform.Find("DrakkarExtensions(Clone)")).gameObject; if ((Object)(object)val == (Object)null) { val = Object.Instantiate(drakkarExtensions, Vector3.zero, Quaternion.identity); shipProcessor.setPosition(val, ((Component)__instance).gameObject); } } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"I PATCHED AND NOT FOUND EXTENSIONS FOR DRAKKAR"); } if ((Object)(object)val != (Object)null) { __instance.lights = ((Component)val.transform.Find("Lamps")).gameObject; __instance.anchor = ((Component)val.transform.Find("Anchor")).gameObject; __instance.oars = ((Component)val.transform.Find("Oars")).gameObject; __instance.shields = ((Component)val.transform.Find("shieldset")).gameObject; __instance.roof = ((Component)val.transform.Find("Roof")).gameObject; __instance.lampheat = ((Component)val.transform.Find("LampWarm")).gameObject; __instance.fishnet = ((Component)val.transform.Find("fishnet")).gameObject; __instance.armor = ((Component)val.transform.Find("carapacehull")).gameObject; __instance.ram = ((Component)val.transform.Find("BatteringRam")).gameObject; __instance.nameplate = ((Component)val.transform.Find("shipplate")).gameObject; __instance.nameplate.SetActive(false); } __instance.shipExtensions = listDrakkar; Transform val2 = ((Component)__instance).gameObject.transform.Find("ship").Find("visual"); GameObject gameObject = ((Component)val2.Find("Customize")).gameObject; gameObject.SetActive(true); __instance.customize = gameObject; __instance.sail = ((Component)val2.Find("Mast").Find("Sail").Find("sail_full")).gameObject; __instance.textures = texturesDrakkar; shipProcessor.setupNamePlate(__instance.nameplate, ((Component)__instance).GetComponent()); shipProcessor.setupFishnet(__instance.fishnet, ((Component)__instance).GetComponent()); shipProcessor.setupShipHeads(((Component)__instance).gameObject); shipProcessor.setupShipLamps(__instance.customize); shipProcessor.setupShipShieldsAndCrates(__instance.customize); shipProcessor.setupShipTent(__instance.customize); } public static void setupAshlandsDrakkarPath(ShipExtensionManager __instance) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) GameObject val = ((Component)((Component)__instance).transform.Find("AshlandsDrakkarExtensions")).gameObject; if ((Object)(object)val == (Object)null) { val = ((Component)((Component)__instance).transform.Find("AshlandsDrakkarExtensions(Clone)")).gameObject; if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"Extension not found on clone"); val = Object.Instantiate(ashlandsDrakkarExtensions, Vector3.zero, Quaternion.identity); shipProcessor.setPosition(val, ((Component)__instance).gameObject); } } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"I PATCHED AND NOT FOUND EXTENSIONS FOR HOLK"); } Ship component = ((Component)__instance).GetComponent(); shipProcessor.addAshlandsDrakkarExtensions(val, ((Component)component).gameObject, ZNetScene.instance); __instance.textures = texturesDrakkar; } public static void setupHolkPath(ShipExtensionManager __instance) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) GameObject val = ((Component)((Component)__instance).transform.Find("DvergerExtension")).gameObject; if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"Extension not found on ship"); val = ((Component)((Component)__instance).transform.Find("DvergerExtension(Clone)")).gameObject; if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"Extension not found on clone"); val = Object.Instantiate(holkExtensions, Vector3.zero, Quaternion.identity); shipProcessor.setPosition(val, ((Component)__instance).gameObject); } } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"I PATCHED AND NOT FOUND EXTENSIONS FOR HOLK"); } Ship component = ((Component)__instance).GetComponent(); shipProcessor.addHolkExtensions(val, ((Component)component).gameObject, ZNetScene.instance); __instance.textures = texturesDrakkar; } public static void setupKarvePath(ShipExtensionManager __instance) { GameObject val = ((Component)((Component)__instance).transform.Find("karveExtension")).gameObject; if ((Object)(object)val == (Object)null) { val = ((Component)((Component)__instance).transform.Find("karveExtension(Clone)")).gameObject; if ((Object)(object)val == (Object)null) { val = Object.Instantiate(karveExtension); shipProcessor.setPosition(val, ((Component)__instance).gameObject); } } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"I PATCHED AND NOT FOUND EXTENSIONS FOR KARVE"); return; } shipProcessor.addKarveExtensions(val, ((Component)__instance).gameObject, ZNetScene.instance); __instance.textures = texturesDrakkar; } public static void setupKnarrPath(ShipExtensionManager __instance) { GameObject val = ((Component)((Component)__instance).transform.Find("knarrExtension")).gameObject; if ((Object)(object)val == (Object)null) { val = ((Component)((Component)__instance).transform.Find("knarrExtension(Clone)")).gameObject; if ((Object)(object)val == (Object)null) { val = Object.Instantiate(knarrExtension); } } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"I PATCHED AND NOT FOUND EXTENSIONS FOR KNARR"); return; } shipProcessor.addKnarrExtensions(val, ((Component)__instance).gameObject, ZNetScene.instance); __instance.textures = texturesDrakkar; } public static void setupSnekkePath(ShipExtensionManager __instance) { GameObject val = ((Component)((Component)__instance).transform.Find("snekkeExtension")).gameObject; if ((Object)(object)val == (Object)null) { val = ((Component)((Component)__instance).transform.Find("snekkeExtension(Clone)")).gameObject; if ((Object)(object)val == (Object)null) { val = Object.Instantiate(snekkeExtension); } } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"I PATCHED AND NOT FOUND EXTENSIONS FOR SNEKKE"); return; } shipProcessor.addSnekkeExtensions(val, ((Component)__instance).gameObject, ZNetScene.instance); __instance.textures = texturesDrakkar; } [HarmonyPostfix] [HarmonyPatch(typeof(Ship), "OnTriggerEnter")] [HarmonyPatch(typeof(Ship), "OnTriggerExit")] public static void Ship_EnterExit(Collider collider, Ship __instance, List ___m_players) { if (Object.op_Implicit((Object)(object)((Component)collider).GetComponent())) { __instance.m_backwardForce = CalculateForce(___m_players.Count); } } [HarmonyPostfix] [HarmonyPatch(typeof(Ship), "UpdateOwner")] public static void Ship_UpdateOwner(Ship __instance, List ___m_players) { ShipExtensionManager component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.isOarActive()) { int count = ___m_players.FindAll((Player p) => ((Character)p).IsAttached() && (string)AttachAnimField.GetValue(p) == "attach_chair").Count; __instance.m_backwardForce = CalculateForce(count); Debug.Log((object)("Ship ID:" + ((Object)__instance).GetInstanceID() + " sitting player count:" + count + " paddle force:" + __instance.m_backwardForce)); } } public static bool isPaddleForceActive() { return true; } public static bool isLinear() { return true; } public static float CalculateForce(int playerCount) { if (playerCount <= 0 || !isPaddleForceActive()) { return 0.5f; } if (isLinear()) { return Mathf.Min(0.5f + 0.25f * (float)(playerCount - 1), 3f); } float num = 0.55f; float num2 = Mathf.Clamp(0.875f, 1E-05f, 0.99999f); return num * (float)((1.0 - (double)Mathf.Pow(num2, (float)playerCount)) / (1.0 - (double)num2)); } public static void ashlandsUpdateFix() { //IL_001a: 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) ImpactEffect component = dvergercarve.GetComponent(); ImpactEffect component2 = karr.GetComponent(); component.m_hitType = (HitType)17; component2.m_hitType = (HitType)17; WearNTear component3 = dvergercarve.GetComponent(); WearNTear component4 = karr.GetComponent(); component3.m_burnable = true; component4.m_burnable = true; Rigidbody component5 = dvergercarve.GetComponent(); Rigidbody component6 = karr.GetComponent(); component5.automaticCenterOfMass = true; component5.automaticInertiaTensor = true; component5.useGravity = true; component6.automaticCenterOfMass = true; component6.automaticInertiaTensor = true; component6.useGravity = true; Ship component7 = dvergercarve.GetComponent(); Ship component8 = karr.GetComponent(); component7.m_ashDamageMsgTime = 10f; component8.m_ashDamageMsgTime = 10f; component7.m_ashdamageEffects = ((Component)((Component)component7).transform.Find("ashlandeffects")).gameObject; component8.m_ashdamageEffects = ((Component)((Component)component8).transform.Find("ashlandeffects")).gameObject; } public static SE_WetImmunity createWateproofStatusEffect() { SE_WetImmunity sE_WetImmunity = ScriptableObject.CreateInstance(); ((Object)sE_WetImmunity).name = "Waterproof"; ((StatusEffect)sE_WetImmunity).m_icon = waterProofIco; return sE_WetImmunity; } private static void AddRecipeToObjectDB(Recipe recipe) { int num = ObjectDB.instance.m_recipes.RemoveAll((Recipe x) => ((Object)x).name == ((Object)recipe).name); if (num > 0) { } ObjectDB.instance.m_recipes.Add(recipe); } private static void AddNewPrefab(GameObject newPrefab) { if ((Object)(object)newPrefab == (Object)null) { return; } if (((Object)newPrefab).name == "CapeSailor") { newPrefab.GetComponent().m_itemData.m_shared.m_equipStatusEffect = ObjectDB.instance.GetStatusEffect("Waterproof".GetHashCode()); } ItemDrop component = newPrefab.GetComponent(); if ((Object)(object)component != (Object)null) { if (((Object)newPrefab).name.Contains("Drakkar")) { component.m_itemData.m_shared.m_name.Replace("Drakkar", "Longship"); } if ((Object)(object)ObjectDB.instance.GetItemPrefab(((Object)newPrefab).name) == (Object)null) { ObjectDB.instance.m_items.Add(newPrefab); Dictionary dictionary = (Dictionary)typeof(ObjectDB).GetField("m_itemByHash", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ObjectDB.instance); dictionary[StringExtensionMethods.GetStableHashCode(((Object)newPrefab).name)] = newPrefab; } } else { Debug.LogError((object)(((Object)newPrefab).name + " - ItemDrop not found on prefab")); } } } public class ObjectRecipes { public List zNetItems; public List ObjectDbItems; public List recipes; public List hammerTables; private string[] fishBaitNames = new string[9] { "FishingBait", "FishingBaitSwamp", "FishingBaitPlains", "FishingBaitOcean", "FishingBaitMistlands", "FishingBaitForest", "FishingBaitDeepNorth", "FishingBaitCave", "FishingBaitAshlands" }; public void initPieces(List items) { zNetItems = items; } public void initItems(List items) { ObjectDbItems = items; GameObject val = ObjectDbItems.Find((GameObject x) => ((Object)x).name == "Hammer"); hammerTables = val.GetComponent().m_itemData.m_shared.m_buildPieces.m_pieces.FindAll((GameObject x) => (Object)(object)x.GetComponent() != (Object)null); } public void editBuildPieceRecipes(List buildables) { foreach (GameObject buildable in buildables) { if ((Object)(object)buildable == (Object)null) { Debug.LogWarning((object)"BUILD PIECE IS NULL SOMETHING DID NOT LOAD"); continue; } List list = new List(); Piece component = buildable.GetComponent(); if (((Object)buildable).name.Contains("tar_")) { component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); switch (((Object)buildable).name) { case "tar_wood_wall_log4": list.Add(GetRequirement("CoalPaste", 2, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 4, 0, zNetItems)); break; case "tar_wood_wall_log2": list.Add(GetRequirement("CoalPaste", 1, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 2, 0, zNetItems)); break; case "tar_wood_pole_log4": list.Add(GetRequirement("CoalPaste", 2, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 4, 0, zNetItems)); break; case "tar_wood_pole_log2": list.Add(GetRequirement("CoalPaste", 1, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 2, 0, zNetItems)); break; case "tar_wood_floor": list.Add(GetRequirement("CoalPaste", 1, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 2, 0, zNetItems)); break; case "tar_ladder": list.Add(GetRequirement("CoalPaste", 2, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 3, 0, zNetItems)); break; case "tar_wood_log_26": list.Add(GetRequirement("CoalPaste", 1, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 2, 0, zNetItems)); break; case "tar_wood_log_45": list.Add(GetRequirement("CoalPaste", 1, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 2, 0, zNetItems)); break; case "tar_wood_pole_log1": list.Add(GetRequirement("CoalPaste", 1, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 1, 0, zNetItems)); break; case "tar_wood_ramp": list.Add(GetRequirement("CoalPaste", 1, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 2, 0, zNetItems)); break; } component.m_resources = list.ToArray(); continue; } component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "forge").GetComponent(); switch (((Object)buildable).name) { case "decor_dragon": list.Add(GetRequirement("Coal", 1, 0, zNetItems)); list.Add(GetRequirement("Iron", 1, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 2, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "piece_chest_cargo": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("CoalPaste", 2, 0, zNetItems)); list.Add(GetRequirement("IronNails", 24, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 2, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "piece_chest_tarred": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("Tar", 5, 0, zNetItems)); list.Add(GetRequirement("IronNails", 64, 0, zNetItems)); list.Add(GetRequirement("FineWood", 20, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 10, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "piece_iron_wall_torch": list.Add(GetRequirement("CoalPaste", 1, 0, zNetItems)); list.Add(GetRequirement("Iron", 1, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 2, 0, zNetItems)); list.Add(GetRequirement("Tar", 2, 0, zNetItems)); component.m_resources = list.ToArray(); ((Component)component).gameObject.GetComponent().m_fuelItem = zNetItems.Find((GameObject x) => ((Object)x).name == "Tar").GetComponent(); break; case "bridge_rope": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 3, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "bridge_rope_support": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 6, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 2, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "bridge_rope_support_side": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 3, 0, zNetItems)); list.Add(GetRequirement("RoundLog", 1, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "cloth_roof": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 1, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 6, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "cloth_roof_corner": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 1, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 6, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "cloth_roof_corner2": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 1, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 6, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "cloth_roof_triangle_sloope": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 1, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 6, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "fishnet_wall": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 1, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 6, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "piece_banner_sail1": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 2, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 2, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "piece_banner_sail2": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 2, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 2, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "piece_ropewall": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 2, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 2, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "piece_ropewall_big": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 2, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 2, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "piece_wisplampceiling": component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("Wisp", 3, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 3, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 8, 0, zNetItems)); list.Add(GetRequirement("Iron", 1, 0, zNetItems)); component.m_resources = list.ToArray(); break; case "FishnetTrap": ((Behaviour)component).enabled = false; component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); list.Add(GetRequirement("FineWood", 4, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 8, 0, zNetItems)); list.Add(GetRequirement("IronNails", 14, 0, zNetItems)); list.Add(GetRequirement("CoalPaste", 4, 0, zNetItems)); list.Add(GetRequirement("FishingBait", 10, 0, zNetItems)); component.m_resources = list.ToArray(); setupFishtrap(component); break; default: Debug.LogWarning((object)("Unknown piece: " + ((Object)buildable).name)); break; } } } private void setupFishtrap(Piece piece) { FishnetTrap fishnetTrap = ((Component)piece).gameObject.GetComponent(); if ((Object)(object)fishnetTrap == (Object)null) { fishnetTrap = ((Component)piece).gameObject.AddComponent(); fishnetTrap.m_container = ((Component)((Component)piece).transform.Find("piece_chest")).GetComponent(); fishnetTrap.m_addOreSwitch = ((Component)((Component)piece).transform.Find("add_ore")).GetComponent(); fishnetTrap.m_haveOreObject = ((Component)((Component)piece).transform.Find("have_ore")).gameObject; fishnetTrap.m_enabledObject = ((Component)((Component)piece).transform.Find("_enabled")).gameObject; fishnetTrap.m_full = ((Component)((Component)piece).transform.Find("full")).gameObject; } Launch.setupRavenGuide(((Component)fishnetTrap).gameObject, zNetItems); setupFishtrapConversions(fishnetTrap); fishnetTrap.m_container.m_destroyedLootPrefab = zNetItems.Find((GameObject x) => ((Object)x).name == "CargoCrate"); } private void setupFishtrapConversions(FishnetTrap FishnetTrap) { List list = new List(); string[] array = fishBaitNames; foreach (string name in array) { FishnetTrap.ItemConversion itemConversion = singleConversion(name); if (itemConversion != null) { list.Add(itemConversion); } } Launch.fishConversions = list; FishnetTrap.m_conversion = list; } private FishnetTrap.ItemConversion singleConversion(string name) { string[] othernames = new string[3] { "Fish1", "Fish2", "Fish3" }; return name switch { "FishingBait" => setupFishConversion(name, "Fish2", othernames, (Biome)1), "FishingBaitSwamp" => setupFishConversion(name, "Fish6", othernames, (Biome)2), "FishingBaitPlains" => setupFishConversion(name, "Fish7", othernames, (Biome)16), "FishingBaitOcean" => setupFishConversion(name, "Fish8", othernames, (Biome)256), "FishingBaitMistlands" => setupFishConversion(name, "Fish12", othernames, (Biome)512), "FishingBaitForest" => setupFishConversion(name, "Fish5", othernames, (Biome)8), "FishingBaitDeepNorth" => setupFishConversion(name, "Fish10", othernames, (Biome)64), "FishingBaitCave" => setupFishConversion(name, "Fish4_cave", othernames, (Biome)4), "FishingBaitAshlands" => setupFishConversion(name, "Fish11", othernames, (Biome)32), _ => null, }; } private FishnetTrap.ItemConversion setupFishConversion(string from, string to, string[] othernames, Biome biome) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) FishnetTrap.ItemConversion itemConversion = new FishnetTrap.ItemConversion(); itemConversion.m_seconds = 0; itemConversion.m_biome = biome; itemConversion.m_from = zNetItems.Find((GameObject x) => ((Object)x).name == from).GetComponent(); itemConversion.m_to = zNetItems.Find((GameObject x) => ((Object)x).name == to).GetComponent(); itemConversion.m_options = new List(); foreach (string name in othernames) { itemConversion.m_options.Add(zNetItems.Find((GameObject x) => ((Object)x).name == name).GetComponent()); } return itemConversion; } public void createAshlandsDrakkarRecipe(GameObject shipyard) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) Piece component = shipyard.GetComponent(); List list = new List(); list.Add(GetRequirement("FineWood", 50, 0, zNetItems)); list.Add(GetRequirement("IronNails", 350, 0, zNetItems)); list.Add(GetRequirement("Tar", 25, 0, zNetItems)); list.Add(GetRequirement("YggdrasilWood", 40, 0, zNetItems)); list.Add(GetRequirement("CeramicPlate", 40, 0, zNetItems)); component.m_resources = list.ToArray(); component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); component.m_comfort = 5; component.m_comfortGroup = (ComfortGroup)4; } public void createDrakkarRecipe(GameObject shipyard) { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) Piece component = shipyard.GetComponent(); List list = new List(); list.Add(GetRequirement("FineWood", 45, 0, zNetItems)); list.Add(GetRequirement("IronNails", 200, 0, zNetItems)); list.Add(GetRequirement("CoalPaste", 40, 0, zNetItems)); list.Add(GetRequirement("WolfPelt", 12, 0, zNetItems)); list.Add(GetRequirement("JuteRed", 4, 0, zNetItems)); component.m_resources = list.ToArray(); component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); component.m_comfort = 4; component.m_comfortGroup = (ComfortGroup)4; } public void createSnekkeRecipe(GameObject shipyard) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) Piece component = shipyard.GetComponent(); List list = new List(); list.Add(GetRequirement("FineWood", 40, 0, zNetItems)); list.Add(GetRequirement("IronNails", 100, 0, zNetItems)); list.Add(GetRequirement("CoalPaste", 30, 0, zNetItems)); list.Add(GetRequirement("TrollHide", 16, 0, zNetItems)); list.Add(GetRequirement("ElderBark", 30, 0, zNetItems)); component.m_resources = list.ToArray(); component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); component.m_comfort = 3; component.m_comfortGroup = (ComfortGroup)4; } public void createKarveRecipe(GameObject shipyard) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) Piece component = shipyard.GetComponent(); List list = new List(); list.Add(GetRequirement("FineWood", 30, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 90, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 16, 0, zNetItems)); list.Add(GetRequirement("DeerHide", 10, 0, zNetItems)); list.Add(GetRequirement("CoalPaste", 20, 0, zNetItems)); component.m_resources = list.ToArray(); component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); component.m_comfort = 2; component.m_comfortGroup = (ComfortGroup)4; } public void createKnarrRecipe(GameObject shipyard) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) Piece component = shipyard.GetComponent(); List list = new List(); list.Add(GetRequirement("FineWood", 35, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 120, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 14, 0, zNetItems)); list.Add(GetRequirement("TrollHide", 12, 0, zNetItems)); list.Add(GetRequirement("CoalPaste", 25, 0, zNetItems)); component.m_resources = list.ToArray(); component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); component.m_comfort = 2; component.m_comfortGroup = (ComfortGroup)4; } public void createHolkRecipe(GameObject shipyard) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) Piece component = shipyard.GetComponent(); List list = new List(); list.Add(GetRequirement("YggdrasilWood", 50, 0, zNetItems)); list.Add(GetRequirement("IronNails", 400, 0, zNetItems)); list.Add(GetRequirement("ElderBark", 50, 0, zNetItems)); list.Add(GetRequirement("LoxPelt", 12, 0, zNetItems)); list.Add(GetRequirement("Tar", 20, 0, zNetItems)); component.m_resources = list.ToArray(); component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); component.m_comfort = 5; component.m_comfortGroup = (ComfortGroup)4; } public void createShipyardRecipe(GameObject shipyard) { Piece component = shipyard.GetComponent(); List list = new List(); list.Add(GetRequirement("FineWood", 30, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 200, 0, zNetItems)); list.Add(GetRequirement("Coal", 25, 0, zNetItems)); list.Add(GetRequirement("DeerHide", 10, 0, zNetItems)); list.Add(GetRequirement("Resin", 25, 0, zNetItems)); component.m_resources = list.ToArray(); component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "forge").GetComponent(); } public void createScribeTableRecipe(GameObject table) { Piece component = table.GetComponent(); List list = new List(); list.Add(GetRequirement("FineWood", 15, 0, zNetItems)); list.Add(GetRequirement("Wood", 15, 0, zNetItems)); list.Add(GetRequirement("BronzeNails", 55, 0, zNetItems)); list.Add(GetRequirement("LeatherScraps", 15, 0, zNetItems)); list.Add(GetRequirement("Feathers", 10, 0, zNetItems)); component.m_resources = list.ToArray(); component.m_craftingStation = zNetItems.Find((GameObject x) => ((Object)x).name == "piece_workbench").GetComponent(); } private Requirement GetRequirement(string name, int amount, int amountPerLevel = 0, List itemlist = null) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown Requirement val = new Requirement(); val.m_amount = amount; val.m_amountPerLevel = amountPerLevel; val.m_recover = true; val.m_resItem = itemlist.Find((GameObject x) => ((Object)x).name == name).GetComponent(); return val; } } public class RecipeBuilder { private List pieces; private List items; private List newItems; public List recipes = new List(); private CraftingStation cauldron; private CraftingStation workbench; private CraftingStation forge; private CraftingStation blackforge; private CraftingStation stoneCutter; private CraftingStation artisian; private CraftingStation runeforge; private CraftingStation tannery; private CraftingStation fletcher; private CraftingStation grill; private CraftingStation alchemylab; private CraftingStation scribe; public List createRecipes(List items, List newItems, GameObject scribeTable, List aditionals) { this.items = items; this.newItems = newItems; this.newItems.AddRange(aditionals); pieces = items.Find((GameObject x) => ((Object)x).name == "Hammer").GetComponent().m_itemData.m_shared.m_buildPieces.m_pieces; prepareTables(); scribe = scribeTable.GetComponent(); CraftingStation val = scribe; int minStationLevel = 1; foreach (GameObject newItem in newItems) { if (!(((Object)newItem).name == "SchematicDrakkarFishnet") && !(((Object)newItem).name == "SchematicDrakkarRam") && !(((Object)newItem).name == "SchematicHolkCage")) { Recipe val2 = ScriptableObject.CreateInstance(); val2.m_craftingStation = val; val2.m_repairStation = val; val2.m_minStationLevel = minStationLevel; val2 = createResources(newItem, val2); recipes.Add(val2); } } return recipes; } private void prepareTables() { cauldron = FindStation(pieces, "piece_cauldron"); workbench = FindStation(pieces, "piece_workbench"); forge = FindStation(pieces, "forge"); blackforge = FindStation(pieces, "blackforge"); stoneCutter = FindStation(pieces, "piece_stonecutter"); artisian = FindStation(pieces, "piece_artisanstation"); runeforge = FindStation(pieces, "piece_runeforge"); tannery = FindStation(pieces, "piece_tannery"); fletcher = FindStation(pieces, "piece_fletcher"); grill = FindStation(pieces, "piece_grill"); alchemylab = FindStation(pieces, "piece_alchemylab"); } private Recipe createResources(GameObject item, Recipe newRecipe) { ((Object)newRecipe).name = "Recipe_" + ((Object)item).name; newRecipe.m_item = item.GetComponent(); newRecipe.m_amount = 1; newRecipe.m_enabled = true; List list = new List(); newRecipe.m_craftingStation = scribe; newRecipe.m_minStationLevel = 1; switch (((Object)item).name) { case "SailInk": newRecipe.m_craftingStation = scribe; newRecipe.m_repairStation = scribe; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 4; list.Add(createReq("Blueberries", 7)); list.Add(createReq("Cloudberry", 4)); list.Add(createReq("Raspberry", 7)); list.Add(createReq("Coal", 7)); list.Add(createReq("Carrot", 6)); list.Add(createReq("Bloodbag", 5)); list.Add(createReq("Guck", 4)); list.Add(createReq("GiantBloodSack", 2)); list.Add(createReq("Charredskull", 2)); list.Add(createReq("CharredBone", 2)); newRecipe.m_requireOnlyOneIngredient = true; break; case "ShieldSteering": newRecipe.m_craftingStation = workbench; newRecipe.m_repairStation = workbench; newRecipe.m_minStationLevel = 3; list.Add(createReq("FineWood", 10, 5)); list.Add(createReq("Iron", 10, 5)); list.Add(createReq("LeatherScraps", 12, 6)); list.Add(createReq("CoalPaste", 6, 3)); break; case "SwordSaber": newRecipe.m_craftingStation = workbench; newRecipe.m_repairStation = workbench; newRecipe.m_minStationLevel = 3; list.Add(createReq("RoundLog", 4, 2)); list.Add(createReq("Iron", 12, 6)); list.Add(createReq("CoalPaste", 4, 2)); list.Add(createReq("LeatherScraps", 12, 6)); break; case "CapeSailor": newRecipe.m_craftingStation = workbench; newRecipe.m_repairStation = workbench; newRecipe.m_minStationLevel = 3; list.Add(createReq("SerpentScale", 9, 4)); list.Add(createReq("LeatherScraps", 12, 6)); list.Add(createReq("CoalPaste", 6, 3)); list.Add(createReq("TrollHide", 6, 3)); break; case "CoalPaste": newRecipe.m_amount = 4; newRecipe.m_craftingStation = workbench; newRecipe.m_repairStation = workbench; newRecipe.m_minStationLevel = 3; list.Add(createReq("Coal", 2)); list.Add(createReq("Resin", 4)); break; case "HelmetPirateBandana": newRecipe.m_craftingStation = workbench; newRecipe.m_repairStation = workbench; newRecipe.m_minStationLevel = 3; list.Add(createReq("JuteRed", 8, 4)); list.Add(createReq("LeatherScraps", 10, 5)); list.Add(createReq("CoalPaste", 6, 3)); list.Add(createReq("TrophySerpent", 1)); break; case "HelmetPirateHat": newRecipe.m_craftingStation = workbench; newRecipe.m_repairStation = workbench; newRecipe.m_minStationLevel = 3; list.Add(createReq("HelmetPirateBandana", 1)); list.Add(createReq("SailInk", 10, 5)); list.Add(createReq("LoxPelt", 4, 2)); list.Add(createReq("Feathers", 14, 7)); break; case "SledgeAnchor": newRecipe.m_craftingStation = forge; newRecipe.m_repairStation = forge; list.Add(createReq("Iron", 38, 18)); list.Add(createReq("LeatherScraps", 20, 10)); list.Add(createReq("Chain", 2, 1)); list.Add(createReq("TrophySerpent", 1)); break; case "SchematicSnekkeNamePlate": case "SchematicKnarrNamePlate": case "SchematicKarveNamePlate": case "SchematicHolkNamePlate": case "SchematicAshlandsDrakkarNamePlate": case "SchematicDrakkarNamePlate": list.Add(createReq("Wood", 2)); list.Add(createReq("Coal", 2)); break; case "SchematicDrakkarArmor": list.Add(createReq("Carapace", 20)); list.Add(createReq("BlackMetal", 16)); list.Add(createReq("Guck", 20)); list.Add(createReq("Chain", 8)); break; case "SchematicDrakkarAnchor": list.Add(createReq("Iron", 13)); list.Add(createReq("CoalPaste", 20)); list.Add(createReq("FineWood", 10)); list.Add(createReq("Chain", 3)); break; case "SchematicDrakkarBarrels": list.Add(createReq("IronNails", 57)); list.Add(createReq("Resin", 30)); list.Add(createReq("FineWood", 10)); list.Add(createReq("Wood", 20)); break; case "SchematicDrakkarCrates": list.Add(createReq("Tar", 6)); list.Add(createReq("BlackMetal", 8)); list.Add(createReq("FineWood", 25)); list.Add(createReq("IronNails", 33)); break; case "SchematicDrakkarLights": list.Add(createReq("FineWood", 10)); list.Add(createReq("IronNails", 37)); list.Add(createReq("Copper", 5)); break; case "SchematicDrakkarFishnet": newRecipe.m_enabled = false; list.Add(createReq("Wood", 10)); list.Add(createReq("FineWood", 5)); list.Add(createReq("RoundLog", 10)); break; case "SchematicDrakkarOar": list.Add(createReq("Wood", 10)); list.Add(createReq("FineWood", 5)); list.Add(createReq("RoundLog", 10)); break; case "SchematicDrakkarRam": newRecipe.m_enabled = false; list.Add(createReq("Iron", 33)); list.Add(createReq("MechanicalSpring", 5)); list.Add(createReq("Tar", 20)); list.Add(createReq("Carapace", 33)); break; case "SchematicDrakkarShields": list.Add(createReq("IronNails", 88)); list.Add(createReq("RoundLog", 12)); list.Add(createReq("Resin", 20)); list.Add(createReq("DeerHide", 15)); break; case "SchematicDrakkarTent": list.Add(createReq("JuteRed", 5)); list.Add(createReq("IronNails", 23)); list.Add(createReq("FineWood", 10)); list.Add(createReq("WolfPelt", 3)); break; case "SchematicDrakkarHeadCernyx": case "SchematicDrakkarHeadDragon": case "SchematicDrakkarHeadOsberg": case "SchematicDrakkarHeadSkull": list.Add(createReq("FineWood", 4)); list.Add(createReq("Tin", 2)); break; case "SchematicKnarrArmor": list.Add(createReq("Carapace", 16)); list.Add(createReq("BlackMetal", 14)); list.Add(createReq("Guck", 16)); list.Add(createReq("Chain", 4)); break; case "SchematicSnekkeArmor": list.Add(createReq("Carapace", 18)); list.Add(createReq("BlackMetal", 16)); list.Add(createReq("Guck", 16)); list.Add(createReq("Chain", 4)); break; case "SchematicKarveArmor": list.Add(createReq("Carapace", 12)); list.Add(createReq("BlackMetal", 12)); list.Add(createReq("Guck", 12)); list.Add(createReq("Chain", 4)); break; case "SchematicKnarrAnchor": list.Add(createReq("Bronze", 8)); list.Add(createReq("CoalPaste", 6)); list.Add(createReq("LeatherScraps", 16)); list.Add(createReq("Wood", 14)); break; case "SchematicSnekkeAnchor": list.Add(createReq("Iron", 8)); list.Add(createReq("CoalPaste", 6)); list.Add(createReq("LeatherScraps", 16)); list.Add(createReq("RoundLog", 10)); break; case "SchematicKarveAnchor": list.Add(createReq("Bronze", 6)); list.Add(createReq("CoalPaste", 4)); list.Add(createReq("LeatherScraps", 12)); list.Add(createReq("Wood", 10)); break; case "SchematicKnarrBag": list.Add(createReq("LeatherScraps", 12)); list.Add(createReq("Tin", 4)); list.Add(createReq("BronzeNails", 20)); list.Add(createReq("FineWood", 14)); break; case "SchematicSnekkeBag": list.Add(createReq("LeatherScraps", 14)); list.Add(createReq("Tin", 6)); list.Add(createReq("IronNails", 30)); list.Add(createReq("FineWood", 16)); break; case "SchematicKarveBag": list.Add(createReq("LeatherScraps", 10)); list.Add(createReq("Tin", 3)); list.Add(createReq("BronzeNails", 15)); list.Add(createReq("FineWood", 10)); break; case "SchematicKnarrLights": list.Add(createReq("CoalPaste", 12)); list.Add(createReq("BronzeNails", 35)); list.Add(createReq("Tin", 6)); list.Add(createReq("FineWood", 12)); break; case "SchematicSnekkeLights": list.Add(createReq("CoalPaste", 12)); list.Add(createReq("IronNails", 55)); list.Add(createReq("Tin", 8)); list.Add(createReq("FineWood", 16)); break; case "SchematicKarveLights": list.Add(createReq("CoalPaste", 8)); list.Add(createReq("BronzeNails", 25)); list.Add(createReq("Tin", 4)); list.Add(createReq("FineWood", 8)); break; case "SchematicKnarrOars": list.Add(createReq("Wood", 7)); list.Add(createReq("FineWood", 4)); list.Add(createReq("RoundLog", 6)); list.Add(createReq("CoalPaste", 6)); break; case "SchematicSnekkeOars": list.Add(createReq("Wood", 8)); list.Add(createReq("FineWood", 5)); list.Add(createReq("RoundLog", 7)); list.Add(createReq("CoalPaste", 7)); break; case "SchematicKarveOars": list.Add(createReq("Wood", 5)); list.Add(createReq("FineWood", 2)); list.Add(createReq("RoundLog", 4)); list.Add(createReq("CoalPaste", 4)); break; case "SchematicKnarrShields": list.Add(createReq("LeatherScraps", 20)); list.Add(createReq("BronzeNails", 65)); list.Add(createReq("Copper", 12)); list.Add(createReq("RoundLog", 24)); break; case "SchematicSnekkeShields": list.Add(createReq("LeatherScraps", 24)); list.Add(createReq("IronNails", 55)); list.Add(createReq("Copper", 14)); list.Add(createReq("RoundLog", 28)); break; case "SchematicKarveShields": list.Add(createReq("LeatherScraps", 14)); list.Add(createReq("BronzeNails", 50)); list.Add(createReq("Copper", 8)); list.Add(createReq("RoundLog", 20)); break; case "SchematicKnarrTent": list.Add(createReq("TrollHide", 10)); list.Add(createReq("BronzeNails", 35)); list.Add(createReq("FineWood", 10)); list.Add(createReq("Wood", 6)); break; case "SchematicSnekkeTent": list.Add(createReq("TrollHide", 12)); list.Add(createReq("IronNails", 55)); list.Add(createReq("FineWood", 14)); list.Add(createReq("Wood", 10)); break; case "SchematicKarveSailWhite": case "SchematicKarveSailTransparent": case "SchematicKarveSailBlack": case "SchematicKarveSailBlue": case "SchematicKarveSailDefault": case "SchematicKarveSailGreen": case "SchematicKarveSailHound": case "SchematicKarveSailDruid": case "SchematicKarveSailWolf": case "SchematicKarveSailRaven": list.Add(createReq("CoalPaste", 2)); list.Add(createReq("Wood", 5)); list.Add(createReq("SailInk", 3)); list.Add(createReq("LeatherScraps", 5)); break; case "SchematicDrakkarSailBlack": case "SchematicDrakkarSailBlue": case "SchematicDrakkarSailGreen": case "SchematicDrakkarSailDefault": case "SchematicDrakkarSailTransparent": case "SchematicDrakkarSailWhite": case "SchematicDrakkarSailHound": case "SchematicDrakkarSailDruid": case "SchematicDrakkarSailWolf": case "SchematicDrakkarSailRaven": list.Add(createReq("CoalPaste", 5)); list.Add(createReq("FineWood", 5)); list.Add(createReq("SailInk", 4)); list.Add(createReq("LeatherScraps", 8)); break; case "SchematicAshlandsDrakkarAnchor": list.Add(createReq("FlametalNew", 13)); list.Add(createReq("CoalPaste", 20)); list.Add(createReq("Blackwood", 10)); list.Add(createReq("Chain", 4)); break; case "SchematicAshlandsDrakkarCrates": list.Add(createReq("CharcoalResin", 6)); list.Add(createReq("FlametalNew", 8)); list.Add(createReq("Blackwood", 25)); list.Add(createReq("IronNails", 33)); break; case "SchematicAshlandsDrakkarLights": list.Add(createReq("Blackwood", 10)); list.Add(createReq("IronNails", 37)); list.Add(createReq("FlametalNew", 5)); list.Add(createReq("Wisp", 4)); break; case "SchematicAshlandsDrakkarOar": list.Add(createReq("Wood", 10)); list.Add(createReq("Blackwood", 5)); list.Add(createReq("RoundLog", 10)); break; case "SchematicAshlandsDrakkarShields": list.Add(createReq("FlametalNew", 14)); list.Add(createReq("Blackwood", 20)); list.Add(createReq("CharcoalResin", 20)); list.Add(createReq("AskHide", 10)); break; case "SchematicAshlandsDrakkarTent": list.Add(createReq("LinenThread", 25)); list.Add(createReq("FlametalNew", 10)); list.Add(createReq("Blackwood", 20)); list.Add(createReq("AskHide", 10)); break; case "SchematicAshlandsDrakkarRopes": list.Add(createReq("Wood", 20)); list.Add(createReq("Blackwood", 5)); list.Add(createReq("LeatherScraps", 20)); list.Add(createReq("FlametalNew", 5)); break; case "SchematicAshlandsDrakkarSailBlack": case "SchematicAshlandsDrakkarSailBlue": case "SchematicAshlandsDrakkarSailGreen": case "SchematicAshlandsDrakkarSailDefault": case "SchematicAshlandsDrakkarSailTransparent": case "SchematicAshlandsDrakkarSailWhite": case "SchematicAshlandsDrakkarSailHound": case "SchematicAshlandsDrakkarSailDruid": case "SchematicAshlandsDrakkarSailWolf": case "SchematicAshlandsDrakkarSailRaven": list.Add(createReq("CoalPaste", 4)); list.Add(createReq("Blackwood", 6)); list.Add(createReq("SailInk", 6)); list.Add(createReq("LeatherScraps", 14)); break; case "SchematicSnekkeSailBlack": case "SchematicSnekkeSailBlue": case "SchematicSnekkeSailDefault": case "SchematicSnekkeSailDruid": case "SchematicSnekkeSailGreen": case "SchematicSnekkeSailHound": case "SchematicSnekkeSailRaven": case "SchematicSnekkeSailTransparent": case "SchematicSnekkeSailWhite": case "SchematicSnekkeSailWolf": list.Add(createReq("CoalPaste", 3)); list.Add(createReq("Wood", 4)); list.Add(createReq("SailInk", 2)); list.Add(createReq("LeatherScraps", 4)); break; case "SchematicKnarrSailBlack": case "SchematicKnarrSailBlue": case "SchematicKnarrSailDefault": case "SchematicKnarrSailDruid": case "SchematicKnarrSailGreen": case "SchematicKnarrSailHound": case "SchematicKnarrSailRaven": case "SchematicKnarrSailTransparent": case "SchematicKnarrSailWhite": case "SchematicKnarrSailWolf": list.Add(createReq("CoalPaste", 3)); list.Add(createReq("Wood", 4)); list.Add(createReq("SailInk", 2)); list.Add(createReq("LeatherScraps", 4)); break; case "SchematicHolkArmor": list.Add(createReq("Carapace", 40)); list.Add(createReq("BlackMetal", 24)); list.Add(createReq("Guck", 30)); list.Add(createReq("Chain", 10)); break; case "SchematicHolkBag": list.Add(createReq("Tar", 10)); list.Add(createReq("BlackMetal", 12)); list.Add(createReq("YggdrasilWood", 15)); list.Add(createReq("IronNails", 77)); break; case "SchematicHolkAnchor": list.Add(createReq("Iron", 20)); list.Add(createReq("Tar", 6)); list.Add(createReq("YggdrasilWood", 10)); list.Add(createReq("Chain", 5)); break; case "SchematicHolkCage": newRecipe.m_enabled = false; list.Add(createReq("Tar", 10)); list.Add(createReq("BlackMetal", 8)); list.Add(createReq("FineWood", 25)); list.Add(createReq("IronNails", 33)); break; case "SchematicHolkLights": list.Add(createReq("YggdrasilWood", 10)); list.Add(createReq("IronNails", 37)); list.Add(createReq("Wisp", 4)); break; case "SchematicHolkRopes": list.Add(createReq("Wood", 10)); list.Add(createReq("YggdrasilWood", 5)); list.Add(createReq("LeatherScraps", 10)); list.Add(createReq("IronNails", 16)); break; case "SchematicHolkOars": list.Add(createReq("Wood", 10)); list.Add(createReq("FineWood", 10)); list.Add(createReq("RoundLog", 10)); list.Add(createReq("YggdrasilWood", 10)); break; case "SchematicHolkShields": list.Add(createReq("Chain", 10)); list.Add(createReq("RoundLog", 40)); list.Add(createReq("BlackMetal", 30)); list.Add(createReq("WolfPelt", 16)); break; case "SchematicHolkTent": list.Add(createReq("YggdrasilWood", 14)); list.Add(createReq("IronNails", 40)); list.Add(createReq("Tar", 10)); list.Add(createReq("BlackMetal", 3)); break; case "SchematicHolkSailBlack": case "SchematicHolkSailBlue": case "SchematicHolkSailGreen": case "SchematicHolkSailDefault": case "SchematicHolkSailTransparent": case "SchematicHolkSailWhite": case "SchematicHolkSailHound": case "SchematicHolkSailDruid": case "SchematicHolkSailWolf": case "SchematicHolkSailRaven": list.Add(createReq("CoalPaste", 7)); list.Add(createReq("YggdrasilWood", 4)); list.Add(createReq("SailInk", 6)); list.Add(createReq("LeatherScraps", 10)); break; } newRecipe.m_repairStation = newRecipe.m_craftingStation; if (list.Count == 0) { Debug.LogWarning((object)(((Object)newRecipe).name + " IS EMPTY")); } newRecipe.m_resources = list.ToArray(); return newRecipe; } private void createSailInkRecipes() { string[] array = new string[7] { "Cloudberry", "Blueberries", "Raspberry", "Coal", "Carrot", "Bloodbag", "Guck" }; ItemDrop component = ObjectDB.instance.m_items.Find((GameObject x) => ((Object)x).name == "SailInk").GetComponent(); string[] array2 = array; foreach (string fruit in array2) { ItemDrop component2 = ObjectDB.instance.m_items.Find((GameObject x) => ((Object)x).name == fruit).GetComponent(); if ((Object)(object)component2 != (Object)null) { Recipe val = ScriptableObject.CreateInstance(); ((Object)val).name = "Recipe_SailInk_" + fruit; val.m_craftingStation = scribe; val.m_repairStation = scribe; val.m_minStationLevel = 1; val.m_item = component; val.m_amount = 1; val = createSailInkRecipe(val, fruit); recipes.Add(val); } } } private Recipe createSailInkRecipe(Recipe newRecipe, string fruit) { List list = new List(); switch (fruit) { case "Cloudberry": newRecipe.m_amount = 4; list.Add(createReq(fruit, 4)); newRecipe.m_resources = list.ToArray(); break; case "Iceberry": newRecipe.m_amount = 3; list.Add(createReq(fruit, 3)); newRecipe.m_resources = list.ToArray(); break; case "Blueberries": newRecipe.m_amount = 3; list.Add(createReq(fruit, 6)); newRecipe.m_resources = list.ToArray(); break; case "Blackberries": newRecipe.m_amount = 3; list.Add(createReq(fruit, 4)); newRecipe.m_resources = list.ToArray(); break; case "Raspberry": newRecipe.m_amount = 3; list.Add(createReq(fruit, 6)); newRecipe.m_resources = list.ToArray(); break; case "Coal": newRecipe.m_amount = 4; list.Add(createReq(fruit, 6)); newRecipe.m_resources = list.ToArray(); break; case "Carrot": newRecipe.m_amount = 3; list.Add(createReq(fruit, 5)); newRecipe.m_resources = list.ToArray(); break; case "Bloodbag": newRecipe.m_amount = 4; list.Add(createReq(fruit, 3)); newRecipe.m_resources = list.ToArray(); break; case "Guck": newRecipe.m_amount = 4; list.Add(createReq(fruit, 3)); newRecipe.m_resources = list.ToArray(); break; } return newRecipe; } private Requirement createReq(string name, int amount, int amountPerLevel = 0) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Requirement val = new Requirement(); val.m_recover = true; ItemDrop component = FindItem(name).GetComponent(); val.m_resItem = component; val.m_amount = amount; val.m_amountPerLevel = amountPerLevel; return val; } private GameObject FindItem(string name) { GameObject val = items.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val == (Object)null) { val = newItems.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val != (Object)null) { return val; } Debug.LogWarning((object)("Item Not Found - " + name + ", Replaced With Wood")); return items.Find((GameObject x) => ((Object)x).name == "Wood"); } if ((Object)(object)val != (Object)null) { return val; } Debug.LogWarning((object)("Item Not Found At All - " + name + ", Replaced With Wood")); return items.Find((GameObject x) => ((Object)x).name == "Wood"); } private CraftingStation FindStation(List list, string name) { GameObject val = list.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val != (Object)null) { return val.GetComponent(); } return null; } } public class ShaderReplacment { public static List prefabsToReplaceShader = new List(); public static List materialsInPrefabs = new List(); public string[] shaderlist = new string[49] { "Custom/AlphaParticle", "Custom/Blob", "Custom/Bonemass", "Custom/Clouds", "Custom/Creature", "Custom/Decal", "Custom/Distortion", "Custom/Flow", "Custom/FlowOpaque", "Custom/Grass", "Custom/GuiScroll", "Custom/Heightmap", "Custom/icon", "Custom/InteriorSide", "Custom/LitGui", "Custom/LitParticles", "Custom/mapshader", "Custom/ParticleDecal", "Custom/Piece", "Custom/Player", "Custom/Rug", "Custom/ShadowBlob", "Custom/SkyboxProcedural", "Custom/SkyObject", "Custom/StaticRock", "Custom/Tar", "Custom/Trilinearmap", "Custom/UI/BGBlur", "Custom/Vegetation", "Custom/Water", "Custom/WaterBottom", "Custom/WaterMask", "Custom/Yggdrasil", "Custom/Yggdrasil/root", "Hidden/BlitCopyHDRTonemap", "Hidden/Dof/DepthOfFieldHdr", "Hidden/Dof/DX11Dof", "Hidden/Internal-Loading", "Hidden/Internal-UIRDefaultWorld", "Hidden/SimpleClear", "Hidden/SunShaftsComposite", "Lux Lit Particles/ Bumped", "Lux Lit Particles/ Tess Bumped", "Particles/Standard Surface2", "Particles/Standard Unlit2", "Standard TwoSided", "ToonDeferredShading2017", "Unlit/DepthWrite", "Unlit/Lighting" }; public static List shaders = new List(); private static readonly HashSet CachedShaders = new HashSet(); public static bool debug = true; public static Shader findShader(string name) { Shader[] array = Resources.FindObjectsOfTypeAll(); if (array.Length == 0) { Debug.LogWarning((object)"SHADER LIST IS EMPTY!"); return null; } if (debug) { } return shaders.Find((Shader x) => ((Object)x).name == name); } public static Shader GetShaderByName(string name) { return shaders.Find((Shader x) => ((Object)x).name == name.Trim()); } public static void debugShaderList(List shadersRes) { foreach (Shader shadersRe in shadersRes) { Debug.LogWarning((object)("SHADER NAME IS: " + ((Object)shadersRe).name)); } debug = false; } public static void Replace(GameObject gameObject) { prefabsToReplaceShader.Add(gameObject); GetMaterialsInPrefab(gameObject); } public static void GetMaterialsInPrefab(GameObject gameObject) { Renderer[] componentsInChildren = gameObject.GetComponentsInChildren(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { continue; } Material[] array2 = sharedMaterials; foreach (Material val2 in array2) { if ((Object)(object)val2 != (Object)null) { materialsInPrefabs.Add(val2); } } } } public static void getMeShaders() { AssetBundle[] array = Resources.FindObjectsOfTypeAll(); AssetBundle[] array2 = array; foreach (AssetBundle val in array2) { IEnumerable enumerable3; try { IEnumerable enumerable2; if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val)) { IEnumerable enumerable = val.LoadAllAssets(); enumerable2 = enumerable; } else { enumerable2 = from shader in ((IEnumerable)val.GetAllAssetNames()).Select((Func)val.LoadAsset) where (Object)(object)shader != (Object)null select shader; } enumerable3 = enumerable2; } catch (Exception) { continue; } if (enumerable3 == null) { continue; } foreach (Shader item in enumerable3) { CachedShaders.Add(item); } } } public static void runMaterialFix() { getMeShaders(); shaders.AddRange(CachedShaders); foreach (Material materialsInPrefab in materialsInPrefabs) { Shader shader = materialsInPrefab.shader; if (!((Object)(object)shader == (Object)null)) { string name = ((Object)shader).name; if (!(name == "Standard") && name.Contains("Balrond")) { setProperValue(materialsInPrefab, name); } } } } private static void setProperValue(Material material, string shaderName) { string name = shaderName.Replace("Balrond", "Custom"); name = checkNaming(name); Shader shaderByName = GetShaderByName(name); if ((Object)(object)shaderByName == (Object)null) { Debug.LogWarning((object)("Shader not found " + name)); } else { material.shader = shaderByName; } } private static string checkNaming(string name) { string result = name; if (name.Contains("Bumped")) { result = name.Replace("Custom", "Lux Lit Particles"); } if (name.Contains("Tess Bumped")) { result = name.Replace("Custom", "Lux Lit Particles"); } if (name.Contains("Standard Surface")) { result = name.Replace("Custom", "Particles"); result = result.Replace("Standard Surface2", "Standard Surface"); } if (name.Contains("Standard Unlit")) { result = name.Replace("Custom", "Particles"); result = result.Replace("Standard Unlit", "Standard Unlit2"); result = result.Replace("Standard Unlit22", "Standard Unlit2"); } return result; } } public sealed class ShieldPainter : MonoBehaviour, Interactable, Hoverable { private const string ZdoKeyStyle = "shieldStyle"; private const string RpcSetStyle = "SetShieldStyle"; [Header("UI")] [SerializeField] private string m_name = "Paint Shields"; [Header("Network")] [SerializeField] public ZNetView m_nview; [SerializeField] public Ship m_ship; [Header("Style")] [SerializeField] public int shieldStyles = 3; [Header("Interaction")] [SerializeField] private float m_useDistance = 5f; private int _currentStyle; private int _lastAppliedStyle = -1; private ItemStyle[] _itemStyles; private void Awake() { if (!Object.op_Implicit((Object)(object)m_ship)) { m_ship = ((Component)this).GetComponentInParent(); } if (!Object.op_Implicit((Object)(object)m_nview)) { if (Object.op_Implicit((Object)(object)m_ship)) { m_nview = ((Component)m_ship).GetComponent(); } if (!Object.op_Implicit((Object)(object)m_nview)) { m_nview = ((Component)this).GetComponentInParent(); } } CacheItemStyles(); if (Object.op_Implicit((Object)(object)m_nview) && m_nview.GetZDO() != null) { m_nview.Register("SetShieldStyle", (Action)RPC_SetShieldStyle); _currentStyle = m_nview.GetZDO().GetInt("shieldStyle", 0); ApplyShieldStyle(_currentStyle); } } private void CacheItemStyles() { _itemStyles = ((Component)this).GetComponentsInChildren(true); } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } if ((Object)(object)user != (Object)(object)Player.m_localPlayer) { return false; } if (!InUseDistance(user)) { return false; } if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid() || m_nview.GetZDO() == null) { return false; } if (!m_nview.IsOwner()) { return false; } int nextStyle = GetNextStyle(_currentStyle); _currentStyle = nextStyle; m_nview.GetZDO().Set("shieldStyle", _currentStyle); m_nview.InvokeRPC(ZNetView.Everybody, "SetShieldStyle", new object[1] { _currentStyle }); ApplyShieldStyle(_currentStyle); return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } public string GetHoverText() { return Localization.instance.Localize(m_name + "\n[$KEY_Use] $piece_use "); } public string GetHoverName() { return m_name; } public bool InUseDistance(Humanoid human) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)human).transform.position, ((Component)this).transform.position) < m_useDistance; } private void RPC_SetShieldStyle(long sender, int styleId) { _currentStyle = ClampStyle(styleId); ApplyShieldStyle(_currentStyle); if ((Object)(object)m_nview != (Object)null && m_nview.IsOwner() && m_nview.GetZDO() != null) { m_nview.GetZDO().Set("shieldStyle", _currentStyle); } } private void ApplyShieldStyle(int styleId) { if (_lastAppliedStyle == styleId) { return; } if (_itemStyles == null || _itemStyles.Length == 0) { CacheItemStyles(); } for (int i = 0; i < _itemStyles.Length; i++) { ItemStyle val = _itemStyles[i]; if ((Object)(object)val != (Object)null) { val.Setup(styleId); } } _lastAppliedStyle = styleId; } private int GetNextStyle(int current) { int num = shieldStyles; int num2 = current + 1; if (num2 >= num) { num2 = 0; } return num2; } private int ClampStyle(int styleId) { int num = shieldStyles; if (styleId < 0) { return 0; } if (styleId >= num) { return num; } return styleId; } } [Serializable] public class ShipExtension { [Serializable] public class Requirement { public ItemDrop m_resItem; public int m_amount = 1; } [Serializable] public enum ExtensionDecorType { Default, One, Two, Three, Four, Five, Six, Seven, Eight, Nine } [Serializable] public enum ShipExtensionType { Inventory, Inventory2, Shelter, Health, Light, Anchor, PaintOne, Head, Oars, Ram, Ramp, ResistBlunt, ResistSlash, ResistPierce, Fishnet, Ropes, Armor, NamePlate, Other } [Serializable] public enum ShipType { Raft, Karve, Drakkar, Knarr, Holk, AshlandsDrakkar, Snekke } public List m_requirements; [Tooltip("Ship ex Raft/Karve/VikingShip")] public ShipType shipType; [Tooltip("Type of ship upgrade will be matched with proper game object")] public ShipExtensionType type = ShipExtensionType.Other; [Tooltip("A sub type for decor purpose aka Sail/ ShipHead")] public ExtensionDecorType decorType = ExtensionDecorType.Default; public string descriptionBase = ""; public string descriptionGenerated = ""; public bool CanCraft(Inventory inv) { bool result = false; int num = 0; foreach (ItemData item in inv.m_inventory) { foreach (Requirement requirement in m_requirements) { if (item.m_shared.m_name == requirement.m_resItem.m_itemData.m_shared.m_name && item.m_stack == requirement.m_amount) { num++; } } } if (num == m_requirements.Count) { result = true; } return result; } } public class ShipExtensionFactory { public ZNetScene zNetScene; public List scrolls = new List(); public List list = new List(); public List listKarve = new List(); public List listSnekke = new List(); public List listKnarr = new List(); public List listDrakkar = new List(); public List listAshlandsDrakkar = new List(); public List listHolk = new List(); public void init(ZNetScene zNetScene, List scrolls) { this.zNetScene = zNetScene; this.scrolls = scrolls; createKarveExtensions(); createDrakkarExtensions(); createKnarrExtensions(); createSnekkeExtensions(); createHolkExtensions(); createAshlandsExtensions(); } private void createHolkExtensions() { createNamePlate("Holk"); createLamp("Holk"); createShield("Holk"); createHolkSupply(); createAnchor("Holk"); shipSail9("Holk", 10); createOars("Holk"); createHolkTent(); createArmor("Holk"); createHolkRopes(); } private void createAshlandsExtensions() { createNamePlate("Drakkar"); createLamp("Drakkar"); createShield("Drakkar"); createAshlandsSupply(); createAnchor("Drakkar"); shipSail9("Drakkar", 10); createOars("Drakkar"); createAshlandsDrakkarTent(); createAshlandsRopes(); } private void createKarveExtensions() { createNamePlate("Karve"); createLamp("Karve"); createShield("Karve"); createKarveSupply(); createAnchor("Karve"); createArmor("Karve"); shipSail9("Karve", 10); createOars("Karve"); } private void createKnarrExtensions() { createNamePlate("Knarr"); createLamp("Knarr"); createShield("Knarr"); createKnarrSupply(); createAnchor("Knarr"); shipSail9("Knarr", 10); createOars("Knarr"); createArmor("Knarr"); createKnarrTent(); } private void createSnekkeExtensions() { createNamePlate("Snekke"); createLamp("Snekke"); createShield("Snekke"); createSnekkeSupply(); createAnchor("Snekke"); shipSail9("Snekke", 10); createOars("Snekke"); createArmor("Snekke"); createSnekkeTent(); } private void createDrakkarExtensions() { createNamePlate("Longship"); createLamp("Longship"); createOars("Longship"); createShield("Longship"); createDrakkarSupply(); createAnchor("Longship"); createDrakkarSupply2(); createDrakkarTent(); shipSail9("Longship", 10); createArmor("Longship"); createDrakkarHeadStyle(); } private void createKnarrSupply() { List list = new List(); list.Add(CreateRequirement("SchematicKnarrBag", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.ResistBlunt, ShipExtension.ShipType.Knarr, list); shipExtension.descriptionBase = "Adds supplies. Increase ship blunt resistance"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listKnarr.Add(shipExtension); } private void createKnarrTent() { List list = new List(); list.Add(CreateRequirement("SchematicKnarrTent", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Shelter, ShipExtension.ShipType.Knarr, list); shipExtension.descriptionBase = "Adds Tent. Increase health by 200"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listKnarr.Add(shipExtension); } private void createSnekkeTent() { List list = new List(); list.Add(CreateRequirement("SchematicSnekkeTent", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Shelter, ShipExtension.ShipType.Snekke, list); shipExtension.descriptionBase = "Adds Tent. Increase health by 200"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listSnekke.Add(shipExtension); } private void createHolkTent() { List list = new List(); list.Add(CreateRequirement("SchematicHolkTent", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Shelter, ShipExtension.ShipType.Holk, list); shipExtension.descriptionBase = "Adds Tent. Increase health by 200"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listHolk.Add(shipExtension); } private void createAshlandsDrakkarTent() { List list = new List(); list.Add(CreateRequirement("SchematicAshlandsDrakkarTent", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Shelter, ShipExtension.ShipType.AshlandsDrakkar, list); shipExtension.descriptionBase = "Adds Tent. Increase health by 200"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listAshlandsDrakkar.Add(shipExtension); } private void createHolkRopes() { List list = new List(); list.Add(CreateRequirement("SchematicHolkRopes", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Ropes, ShipExtension.ShipType.Holk, list); shipExtension.descriptionBase = "Adds side ropes. Allows you to get to upper deck from water level"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listHolk.Add(shipExtension); } private void createAshlandsRopes() { List list = new List(); list.Add(CreateRequirement("SchematicAshlandsDrakkarRopes", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Ropes, ShipExtension.ShipType.AshlandsDrakkar, list); shipExtension.descriptionBase = "Adds side ropes. Allows you to get to upper deck from water level"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listAshlandsDrakkar.Add(shipExtension); } private void createKarveSupply() { List list = new List(); list.Add(CreateRequirement("SchematicKarveBag", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.ResistBlunt, ShipExtension.ShipType.Karve, list); shipExtension.descriptionBase = "Adds supplies. Increase ship blunt resistance"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listKarve.Add(shipExtension); } private void createSnekkeSupply() { List list = new List(); list.Add(CreateRequirement("SchematicSnekkeBag", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.ResistBlunt, ShipExtension.ShipType.Snekke, list); shipExtension.descriptionBase = "Adds supplies. Increase ship blunt resistance"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listSnekke.Add(shipExtension); } private void createAnchor(string shipname) { List list = new List(); ShipExtension shipExtension = null; switch (shipname) { case "Karve": list.Add(CreateRequirement("SchematicKarveAnchor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Anchor, ShipExtension.ShipType.Karve, list); listKarve.Add(shipExtension); break; case "Knarr": list.Add(CreateRequirement("SchematicKnarrAnchor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Anchor, ShipExtension.ShipType.Knarr, list); listKnarr.Add(shipExtension); break; case "Snekke": list.Add(CreateRequirement("SchematicSnekkeAnchor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Anchor, ShipExtension.ShipType.Snekke, list); listSnekke.Add(shipExtension); break; case "Longship": list.Add(CreateRequirement("SchematicDrakkarAnchor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Anchor, ShipExtension.ShipType.Drakkar, list); listDrakkar.Add(shipExtension); break; case "Drakkar": list.Add(CreateRequirement("SchematicAshlandsDrakkarAnchor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Anchor, ShipExtension.ShipType.AshlandsDrakkar, list); listAshlandsDrakkar.Add(shipExtension); break; case "Holk": list.Add(CreateRequirement("SchematicHolkAnchor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Anchor, ShipExtension.ShipType.Holk, list); listHolk.Add(shipExtension); break; } if (shipExtension != null) { shipExtension.descriptionBase = "Adds Anchor. You gain ability to stop your ship in place"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); } } private void createNamePlate(string shipname) { List list = new List(); ShipExtension shipExtension = null; switch (shipname) { case "Karve": list.Add(CreateRequirement("SchematicKarveNamePlate", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.NamePlate, ShipExtension.ShipType.Karve, list); listKarve.Add(shipExtension); break; case "Knarr": list.Add(CreateRequirement("SchematicKnarrNamePlate", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.NamePlate, ShipExtension.ShipType.Knarr, list); listKnarr.Add(shipExtension); break; case "Snekke": list.Add(CreateRequirement("SchematicSnekkeNamePlate", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.NamePlate, ShipExtension.ShipType.Snekke, list); listSnekke.Add(shipExtension); break; case "Drakkar": list.Add(CreateRequirement("SchematicAshlandsDrakkarNamePlate", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.NamePlate, ShipExtension.ShipType.AshlandsDrakkar, list); listAshlandsDrakkar.Add(shipExtension); break; case "Longship": list.Add(CreateRequirement("SchematicDrakkarNamePlate", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.NamePlate, ShipExtension.ShipType.Drakkar, list); listDrakkar.Add(shipExtension); break; case "Holk": list.Add(CreateRequirement("SchematicHolkNamePlate", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.NamePlate, ShipExtension.ShipType.Holk, list); listHolk.Add(shipExtension); break; } if (shipExtension != null) { shipExtension.descriptionBase = "Adds Nameplate. You can name your ship."; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); } } private void createLamp(string shipname) { List list = new List(); ShipExtension shipExtension = null; switch (shipname) { case "Karve": list.Add(CreateRequirement("SchematicKarveLights", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Light, ShipExtension.ShipType.Karve, list); listKarve.Add(shipExtension); break; case "Knarr": list.Add(CreateRequirement("SchematicKnarrLights", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Light, ShipExtension.ShipType.Knarr, list); listKnarr.Add(shipExtension); break; case "Snekke": list.Add(CreateRequirement("SchematicSnekkeLights", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Light, ShipExtension.ShipType.Snekke, list); listSnekke.Add(shipExtension); break; case "Drakkar": list.Add(CreateRequirement("SchematicAshlandsDrakkarLights", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Light, ShipExtension.ShipType.AshlandsDrakkar, list); listAshlandsDrakkar.Add(shipExtension); break; case "Longship": list.Add(CreateRequirement("SchematicDrakkarLights", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Light, ShipExtension.ShipType.Drakkar, list); listDrakkar.Add(shipExtension); break; case "Holk": list.Add(CreateRequirement("SchematicHolkLights", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Light, ShipExtension.ShipType.Holk, list); listHolk.Add(shipExtension); break; } if (shipExtension != null) { shipExtension.descriptionBase = "Adds Lights. Adds Warm effect"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); } } private void createShield(string shipname) { List list = new List(); ShipExtension shipExtension = null; switch (shipname) { case "Karve": list.Add(CreateRequirement("SchematicKarveShields", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Health, ShipExtension.ShipType.Karve, list); shipExtension.descriptionBase = "Adds Shields. Increase ships health by 200"; listKarve.Add(shipExtension); break; case "Knarr": list.Add(CreateRequirement("SchematicKnarrShields", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Health, ShipExtension.ShipType.Knarr, list); shipExtension.descriptionBase = "Adds Shields. Increase ships health by 200"; listKnarr.Add(shipExtension); break; case "Snekke": list.Add(CreateRequirement("SchematicSnekkeShields", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Health, ShipExtension.ShipType.Snekke, list); shipExtension.descriptionBase = "Adds Shields. Increase ships health by 200"; listSnekke.Add(shipExtension); break; case "Longship": list.Add(CreateRequirement("SchematicDrakkarShields", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Health, ShipExtension.ShipType.Drakkar, list); shipExtension.descriptionBase = "Adds Shields. Increase ships health by 300"; listDrakkar.Add(shipExtension); break; case "Drakkar": list.Add(CreateRequirement("SchematicAshlandsDrakkarShields", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Health, ShipExtension.ShipType.AshlandsDrakkar, list); shipExtension.descriptionBase = "Adds Shields. Increase ships health by 300"; listAshlandsDrakkar.Add(shipExtension); break; case "Holk": list.Add(CreateRequirement("SchematicHolkShields", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Health, ShipExtension.ShipType.Holk, list); shipExtension.descriptionBase = "Adds Shields. Increase ships health by 300"; listHolk.Add(shipExtension); break; } if (shipExtension != null) { createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); } } private void createHolkRamp() { List list = new List(); list.Add(CreateRequirement("SchematicHolkCage", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Ramp, ShipExtension.ShipType.Holk, list); shipExtension.descriptionBase = "Adds cage and ramp for transporting animals"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listHolk.Add(shipExtension); } private void createHolkSupply() { List list = new List(); list.Add(CreateRequirement("SchematicHolkBag", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.ResistBlunt, ShipExtension.ShipType.Holk, list); shipExtension.descriptionBase = "Adds supplies. Increase ship blunt resistance"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listHolk.Add(shipExtension); } private void createAshlandsSupply() { List list = new List(); list.Add(CreateRequirement("SchematicAshlandsDrakkarCrates", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.ResistBlunt, ShipExtension.ShipType.AshlandsDrakkar, list); shipExtension.descriptionBase = "Adds supplies. Increase ship blunt resistance"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listAshlandsDrakkar.Add(shipExtension); } private void shipSail9(string shipname, int number) { for (int i = 0; i < number; i++) { List list = new List(); ShipExtension shipExtension = null; switch (shipname) { case "Karve": list.Add(CreateRequirement(GetSailSchematicName(shipname, i), 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.PaintOne, ShipExtension.ShipType.Karve, list, (ShipExtension.ExtensionDecorType)i); listKarve.Add(shipExtension); break; case "Knarr": list.Add(CreateRequirement(GetSailSchematicName(shipname, i), 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.PaintOne, ShipExtension.ShipType.Knarr, list, (ShipExtension.ExtensionDecorType)i); listKnarr.Add(shipExtension); break; case "Snekke": list.Add(CreateRequirement(GetSailSchematicName(shipname, i), 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.PaintOne, ShipExtension.ShipType.Snekke, list, (ShipExtension.ExtensionDecorType)i); listSnekke.Add(shipExtension); break; case "Longship": list.Add(CreateRequirement(GetSailSchematicName(shipname, i), 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.PaintOne, ShipExtension.ShipType.Drakkar, list, (ShipExtension.ExtensionDecorType)i); listDrakkar.Add(shipExtension); break; case "Drakkar": list.Add(CreateRequirement(GetSailSchematicName(shipname, i), 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.PaintOne, ShipExtension.ShipType.AshlandsDrakkar, list, (ShipExtension.ExtensionDecorType)i); listAshlandsDrakkar.Add(shipExtension); break; case "Holk": list.Add(CreateRequirement(GetSailSchematicName(shipname, i), 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.PaintOne, ShipExtension.ShipType.Holk, list, (ShipExtension.ExtensionDecorType)i); listHolk.Add(shipExtension); break; } if (shipExtension != null) { shipExtension.descriptionBase = getSailDescription(i); createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); } } } private string GetSailSchematicName(string shipname, int number) { if (shipname == "Drakkar") { shipname = "AshlandsDrakkar"; } if (shipname == "Longship") { shipname = "Drakkar"; } string text = ""; switch (number) { case 0: text = "Schematic" + shipname + "SailDefault"; break; case 1: text = "Schematic" + shipname + "SailBlue"; break; case 2: text = "Schematic" + shipname + "SailBlack"; break; case 3: text = "Schematic" + shipname + "SailGreen"; break; case 4: text = "Schematic" + shipname + "SailTransparent"; break; case 5: text = "Schematic" + shipname + "SailWhite"; break; case 6: text = "Schematic" + shipname + "SailWolf"; break; case 7: text = "Schematic" + shipname + "SailRaven"; break; case 8: text = "Schematic" + shipname + "SailHound"; break; case 9: text = "Schematic" + shipname + "SailDruid"; break; } if (text == "" || text == null) { Debug.LogError((object)"Something went wrong with schematic name for sail"); } return text; } private string getSailDescription(int number) { string result = ""; switch (number) { case 0: result = "Set default(Red) sail color"; break; case 1: result = "Set blue sail color"; break; case 2: result = "Set Triangle Red sail color"; break; case 3: result = "Set green sail color"; break; case 4: result = "Set transparent sail color"; break; case 5: result = "Set white sail color"; break; case 6: result = "Set Triangle Green sail pattern"; break; case 7: result = "Set Yellow sail color"; break; case 8: result = "Set Gray sail color"; break; case 9: result = "Set Vegvisir sail pattern"; break; } return result; } private void createArmor(string shipname) { List list = new List(); ShipExtension shipExtension = null; switch (shipname) { case "Karve": list.Add(CreateRequirement("SchematicKarveArmor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Armor, ShipExtension.ShipType.Karve, list); listKarve.Add(shipExtension); break; case "Knarr": list.Add(CreateRequirement("SchematicKnarrArmor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Armor, ShipExtension.ShipType.Knarr, list); listKnarr.Add(shipExtension); break; case "Snekke": list.Add(CreateRequirement("SchematicSnekkeArmor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Armor, ShipExtension.ShipType.Snekke, list); listSnekke.Add(shipExtension); break; case "Longship": list.Add(CreateRequirement("SchematicDrakkarArmor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Armor, ShipExtension.ShipType.Drakkar, list); listDrakkar.Add(shipExtension); break; case "Drakkar": list.Add(CreateRequirement("SchematicAshlandsDrakkarArmor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Armor, ShipExtension.ShipType.AshlandsDrakkar, list); listAshlandsDrakkar.Add(shipExtension); break; case "Holk": list.Add(CreateRequirement("SchematicHolkArmor", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Armor, ShipExtension.ShipType.Holk, list); listHolk.Add(shipExtension); break; } if (shipExtension != null) { shipExtension.descriptionBase = "Add Carapace armor. Increase ships health and resistance against pierce damage"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); } } private void createOars(string shipname) { List list = new List(); ShipExtension shipExtension = null; switch (shipname) { case "Karve": list.Add(CreateRequirement("SchematicKarveOars", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Oars, ShipExtension.ShipType.Karve, list); listKarve.Add(shipExtension); break; case "Knarr": list.Add(CreateRequirement("SchematicKnarrOars", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Oars, ShipExtension.ShipType.Knarr, list); listKnarr.Add(shipExtension); break; case "Snekke": list.Add(CreateRequirement("SchematicSnekkeOars", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Oars, ShipExtension.ShipType.Snekke, list); listSnekke.Add(shipExtension); break; case "Longship": list.Add(CreateRequirement("SchematicDrakkarOar", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Oars, ShipExtension.ShipType.Drakkar, list); listDrakkar.Add(shipExtension); break; case "Drakkar": list.Add(CreateRequirement("SchematicAshlandsDrakkarOar", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Oars, ShipExtension.ShipType.AshlandsDrakkar, list); listAshlandsDrakkar.Add(shipExtension); break; case "Holk": list.Add(CreateRequirement("SchematicHolkOars", 1)); shipExtension = createExtension(ShipExtension.ShipExtensionType.Oars, ShipExtension.ShipType.Holk, list); listHolk.Add(shipExtension); break; } if (shipExtension != null) { shipExtension.descriptionBase = "Add Oars. Increase ships movement capability"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); } } private void createDrakkarSupply() { List list = new List(); list.Add(CreateRequirement("SchematicDrakkarBarrels", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.ResistBlunt, ShipExtension.ShipType.Drakkar, list); shipExtension.descriptionBase = "Adds Barrels. Increase blunt resistance and health"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listDrakkar.Add(shipExtension); } private void createDrakkarSupply2() { List list = new List(); list.Add(CreateRequirement("SchematicDrakkarCrates", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.ResistSlash, ShipExtension.ShipType.Drakkar, list); shipExtension.descriptionBase = "Adds Crates. Increase slash resistance and health"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listDrakkar.Add(shipExtension); } private void createDrakkarTent() { List list = new List(); list.Add(CreateRequirement("SchematicDrakkarTent", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Shelter, ShipExtension.ShipType.Drakkar, list); shipExtension.descriptionBase = "Adds Tent. Gain shelter status. Increase health by 300"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listDrakkar.Add(shipExtension); } private void createDrakkarFishnet() { List list = new List(); list.Add(CreateRequirement("SchematicDrakkarFishnet", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Ram, ShipExtension.ShipType.Drakkar, list); shipExtension.descriptionBase = "Adds fishnet. You can fuel it with fishing bait to catch fish while sailing. Require at leas t1 empty slot in ship's cargo!"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listDrakkar.Add(shipExtension); } private void createDrakkarRam() { List list = new List(); list.Add(CreateRequirement("SchematicDrakkarRam", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Ram, ShipExtension.ShipType.Drakkar, list); shipExtension.descriptionBase = "Adds Iron Spike Ram. You gain ability to ram with front spikes. REQUIRE ARMOR UPGRADE"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listDrakkar.Add(shipExtension); } private void createDrakkarHeadStyle() { drakkarHeadDefault(); drakarHeadCernyx(); drakkarHeadDragon(); drakkarHeadOsberg(); } private void drakkarHeadDefault() { List list = new List(); list.Add(CreateRequirement("SchematicDrakkarHeadSkull", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Head, ShipExtension.ShipType.Drakkar, list); shipExtension.descriptionBase = "Set Default Head decoration"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listDrakkar.Add(shipExtension); } private void drakarHeadCernyx() { List list = new List(); list.Add(CreateRequirement("SchematicDrakkarHeadCernyx", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Head, ShipExtension.ShipType.Drakkar, list, ShipExtension.ExtensionDecorType.One); shipExtension.descriptionBase = "Set Cernyx Head decoration"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listDrakkar.Add(shipExtension); } private void drakkarHeadDragon() { List list = new List(); list.Add(CreateRequirement("SchematicDrakkarHeadDragon", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Head, ShipExtension.ShipType.Drakkar, list, ShipExtension.ExtensionDecorType.Two); shipExtension.descriptionBase = "Set Dragon Head decoration"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listDrakkar.Add(shipExtension); } private void drakkarHeadOsberg() { List list = new List(); list.Add(CreateRequirement("SchematicDrakkarHeadOsberg", 1)); ShipExtension shipExtension = createExtension(ShipExtension.ShipExtensionType.Head, ShipExtension.ShipType.Drakkar, list, ShipExtension.ExtensionDecorType.Three); shipExtension.descriptionBase = "Set Osberg Head decoration"; createItemDescription(list, shipExtension.descriptionBase); this.list.Add(shipExtension); listDrakkar.Add(shipExtension); } private ShipExtension createExtension(ShipExtension.ShipExtensionType extensionType, ShipExtension.ShipType shipType, List requirements, ShipExtension.ExtensionDecorType decorType = ShipExtension.ExtensionDecorType.Default) { ShipExtension shipExtension = new ShipExtension(); shipExtension.shipType = shipType; shipExtension.type = extensionType; shipExtension.decorType = decorType; shipExtension.m_requirements = requirements; return shipExtension; } private ShipExtension.Requirement CreateRequirement(string name, int amount) { ShipExtension.Requirement requirement = new ShipExtension.Requirement(); GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val == (Object)null) { val = scrolls.Find((GameObject x) => ((Object)x).name == name); } requirement.m_resItem = val.GetComponent(); requirement.m_amount = amount; return requirement; } private void createItemDescription(List listReq, string baseDescription) { string text = "\n Require: \n"; foreach (ShipExtension.Requirement item in listReq) { if (((Object)((Component)item.m_resItem).gameObject).name.Contains("Drakkar")) { item.m_resItem.m_itemData.m_shared.m_name.Replace("Drakkar", "Longship"); } if (!((Object)((Component)item.m_resItem).gameObject).name.Contains("Schematic")) { string text2 = item.m_amount + " x " + item.m_resItem.m_itemData.m_shared.m_name + "\n"; text += text2; } else { text += "Schematic x 1"; item.m_resItem.m_itemData.m_shared.m_description = baseDescription + text; } } } } [Serializable] public class ShipExtensionManager : MonoBehaviour { public EffectList m_activateEffect = new EffectList(); public EffectList m_deactivateEffect = new EffectList(); public ZNetView m_nview; public Piece m_piece; public WearNTear m_wearNtear; public Ship m_ship; public List shipExtensions; public ShipExtension.ShipType m_type; public GameObject nameplate; public List textures = new List(); public GameObject sail; public GameObject customize; public string currentHeadName = "skull_head"; public GameObject roof; public GameObject lampheat; public GameObject ram; public GameObject ramp; public GameObject cage; public GameObject shields; public GameObject lights; public GameObject anchor; public GameObject bag; public GameObject oars; public GameObject tent; public GameObject ropes; public GameObject fishnet; public GameObject armor; private float baseHealth = 0f; private float baseMass = 0f; private int shieldHealth = 0; private int tentHealth = 0; private int ramHealth = 0; private int armorHealth = 0; private int supplyHealth = 0; private int supply2Health = 0; private int tentComfort = 0; private int shieldComfort = 0; private int lightComfort = 0; private bool supply2Upgrade = false; private bool tentUpgrade = false; private bool ramUpgrade = false; private bool oarUpgrade = false; private bool anchorUpgrade = false; private bool supplyUpgrade = false; private bool shieldUpgrade = false; private bool lightUpgrade = false; private bool armorUpgrade = false; private bool fishnetUpgrade = false; private bool ropesUpgrade = false; private bool nameplateUpgrade = false; private void Awake() { m_nview = ((Component)this).GetComponent(); if (!m_nview.IsValid()) { return; } m_wearNtear = ((Component)this).GetComponent(); WearNTear wearNtear = m_wearNtear; wearNtear.m_onDamaged = (Action)Delegate.Combine(wearNtear.m_onDamaged, new Action(OnDamaged)); WearNTear wearNtear2 = m_wearNtear; wearNtear2.m_onDestroyed = (Action)Delegate.Combine(wearNtear2.m_onDestroyed, new Action(OnDestroy)); m_piece = ((Component)this).GetComponent(); m_ship = ((Component)this).GetComponent(); baseHealth = m_wearNtear.m_health; baseMass = ((Component)this).GetComponent().mass; m_piece.m_comfort = 1; if ((Object)(object)m_piece == (Object)null || (Object)(object)m_ship == (Object)null) { Debug.LogWarning((object)"Missing Piece/Ship component!"); return; } m_piece.m_canBeRemoved = true; if (shipExtensions == null || shipExtensions.Count == 0) { Debug.LogWarning((object)"Extensions not loaded to ship!"); return; } if (shipExtensions.Count > 0) { } m_nview.Register("ShipyardSetExtension", (Action)RPC_ShipyardSetExtension); m_nview.Register("ShipyardSetExtensionDecor", (Action)RPC_ShipyardSetExtensionDecor); if (!Enumerable.Contains(ShipyardStation.m_ships, this)) { ShipyardStation.m_ships.Add(this); } if ((Object)(object)m_nview != (Object)null && m_nview.IsValid() && (GetCreator() == null || GetCreator() == "")) { Setup(Game.instance.GetPlayerProfile().GetName()); } ((MonoBehaviour)this).InvokeRepeating("UpdateStatus", 0f, 2f); } private void UpdateStatus() { checkActiveExtensions(); } private void ExtendShip(string value) { m_nview.InvokeRPC(ZNetView.Everybody, "ShipyardSetExtension", new object[1] { value }); } private void checkActiveExtensions() { if (!shieldUpgrade && getBoolZDOvalue(ShipExtension.ShipExtensionType.Health.ToString())) { ExtendShip(ShipExtension.ShipExtensionType.Health.ToString()); shieldComfort = 1; shieldUpgrade = true; } if (!oarUpgrade && getBoolZDOvalue(ShipExtension.ShipExtensionType.Oars.ToString())) { ExtendShip(ShipExtension.ShipExtensionType.Oars.ToString()); oarUpgrade = true; } if (!lightUpgrade && getBoolZDOvalue(ShipExtension.ShipExtensionType.Light.ToString())) { ExtendShip(ShipExtension.ShipExtensionType.Light.ToString()); lightComfort = 1; lightUpgrade = true; } if (!anchorUpgrade && getBoolZDOvalue(ShipExtension.ShipExtensionType.Anchor.ToString())) { ExtendShip(ShipExtension.ShipExtensionType.Anchor.ToString()); anchorUpgrade = true; } if (!supplyUpgrade && (getBoolZDOvalue(ShipExtension.ShipExtensionType.Inventory.ToString()) || getBoolZDOvalue(ShipExtension.ShipExtensionType.ResistBlunt.ToString()))) { ExtendShip(ShipExtension.ShipExtensionType.ResistBlunt.ToString()); supplyUpgrade = true; } if (!supply2Upgrade && (getBoolZDOvalue(ShipExtension.ShipExtensionType.Inventory2.ToString()) || getBoolZDOvalue(ShipExtension.ShipExtensionType.ResistSlash.ToString()))) { ExtendShip(ShipExtension.ShipExtensionType.ResistSlash.ToString()); supply2Upgrade = true; } if (!tentUpgrade && getBoolZDOvalue(ShipExtension.ShipExtensionType.Shelter.ToString())) { ExtendShip(ShipExtension.ShipExtensionType.Shelter.ToString()); tentComfort = 1; tentUpgrade = true; } if (!ramUpgrade && getBoolZDOvalue(ShipExtension.ShipExtensionType.Ram.ToString())) { ExtendShip(ShipExtension.ShipExtensionType.Ram.ToString()); ramUpgrade = true; } if (!fishnetUpgrade && getBoolZDOvalue(ShipExtension.ShipExtensionType.Fishnet.ToString())) { ExtendShip(ShipExtension.ShipExtensionType.Fishnet.ToString()); fishnetUpgrade = true; } if (!nameplateUpgrade && getBoolZDOvalue(ShipExtension.ShipExtensionType.NamePlate.ToString())) { ExtendShip(ShipExtension.ShipExtensionType.NamePlate.ToString()); nameplateUpgrade = true; } if (!armorUpgrade && getBoolZDOvalue(ShipExtension.ShipExtensionType.Armor.ToString())) { ExtendShip(ShipExtension.ShipExtensionType.Armor.ToString()); armorUpgrade = true; } if (!ropesUpgrade && getBoolZDOvalue(ShipExtension.ShipExtensionType.Ropes.ToString())) { ExtendShip(ShipExtension.ShipExtensionType.Ropes.ToString()); ropesUpgrade = true; } int intZDOvalue = getIntZDOvalue(ShipExtension.ShipExtensionType.PaintOne.ToString()); m_nview.InvokeRPC(ZNetView.Everybody, "ShipyardSetExtensionDecor", new object[2] { ShipExtension.ShipExtensionType.PaintOne.ToString(), intZDOvalue }); int intZDOvalue2 = getIntZDOvalue(ShipExtension.ShipExtensionType.Head.ToString()); m_nview.InvokeRPC(ZNetView.Everybody, "ShipyardSetExtensionDecor", new object[2] { ShipExtension.ShipExtensionType.Head.ToString(), intZDOvalue2 }); } private void RPC_ShipyardSetExtension(long uid, string extensionName) { ShipExtension.ShipExtensionType extType = (ShipExtension.ShipExtensionType)Enum.Parse(typeof(ShipExtension.ShipExtensionType), extensionName); ShipExtension shipExtension = shipExtensions.Find((ShipExtension x) => x.type == extType); SetExtension(extType); } private void RPC_ShipyardSetExtensionDecor(long uid, string extensionName, int id) { SetExtensionDecor(extensionName, id); } public bool isOarActive() { return getBoolZDOvalue(ShipExtension.ShipExtensionType.Oars.ToString()); } private void setZDOvalue(string name, bool value) { if (m_nview.IsValid() && !m_nview.GetZDO().GetBool(name, false)) { m_nview.GetZDO().Set(name, value); } } private void setIntZDOvalue(string name, int value) { if (m_nview.IsValid()) { m_nview.GetZDO().Set(name, value); } } private bool getBoolZDOvalue(string name) { return m_nview.IsValid() && m_nview.GetZDO().GetBool(name, false); } private int getIntZDOvalue(string name) { if (m_nview.IsValid()) { return m_nview.GetZDO().GetInt(name, 0); } return 0; } private void currentActiveHead(int id) { switch (id) { case 0: currentHeadName = "skull_head"; break; case 1: currentHeadName = "carnyx_head"; break; case 2: currentHeadName = "dragon_head"; break; case 3: currentHeadName = "oseberg_head"; break; default: currentHeadName = "skull_head"; break; } } public void SetExtension(ShipExtension.ShipExtensionType extType) { ShipExtension shipExtension = shipExtensions.Find((ShipExtension x) => x.type == extType); if (shipExtension != null) { bool flag = false; switch (shipExtension.type) { default: return; case ShipExtension.ShipExtensionType.NamePlate: debugNote(shipExtension); flag = extensionNamePlate(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.Health: debugNote(shipExtension); flag = extensionCheckHealth(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.Light: debugNote(shipExtension); flag = extensionCheckLight(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.Oars: debugNote(shipExtension); flag = extensionCheckOars(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.ResistBlunt: debugNote(shipExtension); flag = extensionCheckResistance(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.ResistSlash: debugNote(shipExtension); flag = extensionCheckResistance(shipExtension.shipType, 2); break; case ShipExtension.ShipExtensionType.Shelter: debugNote(shipExtension); flag = extensionCheckTent(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.Anchor: debugNote(shipExtension); flag = extensionCheckAnchor(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.Ram: debugNote(shipExtension); flag = extensionCheckRam(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.Ramp: debugNote(shipExtension); flag = extensionCheckRamp(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.Fishnet: debugNote(shipExtension); flag = extensionCheckFishnet(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.Armor: debugNote(shipExtension); flag = extensionCheckArmor(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.Ropes: debugNote(shipExtension); flag = extensionCheckRopes(shipExtension.shipType); break; case ShipExtension.ShipExtensionType.PaintOne: case ShipExtension.ShipExtensionType.Head: case ShipExtension.ShipExtensionType.ResistPierce: return; } if (flag) { setZDOvalue(shipExtension.type.ToString(), value: true); } } } public void SetExtensionDecor(string extensionName, int id) { ShipExtension.ShipExtensionType extType = (ShipExtension.ShipExtensionType)Enum.Parse(typeof(ShipExtension.ShipExtensionType), extensionName); ShipExtension shipExtension = shipExtensions.Find((ShipExtension x) => x.type == extType && x.decorType == (ShipExtension.ExtensionDecorType)id); if (shipExtension != null) { bool flag = false; switch (shipExtension.type) { default: return; case ShipExtension.ShipExtensionType.Head: debugNote(shipExtension); flag = extensionChangeHead(shipExtension.shipType, (int)shipExtension.decorType); break; case ShipExtension.ShipExtensionType.PaintOne: debugNote(shipExtension); flag = extensionPaintSail(shipExtension.shipType, (int)shipExtension.decorType); break; } if (flag) { setIntZDOvalue(shipExtension.type.ToString(), (int)shipExtension.decorType); } } } private bool extensionPaintSail(ShipExtension.ShipType type, int decorType) { setSailPattern(decorType); return true; } private bool extensionChangeHead(ShipExtension.ShipType type, int decorType) { if (type != ShipExtension.ShipType.Drakkar) { return false; } setVikingHead(decorType); return true; } private bool extensionCheckOars(ShipExtension.ShipType type) { switch (type) { case ShipExtension.ShipType.Knarr: case ShipExtension.ShipType.Snekke: setOars(2.3f, 40f, 0.2f); return true; case ShipExtension.ShipType.Karve: setOars(1.1f, 50f, 0.3f); return true; case ShipExtension.ShipType.Drakkar: setOars(1.1f, 50f, 1.1f); return true; case ShipExtension.ShipType.Holk: setOars(1.1f, 50f, 1.65f); return true; default: return false; } } private bool extensionCheckLight(ShipExtension.ShipType type) { switch (type) { case ShipExtension.ShipType.Karve: case ShipExtension.ShipType.Knarr: case ShipExtension.ShipType.Holk: case ShipExtension.ShipType.AshlandsDrakkar: case ShipExtension.ShipType.Snekke: setLamps(); return true; case ShipExtension.ShipType.Drakkar: setVikingLamps(); return true; default: return false; } } private bool extensionCheckTent(ShipExtension.ShipType type) { switch (type) { case ShipExtension.ShipType.Knarr: case ShipExtension.ShipType.Holk: case ShipExtension.ShipType.AshlandsDrakkar: case ShipExtension.ShipType.Snekke: setBasicTent(); return true; case ShipExtension.ShipType.Drakkar: setDrakkarTent(); return true; default: calculateHealth(); return false; } } private bool extensionNamePlate(ShipExtension.ShipType type) { if ((uint)(type - 1) <= 5u) { activateNamePlate(); return true; } return false; } private bool extensionCheckHealth(ShipExtension.ShipType type) { switch (type) { case ShipExtension.ShipType.Karve: case ShipExtension.ShipType.Knarr: case ShipExtension.ShipType.Snekke: shieldHealth = 200; setKarveShields(); calculateHealth(); return true; case ShipExtension.ShipType.Drakkar: shieldHealth = 300; setShieldsVikingShip(); calculateHealth(); return true; case ShipExtension.ShipType.Holk: case ShipExtension.ShipType.AshlandsDrakkar: shieldHealth = 300; setKarveShields(); calculateHealth(); return true; default: return false; } } private bool extensionCheckFishnet(ShipExtension.ShipType type) { switch (type) { case ShipExtension.ShipType.Karve: case ShipExtension.ShipType.Drakkar: case ShipExtension.ShipType.Knarr: case ShipExtension.ShipType.Snekke: setFishnet(); return true; case ShipExtension.ShipType.Raft: case ShipExtension.ShipType.Holk: case ShipExtension.ShipType.AshlandsDrakkar: return true; default: return false; } } private bool extensionCheckRopes(ShipExtension.ShipType type) { switch (type) { case ShipExtension.ShipType.Holk: case ShipExtension.ShipType.AshlandsDrakkar: setRopes(); return true; default: return false; } } private bool extensionCheckArmor(ShipExtension.ShipType type) { switch (type) { case ShipExtension.ShipType.Karve: case ShipExtension.ShipType.Knarr: case ShipExtension.ShipType.Snekke: armorHealth = 100; setArmor(); return true; case ShipExtension.ShipType.Drakkar: armorHealth = 200; setArmor(); return true; case ShipExtension.ShipType.Holk: armorHealth = 200; setArmor(); return true; default: return false; } } private bool extensionCheckRamp(ShipExtension.ShipType type) { switch (type) { case ShipExtension.ShipType.Holk: setRamp(); return true; default: return false; } } private bool extensionCheckRam(ShipExtension.ShipType type) { switch (type) { case ShipExtension.ShipType.Drakkar: setVikingRam(); return true; default: return false; } } private bool extensionCheckAnchor(ShipExtension.ShipType type) { if (type != 0 && (uint)(type - 1) <= 5u) { setAnchorState(); return true; } return false; } private void activateNamePlate() { nameplate.SetActive(true); } private void setRopes() { ropes.SetActive(true); } private void setFishnet() { fishnet.SetActive(true); } private void setArmor() { armor.SetActive(true); resistancePierce(); } private void setRamp() { ramp.SetActive(true); cage.SetActive(true); } private void setVikingRam() { ram.SetActive(true); ramHealth = 100; calculateHealth(); VehicleMovementDamagementDamage vehicleMovementDamagementDamage = ((Component)this).gameObject.GetComponent(); if ((Object)(object)vehicleMovementDamagementDamage == (Object)null) { vehicleMovementDamagementDamage = ((Component)this).gameObject.AddComponent(); } vehicleMovementDamagementDamage.m_runDamageObject = ((Component)ram.transform.Find("HitControler")).gameObject; vehicleMovementDamagementDamage.m_speedTreshold = 5f; vehicleMovementDamagementDamage.setup(); } private bool extensionCheckResistance(ShipExtension.ShipType type, int size = 1) { switch (type) { case ShipExtension.ShipType.Karve: case ShipExtension.ShipType.Knarr: case ShipExtension.ShipType.Snekke: if (size == 1) { setKarveCargo(); supplyHealth = 100; resistanceBlunt(); calculateHealth(); return true; } break; case ShipExtension.ShipType.Drakkar: setVikingCargo(size); calculateHealth(); return true; case ShipExtension.ShipType.Holk: case ShipExtension.ShipType.AshlandsDrakkar: if (size == 1) { setKarveCargo(); resistanceBlunt(); supplyHealth = 200; calculateHealth(); } return true; } return false; } private void debugNote(ShipExtension shipExtension) { } private void calculateHealth() { m_wearNtear.m_health = baseHealth + (float)shieldHealth + (float)tentHealth + (float)ramHealth + (float)supplyHealth + (float)supply2Health + (float)armorHealth; ((Component)this).GetComponent().mass = baseMass + (float)((shieldHealth + tentHealth + ramHealth + supplyHealth + supply2Health) / 2); } private void resistanceBlunt() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) m_wearNtear.m_damages.m_blunt = (DamageModifier)1; } private void resistanceSlash() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) m_wearNtear.m_damages.m_slash = (DamageModifier)1; } private void resistancePierce() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) m_wearNtear.m_damages.m_pierce = (DamageModifier)5; } private bool isKarve() { return ((Object)((Component)this).gameObject).name.Contains("Karve"); } private bool isRaft() { return ((Object)((Component)this).gameObject).name.Contains("Raft"); } private bool isVikingShip() { return ((Object)((Component)this).gameObject).name.Contains("VikingShip"); } private bool setBasicTent() { tentHealth = 200; tent.SetActive(true); return true; } private bool setDrakkarTent() { tentHealth = 300; GameObject gameObject = ((Component)customize.transform.Find("ShipTen2 (1)")).gameObject; GameObject gameObject2 = ((Component)customize.transform.Find("ShipTen2_beam")).gameObject; GameObject gameObject3 = ((Component)customize.transform.Find("ShipTentHolders")).gameObject; GameObject gameObject4 = ((Component)customize.transform.Find("ShipTentHolders (1)")).gameObject; gameObject.SetActive(true); gameObject2.SetActive(true); gameObject3.SetActive(true); gameObject4.SetActive(true); roof.SetActive(true); return true; } private void addComfort() { m_piece.m_comfort = tentComfort + shieldComfort + lightComfort; } private void setKarveShields() { shields.SetActive(true); } private void setShieldsVikingShip() { shields.SetActive(true); } private void setOars(float rudder, float rotation, float force) { oars.SetActive(true); m_ship.m_rudderSpeed = rudder; m_ship.m_rudderRotationMax = rotation; m_ship.m_stearForce = force; } private void setLamps() { lights.SetActive(true); } private void setVikingLamps() { lampheat.SetActive(true); lights.SetActive(true); GameObject gameObject = ((Component)customize.transform.Find("TraderLamp")).gameObject; gameObject.SetActive(true); ((Component)gameObject.transform.Find("insects")).gameObject.SetActive(true); Light component = ((Component)gameObject.transform.Find("Point light")).gameObject.GetComponent(); component.range = 6f; component.intensity = 3f; } private void setRaftAnchor() { Rigidbody[] componentsInChildren = anchor.GetComponentsInChildren(); Rigidbody[] array = componentsInChildren; foreach (Rigidbody val in array) { val.isKinematic = true; } MeshCollider[] componentsInChildren2 = anchor.GetComponentsInChildren(); MeshCollider[] array2 = componentsInChildren2; foreach (MeshCollider val2 in array2) { val2.convex = true; } anchor.SetActive(true); } private void setAnchorState() { anchor.SetActive(true); } public void setKarveCargo() { bag.SetActive(true); } public void setVikingCargo(int size = 1) { string text = null; if (size == 1) { text = "barrell"; resistanceBlunt(); supplyHealth = 100; } if (size == 2) { text = "default"; resistanceSlash(); supply2Health = 100; } if (text == null) { return; } GameObject gameObject = ((Component)customize.transform.Find("storage")).gameObject; gameObject.SetActive(true); Transform[] componentsInChildren = gameObject.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)((Component)val).gameObject).name.Contains(text) || ((Object)val.parent).name.Contains(text)) { ((Component)val).gameObject.SetActive(true); } } } private void setSailPattern(int decorType) { Renderer component = sail.GetComponent(); Material material = component.material; if ((Object)(object)textures[decorType] != (Object)null) { material.mainTexture = textures[decorType]; } } private void setVikingHead(int decorType) { currentActiveHead(decorType); string[] array = new string[4] { "skull_head", "carnyx_head", "dragon_head", "oseberg_head" }; Transform val = ((Component)this).transform.Find("ship").Find("visual"); Transform fresh = val.Find("hull_new"); Transform worn = val.Find("hull_worn"); Transform broken = val.Find("hull_broken"); string[] array2 = array; foreach (string text in array2) { if (text == currentHeadName) { setHeadVisibility(value: true, text, fresh, worn, broken); } else { setHeadVisibility(value: false, text, fresh, worn, broken); } } } private void setHeadVisibility(bool value, string headName, Transform fresh, Transform worn, Transform broken) { ((Component)fresh.Find(headName)).gameObject.SetActive(value); ((Component)worn.Find(headName)).gameObject.SetActive(value); ((Component)broken.Find(headName)).gameObject.SetActive(value); } public bool UseItem(Humanoid user, ItemData item) { return false; } public void Setup(string name) { m_nview.GetZDO().Set(ZDOVars.s_creatorName, name); } public string GetCreator() { return m_nview.GetZDO().GetString(ZDOVars.s_creatorName, ""); } private void OnDamaged() { } private void OnDestroy() { checkForDropReturn(); RemoveMe(); } private void DropCheck(List requirements) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) foreach (ShipExtension.Requirement requirement in requirements) { Object.Instantiate(((Component)requirement.m_resItem).gameObject, ((Component)this).transform.position, ((Component)this).transform.rotation).GetComponent().m_itemData.m_stack = requirement.m_amount; } } private void validateDrop(ShipExtension.ShipExtensionType type) { ShipExtension shipExtension = shipExtensions.Find((ShipExtension x) => x.type == type); if (shipExtension != null) { DropCheck(shipExtension.m_requirements); } } private void checkForDropReturn() { if (getBoolZDOvalue(ShipExtension.ShipExtensionType.NamePlate.ToString())) { validateDrop(ShipExtension.ShipExtensionType.NamePlate); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Health.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Health); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Oars.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Oars); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Light.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Light); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Anchor.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Anchor); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Inventory.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Inventory); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Inventory2.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Inventory2); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Shelter.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Shelter); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Armor.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Armor); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.ResistBlunt.ToString())) { validateDrop(ShipExtension.ShipExtensionType.ResistBlunt); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.ResistPierce.ToString())) { validateDrop(ShipExtension.ShipExtensionType.ResistPierce); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.ResistSlash.ToString())) { validateDrop(ShipExtension.ShipExtensionType.ResistSlash); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Ram.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Ram); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Ramp.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Ramp); } if (getBoolZDOvalue(ShipExtension.ShipExtensionType.Ropes.ToString())) { validateDrop(ShipExtension.ShipExtensionType.Ropes); } } private void RemoveMe() { ShipyardStation.m_ships.Remove(this); } } public class ShipFishnet : MonoBehaviour, Hoverable, Interactable { public string m_name = ""; [BitMask(typeof(Biome))] public Biome m_biome = (Biome)256; public float m_secPerUnit = 120f; public int m_maxFish = 25; public int m_maxBait = 25; public int m_baitPerProduct = 2; public List m_fishes = new List(); public EffectList m_spawnEffect = new EffectList(); public EffectList m_addEffect = new EffectList(); [Header("Texts")] public string m_extractText = "Pick Fishes"; public string m_checkText = "Out of Luck"; public string m_useItemText = "Add Bait"; public string m_notmoving = "Set sail to catch fishes"; public string m_inventoryInUseText = "Can't pick up the net. Inventory is busy/full"; public string m_emptyNet = "Fishnet is empty"; public GameObject m_enabled; public GameObject m_disabled; public GameObject m_full; public GameObject m_fueled; public Transform m_spawnPoint; public ItemDrop m_fishbait; public List m_acceptedItem = new List(); public Ship m_ship; private Container m_container; private ZNetView m_nview; private Piece m_piece; private void Awake() { m_nview = ((Component)m_ship).GetComponent(); m_container = ((Component)((Component)m_ship).transform.Find("piece_chest")).GetComponent(); m_piece = ((Component)m_ship).GetComponent(); if (m_nview.GetZDO() != null) { if (m_nview.IsOwner() && m_nview.GetZDO().GetLong(ZDOVars.s_lastTime, 0L) == 0) { m_nview.GetZDO().Set(ZDOVars.s_lastTime, ZNet.instance.GetTime().Ticks); } m_nview.Register("RPC_Extract", (Action)RPC_Extract); m_nview.Register("RPC_AddFuel", (Action)RPC_AddFuel); ((MonoBehaviour)this).InvokeRepeating("UpdateFishnet", 1f, 1f); } } public string GetHoverText() { float fuel = GetFuel(); int fishLevel = GetFishLevel(); if (fishLevel == m_maxFish) { return Localization.instance.Localize($"{m_name} ( {m_fishes[0].m_itemData.m_shared.m_name} x {fishLevel} )\n[$KEY_Use] {m_extractText}"); } if (fishLevel <= m_maxFish && fuel <= (float)m_maxBait) { return Localization.instance.Localize($"{m_name} ( {m_fishes[0].m_itemData.m_shared.m_name} x {fishLevel} )\n[$KEY_Use] {m_extractText}" + "\n[1-8] " + m_useItemText); } if (fishLevel <= 0 && fuel <= (float)m_maxBait) { return Localization.instance.Localize(m_name + "\n[1-8] " + m_useItemText); } if (fishLevel > 0 && fuel == (float)m_maxBait) { return Localization.instance.Localize($"{m_name} ( {m_fishes[0].m_itemData.m_shared.m_name} x {fishLevel} )\n[$KEY_Use] {m_extractText}"); } if (fuel <= 0f && fishLevel <= 0) { return Localization.instance.Localize(m_name + "\n[1-8] " + m_useItemText); } return Localization.instance.Localize(m_name + m_notmoving); } public string GetHoverName() { return m_name; } public bool Interact(Humanoid character, bool repeat, bool alt) { if (repeat) { return false; } if (GetFishLevel() > 0) { if (m_container.IsInUse()) { ((Character)character).Message((MessageType)2, m_inventoryInUseText, 0, (Sprite)null); return false; } Extract(); } else { ((Character)character).Message((MessageType)2, m_emptyNet, 0, (Sprite)null); } return true; } public bool UseItem(Humanoid user, ItemData item) { if (item != null || !canUseItem(item)) { ((Character)user).Message((MessageType)2, "$msg_wrongitem", 0, (Sprite)null); return false; } if ((double)GetFuel() > (double)(m_maxBait - 1)) { ((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null); return false; } ((Character)user).Message((MessageType)2, "$msg_added " + item.m_shared.m_name, 0, (Sprite)null); user.GetInventory().RemoveItem(item.m_shared.m_name, 1, -1, true); m_nview.InvokeRPC("AddFuel", Array.Empty()); return true; } private bool canUseItem(ItemData item) { return Object.op_Implicit((Object)(object)m_acceptedItem.Find((GameObject x) => ((Object)x).name == ((Object)item.m_dropPrefab).name)); } private void Extract() { m_nview.InvokeRPC("RPC_Extract", Array.Empty()); } private void RPC_Extract(long caller) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) int fishLevel = GetFishLevel(); if (fishLevel <= 0) { return; } m_spawnEffect.Create(m_spawnPoint.position, Quaternion.identity, (Transform)null, 1f, -1); int num = fishLevel; for (int i = 0; i < fishLevel; i++) { ItemDrop val = RollForFish(); if (!m_container.IsInUse() && (m_container.m_inventory.HaveEmptySlot() || m_container.m_inventory.CanAddItem(((Component)val).gameObject, 1))) { ItemData val2 = val.m_itemData.Clone(); m_container.m_inventory.AddItem(val2.m_dropPrefab, Game.instance.ScaleDrops(val2, 1)); num--; continue; } SetFishLevel(num); break; } } private ItemDrop RollForFish() { int index = Random.Range(0, m_fishes.Count - 1); return m_fishes[index]; } private void IncreseLevel(int i) { int fishLevel = GetFishLevel(); m_nview.GetZDO().Set(ZDOVars.s_level, fishLevel + i, false); } private int GetFishLevel() { return m_nview.GetZDO().GetInt(ZDOVars.s_level, 0); } private void SetFishLevel(int level) { m_nview.GetZDO().Set(ZDOVars.s_level, level, false); } private void UpdateFishnet() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 if (!m_nview.IsOwner()) { return; } SetState(); SetNetState(); if ((int)m_ship.m_speed == 0) { return; } int num = timeModifer(); double deltaTime = GetDeltaTime(); float num2 = GetAccumulator() + (float)deltaTime; if ((double)num2 > 3600.0) { num2 = 3600f; } float num3 = 1f; while ((double)num2 >= 1.0) { num2 -= 1f; float fuel = GetFuel(); if ((m_maxBait != 0 && !((double)fuel > 0.0)) || !((double)(m_secPerUnit - (float)num) > 0.0)) { continue; } float num4 = 1f * num3; if (m_maxBait > 0) { float num5 = m_secPerUnit / (float)m_baitPerProduct; float num6 = fuel - num4 / num5; if ((double)num6 < 9.99999974737875E-05) { num6 = 0f; } SetFuel(num6); } float num7 = GetBakeTimer() + num4; SetBakeTimer(num7); if ((double)num7 >= (double)m_secPerUnit - (double)num) { SetBakeTimer(0f); IncreseLevel(1); } } SetAccumulator(num2); } private int timeModifer() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected I4, but got Unknown int num = 0; Speed speed = m_ship.m_speed; Speed val = speed; switch (val - 1) { case 0: num = 10; break; case 1: num = 20; break; case 2: num = 30; break; case 3: num = 40; break; } if (CheckBiome()) { num += 20; } if (!EnvMan.instance.CalculateDaylight()) { num -= 20; } return num; } private void SetNetState() { if (!IsActive()) { m_full.SetActive(false); return; } m_full.SetActive(true); int fishLevel = GetFishLevel(); if (fishLevel > 1) { ((Component)m_full.transform.Find("low")).gameObject.SetActive(true); } else { ((Component)m_full.transform.Find("low")).gameObject.SetActive(false); } if ((double)fishLevel >= (double)m_maxFish * 0.5) { ((Component)m_full.transform.Find("mid")).gameObject.SetActive(true); } else { ((Component)m_full.transform.Find("mid")).gameObject.SetActive(false); } if ((double)fishLevel >= (double)m_maxFish * 0.75) { ((Component)m_full.transform.Find("max")).gameObject.SetActive(true); } else { ((Component)m_fueled.transform.Find("max")).gameObject.SetActive(false); } if (fishLevel >= m_maxFish) { m_full.SetActive(false); } } private void SetState() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 if (GetFuel() > 0f) { m_fueled.SetActive(true); } else { m_enabled.SetActive(false); m_disabled.SetActive(true); m_fueled.SetActive(false); } if ((int)m_ship.m_speed == 0) { m_enabled.SetActive(false); m_disabled.SetActive(true); return; } if (GetFishLevel() == m_maxFish) { m_enabled.SetActive(false); m_disabled.SetActive(true); } if (GetFishLevel() == m_maxFish) { m_enabled.SetActive(false); m_disabled.SetActive(true); } } private float GetFuel() { return (!m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f); } private void SetFuel(float fuel) { if (m_nview.IsValid()) { m_nview.GetZDO().Set(ZDOVars.s_fuel, fuel); } } private void RPC_AddFuel(long sender) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (m_nview.IsOwner()) { SetFuel(GetFuel() + 1f); if (Object.op_Implicit((Object)(object)m_spawnPoint)) { m_addEffect.Create(m_spawnPoint.position, ((Component)this).transform.rotation, ((Component)this).transform, 1f, -1); } } } private float GetAccumulator() { return (!m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_accTime, 0f); } private void SetAccumulator(float t) { if (m_nview.IsValid()) { m_nview.GetZDO().Set(ZDOVars.s_accTime, t); } } private double GetDeltaTime() { DateTime time = ZNet.instance.GetTime(); DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong("StartTime", time.Ticks)); double totalSeconds = (time - dateTime).TotalSeconds; m_nview.GetZDO().Set(ZDOVars.s_startTime, time.Ticks); return totalSeconds; } private bool IsActive() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 return m_nview.IsValid() && GetFuel() > 0f && (int)m_ship.m_speed > 0; } private float GetBakeTimer() { return (!m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_bakeTimer, 0f); } private void SetBakeTimer(float t) { if (m_nview.IsValid()) { m_nview.GetZDO().Set(ZDOVars.s_bakeTimer, t); } } private bool CheckBiome() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 return (Heightmap.FindBiome(((Component)this).transform.position) & m_biome) > 0; } private void DropAllItems() { //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_00f1: 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_0105: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (GetFuel() > 0f) { float num = ((m_nview.GetZDO() == null) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f)); for (int i = 0; i < (int)num; i++) { ItemDrop.OnCreateNew(Object.Instantiate(((Component)m_fishbait).gameObject, ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f))); } } while (GetFishLevel() > 0) { ItemDrop val = RollForFish(); if ((Object)(object)val != (Object)null) { ItemData val2 = val.m_itemData.Clone(); Vector3 val3 = ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f; Quaternion val4 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); ItemDrop.OnCreateNew(Object.Instantiate(val2.m_dropPrefab, val3, val4)); SetFishLevel(GetFishLevel() - 1); } } } private void OnDestroyed() { if (m_nview.IsOwner()) { DropAllItems(); } } } public class ShipOwnerName : MonoBehaviour, Hoverable, Interactable, TextReceiver { public Text m_textWidget; public string m_shipName = ""; public string m_owner = ""; public string m_maintext = "$piece_bed_unclaimed"; public string m_name = ""; public const int m_characterLimit = 100; public ZNetView m_nview; public Ship m_ship; private void Awake() { if ((Object)(object)m_nview == (Object)null) { m_nview = ((Component)m_ship).GetComponent(); } if (m_nview.GetZDO() != null) { m_nview.Register("SetOwner", (Action)RPC_SetOwner); m_nview.Register("SetShipName", (Action)RPC_SetShipName); UpdateText(); ((MonoBehaviour)this).InvokeRepeating("UpdateText", 0f, 1f); } } public string GetHoverText() { if (GetOwner() == 0) { return Localization.instance.Localize("Unclaimed ship \n[$KEY_Use] $piece_bed_claim"); } string text = GetText(); if (GetOwner() != 0L && (text == "" || text == null)) { return Localization.instance.Localize(GetOwnerName() + "\n[$KEY_Use] Set Ship Name"); } return (!IsMine()) ? ("Restricted\n" + text + "\n[Owner] " + GetOwnerName()) : (Localization.instance.Localize(text + "\n[$KEY_Use] Change Name") + "\n[Owner] " + GetOwnerName()); } public string GetHoverName() { return m_shipName; } public bool Interact(Humanoid human, bool repeat, bool alt) { if (repeat || m_nview.GetZDO() == null) { return false; } long playerID = Game.instance.GetPlayerProfile().GetPlayerID(); long owner = GetOwner(); Player val = (Player)(object)((human is Player) ? human : null); if (owner == 0) { ZLog.Log((object)"Has no owner"); SetOwner(playerID, Game.instance.GetPlayerProfile().GetName()); TextInput.instance.RequestText((TextReceiver)(object)this, "$piece_sign_input", 100); UpdateText(); SetShipName(playerID, m_shipName); return true; } if (IsMine()) { ZLog.Log((object)"Is mine"); TextInput.instance.RequestText((TextReceiver)(object)this, "$piece_sign_input", 100); UpdateText(); SetShipName(playerID, m_shipName); return true; } return false; } public bool UseItem(Humanoid user, ItemData item) { return false; } public string GetText() { return m_nview.GetZDO().GetString("ShipName", "O-dynie"); } public void SetText(string text) { SetupTextWIdget(text); ((MonoBehaviour)this).StartCoroutine(GetName(text, ApplyName)); } private void UpdateText() { string text = GetText(); if (!(m_shipName == text)) { SetText(text); } } private void ApplyName(string shipName) { m_nview.GetZDO().Set("ShipName", shipName); m_shipName = shipName; } public IEnumerator GetName(string text, Action callback) { callback(text); yield return null; } public void SetupTextWIdget(string text) { m_shipName = text; if ((Object)(object)m_textWidget != (Object)null) { m_textWidget.text = m_shipName; } else { Debug.LogWarning((object)"Text widget not found"); } } private bool IsMine() { return Game.instance.GetPlayerProfile().GetPlayerID() == GetOwner(); } private void SetOwner(long uid, string name) { m_nview.InvokeRPC("SetOwner", new object[2] { uid, name }); } private void SetShipName(long uid, string name) { m_nview.InvokeRPC(ZNetView.Everybody, "SetShipName", new object[2] { uid, name }); } private void RPC_SetOwner(long sender, long uid, string name) { if (m_nview.IsOwner()) { m_nview.GetZDO().Set(ZDOVars.s_owner, uid); m_nview.GetZDO().Set(ZDOVars.s_ownerName, name); } } private void RPC_SetShipName(long sender, long uid, string name) { if (m_nview.IsOwner()) { m_nview.GetZDO().Set("ShipName", name); SetText(name); } } private long GetOwner() { return (m_nview.GetZDO() == null) ? 0 : m_nview.GetZDO().GetLong(ZDOVars.s_owner, 0L); } private string GetOwnerName() { return (m_nview.GetZDO() == null) ? "" : m_nview.GetZDO().GetString(ZDOVars.s_ownerName, ""); } } public class ShipProcessor { public GameObject shipyard; public List texturesDrakkar; public List list; public void setupShipyard(ZNetScene zNetScene, GameObject prefab) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "guard_stone"); PrivateArea component = val.GetComponent(); ShipyardStation shipyardStation = prefab.GetComponent(); if ((Object)(object)shipyardStation == (Object)null) { shipyardStation = prefab.AddComponent(); } shipyardStation.m_switch = ((Component)shipyard.transform.Find("switch")).GetComponent(); shipyardStation.m_switch.m_name = "Upgrade Ship"; shipyardStation.m_switch.m_hoverText = "Upgrade Ship"; shipyardStation.m_container = ((Component)shipyard.transform.Find("container")).GetComponent(); shipyardStation.m_leverAnim = ((Component)shipyard.transform.Find("Lever")).GetComponent(); shipyardStation.m_effectDelayMax = 3f; shipyardStation.m_effectDelayMin = 3f; shipyardStation.m_areaMarker = ((Component)((Component)shipyardStation).transform.Find("AreaMarker")).GetComponent(); shipyardStation.m_connectEffect = component.m_connectEffect; shipyardStation.m_inRangeEffect = ((Component)((Component)shipyardStation).transform.Find("InRangeIndicator")).gameObject; shipyardStation.m_conversions = list; } public void addDrakkarExtensions(GameObject extensions, GameObject ship, ZNetScene zNetScene) { PrivateArea component = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "guard_stone").GetComponent(); setPosition(extensions, ship); GameObject gameObject = ((Component)ship.transform.Find("ship").Find("visual").Find("Customize")).gameObject; if ((Object)(object)gameObject == (Object)null) { Debug.LogWarning((object)"No customize found"); } ShipExtensionManager shipExtensionManager = ship.GetComponent(); if ((Object)(object)shipExtensionManager == (Object)null) { shipExtensionManager = ship.AddComponent(); } gameObject.SetActive(true); shipExtensionManager.customize = gameObject; shipExtensionManager.textures = texturesDrakkar; shipExtensionManager.m_type = ShipExtension.ShipType.Drakkar; if ((Object)(object)extensions != (Object)null) { shipExtensionManager.lights = ((Component)extensions.transform.Find("Lamps")).gameObject; shipExtensionManager.lights.SetActive(false); shipExtensionManager.anchor = ((Component)extensions.transform.Find("Anchor")).gameObject; shipExtensionManager.oars = ((Component)extensions.transform.Find("Oars")).gameObject; shipExtensionManager.oars.SetActive(false); shipExtensionManager.roof = ((Component)extensions.transform.Find("Roof")).gameObject; shipExtensionManager.lampheat = ((Component)extensions.transform.Find("LampWarm")).gameObject; shipExtensionManager.ram = ((Component)extensions.transform.Find("BatteringRam")).gameObject; shipExtensionManager.fishnet = ((Component)extensions.transform.Find("fishnet")).gameObject; shipExtensionManager.armor = ((Component)extensions.transform.Find("carapacehull")).gameObject; shipExtensionManager.shields = ((Component)extensions.transform.Find("shieldset")).gameObject; shipExtensionManager.shields.SetActive(false); setupShieldPainter(shipExtensionManager.shields, ((Component)shipExtensionManager).GetComponent(), 5); shipExtensionManager.armor.SetActive(false); shipExtensionManager.lampheat.SetActive(false); shipExtensionManager.ram.SetActive(false); shipExtensionManager.nameplate = ((Component)extensions.transform.Find("shipplate")).gameObject; shipExtensionManager.nameplate.SetActive(false); } shipExtensionManager.shipExtensions = Launch.listDrakkar; Ship component2 = ship.GetComponent(); setupNamePlate(shipExtensionManager.nameplate, component2); setupFishnet(shipExtensionManager.fishnet, component2); setupAnchor(shipExtensionManager.anchor, component, component2); setupShipLamps(gameObject); setupShipShieldsAndCrates(gameObject); setupShipTent(gameObject); } public void setupShieldPainter(GameObject shieldSet, Ship ship, int stylesAmount = 3) { ShieldPainter shieldPainter = shieldSet.GetComponent(); if ((Object)(object)shieldPainter == (Object)null) { shieldPainter = shieldSet.AddComponent(); } shieldPainter.m_ship = ship; shieldPainter.shieldStyles = stylesAmount; shieldPainter.m_nview = ((Component)ship).GetComponent(); } public void setupNamePlate(GameObject namePlate, Ship ship) { ShipOwnerName component = namePlate.GetComponent(); if ((Object)(object)component == (Object)null) { component = namePlate.AddComponent(); component.m_nview = ((Component)ship).GetComponent(); component.m_textWidget = ((Component)((Component)component).transform.Find("Canvas/Text")).GetComponent(); component.m_ship = ship; } } public void setupFishnet(GameObject fishnet, Ship ship) { ShipFishnet shipFishnet = fishnet.GetComponent(); if ((Object)(object)shipFishnet == (Object)null) { shipFishnet = fishnet.AddComponent(); } shipFishnet.m_enabled = ((Component)fishnet.transform.Find("_enabled")).gameObject; shipFishnet.m_disabled = ((Component)fishnet.transform.Find("_disabled")).gameObject; shipFishnet.m_fueled = ((Component)fishnet.transform.Find("_fueled")).gameObject; shipFishnet.m_full = ((Component)fishnet.transform.Find("full")).gameObject; shipFishnet.m_ship = ship; } public static void setupAnchorDrakkar(GameObject anchor, PrivateArea privateArea, ZNetView zNetView) { AnchorSwitch anchorSwitch = anchor.GetComponent(); if ((Object)(object)anchorSwitch == (Object)null) { anchorSwitch = anchor.AddComponent(); } anchorSwitch.m_name = "Anchor"; anchorSwitch.m_nview = zNetView; anchorSwitch.m_enabled = ((Component)anchor.transform.Find("_enabled")).gameObject; anchorSwitch.m_ship = ((Component)zNetView).GetComponent(); anchorSwitch.m_disabled = ((Component)anchor.transform.Find("_disabled")).gameObject; anchorSwitch.m_activateEffect = privateArea.m_activateEffect; anchorSwitch.m_deactivateEffect = privateArea.m_deactivateEffect; ((Component)anchorSwitch).gameObject.SetActive(false); } public void setupAnchor(GameObject anchor, PrivateArea privateArea, Ship ship) { if ((Object)(object)anchor == (Object)null) { return; } AnchorSwitch anchorSwitch = anchor.GetComponent(); if ((Object)(object)anchorSwitch == (Object)null) { anchorSwitch = anchor.AddComponent(); } anchorSwitch.m_name = "Anchor"; if ((Object)(object)ship == (Object)null) { Debug.LogError((object)("[setupAnchor] Anchor is not under a Ship in hierarchy: " + ((Object)anchor).name)); return; } ZNetView component = ((Component)ship).GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)("[setupAnchor] Ship has no ZNetView: " + ((Object)ship).name)); return; } anchorSwitch.m_ship = ship; anchorSwitch.m_nview = component; Transform val = anchor.transform.Find("_enabled"); Transform val2 = anchor.transform.Find("_disabled"); anchorSwitch.m_enabled = (Object.op_Implicit((Object)(object)val) ? ((Component)val).gameObject : null); anchorSwitch.m_disabled = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).gameObject : null); if (Object.op_Implicit((Object)(object)anchorSwitch.m_enabled)) { anchorSwitch.m_enabled.SetActive(false); } if (Object.op_Implicit((Object)(object)anchorSwitch.m_disabled)) { anchorSwitch.m_disabled.SetActive(true); } if ((Object)(object)privateArea != (Object)null) { anchorSwitch.m_activateEffect = privateArea.m_activateEffect; anchorSwitch.m_deactivateEffect = privateArea.m_deactivateEffect; } ((Component)anchorSwitch).gameObject.SetActive(false); } public void setupShipLamps(GameObject customize) { GameObject gameObject = ((Component)customize.transform.Find("TraderLamp")).gameObject; if ((Object)(object)gameObject == (Object)null) { Debug.LogWarning((object)"No lamp found"); } gameObject.SetActive(false); ((Component)gameObject.transform.Find("insects")).gameObject.SetActive(true); Light component = ((Component)gameObject.transform.Find("Point light")).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)"No LIGHT found"); } component.range = 6f; component.intensity = 3f; } public void setupShipShieldsAndCrates(GameObject customize) { GameObject gameObject = ((Component)customize.transform.Find("storage")).gameObject; gameObject.SetActive(true); Transform[] componentsInChildren = gameObject.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { ((Component)val).gameObject.SetActive(false); } } public void setupShipTent(GameObject customize) { GameObject gameObject = ((Component)customize.transform.Find("ShipTen2 (1)")).gameObject; GameObject gameObject2 = ((Component)customize.transform.Find("ShipTen2_beam")).gameObject; GameObject gameObject3 = ((Component)customize.transform.Find("ShipTentHolders")).gameObject; GameObject gameObject4 = ((Component)customize.transform.Find("ShipTentHolders (1)")).gameObject; gameObject.SetActive(false); gameObject2.SetActive(false); gameObject3.SetActive(false); gameObject4.SetActive(false); } public void setupShipHeads(GameObject ship) { //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)ship.transform.Find("ship").Find("visual").Find("unused")).gameObject; GameObject gameObject2 = ((Component)gameObject.transform.Find("dragon_head")).gameObject; GameObject gameObject3 = ((Component)gameObject.transform.Find("carnyx_head")).gameObject; GameObject gameObject4 = ((Component)gameObject.transform.Find("oseberg_head")).gameObject; gameObject2.SetActive(false); gameObject3.SetActive(false); gameObject4.SetActive(false); Transform val = ship.transform.Find("ship").Find("visual"); Transform val2 = val.Find("hull_new"); Transform val3 = val.Find("hull_worn"); Transform val4 = val.Find("hull_broken"); Transform val5 = val2.Find("skull_head"); List list = new List(); list.Add(gameObject2); list.Add(gameObject3); list.Add(gameObject4); foreach (GameObject item in list) { Vector3 position = val5.position; Quaternion rotation = val5.rotation; GameObject val6 = null; if (!Object.op_Implicit((Object)(object)val2.Find(((Object)item).name + "(Clone)")) || !Object.op_Implicit((Object)(object)val2.Find(((Object)item).name))) { val6 = Object.Instantiate(item, position, rotation, val2); ((Object)val6).name = ((Object)item).name; } if (!Object.op_Implicit((Object)(object)val3.Find(((Object)item).name + "(Clone)")) || !Object.op_Implicit((Object)(object)val3.Find(((Object)item).name))) { val6 = Object.Instantiate(item, position, rotation, val3); GameObject gameObject5 = ((Component)val3.Find("skull_head")).gameObject; Material material = gameObject5.GetComponent().material; ((Object)val6).name = ((Object)item).name; val6.GetComponent().material = material; } if (!Object.op_Implicit((Object)(object)val4.Find(((Object)item).name + "(Clone)")) || !Object.op_Implicit((Object)(object)val4.Find(((Object)item).name))) { val6 = Object.Instantiate(item, position, rotation, val4); GameObject gameObject6 = ((Component)val3.Find("skull_head")).gameObject; Material material2 = gameObject6.GetComponent().material; ((Object)val6).name = ((Object)item).name; val6.GetComponent().material = material2; } val6.transform.localPosition = position; val6.transform.localRotation = rotation; } } public void addRaftExtensions(GameObject extensions, GameObject ship, ZNetScene zNetScene) { setPosition(extensions, ship); extensions.SetActive(true); GameObject gameObject = ((Component)extensions.transform.Find("piece_chest")).gameObject; gameObject.SetActive(true); gameObject.GetComponent().m_rootObjectOverride = ship.GetComponent(); gameObject.GetComponent().m_destroyedLootPrefab = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "CargoCrate"); } public void addKarveExtensions(GameObject extensions, GameObject ship, ZNetScene zNetScene) { ShipExtensionManager shipExtensionManager = setupShipExtensions(extensions, ship, zNetScene, Launch.listKarve); shipExtensionManager.m_type = ShipExtension.ShipType.Karve; shipExtensionManager.bag = ((Component)extensions.transform.Find("simplebackpack")).gameObject; setupShieldPainter(shipExtensionManager.shields, ((Component)shipExtensionManager).GetComponent()); } public void addKnarrExtensions(GameObject extensions, GameObject ship, ZNetScene zNetScene) { ShipExtensionManager shipExtensionManager = setupShipExtensions(extensions, ship, zNetScene, Launch.listKnarr); shipExtensionManager.m_type = ShipExtension.ShipType.Knarr; shipExtensionManager.bag = ((Component)extensions.transform.Find("simplebackpack")).gameObject; shipExtensionManager.tent = ((Component)extensions.transform.Find("tentfull")).gameObject; setupShieldPainter(shipExtensionManager.shields, ((Component)shipExtensionManager).GetComponent()); } public void addSnekkeExtensions(GameObject extensions, GameObject ship, ZNetScene zNetScene) { ShipExtensionManager shipExtensionManager = setupShipExtensions(extensions, ship, zNetScene, Launch.listSnekke); shipExtensionManager.m_type = ShipExtension.ShipType.Snekke; shipExtensionManager.bag = ((Component)extensions.transform.Find("simplebackpack")).gameObject; shipExtensionManager.tent = ((Component)extensions.transform.Find("tentfull")).gameObject; setupShieldPainter(shipExtensionManager.shields, ((Component)shipExtensionManager).GetComponent()); } public ShipExtensionManager setupShipExtensions(GameObject extensions, GameObject ship, ZNetScene zNetScene, List shipExtensions) { PrivateArea component = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "guard_stone").GetComponent(); setPosition(extensions, ship); ShipExtensionManager shipExtensionManager = ship.GetComponent(); if ((Object)(object)shipExtensionManager == (Object)null) { shipExtensionManager = ship.AddComponent(); } if ((Object)(object)extensions != (Object)null) { shipExtensionManager.lights = ((Component)extensions.transform.Find("Lamps")).gameObject; shipExtensionManager.lights.SetActive(false); shipExtensionManager.anchor = ((Component)extensions.transform.Find("Anchor")).gameObject; shipExtensionManager.anchor.SetActive(false); shipExtensionManager.oars = ((Component)extensions.transform.Find("Oars")).gameObject; shipExtensionManager.oars.SetActive(false); shipExtensionManager.shields = ((Component)extensions.transform.Find("shieldset")).gameObject; shipExtensionManager.shields.SetActive(false); shipExtensionManager.armor = ((Component)extensions.transform.Find("carapacehull")).gameObject; shipExtensionManager.sail = ((Component)ship.GetComponent().m_sailObject.transform.Find("sail_full")).gameObject; shipExtensionManager.nameplate = ((Component)extensions.transform.Find("shipplate")).gameObject; shipExtensionManager.nameplate.SetActive(false); } Ship component2 = ship.GetComponent(); shipExtensionManager.textures = texturesDrakkar; shipExtensionManager.shipExtensions = shipExtensions; setupNamePlate(shipExtensionManager.nameplate, component2); setupAnchor(shipExtensionManager.anchor, component, component2); return shipExtensionManager; } public void addHolkExtensions(GameObject extensions, GameObject ship, ZNetScene zNetScene) { ShipExtensionManager shipExtensionManager = setupShipExtensions(extensions, ship, zNetScene, Launch.listHolk); shipExtensionManager.m_type = ShipExtension.ShipType.Holk; shipExtensionManager.bag = ((Component)extensions.transform.Find("storage")).gameObject; shipExtensionManager.ropes = ((Component)extensions.transform.Find("siderope")).gameObject; shipExtensionManager.ramp = ((Component)extensions.transform.Find("ramp_door")).gameObject; shipExtensionManager.cage = ((Component)extensions.transform.Find("zagroda")).gameObject; shipExtensionManager.tent = ((Component)extensions.transform.Find("maintent")).gameObject; setupShieldPainter(shipExtensionManager.shields, ((Component)shipExtensionManager).GetComponent(), 6); } public void addAshlandsDrakkarExtensions(GameObject extensions, GameObject ship, ZNetScene zNetScene) { ShipExtensionManager shipExtensionManager = setupShipExtensions(extensions, ship, zNetScene, Launch.listAshlandsDrakkar); shipExtensionManager.m_type = ShipExtension.ShipType.AshlandsDrakkar; shipExtensionManager.bag = ((Component)extensions.transform.Find("storage")).gameObject; shipExtensionManager.ropes = ((Component)extensions.transform.Find("siderope")).gameObject; shipExtensionManager.tent = ((Component)extensions.transform.Find("maintent")).gameObject; setupShieldPainter(shipExtensionManager.shields, ((Component)shipExtensionManager).GetComponent(), 4); } public void setupLamp(GameObject lamp, PrivateArea privateArea, ZNetView zNetView) { ShipSwitch shipSwitch = lamp.AddComponent(); shipSwitch.m_name = "Lamp"; shipSwitch.m_nview = zNetView; shipSwitch.m_enabledObject = ((Component)lamp.transform.Find("_enabled")).gameObject; shipSwitch.m_activateEffect = privateArea.m_activateEffect; shipSwitch.m_deactivateEffect = privateArea.m_deactivateEffect; } public void setPosition(GameObject extensions, GameObject ship) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) extensions.transform.position = ship.transform.position; extensions.transform.rotation = ship.transform.rotation; extensions.transform.parent = ship.transform; extensions.transform.position = ship.transform.position; extensions.transform.rotation = ship.transform.rotation; } } public class ShipRamp : MonoBehaviour, Hoverable, Interactable { public string m_name = "ramp"; public ItemDrop m_keyItem; public bool m_canNotBeClosed; public bool m_invertedOpenClosedText; public GameObject m_openEnable; public EffectList m_openEffects = new EffectList(); public EffectList m_closeEffects = new EffectList(); public EffectList m_lockedEffects = new EffectList(); public ZNetView m_nview; private Animator m_animator; private void Awake() { if (m_nview.GetZDO() != null) { m_animator = ((Component)this).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)m_nview)) { m_nview.Register("UseDoor", (Action)RPC_UseDoor); } ((MonoBehaviour)this).InvokeRepeating("UpdateState", 0f, 0.2f); } } private void UpdateState() { if (m_nview.IsValid()) { SetState(m_nview.GetZDO().GetInt(ZDOVars.s_state, 0)); } } private void SetState(int state) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (m_animator.GetInteger("state") != state) { if (state != 0) { m_openEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } else { m_closeEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } m_animator.SetInteger("state", state); } if (Object.op_Implicit((Object)(object)m_openEnable)) { m_openEnable.SetActive(state != 0); } } private bool CanInteract() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)m_keyItem != (Object)null || m_canNotBeClosed) && m_nview.GetZDO().GetInt(ZDOVars.s_state, 0) != 0) { return false; } AnimatorStateInfo currentAnimatorStateInfo = m_animator.GetCurrentAnimatorStateInfo(0); int result; if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsTag("open")) { currentAnimatorStateInfo = m_animator.GetCurrentAnimatorStateInfo(0); result = (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsTag("closed") ? 1 : 0); } else { result = 1; } return (byte)result != 0; } public string GetHoverText() { if (!m_nview.IsValid() || (m_canNotBeClosed && !CanInteract())) { return ""; } if (!CanInteract()) { return Localization.instance.Localize(m_name); } return (m_nview.GetZDO().GetInt(ZDOVars.s_state, 0) != 0) ? Localization.instance.Localize(m_name + "\n[$KEY_Use] " + (m_invertedOpenClosedText ? "$piece_door_open" : "$piece_door_close")) : Localization.instance.Localize(m_name + "\n[$KEY_Use] " + (m_invertedOpenClosedText ? "$piece_door_close" : "$piece_door_open")); } public string GetHoverName() { return m_name; } public bool Interact(Humanoid character, bool hold, bool alt) { //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) if (hold || !CanInteract()) { return false; } if ((Object)(object)m_keyItem != (Object)null) { if (!HaveKey(character)) { m_lockedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); if (Game.m_worldLevel > 0 && HaveKey(character, matchWorldLevel: false)) { ((Character)character).Message((MessageType)2, Localization.instance.Localize("$msg_ng_the_x") + m_keyItem.m_itemData.m_shared.m_name + Localization.instance.Localize("$msg_ng_x_is_too_low"), 0, (Sprite)null); } else { ((Character)character).Message((MessageType)2, Localization.instance.Localize("$msg_door_needkey", new string[1] { m_keyItem.m_itemData.m_shared.m_name }), 0, (Sprite)null); } return true; } ((Character)character).Message((MessageType)2, Localization.instance.Localize("$msg_door_usingkey", new string[1] { m_keyItem.m_itemData.m_shared.m_name }), 0, (Sprite)null); } Vector3 val = ((Component)character).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Game.instance.IncrementPlayerStat((PlayerStatType)((m_nview.GetZDO().GetInt(ZDOVars.s_state, 0) == 0) ? 74 : 75), 1f); Open(normalized); return true; } private void Open(Vector3 userDir) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) m_nview.InvokeRPC("UseDoor", new object[1] { (double)Vector3.Dot(((Component)this).transform.forward, userDir) < 0.0 }); } public bool UseItem(Humanoid user, ItemData item) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_keyItem != (Object)null) || !(m_keyItem.m_itemData.m_shared.m_name == item.m_shared.m_name) || !CanInteract()) { return false; } ((Character)user).Message((MessageType)2, Localization.instance.Localize("$msg_door_usingkey", new string[1] { m_keyItem.m_itemData.m_shared.m_name }), 0, (Sprite)null); Vector3 val = ((Component)user).transform.position - ((Component)this).transform.position; Open(((Vector3)(ref val)).normalized); return true; } private bool HaveKey(Humanoid player, bool matchWorldLevel = true) { return (Object)(object)m_keyItem == (Object)null || player.GetInventory().HaveItem(m_keyItem.m_itemData.m_shared.m_name, matchWorldLevel); } private void RPC_UseDoor(long uid, bool forward) { if (!CanInteract()) { return; } if (m_nview.GetZDO().GetInt(ZDOVars.s_state, 0) == 0) { if (forward) { m_nview.GetZDO().Set(ZDOVars.s_state, 1, false); } else { m_nview.GetZDO().Set(ZDOVars.s_state, -1, false); } } else { m_nview.GetZDO().Set(ZDOVars.s_state, 0, false); } UpdateState(); } } public class ShipSwitch : MonoBehaviour, Hoverable, Interactable { public string m_name = ""; public EffectList m_activateEffect = new EffectList(); public string turnOffMessage = ""; public string turnOnMessage = ""; public EffectList m_deactivateEffect = new EffectList(); public ZNetView m_nview; public GameObject m_enabledObject; public bool wasAdded = false; private void Awake() { if (m_nview.IsValid()) { if (m_name == "") { m_name = " Active Me"; } if (!IsEnabled() && !wasAdded) { m_nview.Register("ToggleShipLight", (Action)RPC_ToggleShipLight); wasAdded = true; } } } private void UpdateStatus() { bool active = IsEnabled(); if ((Object)(object)m_enabledObject != (Object)null) { m_enabledObject.SetActive(active); } else { Debug.LogWarning((object)"[SHIPYARD] No object to Toggle"); } } public string GetHoverText() { if (IsEnabled()) { return Localization.instance.Localize(m_name + "\n[$KEY_Use] Disable"); } return Localization.instance.Localize(m_name + "\n[$KEY_Use] Enable"); } public string GetHoverName() { return m_name; } private void RPC_ToggleShipLight(long uid, long playerID) { SetEnabled(!IsEnabled()); } public bool IsEnabled() { return m_nview.IsValid() && m_nview.GetZDO().GetBool("lightOn", false); } private void SetEnabled(bool enabled) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) m_nview.GetZDO().Set("lightOn", enabled); UpdateStatus(); if (enabled) { m_activateEffect.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } else { m_deactivateEffect.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } } public bool Interact(Humanoid character, bool repeat, bool alt) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (repeat) { return false; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } m_nview.InvokeRPC("ToggleShipLight", new object[1] { ((Component)character).GetComponent().GetPlayerID() }); if (turnOffMessage != "" && turnOnMessage != "") { ((Character)character).Message((MessageType)2, IsEnabled() ? turnOnMessage : turnOffMessage, 0, (Sprite)null); } else { ((Character)character).Message((MessageType)2, m_name + " was " + (IsEnabled() ? "turned on" : "turned off"), 0, (Sprite)null); } return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } public void Setup(string name) { m_nview.GetZDO().Set("creatorLampName", name); } } public class ShipyardStation : MonoBehaviour { public Switch m_switch; public Container m_container; public Animator m_leverAnim; public float m_effectDelayMin; public float m_effectDelayMax; public float m_radius = 30f; public float m_updateConnectionsInterval = 5f; public CircleProjector m_areaMarker; public GameObject m_connectEffect; public GameObject m_inRangeEffect; public static List m_ships = new List(); private List m_connectionInstances = new List(); private float m_connectionUpdateTime = -1000f; private List m_connectedAreas = new List(); private bool m_tempChecked; private static List m_allAreas = new List(); [Header("Conversion")] public List m_conversions = new List(); private ZNetView m_nview; private bool isInUse; private void Awake() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown Switch @switch = m_switch; @switch.m_onUse = (Callback)Delegate.Combine((Delegate?)(object)@switch.m_onUse, (Delegate?)new Callback(OnCollectToBuild)); Switch switch2 = m_switch; switch2.m_onHover = (TooltipCallback)Delegate.Combine((Delegate?)(object)switch2.m_onHover, (Delegate?)new TooltipCallback(GetLeverHoverText)); m_nview = ((Component)this).GetComponent(); if (!((Object)(object)m_nview == (Object)null) && m_nview.GetZDO() != null) { WearNTear component = ((Component)this).GetComponent(); component.m_onDamaged = (Action)Delegate.Combine(component.m_onDamaged, new Action(OnDamaged)); if (Object.op_Implicit((Object)(object)m_areaMarker)) { m_areaMarker.m_radius = m_radius; } if (Object.op_Implicit((Object)(object)m_inRangeEffect)) { m_inRangeEffect.SetActive(false); } if (!m_allAreas.Contains(this)) { m_allAreas.Add(this); } m_nview.GetZDO().Set("enabled", true); m_nview.Register("RPC_RequestShipyardLaunch", (Action)RPC_RequestShipyardLaunch); m_nview.Register("RPC_ShipyardRespons", (Action)RPC_ShipyardRespons); m_nview.Register("RPC_AnimateShipLever", (Action)RPC_AnimateShipLever); m_nview.Register("RPC_AnimateShipLeverReturn", (Action)RPC_AnimateShipLeverReturn); ((MonoBehaviour)this).Invoke("HideMarker", 2f); } } public string GetLeverHoverText() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) ? Localization.instance.Localize("$piece_incinerator\n$piece_noaccess") : Localization.instance.Localize("[$KEY_Use] Upgrade Ship"); } private bool OnCollectToBuild(Switch sw, Humanoid user, ItemData item) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!m_nview.IsValid() || !m_nview.HasOwner() || !PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return false; } m_nview.InvokeRPC("RPC_RequestShipyardLaunch", new object[1] { Game.instance.GetPlayerProfile().GetPlayerID() }); return true; } private void RPC_RequestShipyardLaunch(long uid) { ZLog.Log((object)("[SHIPYARD] Player " + uid + " wants to use shipyard " + ((Object)((Component)this).gameObject).name + " im: " + ZDOMan.GetSessionID())); ShowAreaMarker(); if (!m_nview.IsOwner()) { ZLog.Log((object)" but im not the owner"); } else if (m_container.IsInUse() || isInUse) { m_nview.InvokeRPC(uid, "RPC_ShipyardRespons", new object[1] { 4 }); ZLog.Log((object)" but it's in use"); } else if (m_container.GetInventory().NrOfItems() == 0) { m_nview.InvokeRPC(uid, "RPC_ShipyardRespons", new object[1] { 3 }); ZLog.Log((object)" but it's empty"); } else { ((MonoBehaviour)this).StartCoroutine(CollectToBuild(uid)); } ((MonoBehaviour)this).Invoke("HideMarker", 2f); } public void Setup(string name) { m_nview.GetZDO().Set("creatorName", name); } public bool UseItem(Humanoid user, ItemData item) { return false; } private void OnDestroy() { m_allAreas.Remove(this); } private bool IsInside(Vector3 point, float radius) { //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) return Utils.DistanceXZ(((Component)this).transform.position, point) < m_radius + radius; } private bool IsShipInStationRadius(ShipExtensionManager ship) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ship == (Object)null || (Object)(object)((Component)ship).gameObject == (Object)null) { return false; } return Utils.DistanceXZ(((Component)this).transform.position, ((Component)ship).transform.position) <= m_radius; } private void HideMarker() { ((Component)m_areaMarker).gameObject.SetActive(false); } public void ShowAreaMarker() { if (Object.op_Implicit((Object)(object)m_areaMarker)) { ((Component)m_areaMarker).gameObject.SetActive(true); ((MonoBehaviour)this).CancelInvoke("HideMarker"); } } private void OnDrawGizmosSelected() { } private void OnDamaged() { } public void PokeConnectionEffects() { List connectedAreas = GetConnectedAreas(); StartConnectionEffects(); foreach (ShipyardStation item in connectedAreas) { item.StartConnectionEffects(); } } private void StartConnectionEffects() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (ShipyardStation allArea in m_allAreas) { if (!((Object)(object)allArea == (Object)(object)this) && IsInside(((Component)allArea).transform.position, 0f)) { list.Add(allArea); } } Vector3 val = ((Component)this).transform.position + Vector3.up * 1.4f; if (m_connectionInstances.Count != list.Count) { StopConnectionEffects(); for (int i = 0; i < list.Count; i++) { m_connectionInstances.Add(Object.Instantiate(m_connectEffect, val, Quaternion.identity, ((Component)this).transform)); } } if (m_connectionInstances.Count != 0) { for (int j = 0; j < list.Count; j++) { Vector3 val2 = ((Component)list[j]).transform.position + Vector3.up * 1.4f - val; Quaternion rotation = Quaternion.LookRotation(((Vector3)(ref val2)).normalized); GameObject val3 = m_connectionInstances[j]; val3.transform.position = val; val3.transform.rotation = rotation; val3.transform.localScale = new Vector3(1f, 1f, ((Vector3)(ref val2)).magnitude); } ((MonoBehaviour)this).CancelInvoke("StopConnectionEffects"); ((MonoBehaviour)this).Invoke("StopConnectionEffects", 0.3f); } } private void StopConnectionEffects() { foreach (GameObject connectionInstance in m_connectionInstances) { Object.Destroy((Object)(object)connectionInstance); } m_connectionInstances.Clear(); } private List GetConnectedAreas(bool forceUpdate = false) { if ((double)Time.time - (double)m_connectionUpdateTime > (double)m_updateConnectionsInterval || forceUpdate) { GetAllConnectedAreas(m_connectedAreas); m_connectionUpdateTime = Time.time; } return m_connectedAreas; } private void GetAllConnectedAreas(List areas) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) areas.Clear(); Queue queue = new Queue(); queue.Enqueue(this); foreach (ShipyardStation allArea in m_allAreas) { allArea.m_tempChecked = false; } m_tempChecked = true; while (queue.Count > 0) { ShipyardStation shipyardStation = queue.Dequeue(); foreach (ShipyardStation allArea2 in m_allAreas) { if (!allArea2.m_tempChecked && allArea2.IsEnabled() && allArea2.IsInside(((Component)shipyardStation).transform.position, 0f)) { allArea2.m_tempChecked = true; queue.Enqueue(allArea2); areas.Add(allArea2); } } } } public bool IsEnabled() { return m_nview.IsValid() && m_nview.GetZDO().GetBool("enabled", false); } public static ShipyardStation IsInRange(GameObject piece, float radius = 0f) { //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_0033: Unknown result type (might be due to invalid IL or missing references) Vector3 position = piece.transform.position; List list = new List(); foreach (ShipyardStation allArea in m_allAreas) { if (allArea.IsEnabled() && allArea.IsInside(position, radius)) { list.Add(allArea); } } if (list.Count > 0) { return list.First(); } return null; } private ShipExtensionManager FindClosestValidShip(ShipExtension extension) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) ShipExtensionManager result = null; float num = float.MaxValue; for (int i = 0; i < m_ships.Count; i++) { ShipExtensionManager shipExtensionManager = m_ships[i]; if (!((Object)(object)shipExtensionManager == (Object)null) && !((Object)(object)((Component)shipExtensionManager).gameObject == (Object)null) && !((Object)(object)shipExtensionManager.m_nview == (Object)null) && shipExtensionManager.m_nview.IsValid() && IsShipInStationRadius(shipExtensionManager) && validateShipToExtension(shipExtensionManager, extension)) { float num2 = Utils.DistanceXZ(((Component)this).transform.position, ((Component)shipExtensionManager).transform.position); if (num2 < num) { num = num2; result = shipExtensionManager; } } } return result; } private bool HasAnyShipInStationRadius() { for (int i = 0; i < m_ships.Count; i++) { ShipExtensionManager shipExtensionManager = m_ships[i]; if (!((Object)(object)shipExtensionManager == (Object)null) && !((Object)(object)((Component)shipExtensionManager).gameObject == (Object)null) && !((Object)(object)shipExtensionManager.m_nview == (Object)null) && shipExtensionManager.m_nview.IsValid() && IsShipInStationRadius(shipExtensionManager)) { return true; } } return false; } private IEnumerator CollectToBuild(long uid) { isInUse = true; m_nview.InvokeRPC(ZNetView.Everybody, "RPC_AnimateShipLever", Array.Empty()); yield return (object)new WaitForSeconds(Random.Range(m_effectDelayMin, m_effectDelayMax)); m_nview.InvokeRPC(ZNetView.Everybody, "RPC_AnimateShipLeverReturn", Array.Empty()); if (!m_nview.IsValid() || !m_nview.IsOwner() || m_container.IsInUse()) { isInUse = false; yield break; } Inventory inventory = m_container.GetInventory(); ShipExtension extension = null; bool foundAnUpgrade = false; foreach (ShipExtension conversion in m_conversions) { foundAnUpgrade = conversion.CanCraft(inventory); if (foundAnUpgrade) { extension = conversion; break; } } int answer = 2; if (foundAnUpgrade) { ShipExtensionManager targetShip = FindClosestValidShip(extension); if ((Object)(object)targetShip != (Object)null) { if (extension.type != ShipExtension.ShipExtensionType.Head && extension.type != ShipExtension.ShipExtensionType.PaintOne) { targetShip.m_nview.InvokeRPC(ZNetView.Everybody, "ShipyardSetExtension", new object[1] { extension.type.ToString() }); } else { targetShip.m_nview.InvokeRPC(ZNetView.Everybody, "ShipyardSetExtensionDecor", new object[2] { extension.type.ToString(), (int)extension.decorType }); } inventory.RemoveAll(); answer = 1; } else if (!HasAnyShipInStationRadius()) { Debug.Log((object)"[SHIPYARD] There is no ship in range to upgrade!"); answer = 5; } else { Debug.Log((object)"[SHIPYARD] There is no ship available for that upgrade!"); answer = 6; } } if (!foundAnUpgrade) { Debug.Log((object)"[SHIPYARD] No Recipe for upgrade Found or wrong resource amount"); } m_nview.InvokeRPC(uid, "RPC_ShipyardRespons", new object[1] { answer }); isInUse = false; ((MonoBehaviour)this).Invoke("HideMarker", 2f); } private bool validateShipToExtension(ShipExtensionManager ship, ShipExtension extension) { if (ship.m_type == extension.shipType) { if (extension.type == ShipExtension.ShipExtensionType.Head || extension.type == ShipExtension.ShipExtensionType.PaintOne) { int @int = ship.m_nview.GetZDO().GetInt(extension.type.ToString(), 0); if (@int != (int)extension.decorType) { return true; } } if (ship.m_nview.GetZDO().GetBool(extension.type.ToString(), false) && extension.decorType == ShipExtension.ExtensionDecorType.Default) { return false; } return true; } return false; } private void RPC_ShipyardRespons(long uid, int r) { if (Object.op_Implicit((Object)(object)Player.m_localPlayer)) { ((Character)Player.m_localPlayer).Message((MessageType)2, r switch { 1 => "Upgrade Added", 2 => "Wrong resource amount - failed to upgrade", 3 => "Cargo is empty", 4 => "Shipyard is in use", 5 => "No Ship in range", 6 => "There is no ship avaible for that upgrade", _ => "Something went wrong", }, 0, (Sprite)null); } } private void RPC_AnimateShipLever(long uid) { ZLog.Log((object)"PULL THE LEVER KRONK!"); m_leverAnim.SetBool("Pulled", true); } private void RPC_AnimateShipLeverReturn(long uid) { ZLog.Log((object)"Lever return"); m_leverAnim.SetBool("Pulled", false); } private void UpdateStatus() { } } public class VehicleMovementDamagementDamage : MonoBehaviour { public GameObject m_runDamageObject; public float m_speedTreshold = 6f; private ZNetView m_nview; private Rigidbody m_body; public void setup() { m_nview = ((Component)this).GetComponent(); m_body = ((Component)this).GetComponent(); Aoe component = m_runDamageObject.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { } } private void setupRunDamage(Aoe component) { } private void Update() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (!m_nview.IsValid() || !m_nview.IsOwner()) { m_runDamageObject.SetActive(false); return; } GameObject runDamageObject = m_runDamageObject; Vector3 velocity = m_body.velocity; runDamageObject.SetActive((double)((Vector3)(ref velocity)).magnitude > (double)m_speedTreshold); } } }