Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ValheimVehicle v1.7.1
BepInEx/plugins/ValheimVehicle/ValheimVehicle.dll
Decompiled 2 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.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Newtonsoft.Json.Linq; using Splatform; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: Guid("0ff27dff-2359-4065-842f-ba66aaac02ff")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyFileVersion("1.7.1.0")] [assembly: AssemblyTitle("ValheimVehicle")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ValheimVehicle")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyVersion("1.7.1.0")] public sealed class BalloonAnchor : MonoBehaviour { private const string Prefix = "VV.Balloon.Anchor."; private const string ToggleRpc = "VV_BalloonAnchor"; internal static readonly Vector3 Mount = new Vector3(2.32f, 0.75f, -1.15f); internal static readonly Vector3 Eye = new Vector3(0f, 0.46f, 0f); private readonly BalloonAnchorState state = new BalloonAnchorState(); private ZNetView view; private BalloonFlight flight; private Rigidbody balloon; private Rigidbody weight; private SphereCollider hitbox; private ConfigurableJoint tether; private GameObject weightObject; private LineRenderer rope; private Transform targetTransform; private Collider targetCollider; private ZDOID targetId = ZDOID.None; private Vector3 targetLocal; private Vector3 pinnedPosition; private Vector3 previousMount; private Vector3 sweepFrom; private bool owner; private bool initialized; private bool toggleHeld; private bool trackLocalTarget; private bool targetTerrain; private float nextSync; private float nextPlayerIgnore; private float lastToggle = -10f; private long noticePeer; internal static int WorldMask => LayerMask.GetMask(new string[7] { "terrain", "piece", "Default", "Default_small", "static_solid", "vehicle", "item" }); internal BalloonAnchorMode Mode => state.Mode; internal float RopeLength => state.RopeLength; private Vector3 RopeStart => ((Component)this).transform.TransformPoint(Mount); private Vector3 RopeEnd => weight.position + Eye; private void Start() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Invalid comparison between Unknown and I4 //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown view = ((Component)this).GetComponent<ZNetView>(); flight = ((Component)this).GetComponent<BalloonFlight>(); balloon = ((Component)this).GetComponent<Rigidbody>(); if (!Object.op_Implicit((Object)(object)view) || !view.IsValid() || !Object.op_Implicit((Object)(object)flight)) { ((Behaviour)this).enabled = false; return; } weightObject = new GameObject("Hrafn_Anchor_" + view.GetZDO().m_uid); weightObject.layer = LayerMask.NameToLayer("piece"); weightObject.transform.position = RopeStart - Eye; weight = weightObject.AddComponent<Rigidbody>(); weight.mass = 45f; weight.useGravity = false; weight.isKinematic = true; weight.constraints = (RigidbodyConstraints)112; weight.linearDamping = 0.18f; weight.collisionDetectionMode = (CollisionDetectionMode)3; hitbox = weightObject.AddComponent<SphereCollider>(); hitbox.radius = 0.24f; hitbox.center = new Vector3(0f, -0.08f, 0f); ((Collider)hitbox).enabled = false; weightObject.AddComponent<BalloonAnchorContact>().Anchor = this; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(); foreach (Collider val in componentsInChildren) { Physics.IgnoreCollision((Collider)(object)hitbox, val); } if ((int)SystemInfo.graphicsDeviceType != 4) { BalloonAnchorVisual.Build(weightObject); BalloonAnchorVisual.BuildMount(((Component)this).gameObject); GameObject val2 = new GameObject("Hrafn_Anchor_Rope"); val2.transform.SetParent(((Component)this).transform, false); rope = val2.AddComponent<LineRenderer>(); rope.useWorldSpace = true; rope.positionCount = 13; LineRenderer obj = rope; float startWidth = (rope.endWidth = 0.045f); obj.startWidth = startWidth; rope.numCapVertices = 3; rope.generateLightingData = true; rope.textureMode = (LineTextureMode)1; ((Renderer)rope).shadowCastingMode = (ShadowCastingMode)1; if (BalloonModel.Materials.TryGetValue("Hemp rope", out var value)) { ((Renderer)rope).sharedMaterial = value; } } view.Register<ZDOID>("VV_BalloonAnchor", (Action<long, ZDOID>)OnToggle); initialized = true; previousMount = RopeStart; CheckOwner(); } private void ReadState() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) ZDO zDO = view.GetZDO(); state.Restore(zDO.GetInt("VV.Balloon.Anchor.Mode", 0), zDO.GetFloat("VV.Balloon.Anchor.Length", 0.15f)); pinnedPosition = zDO.GetVec3("VV.Balloon.Anchor.Position", RopeStart - Eye); targetId = zDO.GetZDOID("VV.Balloon.Anchor.Target"); targetLocal = zDO.GetVec3("VV.Balloon.Anchor.Local", Vector3.zero); targetTerrain = zDO.GetBool("VV.Balloon.Anchor.Terrain", false); } private void CheckOwner() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) if (!initialized || !view.IsValid()) { return; } bool flag = view.IsOwner(); if (flag == owner) { return; } owner = flag; RemoveTether(); if (owner) { ReadState(); weight.position = pinnedPosition; targetTransform = null; targetCollider = null; trackLocalTarget = false; previousMount = RopeStart; if (!view.GetZDO().GetBool("VV.Balloon.Anchor.Initialized", false)) { view.GetZDO().Set("VV.Balloon.Anchor.Initialized", true); state.Stow(); BeginDrop(); } else { SetFalling(state.Mode == BalloonAnchorMode.Dropping); if (state.Mode == BalloonAnchorMode.Dropping) { weight.linearVelocity = view.GetZDO().GetVec3("VV.Balloon.Anchor.Velocity", Vector3.zero); } if (state.Mode == BalloonAnchorMode.Latched) { ResolveTarget(); CreateTether(); } } sweepFrom = weight.position; } else { SetFalling(falling: false); } } private void SetFalling(bool falling) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) ((Collider)hitbox).enabled = falling; if (!falling) { weight.collisionDetectionMode = (CollisionDetectionMode)3; } weight.isKinematic = !falling; weight.useGravity = falling; if (falling) { weight.collisionDetectionMode = (CollisionDetectionMode)2; } if (falling) { sweepFrom = weight.position; } } private void BeginDrop() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) if (state.Drop(0.15f)) { targetId = ZDOID.None; targetTransform = null; targetCollider = null; trackLocalTarget = false; targetTerrain = false; weight.position = RopeStart - Eye - Vector3.up * 0.1f; weight.rotation = Quaternion.identity; SetFalling(falling: true); weight.linearVelocity = balloon.GetPointVelocity(RopeStart); weight.WakeUp(); Publish(force: true); } } private void BeginRetrieve() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (state.Retrieve()) { RemoveTether(); SetFalling(falling: false); targetId = ZDOID.None; targetTransform = null; targetCollider = null; trackLocalTarget = false; previousMount = RopeStart; Publish(force: true); } } public void ResetForRecall() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (initialized && view.IsOwner()) { RemoveTether(); SetFalling(falling: false); state.Stow(); targetId = ZDOID.None; targetTransform = null; targetCollider = null; trackLocalTarget = false; Publish(force: true); } } public void DropAfterRecall() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (initialized && view.IsOwner()) { weight.position = RopeStart - Eye; previousMount = RopeStart; BeginDrop(); } } private void Update() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d1: 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_008d: 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) if (!initialized || !view.IsValid()) { return; } CheckOwner(); bool flag = BepInExPlugin.Pressed(BepInExPlugin.BalloonAnchorKey.Value, ref toggleHeld); Player localPlayer = Player.m_localPlayer; if (flag && Object.op_Implicit((Object)(object)localPlayer) && !BepInExPlugin.InputBlocked() && (flight.AttachedSeat(localPlayer) == 0 || (flight.Creator == localPlayer.GetPlayerID() && !((Character)localPlayer).IsAttached() && Vector3.Distance(((Component)localPlayer).transform.position, ((Component)this).transform.position) < 4.5f))) { ZNetView component = ((Component)localPlayer).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component) && component.IsValid()) { view.InvokeRPC("VV_BalloonAnchor", new object[1] { component.GetZDO().m_uid }); } } if (owner) { return; } ReadState(); Vector3 val = ((state.Mode == BalloonAnchorMode.Stowed) ? (RopeStart - Eye) : pinnedPosition); if (state.Mode == BalloonAnchorMode.Latched) { ResolveTarget(); if (Object.op_Implicit((Object)(object)targetTransform)) { val = targetTransform.TransformPoint(targetLocal); } } weight.position = ((state.Mode == BalloonAnchorMode.Dropping || state.Mode == BalloonAnchorMode.Retracting) ? Vector3.Lerp(weight.position, val, 1f - Mathf.Exp(-18f * Time.deltaTime)) : val); } private void OnToggle(long sender, ZDOID player) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) CheckOwner(); if (owner && flight.CanOperateAnchor(sender, player) && !(Time.time - lastToggle < 0.4f)) { lastToggle = Time.time; noticePeer = sender; if (state.Mode == BalloonAnchorMode.Stowed) { BeginDrop(); } else { BeginRetrieve(); } view.InvokeRPC(sender, "VV_BalloonNotice", new object[1] { StatusText() }); } } private void FixedUpdate() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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) if (!initialized || !view.IsValid()) { return; } CheckOwner(); if (!owner) { return; } if (Time.time >= nextPlayerIgnore) { nextPlayerIgnore = Time.time + 1f; foreach (Player allPlayer in Player.GetAllPlayers()) { Collider[] componentsInChildren = ((Component)allPlayer).GetComponentsInChildren<Collider>(); foreach (Collider val in componentsInChildren) { Physics.IgnoreCollision((Collider)(object)hitbox, val); } } } if (state.Mode == BalloonAnchorMode.Dropping) { Vector3 val2 = weight.position - sweepFrom; if (((Vector3)(ref val2)).sqrMagnitude > 1E-05f) { RaycastHit[] array = Physics.SphereCastAll(sweepFrom + hitbox.center, hitbox.radius, ((Vector3)(ref val2)).normalized, ((Vector3)(ref val2)).magnitude, WorldMask, (QueryTriggerInteraction)1); RaycastHit val3 = default(RaycastHit); float num = float.MaxValue; RaycastHit[] array2 = array; for (int j = 0; j < array2.Length; j++) { RaycastHit val4 = array2[j]; if (CanLatch(((RaycastHit)(ref val4)).collider) && ((RaycastHit)(ref val4)).distance < num) { val3 = val4; num = ((RaycastHit)(ref val4)).distance; } } if (num < float.MaxValue) { weight.position = sweepFrom + ((Vector3)(ref val2)).normalized * num; Touch(((RaycastHit)(ref val3)).collider); } } sweepFrom = weight.position; state.PayOut(Vector3.Distance(RopeStart, RopeEnd), Time.fixedDeltaTime); if (state.FallTime > 45f || state.RopeLength > 600f) { BeginRetrieve(); } } if (state.Mode == BalloonAnchorMode.Latched) { ResolveTarget(); bool num2; if (!(targetId != ZDOID.None)) { if (!trackLocalTarget || Object.op_Implicit((Object)(object)targetCollider)) { goto IL_02bb; } num2 = !targetTerrain; } else { num2 = ZDOMan.instance.GetZDO(targetId) == null; } if (!num2) { goto IL_02bb; } RemoveTether(); state.Unlatch(); targetId = ZDOID.None; targetTransform = null; targetCollider = null; trackLocalTarget = false; SetFalling(falling: true); weight.linearVelocity = Vector3.zero; Publish(force: true); } goto IL_02f6; IL_02f6: if (state.Mode == BalloonAnchorMode.Retracting) { Vector3 val5 = weight.position + (RopeStart - previousMount); weight.position = Vector3.MoveTowards(val5, RopeStart - Eye, 12f * Time.fixedDeltaTime); state.Reel(Vector3.Distance(RopeStart, RopeEnd)); if (Vector3.Distance(RopeStart, RopeEnd) < 0.16f) { state.Stow(); Publish(force: true); } } if (state.Mode == BalloonAnchorMode.Stowed) { weight.position = RopeStart - Eye; } previousMount = RopeStart; Publish(force: false); return; IL_02bb: if (Object.op_Implicit((Object)(object)targetTransform)) { pinnedPosition = targetTransform.TransformPoint(targetLocal); } weight.MovePosition(pinnedPosition); CreateTether(); goto IL_02f6; } private bool CanLatch(Collider collider) { if (Object.op_Implicit((Object)(object)collider) && (Object)(object)collider != (Object)(object)hitbox && !collider.isTrigger && ((1 << ((Component)collider).gameObject.layer) & WorldMask) != 0 && !((Component)collider).transform.IsChildOf(((Component)this).transform)) { return !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<Character>()); } return false; } internal void Touch(Collider collider) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (owner && CanLatch(collider) && state.Latch(Vector3.Distance(RopeStart, RopeEnd))) { weight.linearVelocity = Vector3.zero; weight.angularVelocity = Vector3.zero; SetFalling(falling: false); pinnedPosition = weight.position; targetCollider = collider; trackLocalTarget = true; targetTerrain = Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<Heightmap>()); ZNetView componentInParent = ((Component)collider).GetComponentInParent<ZNetView>(); if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.IsValid()) { targetId = componentInParent.GetZDO().m_uid; targetTransform = ((Component)componentInParent).transform; } else { targetId = ZDOID.None; targetTransform = ((Component)collider).transform; } targetLocal = targetTransform.InverseTransformPoint(pinnedPosition); CreateTether(); Publish(force: true); if (noticePeer != 0) { view.InvokeRPC(noticePeer, "VV_BalloonNotice", new object[1] { "Якорь закреплён. Верёвка: " + state.RopeLength.ToString("0.0") + " м" }); } } } private void ResolveTarget() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (targetId != ZDOID.None) { GameObject val = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.FindInstance(targetId) : null); targetTransform = (Object.op_Implicit((Object)(object)val) ? val.transform : null); } if (!owner || Object.op_Implicit((Object)(object)targetTransform) || trackLocalTarget || !(targetId == ZDOID.None) || state.Mode != BalloonAnchorMode.Latched) { return; } Collider[] array = Physics.OverlapSphere(pinnedPosition + hitbox.center, hitbox.radius + 0.1f, WorldMask, (QueryTriggerInteraction)1); foreach (Collider val2 in array) { if (CanLatch(val2)) { targetCollider = val2; trackLocalTarget = true; targetTransform = ((Component)val2).transform; targetLocal = targetTransform.InverseTransformPoint(pinnedPosition); break; } } } private void CreateTether() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_011e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)tether) && owner && state.Mode == BalloonAnchorMode.Latched) { tether = ((Component)this).gameObject.AddComponent<ConfigurableJoint>(); ((Joint)tether).autoConfigureConnectedAnchor = false; ((Joint)tether).connectedBody = weight; ((Joint)tether).anchor = Mount; ((Joint)tether).connectedAnchor = Eye; ConfigurableJoint obj = tether; ConfigurableJoint obj2 = tether; ConfigurableJoint obj3 = tether; ConfigurableJointMotion val = (ConfigurableJointMotion)1; obj3.zMotion = (ConfigurableJointMotion)1; ConfigurableJointMotion xMotion = (obj2.yMotion = val); obj.xMotion = xMotion; ConfigurableJoint obj4 = tether; ConfigurableJoint obj5 = tether; ConfigurableJoint obj6 = tether; ConfigurableJointMotion val3 = (ConfigurableJointMotion)2; obj6.angularZMotion = (ConfigurableJointMotion)2; ConfigurableJointMotion angularXMotion = (obj5.angularYMotion = val3); obj4.angularXMotion = angularXMotion; ConfigurableJoint obj7 = tether; SoftJointLimit linearLimit = default(SoftJointLimit); ((SoftJointLimit)(ref linearLimit)).limit = state.RopeLength; ((SoftJointLimit)(ref linearLimit)).contactDistance = 0.02f; obj7.linearLimit = linearLimit; ConfigurableJoint obj8 = tether; SoftJointLimitSpring linearLimitSpring = default(SoftJointLimitSpring); ((SoftJointLimitSpring)(ref linearLimitSpring)).spring = 0f; ((SoftJointLimitSpring)(ref linearLimitSpring)).damper = 0f; obj8.linearLimitSpring = linearLimitSpring; tether.projectionMode = (JointProjectionMode)1; tether.projectionDistance = 0.1f; ((Joint)tether).enableCollision = false; ((Joint)tether).enablePreprocessing = true; balloon.WakeUp(); } } private void RemoveTether() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)tether)) { ConfigurableJoint obj = tether; ConfigurableJoint obj2 = tether; ConfigurableJoint obj3 = tether; ConfigurableJointMotion val = (ConfigurableJointMotion)2; obj3.zMotion = (ConfigurableJointMotion)2; ConfigurableJointMotion xMotion = (obj2.yMotion = val); obj.xMotion = xMotion; Object.Destroy((Object)(object)tether); tether = null; } } private void Publish(bool force) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_00b1: Unknown result type (might be due to invalid IL or missing references) if (owner && view.IsValid() && (force || !(Time.time < nextSync))) { nextSync = Time.time + 0.1f; ZDO zDO = view.GetZDO(); zDO.Set("VV.Balloon.Anchor.Position", weight.position); zDO.Set("VV.Balloon.Anchor.Velocity", weight.isKinematic ? Vector3.zero : weight.linearVelocity); zDO.Set("VV.Balloon.Anchor.Length", state.RopeLength); zDO.Set("VV.Balloon.Anchor.Target", targetId); zDO.Set("VV.Balloon.Anchor.Local", targetLocal); zDO.Set("VV.Balloon.Anchor.Terrain", targetTerrain); zDO.Set("VV.Balloon.Anchor.Mode", (int)state.Mode); } } private void LateUpdate() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)rope) && Object.op_Implicit((Object)(object)weight)) { Vector3 ropeStart = RopeStart; Vector3 ropeEnd = RopeEnd; float num = Vector3.Distance(ropeStart, ropeEnd); float num2 = Mathf.Max(0f, state.RopeLength - num); float num3 = Mathf.Min(3f, Mathf.Sqrt(num2 * Mathf.Max(num, 0.1f)) * 0.55f); for (int i = 0; i < rope.positionCount; i++) { float num4 = (float)i / (float)(rope.positionCount - 1); rope.SetPosition(i, Vector3.Lerp(ropeStart, ropeEnd, num4) - Vector3.up * (Mathf.Sin(num4 * (float)Math.PI) * num3)); } } } internal string StatusText() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) string text = ((state.Mode == BalloonAnchorMode.Latched) ? "закреплён" : ((state.Mode == BalloonAnchorMode.Dropping) ? "опускается" : ((state.Mode == BalloonAnchorMode.Retracting) ? "поднимается" : "поднят"))); return string.Concat("Якорь [", BepInExPlugin.BalloonAnchorKey.Value, "]: ", text); } private void OnDestroy() { RemoveTether(); if (Object.op_Implicit((Object)(object)weightObject)) { Object.Destroy((Object)(object)weightObject); } } } public sealed class BalloonAnchorContact : MonoBehaviour { internal BalloonAnchor Anchor; private void OnCollisionEnter(Collision collision) { if (Object.op_Implicit((Object)(object)Anchor)) { Anchor.Touch(collision.collider); } } private void OnCollisionStay(Collision collision) { if (Object.op_Implicit((Object)(object)Anchor)) { Anchor.Touch(collision.collider); } } } internal enum BalloonAnchorMode { Stowed, Dropping, Latched, Retracting } internal sealed class BalloonAnchorState { internal BalloonAnchorMode Mode { get; private set; } internal float RopeLength { get; private set; } internal float FallTime { get; private set; } private static float Length(float value) { if (!float.IsNaN(value) && !float.IsInfinity(value)) { return Math.Max(0.15f, Math.Min(1000f, value)); } return 0.15f; } internal void Restore(int mode, float length) { Mode = ((mode >= 0 && mode <= 3) ? ((BalloonAnchorMode)mode) : BalloonAnchorMode.Stowed); RopeLength = Length(length); FallTime = 0f; } internal bool Drop(float distance) { if (Mode != BalloonAnchorMode.Stowed) { return false; } Mode = BalloonAnchorMode.Dropping; RopeLength = Length(distance); FallTime = 0f; return true; } internal void PayOut(float distance, float dt) { if (Mode == BalloonAnchorMode.Dropping) { RopeLength = Math.Max(RopeLength, Length(distance)); FallTime += Math.Max(0f, dt); } } internal bool Latch(float distance) { if (Mode != BalloonAnchorMode.Dropping) { return false; } RopeLength = Math.Max(RopeLength, Length(distance)); Mode = BalloonAnchorMode.Latched; return true; } internal bool Retrieve() { if (Mode != BalloonAnchorMode.Dropping && Mode != BalloonAnchorMode.Latched) { return false; } Mode = BalloonAnchorMode.Retracting; return true; } internal void Reel(float distance) { if (Mode == BalloonAnchorMode.Retracting) { RopeLength = Length(distance); } } internal void Unlatch() { if (Mode == BalloonAnchorMode.Latched) { Mode = BalloonAnchorMode.Dropping; FallTime = 0f; } } internal void Stow() { Mode = BalloonAnchorMode.Stowed; RopeLength = 0.15f; FallTime = 0f; } } internal static class BalloonAnchorVisual { private static Mesh mesh; private static Mesh bracket; internal static void BuildMount(GameObject root) { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)bracket)) { List<Vector3> vertices = new List<Vector3>(); List<int> list = new List<int>(); Cylinder(vertices, list, new Vector3(1.77f, 0.91f, -1.15f), BalloonAnchor.Mount, 0.055f); Cylinder(vertices, list, new Vector3(1.77f, 0.4f, -1.15f), BalloonAnchor.Mount, 0.042f); bracket = new Mesh(); ((Object)bracket).name = "Hrafn_anchor_bracket"; bracket.SetVertices(vertices); bracket.SetTriangles(list, 0); bracket.RecalculateNormals(); bracket.RecalculateBounds(); BalloonModel.Own((Object)(object)bracket); } GameObject val = new GameObject("Hrafn_anchor_bracket"); val.transform.SetParent(root.transform, false); val.AddComponent<MeshFilter>().sharedMesh = bracket; MeshRenderer val2 = val.AddComponent<MeshRenderer>(); if (BalloonModel.Materials.TryGetValue("Forged iron", out var value)) { ((Renderer)val2).sharedMaterial = value; } } internal static void Build(GameObject root) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)mesh)) { List<Vector3> vertices = new List<Vector3>(); List<int> list = new List<int>(); Cylinder(vertices, list, new Vector3(0f, -0.26f, 0f), new Vector3(0f, 0.33f, 0f), 0.065f); for (int i = 0; i < 12; i++) { float num = (float)i * (float)Math.PI / 6f; float num2 = (float)(i + 1) * (float)Math.PI / 6f; Cylinder(vertices, list, new Vector3(Mathf.Cos(num) * 0.12f, 0.36f + Mathf.Sin(num) * 0.12f, 0f), new Vector3(Mathf.Cos(num2) * 0.12f, 0.36f + Mathf.Sin(num2) * 0.12f, 0f), 0.032f); } Cylinder(vertices, list, new Vector3(-0.28f, 0.2f, 0f), new Vector3(0.28f, 0.2f, 0f), 0.045f); Vector3 val = default(Vector3); for (int j = 0; j < 4; j++) { ((Vector3)(ref val))..ctor(Mathf.Cos((float)j * (float)Math.PI / 2f), 0f, Mathf.Sin((float)j * (float)Math.PI / 2f)); Cylinder(vertices, list, Vector3.down * 0.24f, val * 0.26f - Vector3.up * 0.16f, 0.055f); Cylinder(vertices, list, val * 0.26f - Vector3.up * 0.16f, val * 0.36f + Vector3.up * 0.03f, 0.07f); Cylinder(vertices, list, val * 0.36f + Vector3.up * 0.03f, val * 0.26f + Vector3.up * 0.11f, 0.065f); } mesh = new Mesh(); ((Object)mesh).name = "Hrafn_forged_anchor"; mesh.SetVertices(vertices); mesh.SetTriangles(list, 0); mesh.RecalculateNormals(); mesh.RecalculateBounds(); BalloonModel.Own((Object)(object)mesh); } root.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer val2 = root.AddComponent<MeshRenderer>(); if (BalloonModel.Materials.TryGetValue("Forged iron", out var value)) { ((Renderer)val2).sharedMaterial = value; } } private static void Cylinder(List<Vector3> vertices, List<int> triangles, Vector3 a, Vector3 b, float radius) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = Vector3.Cross(normalized, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.Cross(normalized, Vector3.right); } ((Vector3)(ref val2)).Normalize(); Vector3 val3 = Vector3.Cross(normalized, val2); int count = vertices.Count; for (int i = 0; i < 2; i++) { for (int j = 0; j < 8; j++) { vertices.Add(((i == 0) ? a : b) + radius * (Mathf.Cos((float)j * (float)Math.PI / 4f) * val2 + Mathf.Sin((float)j * (float)Math.PI / 4f) * val3)); } } for (int k = 0; k < 8; k++) { int num = (k + 1) % 8; triangles.AddRange(new int[6] { count + k, count + num, count + num + 8, count + k, count + num + 8, count + k + 8 }); if (k > 0 && k < 7) { triangles.AddRange(new int[6] { count, count + k + 1, count + k, count + 8, count + k + 8, count + k + 9 }); } } } } public sealed class BalloonBurner : MonoBehaviour { private readonly List<Renderer> flames = new List<Renderer>(); private MaterialPropertyBlock block; private ZNetView view; private Light glow; private ParticleSystem sparks; private Mesh sparkMesh; private float heat = 0.5f; private float seed; private void Start() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Expected O, but got Unknown //IL_030d: 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_0322: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Expected O, but got Unknown //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) if ((int)SystemInfo.graphicsDeviceType == 4) { ((Behaviour)this).enabled = false; return; } view = ((Component)this).GetComponent<ZNetView>(); if (!Object.op_Implicit((Object)(object)view) || !view.IsValid()) { ((Behaviour)this).enabled = false; return; } seed = (float)(((object)Unsafe.As<ZDOID, ZDOID>(ref view.GetZDO().m_uid)/*cast due to .constrained prefix*/).GetHashCode() & 0xFF) * 0.17f; block = new MaterialPropertyBlock(); Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (((Object)val).name.StartsWith("Hrafn_flame_")) { flames.Add(val); } } GameObject val2 = new GameObject("Hrafn_burner_glow"); val2.transform.SetParent(((Component)this).transform, false); val2.transform.localPosition = new Vector3(0f, 3.05f, 0f); glow = val2.AddComponent<Light>(); glow.type = (LightType)2; glow.color = new Color(1f, 0.49f, 0.1f); glow.shadows = (LightShadows)0; glow.range = 5f; glow.intensity = 1.3f; GameObject val3 = new GameObject("Hrafn_burner_embers"); val3.SetActive(false); val3.transform.SetParent(((Component)this).transform, false); val3.transform.localPosition = new Vector3(0f, 2.91f, 0f); val3.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); sparks = val3.AddComponent<ParticleSystem>(); MainModule main = sparks.main; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 80; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.3f, 0.65f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.035f, 0.08f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.6f, 1.6f); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.06f); EmissionModule emission = sparks.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(10f); ShapeModule shape = sparks.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).radius = 0.13f; ((ShapeModule)(ref shape)).angle = 8f; SizeOverLifetimeModule sizeOverLifetime = sparks.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0.3f), new Keyframe(0.2f, 1f), new Keyframe(1f, 0f) })); InheritVelocityModule inheritVelocity = sparks.inheritVelocity; ((InheritVelocityModule)(ref inheritVelocity)).enabled = true; ((InheritVelocityModule)(ref inheritVelocity)).mode = (ParticleSystemInheritVelocityMode)0; ((InheritVelocityModule)(ref inheritVelocity)).curve = MinMaxCurve.op_Implicit(1f); sparkMesh = new Mesh(); ((Object)sparkMesh).name = "Hrafn_ember"; sparkMesh.vertices = (Vector3[])(object)new Vector3[6] { Vector3.up * 2f, Vector3.down, Vector3.right, Vector3.left, Vector3.forward, Vector3.back }; sparkMesh.triangles = new int[24] { 0, 4, 2, 0, 2, 5, 0, 5, 3, 0, 3, 4, 1, 2, 4, 1, 5, 2, 1, 3, 5, 1, 4, 3 }; sparkMesh.RecalculateNormals(); sparkMesh.RecalculateBounds(); ParticleSystemRenderer component = ((Component)sparks).GetComponent<ParticleSystemRenderer>(); component.renderMode = (ParticleSystemRenderMode)4; component.mesh = sparkMesh; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; if (BalloonModel.Materials.TryGetValue("Yellow burner", out var value)) { ((Renderer)component).sharedMaterial = value; } val3.SetActive(true); sparks.Play(); } private void Update() { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)view) || !view.IsValid() || !Object.op_Implicit((Object)(object)glow)) { return; } heat = Mathf.MoveTowards(heat, Mathf.Clamp01(view.GetZDO().GetFloat("VV.Balloon.BurnerHeat", 0.5f)), Time.deltaTime * 1.8f); float num = 1f + Mathf.Sin(Time.time * 13f + seed) * 0.05f + Mathf.Sin(Time.time * 21.7f + seed) * 0.035f; float num2 = BalloonMotion.FlameHeight(heat); foreach (Renderer flame in flames) { float num3 = (0.55f + heat * 0.65f) * num; ((Component)flame).transform.localScale = new Vector3(num3, num2 / 0.51f * num, num3); Color color = flame.sharedMaterial.color; block.SetColor("_EmissionColor", color * ((1.1f + heat * 4.5f) * num)); flame.SetPropertyBlock(block); } glow.intensity = (0.35f + heat * 2.8f) * num; glow.range = 3f + heat * 4f; if (Object.op_Implicit((Object)(object)sparks)) { EmissionModule emission = sparks.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(2f + heat * heat * 34f); MainModule main = sparks.main; ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.45f + heat * 0.4f, 0.7f + heat * 1.5f); VelocityOverLifetimeModule velocityOverLifetime = sparks.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1; Vector3 val = (Object.op_Implicit((Object)(object)EnvMan.instance) ? EnvMan.instance.GetWindForce() : Vector3.zero); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = MinMaxCurve.op_Implicit(val.x * 0.35f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = MinMaxCurve.op_Implicit(val.z * 0.35f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = MinMaxCurve.op_Implicit(0.15f); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)sparkMesh)) { Object.Destroy((Object)(object)sparkMesh); } } } internal static class BalloonCamera { [HarmonyPatch] private static class ObstructionQueries { private static IEnumerable<MethodBase> TargetMethods() { foreach (MethodInfo method in AccessTools.GetDeclaredMethods(typeof(GameCamera))) { if (method.Name == "RayTestPoint" || method.Name == "RayTest" || method.Name == "UpdateNearClipping") { yield return method; } } } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { MethodInfo call = instruction.operand as MethodInfo; if (instruction.opcode == OpCodes.Call && call != null && call.DeclaringType == typeof(Physics) && (call.Name == "SphereCast" || call.Name == "Raycast" || call.Name == "CheckSphere")) { ParameterInfo[] parameters = call.GetParameters(); Type[] array = new Type[parameters.Length]; for (int i = 0; i < array.Length; i++) { array[i] = parameters[i].ParameterType; } MethodInfo methodInfo = AccessTools.Method(typeof(BalloonCamera), call.Name, array, (Type[])null); if (methodInfo == null) { throw new InvalidOperationException("Unsupported camera query: " + call); } instruction.operand = methodInfo; } yield return instruction; } } } private static bool Blocks(Collider collider) { if (Object.op_Implicit((Object)(object)collider) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<BalloonFlight>())) { return !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<BalloonAnchorContact>()); } return false; } private static bool Closest(RaycastHit[] hits, out RaycastHit hit) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) hit = default(RaycastHit); float num = float.MaxValue; bool result = false; for (int i = 0; i < hits.Length; i++) { RaycastHit val = hits[i]; if (Blocks(((RaycastHit)(ref val)).collider) && ((RaycastHit)(ref val)).distance < num) { hit = val; num = ((RaycastHit)(ref val)).distance; result = true; } } return result; } internal static bool SphereCast(Vector3 origin, float radius, Vector3 direction, out RaycastHit hit, float distance, int mask) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Closest(Physics.SphereCastAll(origin, radius, direction, distance, mask, (QueryTriggerInteraction)0), out hit); } internal static bool Raycast(Vector3 origin, Vector3 direction, out RaycastHit hit, float distance, int mask) { //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) return Closest(Physics.RaycastAll(origin, direction, distance, mask, (QueryTriggerInteraction)0), out hit); } internal static bool CheckSphere(Vector3 position, float radius, int mask) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(position, radius, mask, (QueryTriggerInteraction)0); foreach (Collider collider in array) { if (Blocks(collider)) { return true; } } return false; } } public sealed class BalloonFlight : MonoBehaviour { private const string SeatRequest = "VV_BalloonSeat"; private const string Grant = "VV_BalloonGrant"; private const string Pulse = "VV_BalloonPulse"; private const string ReleaseSeat = "VV_BalloonRelease"; private const string Input = "VV_BalloonInput"; private const string Transport = "VV_BalloonTransport"; private const string Notice = "VV_BalloonNotice"; internal const string HeatKey = "VV.Balloon.BurnerHeat"; private readonly float[] seen = new float[4]; private readonly Transform[] seats = (Transform[])(object)new Transform[4]; private ZNetView view; private Rigidbody body; private Vector3 localInput; private Vector3 command; private float lastCommand = -10f; private float nextPulse; private float ownerSince; private float holdHeight; private float pendingAt; private float lastAck; private int pending = -1; private int localSeat = -1; private bool wasOwner; private bool climbing; private float throttle; private float heat = 0.5f; private float nextHeatSync; private float nextShelterCheck; private float shelter = 1f; private Vector3 wind; public bool Valid { get { if (Object.op_Implicit((Object)(object)view)) { return view.IsValid(); } return false; } } public long Creator { get { if (!Valid) { return 0L; } return view.GetZDO().GetLong("Dropoff.VehicleMod.Creator", 0L); } } private static string Key(int i) { return "VV.Balloon.Seat." + i; } public bool SeatOccupied(int i) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Valid && i >= 0 && i < 4) { return view.GetZDO().GetZDOID(Key(i)) != ZDOID.None; } return false; } private void Start() { view = ((Component)this).GetComponent<ZNetView>(); body = ((Component)this).GetComponent<Rigidbody>(); if (!Valid) { ((Behaviour)this).enabled = false; return; } for (int i = 0; i < 4; i++) { seats[i] = ((Component)this).transform.Find("balloon_seat_" + i); } view.Register<ZDOID, int>("VV_BalloonSeat", (Action<long, ZDOID, int>)OnSeatRequest); view.Register<int>("VV_BalloonGrant", (Action<long, int>)OnGrant); view.Register<ZDOID, int>("VV_BalloonPulse", (Action<long, ZDOID, int>)OnPulse); view.Register<ZDOID, int>("VV_BalloonRelease", (Action<long, ZDOID, int>)OnRelease); view.Register<ZDOID, Vector3>("VV_BalloonInput", (Action<long, ZDOID, Vector3>)OnInput); view.Register<ZDOID, bool>("VV_BalloonTransport", (Action<long, ZDOID, bool>)OnTransport); view.Register<string>("VV_BalloonNotice", (Action<long, string>)OnNotice); CheckOwnership(); } private void CheckOwnership() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if (!Valid) { return; } bool flag = view.IsOwner(); if (flag && !wasOwner) { ownerSince = Time.time; for (int i = 0; i < 4; i++) { seen[i] = Time.time; } command = Vector3.zero; lastCommand = -10f; holdHeight = body.position.y; climbing = false; throttle = 0f; heat = Mathf.Clamp01(view.GetZDO().GetFloat("VV.Balloon.BurnerHeat", 0.5f)); wind = (Object.op_Implicit((Object)(object)EnvMan.instance) ? (EnvMan.instance.GetWindForce() * 0.18f * Mathf.Clamp(BepInExPlugin.BalloonWindScale.Value, 0f, 2f)) : Vector3.zero); wind.y = 0f; } wasOwner = flag; } private Player Sender(long sender, ZDOID id) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (!Valid || !view.IsOwner() || id == ZDOID.None || !Object.op_Implicit((Object)(object)ZNetScene.instance)) { return null; } GameObject val = ZNetScene.instance.FindInstance(id); if (!Object.op_Implicit((Object)(object)val)) { return null; } ZNetView component = val.GetComponent<ZNetView>(); Player component2 = val.GetComponent<Player>(); if (!Object.op_Implicit((Object)(object)component2) || !Object.op_Implicit((Object)(object)component) || !component.IsValid() || component.GetZDO().GetOwner() != sender) { return null; } return component2; } private static ZDOID Identity(Player player) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) ZNetView val = (Object.op_Implicit((Object)(object)player) ? ((Component)player).GetComponent<ZNetView>() : null); if (!Object.op_Implicit((Object)(object)val) || !val.IsValid()) { return ZDOID.None; } return val.GetZDO().m_uid; } public int AttachedSeat(Player player) { if (!Object.op_Implicit((Object)(object)player) || !((Character)player).IsAttached()) { return -1; } Transform attachPoint = player.GetAttachPoint(); for (int i = 0; i < 4; i++) { if (Object.op_Implicit((Object)(object)attachPoint) && (Object)(object)attachPoint == (Object)(object)seats[i]) { return i; } } return -1; } public void SetMovement(Vector3 movement) { //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) localInput = movement; } internal bool CanOperateAnchor(long sender, ZDOID id) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) Player val = Sender(sender, id); if (!Object.op_Implicit((Object)(object)val) || ((Character)val).IsDead() || ((Character)val).IsTeleporting()) { return false; } if (view.GetZDO().GetZDOID(Key(0)) == id && Vector3.Distance(((Component)val).transform.position, seats[0].position) < 4f) { return true; } if (val.GetPlayerID() == Creator && Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < 4.5f) { return !((Character)val).IsAttached(); } return false; } public void RequestSeat(int index) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Valid && Object.op_Implicit((Object)(object)localPlayer) && index >= 0 && index < 4 && !((Character)localPlayer).IsAttached() && !((Character)localPlayer).IsDead() && !((Character)localPlayer).IsTeleporting() && !((Character)localPlayer).IsEncumbered() && !(Vector3.Distance(((Component)localPlayer).transform.position, seats[index].position) > 3.5f) && (pending < 0 || !(Time.time - pendingAt < 4f))) { pending = index; pendingAt = Time.time; view.InvokeRPC("VV_BalloonSeat", new object[2] { Identity(localPlayer), index }); } } private void OnSeatRequest(long sender, ZDOID id, int index) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_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_009a: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) CheckOwnership(); Player val = Sender(sender, id); if (!Object.op_Implicit((Object)(object)val) || index < 0 || index >= 4 || ((Character)val).IsDead() || ((Character)val).IsTeleporting() || Vector3.Distance(((Component)val).transform.position, seats[index].position) > 3.5f) { return; } for (int i = 0; i < 4; i++) { if (view.GetZDO().GetZDOID(Key(i)) == id && i != index) { return; } } ZDOID zDOID = view.GetZDO().GetZDOID(Key(index)); if (zDOID != ZDOID.None && zDOID != id) { view.InvokeRPC(sender, "VV_BalloonNotice", new object[1] { "Это место уже занято" }); return; } view.GetZDO().Set(Key(index), id); seen[index] = Time.time; view.InvokeRPC(sender, "VV_BalloonGrant", new object[1] { index }); } private void OnGrant(long sender, int index) { //IL_00b6: 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_0090: 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) if (!Valid || sender != view.GetZDO().GetOwner() || index < 0 || index >= 4) { return; } Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { if (AttachedSeat(localPlayer) == index) { lastAck = Time.time; return; } if (pending != index || Time.time - pendingAt > 4f || ((Character)localPlayer).IsAttached() || ((Character)localPlayer).IsDead() || ((Character)localPlayer).IsTeleporting() || Vector3.Distance(((Component)localPlayer).transform.position, seats[index].position) > 3.5f) { view.InvokeRPC("VV_BalloonRelease", new object[2] { Identity(localPlayer), index }); return; } pending = -1; localSeat = index; lastAck = Time.time; nextPulse = 0f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((index % 2 == 0) ? 0.91f : (-0.91f), -0.4f, 0f); ((Character)localPlayer).AttachStart(seats[index], ((Component)this).gameObject, true, false, true, "attach_chair", val, (Transform)null); } } private void OnPulse(long sender, ZDOID id, int index) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Player val = Sender(sender, id); if (Object.op_Implicit((Object)(object)val) && index >= 0 && index < 4 && !((Character)val).IsDead() && !(view.GetZDO().GetZDOID(Key(index)) != id) && !(Vector3.Distance(((Component)val).transform.position, seats[index].position) > 4f)) { seen[index] = Time.time; view.InvokeRPC(sender, "VV_BalloonGrant", new object[1] { index }); } } private void OnRelease(long sender, ZDOID id, int index) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Sender(sender, id)) && index >= 0 && index < 4 && !(view.GetZDO().GetZDOID(Key(index)) != id)) { ClearSeat(index); } } private void ClearSeat(int index) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) view.GetZDO().Set(Key(index), ZDOID.None); if (index == 0) { command = Vector3.zero; lastCommand = -10f; } } private void OnInput(long sender, ZDOID id, Vector3 input) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) Player val = Sender(sender, id); if (Object.op_Implicit((Object)(object)val) && !((Character)val).IsDead() && !(view.GetZDO().GetZDOID(Key(0)) != id) && !(Vector3.Distance(((Component)val).transform.position, seats[0].position) > 4f)) { command = new Vector3(BalloonMotion.Axis(input.x), BalloonMotion.Axis(input.y), BalloonMotion.Axis(input.z)); lastCommand = Time.time; } } private void Update() { //IL_0186: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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) if (!Valid) { return; } CheckOwnership(); Player localPlayer = Player.m_localPlayer; int num = AttachedSeat(localPlayer); if (Object.op_Implicit((Object)(object)localPlayer) && num >= 0 && !((Character)localPlayer).IsDead()) { localSeat = num; if (Time.time - lastAck > 6f) { ((Character)localPlayer).AttachStop(); ((Character)localPlayer).Message((MessageType)2, "Потеряна связь с воздушным шаром", 0, (Sprite)null, false); } else if (Time.time >= nextPulse) { nextPulse = Time.time + 0.2f; ZDOID val = Identity(localPlayer); view.InvokeRPC("VV_BalloonPulse", new object[2] { val, num }); if (num == 0) { Vector3 zero = Vector3.zero; if (!BepInExPlugin.InputBlocked()) { ((Vector3)(ref zero))..ctor(localInput.x, 0f, localInput.z); zero.y = (ZInput.GetKey(BepInExPlugin.BalloonUpKey.Value, true) ? 1 : 0) - (ZInput.GetKey(BepInExPlugin.BalloonDownKey.Value, true) ? 1 : 0); } view.InvokeRPC("VV_BalloonInput", new object[2] { val, zero }); } } } else if (localSeat >= 0 && Object.op_Implicit((Object)(object)localPlayer)) { view.InvokeRPC("VV_BalloonRelease", new object[2] { Identity(localPlayer), localSeat }); localSeat = -1; localInput = Vector3.zero; } if (!view.IsOwner()) { return; } for (int i = 0; i < 4; i++) { if (SeatOccupied(i) && Time.time - seen[i] > 7f && Time.time - ownerSince > 7f) { ClearSeat(i); } } } private void FixedUpdate() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: 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_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) if (!Valid) { return; } CheckOwnership(); if (!view.IsOwner() || body.isKinematic) { return; } Vector3 val = ((SeatOccupied(0) && BalloonMotion.Live(Time.time, lastCommand)) ? command : Vector3.zero); float fixedDeltaTime = Time.fixedDeltaTime; if (Mathf.Abs(val.y) > 0.01f) { climbing = true; holdHeight = body.position.y; } else if (climbing) { holdHeight = body.position.y + body.linearVelocity.y * 0.6f; climbing = false; } throttle = BalloonMotion.Approach(throttle, val.z, 0.8f * fixedDeltaTime); heat = BalloonMotion.Approach(heat, BalloonMotion.BurnerTarget(val.y, holdHeight - body.position.y, body.linearVelocity.y), 0.28f * fixedDeltaTime); Vector3 val2 = (Object.op_Implicit((Object)(object)EnvMan.instance) ? (EnvMan.instance.GetWindForce() * 0.18f * Mathf.Clamp(BepInExPlugin.BalloonWindScale.Value, 0f, 2f)) : Vector3.zero); val2.y = 0f; if (Time.time >= nextShelterCheck) { nextShelterCheck = Time.time + 0.5f; shelter = 1f; if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f) { RaycastHit[] array = Physics.RaycastAll(((Component)this).transform.TransformPoint(new Vector3(0f, 5.8f, 0f)), -((Vector3)(ref val2)).normalized, 18f, BalloonAnchor.WorldMask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val3)).collider) && !((Component)((RaycastHit)(ref val3)).collider).transform.IsChildOf(((Component)this).transform)) { shelter = 0.2f; break; } } } } wind = Vector3.MoveTowards(wind, val2 * shelter, 0.25f * fixedDeltaTime); Vector3 val4 = wind - body.linearVelocity; val4.y = 0f; Vector3 val5 = ((((Vector3)(ref val4)).sqrMagnitude > 1E-06f) ? (((Vector3)(ref val4)).normalized * BalloonMotion.WindDrag(((Vector3)(ref val4)).magnitude)) : Vector3.zero); Vector3 val6 = Vector3.ProjectOnPlane(((Component)this).transform.forward, Vector3.up); Vector3 normalized = ((Vector3)(ref val6)).normalized; body.AddForce(val5 + normalized * (throttle * 4f), (ForceMode)5); float num = 0f - Physics.gravity.y + BalloonMotion.VerticalAcceleration(heat, body.linearVelocity.y); body.AddForce(Vector3.up * num, (ForceMode)5); float liquidLevel = Floating.GetLiquidLevel(((Component)this).transform.position, 1f, (LiquidType)0); float num2 = Mathf.Clamp01(liquidLevel - (body.position.y + 0.05f)); if (num2 > 0f) { body.AddForce(Vector3.up * (num2 * 12f - Mathf.Min(0f, body.linearVelocity.y) * num2 * 2f), (ForceMode)5); } Vector3 val7 = Vector3.Cross(((Component)this).transform.up, Vector3.up) * ((((Component)this).transform.up.y < 0.85f) ? 30f : 12f); if (((Component)this).transform.up.y < -0.9f && ((Vector3)(ref val7)).sqrMagnitude < 0.04f) { val7 = ((Component)this).transform.forward * 20f; } Vector3 val8 = Vector3.Cross(Vector3.up, val5) * 0.45f; val8 += ((Component)this).transform.forward * (Mathf.Sin(Time.time * 1.1f) * ((Vector3)(ref wind)).magnitude * 0.012f); Vector3 val9 = Vector3.ProjectOnPlane(body.angularVelocity, Vector3.up) * 5f; body.AddTorque(val7 + val8 - val9 + Vector3.up * (val.x * 1.25f - body.angularVelocity.y * 2f), (ForceMode)5); if (Time.time >= nextHeatSync) { nextHeatSync = Time.time + 0.15f; view.GetZDO().Set("VV.Balloon.BurnerHeat", heat); } } public bool Occupied() { for (int i = 0; i < 4; i++) { if (SeatOccupied(i)) { return true; } } foreach (Player allPlayer in Player.GetAllPlayers()) { if (AttachedSeat(allPlayer) >= 0) { return true; } } return false; } public void RequestTransport(bool despawn) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (Valid && Object.op_Implicit((Object)(object)Player.m_localPlayer)) { BalloonTrunk component = ((Component)this).GetComponent<BalloonTrunk>(); if (Object.op_Implicit((Object)(object)component)) { component.CloseAndPersist(); } view.InvokeRPC("VV_BalloonTransport", new object[2] { Identity(Player.m_localPlayer), despawn }); } } private void OnNotice(long sender, string message) { if (Valid && sender == view.GetZDO().GetOwner() && Object.op_Implicit((Object)(object)Player.m_localPlayer)) { ((Character)Player.m_localPlayer).Message((MessageType)2, message, 0, (Sprite)null, false); } } private void OnTransport(long sender, ZDOID id, bool despawn) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) Player val = Sender(sender, id); if (!Object.op_Implicit((Object)(object)val) || Creator != val.GetPlayerID() || ((Character)val).IsDead() || ((Character)val).IsTeleporting()) { return; } if (Occupied()) { view.InvokeRPC(sender, "VV_BalloonNotice", new object[1] { "Сначала все должны покинуть места в шаре" }); return; } foreach (Player allPlayer in Player.GetAllPlayers()) { Vector3 val2 = ((Component)this).transform.InverseTransformPoint(((Component)allPlayer).transform.position); if (Mathf.Abs(val2.x) < 1.9f && Mathf.Abs(val2.z) < 2f && val2.y > -0.4f && val2.y < 3f) { view.InvokeRPC(sender, "VV_BalloonNotice", new object[1] { "Корзина должна быть пустой" }); return; } } if (despawn) { BalloonTrunk component = ((Component)this).GetComponent<BalloonTrunk>(); if (Object.op_Implicit((Object)(object)component)) { component.CloseAndPersist(); } ZNetScene.instance.Destroy(((Component)this).gameObject); return; } if (!BepInExPlugin.BalloonSpawnPosition(val, ((Component)this).gameObject, out var position)) { view.InvokeRPC(sender, "VV_BalloonNotice", new object[1] { "Для шара нужна открытая площадка без крыши и деревьев" }); return; } BalloonAnchor component2 = ((Component)this).GetComponent<BalloonAnchor>(); if (Object.op_Implicit((Object)(object)component2)) { component2.ResetForRecall(); } body.position = position; body.rotation = Quaternion.Euler(0f, ((Component)val).transform.eulerAngles.y, 0f); Rigidbody obj = body; Vector3 linearVelocity = (body.angularVelocity = Vector3.zero); obj.linearVelocity = linearVelocity; view.GetZDO().SetPosition(position); view.GetZDO().SetRotation(body.rotation); holdHeight = position.y; climbing = false; throttle = 0f; wind = Vector3.zero; body.WakeUp(); if (Object.op_Implicit((Object)(object)component2)) { component2.DropAfterRecall(); } } private void OnDestroy() { Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer) && AttachedSeat(localPlayer) >= 0) { ((Character)localPlayer).AttachStop(); } } } internal static class BalloonModel { internal const string ResourceName = "ValheimVehicle.Assets.HrafnBalloon.bin"; private static readonly List<Object> resources = new List<Object>(); internal static readonly Dictionary<string, Bounds> Anchors = new Dictionary<string, Bounds>(); internal static readonly Dictionary<string, Material> Materials = new Dictionary<string, Material>(); internal static void Own(Object resource) { resources.Add(resource); } internal static void Build(GameObject root) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Expected O, but got Unknown //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) bool flag = (int)SystemInfo.graphicsDeviceType != 4; Shader val = Shader.Find("Standard"); if (!Object.op_Implicit((Object)(object)val) || !val.isSupported) { Renderer[] componentsInChildren = BepInExPlugin.VehiclePrefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { Material[] sharedMaterials = val2.sharedMaterials; foreach (Material val3 in sharedMaterials) { if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.shader) && val3.shader.isSupported && val3.HasProperty("_MainTex") && val3.HasProperty("_Color")) { val = val3.shader; } } } } if (flag && (!Object.op_Implicit((Object)(object)val) || !val.isSupported)) { throw new InvalidOperationException("Balloon color shader unavailable."); } using Stream stream = typeof(BalloonModel).Assembly.GetManifestResourceStream("ValheimVehicle.Assets.HrafnBalloon.bin"); if (stream == null) { throw new InvalidDataException("Embedded balloon mesh is missing."); } using BinaryReader binaryReader = new BinaryReader(stream); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(4)) != "VVBL" || binaryReader.ReadInt32() != 1) { throw new InvalidDataException("Unsupported balloon mesh format."); } Material[] array = (Material[])(object)new Material[Count(binaryReader, 64)]; float[] array2 = new float[array.Length]; Color color = default(Color); for (int k = 0; k < array.Length; k++) { string text = Text(binaryReader); ((Color)(ref color))..ctor(Float(binaryReader), Float(binaryReader), Float(binaryReader), Float(binaryReader)); float num = Float(binaryReader); float num2 = Float(binaryReader); float num3 = (array2[k] = Float(binaryReader)); int num4 = Count(binaryReader, 4194304); byte[] array3 = binaryReader.ReadBytes(num4); if (array3.Length != num4) { throw new EndOfStreamException(); } if (!flag) { continue; } Material val4 = new Material(val); resources.Add((Object)(object)val4); array[k] = val4; ((Object)val4).name = text; val4.color = color; Materials[text] = val4; if (val4.HasProperty("_Glossiness")) { val4.SetFloat("_Glossiness", 1f - num); } if (val4.HasProperty("_Metallic")) { val4.SetFloat("_Metallic", num2); } if (num4 > 0) { Texture2D val5 = new Texture2D(2, 2, (TextureFormat)4, true); resources.Add((Object)(object)val5); if (!ImageConversion.LoadImage(val5, array3)) { throw new InvalidDataException("Bad balloon texture."); } ((Object)val5).name = ((Object)val4).name; ((Texture)val5).filterMode = (FilterMode)0; ((Texture)val5).wrapMode = (TextureWrapMode)0; val4.mainTexture = (Texture)(object)val5; } if (num3 > 0f) { val4.EnableKeyword("_EMISSION"); val4.SetColor("_EmissionColor", val4.color * num3); } if (val4.HasProperty("_Cull")) { val4.SetInt("_Cull", 0); } } int num5 = Count(binaryReader, 32); for (int l = 0; l < num5; l++) { string text2 = Text(binaryReader); int num6 = Count(binaryReader, 250000); Vector3[] array4 = (Vector3[])(object)new Vector3[num6]; Vector3[] array5 = (Vector3[])(object)new Vector3[num6]; Vector2[] array6 = (Vector2[])(object)new Vector2[num6]; for (int m = 0; m < num6; m++) { ref Vector3 reference = ref array4[m]; reference = Vector(binaryReader); ref Vector3 reference2 = ref array5[m]; reference2 = Vector(binaryReader); ref Vector2 reference3 = ref array6[m]; reference3 = new Vector2(Float(binaryReader), Float(binaryReader)); } Mesh val6 = new Mesh(); resources.Add((Object)(object)val6); ((Object)val6).name = text2; val6.indexFormat = (IndexFormat)1; val6.vertices = array4; val6.normals = array5; val6.uv = array6; int num7 = Count(binaryReader, 64); if (num7 != array.Length) { throw new InvalidDataException("Balloon material count mismatch."); } val6.subMeshCount = num7; for (int n = 0; n < num7; n++) { int[] array7 = new int[Count(binaryReader, 750000)]; if (array7.Length % 3 != 0) { throw new InvalidDataException("Invalid triangle list."); } for (int num8 = 0; num8 < array7.Length; num8++) { array7[num8] = binaryReader.ReadInt32(); if (array7[num8] < 0 || array7[num8] >= num6) { throw new InvalidDataException("Balloon vertex index out of range."); } } if (text2 == "Burner_and_helm" && array2[n] > 0f && array7.Length > 0) { if (flag) { Flame(root, array[n], array4, array5, array6, array7, n); } val6.SetTriangles(new int[0], n); } else { val6.SetTriangles(array7, n); } } val6.RecalculateBounds(); GameObject val7 = Child(root, text2); val7.AddComponent<MeshFilter>().sharedMesh = val6; if (text2 == "Envelope_collision") { MeshCollider val8 = val7.AddComponent<MeshCollider>(); val8.sharedMesh = val6; val8.convex = true; } else if (flag) { MeshRenderer val9 = val7.AddComponent<MeshRenderer>(); ((Renderer)val9).sharedMaterials = array; ((Renderer)val9).shadowCastingMode = (ShadowCastingMode)2; } } Anchors.Clear(); int num9 = Count(binaryReader, 16); Bounds value = default(Bounds); for (int num10 = 0; num10 < num9; num10++) { string text3 = Text(binaryReader); ((Bounds)(ref value))..ctor(Vector(binaryReader), Vector(binaryReader)); Anchors.Add(text3, value); Child(root, text3).transform.localPosition = ((Bounds)(ref value)).center; } int num11 = Count(binaryReader, 64); for (int num12 = 0; num12 < num11; num12++) { GameObject val10 = Child(root, "Hull_" + num12 + "_" + Text(binaryReader)); BoxCollider val11 = val10.AddComponent<BoxCollider>(); val11.center = Vector(binaryReader); val11.size = Vector(binaryReader); } if (stream.Position != stream.Length || Anchors.Count != 5) { throw new InvalidDataException("Incomplete balloon geometry."); } } private static void Flame(GameObject root, Material material, Vector3[] vertices, Vector3[] normals, Vector2[] uv, int