Decompiled source of ValheimRAFT v1.6.14
plugins\ValheimRAFT.dll
Decompiled 4 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.GUI; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using PlanBuild.Blueprints; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.U2D; using UnityEngine.UI; using ValheimRAFT.Patches; using ValheimRAFT.UI; using ValheimRAFT.Util; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ValheimRAFT")] [assembly: AssemblyDescription("Valheim Mod for building on the sea")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Virtualize LLC")] [assembly: AssemblyProduct("ValheimRAFT")] [assembly: AssemblyCopyright("Copyright © 2023, GNU-v3 licensed")] [assembly: Guid("6015B165-2627-40A7-8CA1-3E6B6CD7CB49")] [assembly: AssemblyFileVersion("1.6.14")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.6.14.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ValheimRAFT { public class BoardingRampComponent : MonoBehaviour, Interactable, Hoverable { public enum BoardingRampState { Closed = 0, Closing = 1, Opening = 3, Open = 5 } public BoardingRampState m_state = BoardingRampState.Closing; public float m_stateProgress; public float m_stateChangeDuration = 0.5f; public int m_segments = 8; public float m_segmentLength = 2f; public float m_segmentOverlap = 0.2f; public float m_segmentHeight = 0.05f; public float m_maxRampRotation; private GameObject m_segmentObject; private List<GameObject> m_segmentObjects = new List<GameObject>(); private List<Transform> m_ropeAttach1 = new List<Transform>(); private List<Transform> m_ropeAttach2 = new List<Transform>(); private LineRenderer m_rope1; private LineRenderer m_rope2; private GameObject m_ramp; private Transform m_winch1; private Transform m_winch2; private Transform m_winch1Rope; private Transform m_winch2Rope; private bool m_lastHitRamp; private Vector3 m_hitPosition; private bool m_updateRamp; private Quaternion m_desiredRotation; private float m_rotSpeed; private Color m_hitColor; private float m_hitDistance; private ZNetView m_nview; private int m_groundRayMask; private static RaycastHit[] m_rayHits = (RaycastHit[])(object)new RaycastHit[30]; private float m_lastBridgeProgress = -1f; private static EditRampComponent m_editPanel; private void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); m_groundRayMask = LayerMask.GetMask(new string[8] { "Default", "static_solid", "Default_small", "piece", "terrain", "blocker", "WaterVolume", "Water" }); m_ramp = ((Component)((Component)this).transform.Find("Ramp")).gameObject; m_segmentObject = ((Component)((Component)this).transform.Find("Ramp/Segment")).gameObject; m_rope1 = ((Component)((Component)this).transform.Find("Rope1")).GetComponent<LineRenderer>(); m_rope2 = ((Component)((Component)this).transform.Find("Rope2")).GetComponent<LineRenderer>(); m_winch1 = ((Component)this).transform.Find("Winch1/Cylinder"); m_winch2 = ((Component)this).transform.Find("Winch2/Cylinder"); m_winch1Rope = ((Component)this).transform.Find("Winch1/Pole/RopeAttach"); m_winch2Rope = ((Component)this).transform.Find("Winch2/Pole/RopeAttach"); m_segmentObject.SetActive(ZNetView.m_forceDisableInit); if (ZNetView.m_forceDisableInit) { ((Component)m_rope1).gameObject.SetActive(false); ((Component)m_rope2).gameObject.SetActive(false); m_segmentObject.SetActive(true); ((Behaviour)this).enabled = false; } else { m_nview.Register<int>("RPC_SetState", (Action<long, int>)RPC_SetState); m_nview.Register<int>("RPC_SetSegmentCount", (Action<long, int>)RPC_SetSegmentCount); m_updateRamp = true; LoadZDO(); } } private void RPC_SetState(long sender, int state) { if (m_nview.IsOwner()) { SetState((BoardingRampState)state); } } private void LoadZDO() { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.m_zdo != null) { m_state = (BoardingRampState)m_nview.m_zdo.GetInt("MB_m_state", 0); m_segments = m_nview.m_zdo.GetInt("MB_m_segments", 5); } } public void RPC_SetSegmentCount(long sender, int segmentCount) { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsOwner()) { SetSegmentCount(segmentCount); } } public void SetSegmentCount(int segmentCount) { if (segmentCount != m_segments) { if (Object.op_Implicit((Object)(object)m_nview) && !m_nview.IsOwner()) { m_nview.InvokeRPC("RPC_SetSegmentCount", new object[1] { segmentCount }); } else { m_segments = segmentCount; m_nview.m_zdo.Set("MB_m_segments", m_segments); } } } private void CreateSegments() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) while (m_segments < m_segmentObjects.Count) { int index = m_segmentObjects.Count - 1; Object.Destroy((Object)(object)m_segmentObjects[index]); Object.Destroy((Object)(object)m_ropeAttach1[index]); Object.Destroy((Object)(object)m_ropeAttach2[index]); m_segmentObjects.RemoveAt(index); m_ropeAttach1.RemoveAt(index); m_ropeAttach2.RemoveAt(index); } for (int i = m_segmentObjects.Count; i < m_segments; i++) { GameObject val = Object.Instantiate<GameObject>(m_segmentObject, ((Component)this).transform.position + new Vector3(0f, (0f - m_segmentHeight) * (float)i, m_segmentLength * (float)i), Quaternion.identity, m_ramp.transform); val.transform.localRotation = Quaternion.identity; val.transform.localScale = new Vector3(1f + (float)i * 0.0001f, 1f + (float)i * 0.0001f, 1f + (float)i * 0.0001f); m_segmentObjects.Add(val); m_ropeAttach1.Add(val.transform.Find("SegmentAnchor/Pole1/RopeAttach")); m_ropeAttach2.Add(val.transform.Find("SegmentAnchor/Pole2/RopeAttach")); val.SetActive(true); } } private void Update() { if (Object.op_Implicit((Object)(object)m_nview) && !m_nview.IsOwner()) { BoardingRampState @int = (BoardingRampState)m_nview.m_zdo.GetInt("MB_m_state", 0); if (@int != m_state) { switch (@int) { case BoardingRampState.Closed: case BoardingRampState.Closing: m_state = BoardingRampState.Closing; break; case BoardingRampState.Opening: case BoardingRampState.Open: m_state = BoardingRampState.Opening; break; } } m_segments = m_nview.m_zdo.GetInt("MB_m_segments", 5); } if (m_segmentObjects.Count != m_segments) { CreateSegments(); ForceRampUpdate(); } CheckRampFloor(); if (m_state == BoardingRampState.Closing) { m_stateProgress = Mathf.Clamp01(m_stateProgress - Time.deltaTime / (m_stateChangeDuration * (float)m_segments)); UpdateRamp(); if (m_stateProgress <= 0f) { m_state = BoardingRampState.Closed; } } else if (m_state == BoardingRampState.Opening) { m_stateProgress = Mathf.Clamp01(m_stateProgress + Time.deltaTime / (m_stateChangeDuration * (float)m_segments)); UpdateRamp(); if (m_stateProgress >= 1f) { m_state = BoardingRampState.Open; } } else if (m_updateRamp) { UpdateRamp(); } } private void SetState(BoardingRampState state) { if (m_state == state) { return; } m_state = state; if (Object.op_Implicit((Object)(object)m_nview) && m_nview.m_zdo != null) { if (m_nview.IsOwner()) { m_nview.m_zdo.Set("MB_m_state", (int)state); return; } m_nview.InvokeRPC("RPC_SetState", new object[1] { (int)state }); } } private bool LinecastNonSelf(Vector3 start, Vector3 end, out RaycastHit hit) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) Vector3 val = end - start; return RaycastNonSelf(start, ((Vector3)(ref val)).normalized, ((Vector3)(ref val)).magnitude, out hit); } private bool RaycastNonSelf(Vector3 start, Vector3 dir, float dist, out RaycastHit hit) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) int num = Physics.RaycastNonAlloc(start, dir, m_rayHits, dist, m_groundRayMask, (QueryTriggerInteraction)1); int num2 = 0; bool flag = false; for (int i = 0; i < num; i++) { if (!((RaycastHit)(ref m_rayHits[i])).transform.IsChildOf(((Component)this).transform.parent ?? ((Component)this).transform) && (!flag || ((RaycastHit)(ref m_rayHits[num2])).distance > ((RaycastHit)(ref m_rayHits[i])).distance)) { num2 = i; flag = true; } } hit = m_rayHits[num2]; return flag; } private void CheckRampFloor() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) if (m_state == BoardingRampState.Closed || m_state == BoardingRampState.Closing) { m_updateRamp |= m_state == BoardingRampState.Closing || m_ramp.transform.eulerAngles.x != -90f; } else { if (m_state != BoardingRampState.Opening && m_state != BoardingRampState.Open) { return; } m_updateRamp = true; float num = m_segmentLength * (float)m_segments; float num2 = 1f * (m_segmentLength - m_segmentOverlap) * (float)m_segments; Vector3 val = m_ramp.transform.TransformPoint(new Vector3(0f, (0f - m_segmentHeight) * (float)m_segments, num2)); Vector3 position = m_ramp.transform.position; Vector3 val2 = val - position; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 up = m_ramp.transform.up; if (LinecastNonSelf(position, val, out var hit)) { m_hitColor = Color.green; m_hitDistance = ((RaycastHit)(ref hit)).distance / num2; if (num * 0.94f > ((RaycastHit)(ref hit)).distance) { m_hitColor = Color.black; LinecastNonSelf(((RaycastHit)(ref hit)).point + normalized * 0.1f + up, ((RaycastHit)(ref hit)).point + normalized * 0.1f - up, out hit); } if ((double)Vector3.Dot(((RaycastHit)(ref hit)).normal, Vector3.up) < 0.5) { m_hitColor = Color.white; LinecastNonSelf(((RaycastHit)(ref hit)).point + up, ((RaycastHit)(ref hit)).point - up, out hit); } m_lastHitRamp = true; m_hitPosition = ((RaycastHit)(ref hit)).point; m_updateRamp = true; } else if (m_lastHitRamp && LinecastNonSelf(position - up * 0.3f, val - up * 0.3f, out hit)) { m_hitColor = Color.magenta; } else if (!m_lastHitRamp && RaycastNonSelf(val + new Vector3(0f, 5f, 0f), Vector3.down, 1000f, out hit)) { m_hitColor = Color.blue; m_hitPosition = ((RaycastHit)(ref hit)).point; m_hitDistance = 1f; m_updateRamp = true; m_lastHitRamp = false; } else { m_lastHitRamp = false; } } } public void ForceRampUpdate() { m_updateRamp = true; m_lastBridgeProgress = -1f; } private void UpdateRamp() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_0197: 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_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) if (!m_updateRamp) { return; } m_updateRamp = false; if (m_state == BoardingRampState.Closed || m_state == BoardingRampState.Closing) { m_desiredRotation = ((m_stateProgress < 1f / (float)m_segments) ? Quaternion.Euler(-90f, 0f, 0f) : m_ramp.transform.localRotation); m_rotSpeed = 90f; } else { Vector3 val = m_hitPosition - (((Component)this).transform.position - new Vector3(0f, m_hitDistance * m_segmentHeight * (float)m_segments, 0f)); m_desiredRotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized); Quaternion val2 = Quaternion.Inverse(((Component)this).transform.rotation) * m_desiredRotation; m_desiredRotation = Quaternion.Euler(((Quaternion)(ref val2)).eulerAngles.x, 0f, 0f); m_rotSpeed = Mathf.Clamp(Quaternion.Angle(m_ramp.transform.localRotation, m_desiredRotation) * 5f, 0f, 90f); } m_ramp.transform.localRotation = Quaternion.RotateTowards(m_ramp.transform.localRotation, m_desiredRotation, Time.deltaTime * m_rotSpeed); ((Component)m_winch1).transform.localRotation = Quaternion.Euler(m_stateProgress * 1000f * (float)m_segments, 0f, -90f); ((Component)m_winch2).transform.localRotation = Quaternion.Euler(m_stateProgress * 1000f * (float)m_segments, 0f, -90f); float stateProgress = m_stateProgress; if (m_lastBridgeProgress != stateProgress) { m_lastBridgeProgress = stateProgress; for (int i = 1; i < m_segmentObjects.Count; i++) { float num = Mathf.Clamp01(stateProgress * (float)m_segmentObjects.Count / (float)i); m_segmentObjects[i].transform.position = m_ramp.transform.TransformPoint(new Vector3(0f, (0f - m_segmentHeight) * (float)i, num * (m_segmentLength - m_segmentOverlap) * (float)i)); } } UpdateRopes(); } private void UpdateRopes() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) m_rope1.positionCount = m_segmentObjects.Count + 1; m_rope2.positionCount = m_segmentObjects.Count + 1; m_rope1.SetPosition(m_segmentObjects.Count, ((Component)m_rope1).transform.InverseTransformPoint(m_winch1Rope.position)); m_rope2.SetPosition(m_segmentObjects.Count, ((Component)m_rope2).transform.InverseTransformPoint(m_winch2Rope.position)); for (int i = 0; i < m_segmentObjects.Count; i++) { m_rope1.SetPosition(m_segmentObjects.Count - (i + 1), ((Component)m_rope1).transform.InverseTransformPoint(m_ropeAttach1[i].position)); m_rope2.SetPosition(m_segmentObjects.Count - (i + 1), ((Component)m_rope2).transform.InverseTransformPoint(m_ropeAttach2[i].position)); } } private void OnDrawGizmos() { //IL_0001: 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) Gizmos.color = m_hitColor; Gizmos.DrawSphere(m_hitPosition, 0.3f); } public string GetHoverName() { return ""; } public string GetHoverText() { string text = ((m_state == BoardingRampState.Open || m_state == BoardingRampState.Opening) ? "$mb_boarding_ramp_retract" : "$mb_boarding_ramp_extend"); return Localization.instance.Localize("[<color=yellow><b>$KEY_Use</b></color>] " + text) + Localization.instance.Localize("\n[<color=yellow><b>$KEY_AltPlace + $KEY_Use</b></color>] $mb_boarding_ramp_edit"); } public bool Interact(Humanoid user, bool hold, bool alt) { if (alt) { if (m_editPanel == null) { m_editPanel = new EditRampComponent(); } m_editPanel.ShowPanel(this); return true; } if (!hold) { if (m_state == BoardingRampState.Open || m_state == BoardingRampState.Opening) { SetState(BoardingRampState.Closing); } else if (m_state == BoardingRampState.Closing || m_state == BoardingRampState.Closed) { SetState(BoardingRampState.Opening); } } return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } } internal class CreativeModeConsoleCommand : ConsoleCommand { public override string Name => "RaftCreative"; public override string Help => "Sets the current raft you are standing on into creative mode."; public override void Run(string[] args) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { return; } Ship standingOnShip = ((Character)localPlayer).GetStandingOnShip(); RaycastHit val = default(RaycastHit); if ((!Object.op_Implicit((Object)(object)standingOnShip) || !ToggleMode(localPlayer, standingOnShip)) && Physics.Raycast(((Component)GameCamera.instance).transform.position, ((Component)GameCamera.instance).transform.forward, ref val, 50f, LayerMask.GetMask(new string[1] { "piece" }))) { MoveableBaseRootComponent componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<MoveableBaseRootComponent>(); if (Object.op_Implicit((Object)(object)componentInParent)) { ToggleMode(localPlayer, componentInParent.m_ship); } } } private static bool ToggleMode(Player player, Ship ship) { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) MoveableBaseShipComponent component = ((Component)ship).GetComponent<MoveableBaseShipComponent>(); if (Object.op_Implicit((Object)(object)component)) { ZSyncTransform component2 = ((Component)ship).GetComponent<ZSyncTransform>(); component.m_rigidbody.isKinematic = !component.m_rigidbody.isKinematic; component2.m_isKinematicBody = component.m_rigidbody.isKinematic; if (component.m_rigidbody.isKinematic) { if ((Object)(object)((Component)player).transform.parent == (Object)(object)((Component)component.m_baseRoot).transform) { ((Character)player).m_body.position = new Vector3(((Component)((Character)player).m_body).transform.position.x, ((Component)((Character)player).m_body).transform.position.y + ValheimRaftPlugin.Instance.RaftCreativeHeight.Value, ((Component)((Character)player).m_body).transform.position.z); } component.m_rigidbody.position = new Vector3(((Component)component).transform.position.x, component.m_rigidbody.position.y + ValheimRaftPlugin.Instance.RaftCreativeHeight.Value, ((Component)component).transform.position.z); component.m_rigidbody.rotation = Quaternion.Euler(component.m_rigidbody.rotation.x, 0f, component.m_rigidbody.rotation.z); component.isCreative = true; } else { component.isCreative = false; } return true; } component.isCreative = false; return false; } } public class CultivatableComponent : MonoBehaviour { private ZNetView m_nview; private static Dictionary<int, List<int>> m_childObjects = new Dictionary<int, List<int>>(); private static readonly int MBCultivatableParentIdHash = StringExtensionMethods.GetStableHashCode("MBCultivatableParentId"); public static readonly KeyValuePair<int, int> MBCultivatableParentHash = ZDO.GetHashZDOID("MBCultivatableParent"); private float textureScale = 8f; public bool isCultivatable { get; set; } = true; public void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); WearNTear component = ((Component)this).GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component)) { component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed)); } } public void Start() { UpdateMaterial(); } public void UpdateMaterial() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) Vector2 val = (Object.op_Implicit((Object)(object)((Component)this).transform.parent) ? new Vector2(0f - ((Component)this).transform.localPosition.x, 0f - ((Component)this).transform.localPosition.z) : new Vector2(0f - ((Component)this).transform.position.x, 0f - ((Component)this).transform.position.z)); val /= textureScale; float num = (Object.op_Implicit((Object)(object)((Component)this).transform.parent) ? (0f - ((Component)this).transform.localEulerAngles.y) : (0f - ((Component)this).transform.eulerAngles.y)); num /= 360f; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(((Component)this).transform.localScale.x, ((Component)this).transform.localScale.z); val2 /= textureScale; MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshRenderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Material material = ((Renderer)componentsInChildren[i]).material; material.SetTextureOffset("_MainTex", val); material.SetTextureScale("_MainTex", val2); material.SetTextureOffset("_MainNormal", val); material.SetTextureScale("_MainNormal", val2); material.SetFloat("_MainRotation", num); } } private void OnDestroyed() { int orCreatePersistantID = ZDOPersistantID.Instance.GetOrCreatePersistantID(m_nview.m_zdo); if (!m_childObjects.TryGetValue(orCreatePersistantID, out var value)) { return; } for (int i = 0; i < value.Count; i++) { ZDO zDO = ZDOPersistantID.Instance.GetZDO(value[i]); if (zDO == null) { continue; } ZNetView val = ZNetScene.instance.FindInstance(zDO); if (Object.op_Implicit((Object)(object)val)) { if ((Object)(object)((Component)this).gameObject == (Object)(object)val || ((Component)this).transform.IsChildOf(((Component)val).transform)) { Logger.LogWarning((object)$" gameObject == obj || transform.IsChildOf(obj.transform) {((Component)this).gameObject} == {val} || {((Component)this).transform.IsChildOf(((Component)val).transform)}"); continue; } WearNTear component = ((Component)val).GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component)) { component.Destroy(); continue; } ZNetView component2 = ((Component)val).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component2)) { component2.Destroy(); } } else { ZDOMan.instance.DestroyZDO(zDO); } } m_childObjects.Remove(orCreatePersistantID); } public string GetHoverName() { return ""; } public string GetHoverText() { return ""; } public bool Interact(Humanoid user, bool hold, bool alt) { return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } public void AddNewChild(ZNetView child) { AddNewChild(ZDOPersistantID.Instance.GetOrCreatePersistantID(m_nview.m_zdo), child); } public static void InitPiece(ZNetView netview) { int parentID = GetParentID(netview); if (parentID != 0) { AddChild(parentID, netview); } } public static int GetParentID(ZNetView netview) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) int num = netview.m_zdo.GetInt(MBCultivatableParentIdHash, 0); if (num == 0) { ZDOID zDOID = netview.m_zdo.GetZDOID(MBCultivatableParentHash); if (zDOID != ZDOID.None) { ZDO zDO = ZDOMan.instance.GetZDO(zDOID); num = ((zDO == null) ? ZDOPersistantID.ZDOIDToId(zDOID) : ZDOPersistantID.Instance.GetOrCreatePersistantID(zDO)); netview.m_zdo.Set(MBCultivatableParentIdHash, num, false); } } return num; } public static void AddNewChild(int parent, ZNetView child) { child.m_zdo.Set(MBCultivatableParentIdHash, parent, false); AddChild(parent, child); } public static void AddChild(int parent, ZNetView child) { StaticPhysics component = ((Component)child).GetComponent<StaticPhysics>(); if (Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)component); } AddChild(parent, ZDOPersistantID.Instance.GetOrCreatePersistantID(child.m_zdo)); } private static void AddChild(int parent, int child) { if (parent != 0) { if (!m_childObjects.TryGetValue(parent, out var value)) { value = new List<int>(); m_childObjects.Add(parent, value); } value.Add(child); } } } public class CustomMastComponent : MastComponent { public GameObject m_upperBeam; public GameObject m_lowerBeam; public float m_upperBeamLength; public float m_lowerBeamLength; public float m_upperBeamWidth; public float m_lowerBeamWidth; public bool m_upperBeamEnabled; public bool m_lowerBeamEnabled; public RopeAnchorComponent m_upperBeamLeftAnchor; public RopeAnchorComponent m_upperBeamRightAnchor; public RopeAnchorComponent m_lowerBeamLeftAnchor; public RopeAnchorComponent m_lowerBeamRightAnchor; public ZNetView m_nview; public SailComponent m_sailComponent; public void Awake() { m_sailCloth = ((Component)this).GetComponent<Cloth>(); m_nview = ((Component)this).GetComponent<ZNetView>(); m_sailComponent = ((Component)this).GetComponent<SailComponent>(); } public void LoadZDO() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_011f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)m_nview) && m_nview.m_zdo != null) { Vector3 vec = m_nview.m_zdo.GetVec3("MBMast_upperBeam", new Vector3(1f, 1f, 1f)); m_upperBeamLength = vec.x; m_upperBeamWidth = vec.y; m_upperBeamEnabled = vec.z == 1f; Vector3 vec2 = m_nview.m_zdo.GetVec3("MBMast_lowerBeam", new Vector3(1f, 1f, 1f)); m_lowerBeamLength = vec2.x; m_lowerBeamWidth = vec2.y; m_lowerBeamEnabled = vec2.z == 1f; m_upperBeam.transform.localScale = new Vector3(m_upperBeamLength, m_upperBeamWidth, m_upperBeamWidth); m_upperBeam.SetActive(m_upperBeamEnabled); m_lowerBeam.transform.localScale = new Vector3(m_lowerBeamLength, m_lowerBeamWidth, m_lowerBeamWidth); m_lowerBeam.SetActive(m_lowerBeamEnabled); } } } public class CustomTextureGroup { public class CustomTexture { public Texture Texture { get; internal set; } public Texture Normal { get; internal set; } public int Index { get; internal set; } } private static readonly string[] m_validExtensions = new string[3] { ".png", ".jpg", ".jpeg" }; private static Dictionary<string, CustomTextureGroup> m_groups = new Dictionary<string, CustomTextureGroup>(); private Dictionary<string, CustomTexture> m_textureLookUp = new Dictionary<string, CustomTexture>(); private Dictionary<int, CustomTexture> m_textureHashLookUp = new Dictionary<int, CustomTexture>(); private List<CustomTexture> m_textures = new List<CustomTexture>(); public List<CustomTexture> Textures => m_textures; public CustomTexture GetTextureByHash(int hash) { if (!m_textureHashLookUp.TryGetValue(hash, out var value)) { return null; } return value; } public CustomTexture GetTextureByName(string name) { if (!m_textureLookUp.TryGetValue(name, out var value)) { return null; } return value; } public static CustomTextureGroup Get(string groupName) { if (m_groups.TryGetValue(groupName, out var value)) { return value; } return null; } public static string[] GetFiles(string groupName, string modFolderName) { if (!Directory.Exists(Path.Combine(Paths.PluginPath, modFolderName))) { return Array.Empty<string>(); } string text = Path.Combine(Paths.PluginPath, modFolderName, "Assets"); if (!Directory.Exists(text)) { Logger.LogError((object)("Invalid setup, Asset Directory missing within " + text)); } return Directory.GetFiles(Path.Combine(text, groupName)); } public static CustomTextureGroup Load(string groupName) { if (m_groups.TryGetValue(groupName, out var value)) { return value; } value = new CustomTextureGroup(); m_groups.Add(groupName, value); string[] array = new string[0]; string[] possibleModFolderNames; if (ValheimRaftPlugin.Instance.PluginFolderName.Value != "" && Directory.Exists(Path.Combine(Paths.PluginPath, ValheimRaftPlugin.Instance.PluginFolderName.Value))) { Logger.LogDebug((object)"ValheimRAFT PluginFolderName path detected, resolving assets from that folder"); array = GetFiles(groupName, ValheimRaftPlugin.Instance.PluginFolderName.Value); } else { possibleModFolderNames = ValheimRaftPlugin.Instance.possibleModFolderNames; foreach (string text in possibleModFolderNames) { if (Directory.Exists(Path.Combine(Paths.PluginPath, text))) { array = GetFiles(groupName, text); break; } } if (array.Length == 0) { Logger.LogError((object)("ValheimRAFT: Unable to detect modFolder path, this will cause mesh issues with sails. Please set ValheimRAFT mod folder in the BepInExConfig file. The ValheimRAFT folder should found within this directory " + Paths.PluginPath)); } } possibleModFolderNames = array; foreach (string text2 in possibleModFolderNames) { string extension = Path.GetExtension(text2); if (m_validExtensions.Contains<string>(extension, StringComparer.InvariantCultureIgnoreCase) && !Path.GetFileNameWithoutExtension(text2).EndsWith("_normal", StringComparison.InvariantCultureIgnoreCase)) { value.AddTexture(text2); } } return value; } public void AddTexture(string file) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); string extension = Path.GetExtension(file); string? directoryName = Path.GetDirectoryName(file); CustomTexture customTexture = new CustomTexture(); string text = Path.Combine(directoryName, fileNameWithoutExtension + "_normal" + extension); if (File.Exists(text)) { customTexture.Normal = (Texture)(object)AssetUtils.LoadTexture(text, false); } customTexture.Texture = (Texture)(object)AssetUtils.LoadTexture(file, false); ((Object)customTexture.Texture).name = fileNameWithoutExtension; AddTexture(customTexture); } public void AddTexture(CustomTexture texture) { string name = ((Object)texture.Texture).name; if (!m_textureLookUp.ContainsKey(name)) { m_textureLookUp.Add(name, texture); m_textureHashLookUp.Add(StringExtensionMethods.GetStableHashCode(name), texture); texture.Index = m_textures.Count; m_textures.Add(texture); } } } public class DockComponent : MonoBehaviour { private enum DockState { None, EnteringDock, Docked, LeavingDock } private DockState m_dockState; private float m_dockingStrength = 1f; private GameObject m_dockedObject; private Rigidbody m_dockedRigidbody; private ZNetView m_nview; public Transform m_dockLocation; public Transform m_dockExit; public void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); } public void FixedUpdate() { if (Object.op_Implicit((Object)(object)m_dockedRigidbody)) { if (m_dockState == DockState.EnteringDock) { PushToward(m_dockLocation); } else if (m_dockState == DockState.LeavingDock) { PushToward(m_dockExit); } } } private void PushToward(Transform target) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)target).transform.position - ((Component)m_dockedRigidbody).transform.position; m_dockedRigidbody.AddForce(((Vector3)(ref val)).normalized * m_dockingStrength, (ForceMode)2); } public void OnTriggerEnter(Collider other) { if (Object.op_Implicit((Object)(object)m_dockedObject) && CanDock(other)) { Dock(other); } } private void Dock(Collider other) { ZNetView componentInParent = ((Component)other).GetComponentInParent<ZNetView>(); if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.IsOwner()) { Rigidbody component = ((Component)componentInParent).GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component)) { int orCreatePersistantID = ZDOPersistantID.Instance.GetOrCreatePersistantID(componentInParent.m_zdo); m_dockedObject = ((Component)componentInParent).gameObject; m_dockedRigidbody = component; m_nview.m_zdo.Set("MBDock_dockedObject", orCreatePersistantID); m_dockState = DockState.EnteringDock; } } } private bool CanDock(Collider other) { if (((Object)other).name.StartsWith("Karve")) { return true; } if (((Object)other).name.StartsWith("VikingShip")) { return true; } return false; } } internal class HideRaftConsoleCommand : ConsoleCommand { public override string Name => "RaftHide"; public override string Help => "Toggles the base raft mesh"; public override void Run(string[] args) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (args.Length < 1) { Logger.LogInfo((object)"Missing arguments, arguments required: true\\false"); return; } if (!bool.TryParse(args[0], out var result)) { Logger.LogInfo((object)("Invalid arguments, " + args[0])); return; } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { return; } Ship standingOnShip = ((Character)localPlayer).GetStandingOnShip(); RaycastHit val = default(RaycastHit); if ((!Object.op_Implicit((Object)(object)standingOnShip) || !HideRaft(localPlayer, standingOnShip, result)) && Physics.Raycast(((Component)GameCamera.instance).transform.position, ((Component)GameCamera.instance).transform.forward, ref val, 50f, LayerMask.GetMask(new string[1] { "piece" }))) { MoveableBaseRootComponent componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<MoveableBaseRootComponent>(); if (Object.op_Implicit((Object)(object)componentInParent)) { HideRaft(localPlayer, componentInParent.m_ship, result); } } } private static bool HideRaft(Player player, Ship ship, bool hide) { MoveableBaseShipComponent component = ((Component)ship).GetComponent<MoveableBaseShipComponent>(); if (Object.op_Implicit((Object)(object)component)) { component.SetVisual(hide); return true; } return false; } } public static class MaterialWeight { public const float BlackMarble = 8f; public const float Stone = 12f; public const float Wood = 4f; } public class MovableBaseZone : MonoBehaviour { public MovableBaseZone instance; public CustomLocation boatZoneLocation; public void Awake() { instance = this; Logger.LogInfo((object)"Loaded boat zone"); } public void RegisterBoatZone() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown LocationConfig val = new LocationConfig(); val.Group = "boat"; boatZoneLocation = new CustomLocation(((Component)this).gameObject, val); ((Component)boatZoneLocation.Location).transform.SetParent(((Component)this).transform); ZoneManager.Instance.AddCustomLocation(boatZoneLocation); Logger.LogInfo((object)$"BOATZONELOCATION After registry: {boatZoneLocation} {boatZoneLocation}"); } } public class PrefabController : MonoBehaviour { private PrefabManager prefabManager; private PieceManager pieceManager; private SpriteAtlas sprites; private GameObject boarding_ramp; private GameObject mbBoardingRamp; private GameObject steering_wheel; private GameObject rope_ladder; private GameObject rope_anchor; private GameObject raftMast; private GameObject dirtFloor; private Material sailMat; private Piece woodFloorPiece; private WearNTear woodFloorPieceWearNTear; private SynchronizationManager synchronizationManager; private List<Piece> raftPrefabPieces = new List<Piece>(); private bool prefabsEnabled = true; public const string Tier1RaftMastName = "MBRaftMast"; public const string Tier2RaftMastName = "MBKarveMast"; public const string Tier3RaftMastName = "MBVikingShipMast"; public const string Tier1CustomSailName = "MBSail"; private const string ValheimRaftMenuName = "Raft"; private float wearNTearBaseHealth = 250f; private void UpdatePrefabs(bool isPrefabEnabled) { foreach (Piece raftPrefabPiece in raftPrefabPieces) { CustomPiece piece = pieceManager.GetPiece(((Object)raftPrefabPiece).name); if (piece == null) { Logger.LogWarning((object)("ValheimRaft attempted to run UpdatePrefab on " + ((Object)raftPrefabPiece).name + " but jotunn pieceManager did not find that piece name")); continue; } Logger.LogDebug((object)$"Setting m_enabled: to {isPrefabEnabled}, for name {((Object)raftPrefabPiece).name}"); piece.Piece.m_enabled = isPrefabEnabled; } prefabsEnabled = isPrefabEnabled; } public void RegisterBoatWood() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown string text = "bloat_wood"; if (pieceManager.GetPiece(text) == null) { GameObject val = prefabManager.CreateClonedPrefab(text, prefabManager.GetPrefab("wood_floor")); Piece val2 = val.AddComponent<Piece>(); SetWearNTear(val); ((Object)val2).name = "boat_wood"; ((Component)val2).transform.localScale = new Vector3(2f, 4f, 2f); AddNetViewWithPersistence(val).m_zdo = new ZDO(); AddToRaftPrefabPieces(val2); SetWearNTear(val); PieceManager obj = pieceManager; PieceConfig val3 = new PieceConfig(); val3.PieceTable = "Hammer"; val3.Description = "This is custom wood floor"; val3.Icon = sprites.GetSprite("vikingmast"); val3.Category = "Raft"; val3.Enabled = true; val3.Name = text; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Amount = 10, Item = "FineWood", Recover = true } }; obj.AddPiece(new CustomPiece(val, false, val3)); pieceManager.RegisterPieceInPieceTable(val, "Hammer", "Raft"); } } public void RegisterTestBoatPrefab(MoveableBaseRootComponent mbroot) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown string text = "MBTestBoat"; if (Object.op_Implicit((Object)(object)prefabManager.GetPrefab(text))) { pieceManager.RemovePiece(text); } RegisterBoatWood(); GameObject val = prefabManager.CreateClonedPrefab(text, prefabManager.GetPrefab("MBRaft")); ExposedGameObjectExtension.AddComponentCopy<MoveableBaseShipComponent>(val, mbroot.MMoveableBaseShip); AddNetViewWithPersistence(val); SetWearNTear(val); pieceManager.RemovePiece(text); PieceConfig val2 = new PieceConfig(); val2.PieceTable = "Hammer"; val2.Description = "This is a custom boat"; val2.Icon = sprites.GetSprite("vikingmast"); val2.Category = "Raft"; val2.Enabled = true; val2.Name = text; val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Amount = 10, Item = "FineWood", Recover = true }, new RequirementConfig { Amount = 2, Item = "RoundLog", Recover = true }, new RequirementConfig { Amount = 6, Item = "WolfPelt", Recover = true } }; CustomPiece val3 = new CustomPiece(val, false, val2); pieceManager.AddPiece(val3); pieceManager.RegisterPieceInPieceTable(val, "Hammer", "Raft"); } public void UpdatePrefabStatus() { if (ValheimRaftPlugin.Instance.AdminsCanOnlyBuildRaft.Value || !prefabsEnabled) { Logger.LogDebug((object)$"ValheimRAFT: UpdatePrefabStatusCalled with AdminsCanOnlyBuildRaft set as {ValheimRaftPlugin.Instance.AdminsCanOnlyBuildRaft.Value}, updating prefabs and player access"); bool playerIsAdmin = SynchronizationManager.Instance.PlayerIsAdmin; UpdatePrefabs(playerIsAdmin); } } public void UpdatePrefabStatus(object obj, ConfigurationSynchronizationEventArgs e) { UpdateRaftSailDescriptions(); UpdatePrefabStatus(); } private void AddToRaftPrefabPieces(Piece raftPiece) { raftPrefabPieces.Add(raftPiece); } private static ZNetView AddNetViewWithPersistence(GameObject prefab) { ZNetView val = prefab.GetComponent<ZNetView>(); if (!Object.op_Implicit((Object)(object)val)) { val = prefab.AddComponent<ZNetView>(); } if (!Object.op_Implicit((Object)(object)val)) { Logger.LogError((object)"Unable to register NetView, ValheimRAFT could be broken without netview"); return val; } val.m_persistent = true; return val; } public void RegisterAllPrefabs() { RegisterRaftPrefab(); RegisterRudder(); RegisterRaftMast(); RegisterKarveMast(); RegisterVikingMast(); RegisterCustomSail(); RegisterCustomSailCreator(3); RegisterCustomSailCreator(4); RegisterRopeAnchor(); RegisterRopeLadder(); RegisterPierPole(); RegisterPierWall(); RegisterBoardingRamp(); RegisterBoardingRampWide(); RegisterDirtFloor(1); RegisterDirtFloor(2); } public void Init() { boarding_ramp = ValheimRaftPlugin.m_assetBundle.LoadAsset<GameObject>("Assets/boarding_ramp.prefab"); steering_wheel = ValheimRaftPlugin.m_assetBundle.LoadAsset<GameObject>("Assets/steering_wheel.prefab"); rope_ladder = ValheimRaftPlugin.m_assetBundle.LoadAsset<GameObject>("Assets/rope_ladder.prefab"); rope_anchor = ValheimRaftPlugin.m_assetBundle.LoadAsset<GameObject>("Assets/rope_anchor.prefab"); sprites = ValheimRaftPlugin.m_assetBundle.LoadAsset<SpriteAtlas>("Assets/icons.spriteatlas"); sailMat = ValheimRaftPlugin.m_assetBundle.LoadAsset<Material>("Assets/SailMat.mat"); dirtFloor = ValheimRaftPlugin.m_assetBundle.LoadAsset<GameObject>("dirt_floor.prefab"); prefabManager = PrefabManager.Instance; pieceManager = PieceManager.Instance; GameObject prefab = prefabManager.GetPrefab("wood_floor"); woodFloorPiece = prefab.GetComponent<Piece>(); woodFloorPieceWearNTear = ((Component)woodFloorPiece).GetComponent<WearNTear>(); RegisterAllPrefabs(); SynchronizationManager.OnConfigurationSynchronized += UpdatePrefabStatus; SynchronizationManager.OnAdminStatusChanged += UpdatePrefabStatus; UpdatePrefabStatus(); } private WearNTear SetWearNTear(GameObject prefabComponent, int tierMultiplier = 1) { WearNTear component = prefabComponent.GetComponent<WearNTear>(); if (!Object.op_Implicit((Object)(object)component)) { component = prefabComponent.AddComponent<WearNTear>(); if (!Object.op_Implicit((Object)(object)component)) { Logger.LogError((object)("error setting WearNTear for RAFT prefab " + ((Object)prefabComponent).name)); } return component; } component.m_health = wearNTearBaseHealth * (float)tierMultiplier; component.m_noRoofWear = false; component.m_destroyedEffect = woodFloorPieceWearNTear.m_destroyedEffect; component.m_hitEffect = woodFloorPieceWearNTear.m_hitEffect; return component; } private void RegisterVikingMast() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //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_014b: 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_015e: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown GameObject gameObject = ((Component)prefabManager.GetPrefab("VikingShip").transform.Find("ship/visual/Mast")).gameObject; GameObject val = prefabManager.CreateClonedPrefab("MBVikingShipMast", gameObject); Piece val2 = val.AddComponent<Piece>(); ((Component)val2).transform.localScale = new Vector3(2f, 2f, 2f); val2.m_name = "$mb_vikingship_mast"; val2.m_description = "$mb_vikingship_mast_desc"; val2.m_placeEffect = woodFloorPiece.m_placeEffect; AddToRaftPrefabPieces(val2); AddNetViewWithPersistence(val); MastComponent mastComponent = val.AddComponent<MastComponent>(); mastComponent.m_sailObject = ((Component)val.transform.Find("Sail")).gameObject; mastComponent.m_sailCloth = mastComponent.m_sailObject.GetComponentInChildren<Cloth>(); mastComponent.m_allowSailRotation = true; mastComponent.m_allowSailShrinking = true; SetWearNTear(val, 3); FixedRopes(val); FixCollisionLayers(val); PieceManager obj = pieceManager; PieceConfig val3 = new PieceConfig(); val3.PieceTable = "Hammer"; val3.Description = GetTieredSailAreaText(3); val3.Icon = sprites.GetSprite("vikingmast"); val3.Category = "Raft"; val3.Enabled = true; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Amount = 10, Item = "FineWood", Recover = true }, new RequirementConfig { Amount = 2, Item = "RoundLog", Recover = true }, new RequirementConfig { Amount = 6, Item = "WolfPelt", Recover = true } }; obj.AddPiece(new CustomPiece(val, false, val3)); } private void RegisterRaftPrefab() { //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown GameObject prefab = prefabManager.GetPrefab("Raft"); raftMast = ((Component)prefab.transform.Find("ship/visual/mast")).gameObject; GameObject val = prefabManager.CreateClonedPrefab("MBRaft", prefab); ((Component)val.transform.Find("ship/visual/mast")).gameObject.SetActive(false); ((Component)val.transform.Find("interactive/mast")).gameObject.SetActive(false); val.GetComponent<Rigidbody>().mass = 1000f; Object.Destroy((Object)(object)((Component)val.transform.Find("ship/colliders/log")).gameObject); Object.Destroy((Object)(object)((Component)val.transform.Find("ship/colliders/log (1)")).gameObject); Object.Destroy((Object)(object)((Component)val.transform.Find("ship/colliders/log (2)")).gameObject); Object.Destroy((Object)(object)((Component)val.transform.Find("ship/colliders/log (3)")).gameObject); Piece component = val.GetComponent<Piece>(); component.m_name = "$mb_raft"; component.m_description = "$mb_raft_desc"; AddToRaftPrefabPieces(component); AddNetViewWithPersistence(val); WearNTear component2 = val.GetComponent<WearNTear>(); component2.m_health = Math.Max(100f, ValheimRaftPlugin.Instance.RaftHealth.Value); component2.m_noRoofWear = false; val.GetComponent<ImpactEffect>().m_damageToSelf = false; PieceManager obj = pieceManager; PieceConfig val2 = new PieceConfig(); val2.PieceTable = "Hammer"; val2.Description = "$mb_raft_desc"; val2.Category = "Raft"; val2.Enabled = true; val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Amount = 20, Item = "Wood" } }; obj.AddPiece(new CustomPiece(val, false, val2)); } private void UpdateRaftSailDescriptions() { pieceManager.GetPiece("MBRaftMast").Piece.m_description = GetTieredSailAreaText(1); pieceManager.GetPiece("MBKarveMast").Piece.m_description = GetTieredSailAreaText(2); pieceManager.GetPiece("MBVikingShipMast").Piece.m_description = GetTieredSailAreaText(3); } private string GetTieredSailAreaText(int tier) { return tier switch { 1 => $"$mb_raft_mast_desc\n$mb_raft_mast_generic_wind_desc [<color=yellow><b>{ValheimRaftPlugin.Instance.SailTier1Area.Value}</b></color>]", 2 => $"$mb_karve_mast_desc\n$mb_raft_mast_generic_wind_desc [<color=yellow><b>{ValheimRaftPlugin.Instance.SailTier2Area.Value}</b></color>]", 3 => $"$mb_vikingship_mast_desc\n$mb_raft_mast_generic_wind_desc [<color=yellow><b>{ValheimRaftPlugin.Instance.SailTier3Area.Value}</b></color>]", _ => "", }; } private void RegisterRaftMast() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_011f: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown GameObject val = prefabManager.CreateClonedPrefab("MBRaftMast", raftMast); Piece val2 = val.AddComponent<Piece>(); val2.m_name = "$mb_raft_mast"; val2.m_description = "$mb_raft_mast_desc"; val2.m_placeEffect = woodFloorPiece.m_placeEffect; AddToRaftPrefabPieces(val2); AddNetViewWithPersistence(val); MastComponent mastComponent = val.AddComponent<MastComponent>(); mastComponent.m_allowSailRotation = true; mastComponent.m_allowSailShrinking = true; mastComponent.m_sailObject = ((Component)val.transform.Find("Sail")).gameObject; mastComponent.m_sailCloth = mastComponent.m_sailObject.GetComponentInChildren<Cloth>(); SetWearNTear(val); FixedRopes(val); FixCollisionLayers(val); PieceManager obj = pieceManager; PieceConfig val3 = new PieceConfig(); val3.PieceTable = "Hammer"; val3.Description = GetTieredSailAreaText(1); val3.Icon = sprites.GetSprite("raftmast"); val3.Category = "Raft"; val3.Enabled = true; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Amount = 10, Item = "Wood", Recover = true }, new RequirementConfig { Amount = 6, Item = "DeerHide", Recover = true } }; obj.AddPiece(new CustomPiece(val, false, val3)); } public void RegisterKarveMast() { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown GameObject gameObject = ((Component)prefabManager.GetPrefab("Karve").transform.Find("ship/mast")).gameObject; GameObject val = prefabManager.CreateClonedPrefab("MBKarveMast", gameObject); Piece val2 = val.AddComponent<Piece>(); val2.m_name = "$mb_karve_mast"; val2.m_description = "$mb_karve_mast_desc"; val2.m_placeEffect = woodFloorPiece.m_placeEffect; AddToRaftPrefabPieces(val2); AddNetViewWithPersistence(val); MastComponent mastComponent = val.AddComponent<MastComponent>(); mastComponent.m_sailObject = ((Component)val.transform.Find("Sail")).gameObject; mastComponent.m_sailCloth = mastComponent.m_sailObject.GetComponentInChildren<Cloth>(); mastComponent.m_allowSailShrinking = true; mastComponent.m_allowSailRotation = true; SetWearNTear(val, 2); FixedRopes(val); FixCollisionLayers(val); PieceManager obj = pieceManager; PieceConfig val3 = new PieceConfig(); val3.PieceTable = "Hammer"; val3.Description = GetTieredSailAreaText(2); val3.Icon = sprites.GetSprite("karvemast"); val3.Category = "Raft"; val3.Enabled = true; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Amount = 10, Item = "FineWood", Recover = true }, new RequirementConfig { Amount = 2, Item = "RoundLog", Recover = true }, new RequirementConfig { Amount = 6, Item = "TrollHide", Recover = true } }; obj.AddPiece(new CustomPiece(val, false, val3)); } private void RegisterRudder() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown GameObject val = prefabManager.CreateClonedPrefab("MBRudder", steering_wheel); Piece val2 = val.AddComponent<Piece>(); val2.m_name = "$mb_rudder"; val2.m_description = "$mb_rudder_desc"; val2.m_placeEffect = woodFloorPiece.m_placeEffect; AddToRaftPrefabPieces(val2); AddNetViewWithPersistence(val); RudderComponent rudderComponent = val.AddComponent<RudderComponent>(); rudderComponent.m_controls = val.AddComponent<ShipControlls>(); rudderComponent.m_controls.m_hoverText = "$mb_rudder_use"; rudderComponent.m_controls.m_attachPoint = val.transform.Find("attachpoint"); rudderComponent.m_controls.m_attachAnimation = "Standing Torch Idle right"; rudderComponent.m_controls.m_detachOffset = new Vector3(0f, 0f, 0f); rudderComponent.m_wheel = val.transform.Find("controls/wheel"); rudderComponent.UpdateSpokes(); SetWearNTear(val); FixSnapPoints(val); FixCollisionLayers(val); PieceManager obj = pieceManager; PieceConfig val3 = new PieceConfig(); val3.PieceTable = "Hammer"; val3.Description = "$mb_rudder_desc"; val3.Icon = sprites.GetSprite("steering_wheel"); val3.Category = "Raft"; val3.Enabled = true; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Amount = 10, Item = "Wood", Recover = true } }; obj.AddPiece(new CustomPiece(val, false, val3)); } private void RegisterRopeLadder() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown GameObject val = prefabManager.CreateClonedPrefab("MBRopeLadder", rope_ladder); Piece val2 = val.AddComponent<Piece>(); val2.m_name = "$mb_rope_ladder"; val2.m_description = "$mb_rope_ladder_desc"; val2.m_placeEffect = woodFloorPiece.m_placeEffect; ((StaticTarget)val2).m_primaryTarget = false; ((StaticTarget)val2).m_randomTarget = false; AddToRaftPrefabPieces(val2); AddNetViewWithPersistence(val); FixSnapPoints(val); RopeLadderComponent ropeLadderComponent = val.AddComponent<RopeLadderComponent>(); LineRenderer componentInChildren = raftMast.GetComponentInChildren<LineRenderer>(true); ropeLadderComponent.m_ropeLine = ((Component)ropeLadderComponent).GetComponent<LineRenderer>(); ((Renderer)ropeLadderComponent.m_ropeLine).material = new Material(((Renderer)componentInChildren).material); ropeLadderComponent.m_ropeLine.textureMode = (LineTextureMode)1; ropeLadderComponent.m_ropeLine.widthMultiplier = 0.05f; ropeLadderComponent.m_stepObject = ((Component)((Component)ropeLadderComponent).transform.Find("step")).gameObject; ((Renderer)ropeLadderComponent.m_stepObject.GetComponentInChildren<MeshRenderer>()).material = new Material(((Renderer)((Component)woodFloorPiece).GetComponentInChildren<MeshRenderer>()).material); SetWearNTear(val).m_supports = false; FixCollisionLayers(val); PieceManager obj = pieceManager; PieceConfig val3 = new PieceConfig(); val3.PieceTable = "Hammer"; val3.Description = "$mb_rope_ladder_desc"; val3.Icon = sprites.GetSprite("rope_ladder"); val3.Category = "Raft"; val3.Enabled = true; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Amount = 10, Item = "Wood", Recover = true } }; obj.AddPiece(new CustomPiece(val, false, val3)); } private void RegisterRopeAnchor() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown GameObject val = prefabManager.CreateClonedPrefab("MBRopeAnchor", rope_anchor); Piece val2 = val.AddComponent<Piece>(); val2.m_name = "$mb_rope_anchor"; val2.m_description = "$mb_rope_anchor_desc"; val2.m_placeEffect = woodFloorPiece.m_placeEffect; AddToRaftPrefabPieces(val2); AddNetViewWithPersistence(val); RopeAnchorComponent ropeAnchorComponent = val.AddComponent<RopeAnchorComponent>(); LineRenderer componentInChildren = raftMast.GetComponentInChildren<LineRenderer>(true); ropeAnchorComponent.m_rope = val.AddComponent<LineRenderer>(); ((Renderer)ropeAnchorComponent.m_rope).material = new Material(((Renderer)componentInChildren).material); ropeAnchorComponent.m_rope.widthMultiplier = 0.05f; ((Renderer)ropeAnchorComponent.m_rope).enabled = false; SetWearNTear(val, 3).m_supports = false; FixCollisionLayers(val); PieceManager obj = pieceManager; PieceConfig val3 = new PieceConfig(); val3.PieceTable = "Hammer"; val3.Description = "$mb_rope_anchor_desc"; val3.Icon = sprites.GetSprite("rope_anchor"); val3.Category = "Raft"; val3.Enabled = true; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Amount = 1, Item = "Iron", Recover = true }, new RequirementConfig { Amount = 4, Item = "IronNails", Recover = true } }; obj.AddPiece(new CustomPiece(val, false, val3)); } private void RegisterCustomSail() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown GameObject val = prefabManager.CreateEmptyPrefab("MBSail", true); Object.Destroy((Object)(object)val.GetComponent<BoxCollider>()); Object.Destroy((Object)(object)val.GetComponent<MeshFilter>()); Piece val2 = val.AddComponent<Piece>(); val2.m_name = "$mb_sail"; val2.m_description = "$mb_sail_desc"; val2.m_placeEffect = woodFloorPiece.m_placeEffect; AddToRaftPrefabPieces(val2); AddNetViewWithPersistence(val); GameObject val3 = new GameObject("Sail"); val3.transform.parent = val.transform; val3.layer = LayerMask.NameToLayer("piece_nonsolid"); GameObject val4 = val3; SailComponent sailComponent = val.AddComponent<SailComponent>(); sailComponent.m_sailObject = val4; sailComponent.m_sailCloth = val4.AddComponent<Cloth>(); sailComponent.m_meshCollider = val4.AddComponent<MeshCollider>(); sailComponent.m_mesh = val4.GetComponent<SkinnedMeshRenderer>(); ((Renderer)sailComponent.m_mesh).shadowCastingMode = (ShadowCastingMode)2; ((Renderer)sailComponent.m_mesh).sharedMaterial = sailMat; SetWearNTear(val); FixSnapPoints(val); MastComponent mastComponent = val.AddComponent<MastComponent>(); mastComponent.m_sailObject = val4; mastComponent.m_sailCloth = sailComponent.m_sailCloth; mastComponent.m_allowSailRotation = false; mastComponent.m_allowSailShrinking = true; val.layer = LayerMask.NameToLayer("piece_nonsolid"); SailCreatorComponent.m_sailPrefab = val; PrefabManager.Instance.AddPrefab(val); } public void RegisterCustomSailCreator(int sailCount) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0146: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown if (sailCount != 3 && sailCount != 4) { Logger.LogError((object)$"Attempted to register a sail that is not of type 3 or 4. Got {sailCount}"); return; } GameObject val = prefabManager.CreateEmptyPrefab($"MBSailCreator_{sailCount}", false); val.layer = LayerMask.NameToLayer("piece_nonsolid"); Piece val2 = val.AddComponent<Piece>(); string name = ((sailCount == 3) ? "$mb_sail" : $"$mb_sail_{sailCount}"); val2.m_name = name; val2.m_description = $"$mb_sail_{sailCount}_desc"; val2.m_placeEffect = woodFloorPiece.m_placeEffect; AddToRaftPrefabPieces(val2); val.AddComponent<SailCreatorComponent>().m_sailSize = sailCount; ((Component)val.GetComponent<MeshRenderer>()).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); Sprite icon = ((sailCount == 3) ? sprites.GetSprite("customsail_tri") : sprites.GetSprite("customsail")); pieceManager.AddPiece(new CustomPiece(val, false, new PieceConfig { PieceTable = "Hammer", Description = $"$mb_sail_{sailCount}_desc", Category = "Raft", Enabled = true, Icon = icon })); } private void RegisterPierPole() { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown GameObject prefab = prefabManager.GetPrefab("wood_pole_log_4"); GameObject val = prefabManager.CreateClonedPrefab("MBPier_Pole", prefab); val.GetComponent<WearNTear>().m_noRoofWear = false; Piece component = val.GetComponent<Piece>(); component.m_waterPiece = true; AddToRaftPrefabPieces(component); PierComponent pierComponent = val.AddComponent<PierComponent>(); pierComponent.m_segmentObject = prefabManager.CreateClonedPrefab("MBPier_Pole_Segment", prefab); Object.Destroy((Object)(object)pierComponent.m_segmentObject.GetComponent<ZNetView>()); Object.Destroy((Object)(object)pierComponent.m_segmentObject.GetComponent<Piece>()); Object.Destroy((Object)(object)pierComponent.m_segmentObject.GetComponent<WearNTear>()); FixSnapPoints(val); Transform[] componentsInChildren = pierComponent.m_segmentObject.GetComponentsInChildren<Transform>(); for (int i = 0; i < componentsInChildren.Length; i++) { if (Object.op_Implicit((Object)(object)componentsInChildren[i]) && ((Component)componentsInChildren[i]).CompareTag("snappoint")) { Object.Destroy((Object)(object)componentsInChildren[i]); } } pierComponent.m_segmentHeight = 4f; pierComponent.m_baseOffset = -1f; PieceConfig val2 = new PieceConfig(); val2.PieceTable = "Hammer"; val2.Name = "$mb_pier (" + component.m_name + ")"; val2.Description = "$mb_pier_desc\n " + component.m_description; val2.Category = "Raft"; val2.Enabled = true; val2.Icon = component.m_icon; val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Amount = 4, Item = "RoundLog", Recover = true } }; CustomPiece val3 = new CustomPiece(val, false, val2); AddToRaftPrefabPieces(val3.Piece); pieceManager.AddPiece(val3); } private void RegisterPierWall() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //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_0163: 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_0176: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown GameObject prefab = prefabManager.GetPrefab("stone_wall_4x2"); GameObject val = prefabManager.CreateClonedPrefab("MBPier_Stone", prefab); Piece component = val.GetComponent<Piece>(); component.m_waterPiece = true; PierComponent pierComponent = val.AddComponent<PierComponent>(); pierComponent.m_segmentObject = prefabManager.CreateClonedPrefab("MBPier_Stone_Segment", prefab); Object.Destroy((Object)(object)pierComponent.m_segmentObject.GetComponent<ZNetView>()); Object.Destroy((Object)(object)pierComponent.m_segmentObject.GetComponent<Piece>()); Object.Destroy((Object)(object)pierComponent.m_segmentObject.GetComponent<WearNTear>()); FixSnapPoints(val); Transform[] componentsInChildren = pierComponent.m_segmentObject.GetComponentsInChildren<Transform>(); for (int i = 0; i < componentsInChildren.Length; i++) { if (Object.op_Implicit((Object)(object)componentsInChildren[i]) && ((Component)componentsInChildren[i]).CompareTag("snappoint")) { Object.Destroy((Object)(object)componentsInChildren[i]); } } pierComponent.m_segmentHeight = 2f; pierComponent.m_baseOffset = 0f; PieceConfig val2 = new PieceConfig(); val2.PieceTable = "Hammer"; val2.Name = "$mb_pier (" + component.m_name + ")"; val2.Description = "$mb_pier_desc\n " + component.m_description; val2.Category = "Raft"; val2.Enabled = true; val2.Icon = component.m_icon; val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Amount = 12, Item = "Stone", Recover = true } }; CustomPiece val3 = new CustomPiece(val, false, val2); AddToRaftPrefabPieces(val3.Piece); pieceManager.AddPiece(val3); } private void RegisterBoardingRamp() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Expected O, but got Unknown //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Expected O, but got Unknown Piece component = prefabManager.GetPrefab("wood_pole2").GetComponent<Piece>(); mbBoardingRamp = prefabManager.CreateClonedPrefab("MBBoardingRamp", boarding_ramp); GameObject gameObject = ((Component)mbBoardingRamp.transform.Find("Ramp/Segment/SegmentAnchor/Floor")).gameObject; GameObject obj = Object.Instantiate<GameObject>(((Component)((Component)woodFloorPiece).transform.Find("New/_Combined Mesh [high]")).gameObject, gameObject.transform.parent, false); Object.Destroy((Object)(object)gameObject); obj.transform.localPosition = new Vector3(1f, -52.55f, 0.5f); obj.transform.localScale = Vector3.one; obj.transform.localRotation = Quaternion.Euler(0f, 90f, 0f); Material sharedMaterial = ((Renderer)((Component)((Component)component).transform.Find("New")).GetComponent<MeshRenderer>()).sharedMaterial; ((Renderer)((Component)mbBoardingRamp.transform.Find("Winch1/Pole")).GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial; ((Renderer)((Component)mbBoardingRamp.transform.Find("Winch2/Pole")).GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial; ((Renderer)((Component)mbBoardingRamp.transform.Find("Ramp/Segment/SegmentAnchor/Pole1")).GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial; ((Renderer)((Component)mbBoardingRamp.transform.Find("Ramp/Segment/SegmentAnchor/Pole2")).GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial; ((Renderer)((Component)mbBoardingRamp.transform.Find("Winch1/Cylinder")).GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial; ((Renderer)((Component)mbBoardingRamp.transform.Find("Winch2/Cylinder")).GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial; Material sharedMaterial2 = ((Renderer)raftMast.GetComponentInChildren<LineRenderer>(true)).sharedMaterial; ((Renderer)((Component)mbBoardingRamp.transform.Find("Rope1")).GetComponent<LineRenderer>()).sharedMaterial = sharedMaterial2; ((Renderer)((Component)mbBoardingRamp.transform.Find("Rope2")).GetComponent<LineRenderer>()).sharedMaterial = sharedMaterial2; Piece val = mbBoardingRamp.AddComponent<Piece>(); val.m_name = "$mb_boarding_ramp"; val.m_description = "$mb_boarding_ramp_desc"; val.m_placeEffect = woodFloorPiece.m_placeEffect; AddToRaftPrefabPieces(val); AddNetViewWithPersistence(mbBoardingRamp); BoardingRampComponent boardingRampComponent = mbBoardingRamp.AddComponent<BoardingRampComponent>(); boardingRampComponent.m_stateChangeDuration = 0.3f; boardingRampComponent.m_segments = 5; SetWearNTear(mbBoardingRamp).m_supports = false; FixCollisionLayers(mbBoardingRamp); FixSnapPoints(mbBoardingRamp); PieceManager obj2 = pieceManager; GameObject obj3 = mbBoardingRamp; PieceConfig val2 = new PieceConfig(); val2.PieceTable = "Hammer"; val2.Description = "$mb_boarding_ramp_desc"; val2.Icon = sprites.GetSprite("boarding_ramp"); val2.Category = "Raft"; val2.Enabled = true; val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Amount = 10, Item = "Wood", Recover = true }, new RequirementConfig { Amount = 4, Item = "IronNails", Recover = true } }; obj2.AddPiece(new CustomPiece(obj3, false, val2)); } private void RegisterBoardingRampWide() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown GameObject val = prefabManager.CreateClonedPrefab("MBBoardingRamp_Wide", mbBoardingRamp); Piece component = val.GetComponent<Piece>(); component.m_name = "$mb_boarding_ramp_wide"; component.m_description = "$mb_boarding_ramp_wide_desc"; AddToRaftPrefabPieces(component); BoardingRampComponent component2 = val.GetComponent<BoardingRampComponent>(); component2.m_stateChangeDuration = 0.3f; component2.m_segments = 5; SetWearNTear(val); val.transform.localScale = new Vector3(2f, 1f, 1f); FixSnapPoints(val); PieceManager obj = pieceManager; PieceConfig val2 = new PieceConfig(); val2.PieceTable = "Hammer"; val2.Description = "$mb_boarding_ramp_wide_desc"; val2.Icon = sprites.GetSprite("boarding_ramp"); val2.Category = "Raft"; val2.Enabled = true; val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Amount = 20, Item = "Wood", Recover = true }, new RequirementConfig { Amount = 8, Item = "IronNails", Recover = true } }; obj.AddPiece(new CustomPiece(val, false, val2)); } private void RegisterDirtFloor(int size) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown string text = $"{size}x{size}"; string text2 = "MBDirtFloor_" + text; GameObject val = prefabManager.CreateClonedPrefab(text2, dirtFloor); val.transform.localScale = new Vector3((float)size, 1f, (float)size); Piece val2 = val.AddComponent<Piece>(); val2.m_placeEffect = woodFloorPiece.m_placeEffect; AddToRaftPrefabPieces(val2); AddNetViewWithPersistence(val); SetWearNTear(val); val.AddComponent<CultivatableComponent>(); FixCollisionLayers(val); FixSnapPoints(val); PieceManager obj = pieceManager; PieceConfig val3 = new PieceConfig(); val3.PieceTable = "Hammer"; val3.Name = "$mb_dirt_floor_" + text; val3.Description = "$mb_dirt_floor_" + text + "_desc"; val3.Category = "Raft"; val3.Enabled = true; val3.Icon = sprites.GetSprite("dirtfloor_icon"); val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Amount = (int)Math.Pow(size, 2.0), Item = "Stone", Recover = true } }; obj.AddPiece(new CustomPiece(val, false, val3)); } private void FixCollisionLayers(GameObject r) { int num2 = (r.layer = LayerMask.NameToLayer("piece")); int layer = num2; Transform[] componentsInChildren = ((Component)r.transform).GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = layer; } } private static void FixedRopes(GameObject r) { LineAttach[] componentsInChildren = r.GetComponentsInChildren<LineAttach>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).GetComponent<LineRenderer>().positionCount = 2; componentsInChildren[i].m_attachments.Clear(); componentsInChildren[i].m_attachments.Add(r.transform); } } private void FixSnapPoints(GameObject r) { Transform[] componentsInChildren = r.GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (((Object)componentsInChildren[i]).name.StartsWith("_snappoint")) { ((Component)componentsInChildren[i]).tag = "snappoint"; } } } private void PrintCollisionMatrix() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(""); stringBuilder.Append(" ".PadLeft(23)); for (int i = 0; i < 32; i++) { stringBuilder.Append(i.ToString().PadRight(3)); } stringBuilder.AppendLine(""); for (int j = 0; j < 32; j++) { stringBuilder.Append(LayerMask.LayerToName(j).PadLeft(20) + j.ToString().PadLeft(3)); for (int k = 0; k < 32; k++) { bool flag = !Physics.GetIgnoreLayerCollision(j, k); stringBuilder.Append(flag ? "[X]" : "[ ]"); } stringBuilder.AppendLine(""); } stringBuilder.AppendLine(""); Logger.LogDebug((object)stringBuilder.ToString()); } } public class ShipStats { public float baseShipMass = 500f; public float shipMassPerWoodFloorItem = 50f; public float shipMassPerStoneItem = 200f; public float baseShipFloatation = 500f; public float shipFloationPerWoodFloorItem = 100f; public float shipFloatationPerStoneItem = -200f; private float cachedShipFloatation; public float GetShipFloatation(List<ZNetView> pieces) { if (cachedShipFloatation != 0f) { return cachedShipFloatation; } float result = 1000f; new List<ZNetView>(); foreach (ZNetView piece in pieces) { string prefabName = piece.GetPrefabName(); Logger.LogDebug((object)("prefabName " + prefabName)); _ = prefabName == ""; } cachedShipFloatation = result; return result; } } internal static class SailAreaForce { public static readonly float Tier1 = 5f; public static readonly float Tier2 = 7.5f; public static readonly float Tier3 = 10f; public static readonly float CustomTier1AreaForceMultiplier = 0.5f; public static readonly bool HasPropulsionConfigOverride = false; } [BepInPlugin("BepIn.Sarcen.ValheimRAFT", "ValheimRAFT", "1.6.14")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class ValheimRaftPlugin : BaseUnityPlugin { public const string Author = "Sarcen"; public const string Version = "1.6.14"; internal const string ModName = "ValheimRAFT"; public const string BepInGuid = "BepIn.Sarcen.ValheimRAFT"; private const string HarmonyGuid = "Harmony.Sarcen.ValheimRAFT"; public const string ModDescription = "Valheim Mod for building on the sea"; public const string CopyRight = "Copyright © 2023, GNU-v3 licensed"; internal static readonly int CustomRaftLayer = 29; public static AssetBundle m_assetBundle; private bool m_customItemsAdded; public PrefabController prefabController; public string[] possibleModFolderNames = new string[4] { "Sarcen-ValheimRAFT", "zolantris-ValheimRAFT", "Zolantris-ValheimRAFT", "ValheimRAFT" }; public static ValheimRaftPlugin Instance { get; private set; } public ConfigEntry<bool> MakeAllPiecesWaterProof { get; set; } public ConfigEntry<bool> AllowFlight { get; set; } public ConfigEntry<string> PluginFolderName { get; set; } public ConfigEntry<float> InitialRaftFloorHeight { get; set; } public ConfigEntry<bool> PatchPlanBuildPositionIssues { get; set; } public ConfigEntry<float> RaftHealth { get; set; } public ConfigEntry<float> ServerRaftUpdateZoneInterval { get; set; } public ConfigEntry<float> RaftSailForceMultiplier { get; set; } public ConfigEntry<bool> DisplacedRaftAutoFix { get; set; } public ConfigEntry<bool> AdminsCanOnlyBuildRaft { get; set; } public ConfigEntry<bool> EnableCustomPropulsionConfig { get; set; } public ConfigEntry<float> MaxPropulsionSpeed { get; set; } public ConfigEntry<float> MaxSailSpeed { get; set; } public ConfigEntry<float> SpeedCapMultiplier { get; set; } public ConfigEntry<float> SailTier1Area { get; set; } public ConfigEntry<float> SailTier2Area { get; set; } public ConfigEntry<float> SailTier3Area { get; set; } public ConfigEntry<float> SailCustomAreaTier1Multiplier { get; set; } public ConfigEntry<float> BoatDragCoefficient { get; set; } public ConfigEntry<float> MastShearForceThreshold { get; set; } public ConfigEntry<bool> HasDebugSails { get; set; } public ConfigEntry<bool> HasDebugBase { get; set; } public ConfigEntry<bool> HasShipWeightCalculations { get; set; } public ConfigEntry<float> MassPercentageFactor { get; set; } public ConfigEntry<bool> ShowShipStats { get; set; } public ConfigEntry<bool> HasShipContainerWeightCalculations { get; set; } public ConfigEntry<float> RaftCreativeHeight { get; set; } public ConfigEntry<float> FloatingColliderVerticalSize { get; set; } public ConfigEntry<float> FloatingColliderVerticalCenterOffset { get; set; } public ConfigEntry<float> BlockingColliderVerticalSize { get; set; } public ConfigEntry<float> BlockingColliderVerticalCenterOffset { get; set; } public ConfigEntry<KeyboardShortcut> AnchorKeyboardShortcut { get; set; } private ConfigDescription CreateConfigDescription(string description, bool isAdmin = false) { //IL_000a: Unknown result type