Decompiled source of NebulaMultiplayerModApi v2.0.0

NebulaAPI.dll

Decompiled 3 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using NebulaAPI.DataStructures;
using NebulaAPI.GameState;
using NebulaAPI.Interfaces;
using NebulaAPI.Networking;
using NebulaAPI.Packets;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("2.0.0.24")]
[assembly: AssemblyInformationalVersion("2.0.0.24+ae8e7af")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Nebula Mod Team")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("API for other mods to work with the Nebula Multiplayer Mod for Dyson Sphere Program.")]
[assembly: AssemblyProduct("NebulaAPI")]
[assembly: AssemblyTitle("NebulaAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[GeneratedCode("Nerdbank.GitVersioning.Tasks", "3.6.133.12845")]
[ExcludeFromCodeCoverage]
internal static class ThisAssembly
{
	internal const string AssemblyConfiguration = "Release";

	internal const string AssemblyFileVersion = "2.0.0.24";

	internal const string AssemblyInformationalVersion = "2.0.0.24+ae8e7af";

	internal const string AssemblyName = "NebulaAPI";

	internal const string AssemblyTitle = "NebulaAPI";

	internal const string AssemblyVersion = "2.0.0.0";

	internal static readonly DateTime GitCommitDate = new DateTime(638438216920000000L, DateTimeKind.Utc);

	internal const string GitCommitId = "ae8e7af7a1b833185e2b1239b142f51f18cebf53";

	internal const bool IsPrerelease = false;

	internal const bool IsPublicRelease = true;

	internal const string RootNamespace = "NebulaAPI";
}
namespace NebulaAPI
{
	[BepInPlugin("dsp.nebula-multiplayer-api", "NebulaMultiplayerModApi", "2.0.0.24")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class NebulaModAPI : BaseUnityPlugin
	{
		public const string NEBULA_MODID = "dsp.nebula-multiplayer";

		public const string API_GUID = "dsp.nebula-multiplayer-api";

		public const string API_NAME = "NebulaMultiplayerModApi";

		public const int PLANET_NONE = -2;

		public const int AUTHOR_NONE = -1;

		public const int STAR_NONE = -1;

		private static PropertyInfo multiplayerSessionGetter;

		private static ConstructorInfo binaryWriterConstructor;

		private static ConstructorInfo binaryReaderConstructor;

		public static readonly List<Assembly> TargetAssemblies = new List<Assembly>();

		public static Action OnMultiplayerGameStarted;

		public static Action OnMultiplayerGameEnded;

		public static Action<int> OnStarLoadRequest;

		public static Action<int> OnDysonSphereLoadFinished;

		public static Action<int> OnPlanetLoadRequest;

		public static Action<int> OnPlanetLoadFinished;

		public static Action<IPlayerData> OnPlayerJoinedGame;

		public static Action<IPlayerData> OnPlayerLeftGame;

		public static bool NebulaIsInstalled { get; set; }

		public static bool IsMultiplayerActive { get; private set; }

		public static IMultiplayerSession MultiplayerSession { get; private set; }

		public static void OnMultiplayerSessionChange(bool isActive)
		{
			IsMultiplayerActive = isActive;
			MultiplayerSession = (isActive ? ((IMultiplayerSession)(multiplayerSessionGetter?.GetValue(null))) : null);
		}

		private void Awake()
		{
			NebulaIsInstalled = false;
			using (IEnumerator<KeyValuePair<string, PluginInfo>> enumerator = Chainloader.PluginInfos.Where((KeyValuePair<string, PluginInfo> pluginInfo) => pluginInfo.Value.Metadata.GUID == "dsp.nebula-multiplayer").GetEnumerator())
			{
				if (enumerator.MoveNext())
				{
					KeyValuePair<string, PluginInfo> current = enumerator.Current;
					NebulaIsInstalled = true;
				}
			}
			if (NebulaIsInstalled)
			{
				multiplayerSessionGetter = AccessTools.TypeByName("NebulaWorld.Multiplayer").GetProperty("Session");
				Type type = AccessTools.TypeByName("NebulaModel.Networking.BinaryUtils");
				binaryWriterConstructor = type.GetNestedType("Writer").GetConstructor(Type.EmptyTypes);
				binaryReaderConstructor = type.GetNestedType("Reader").GetConstructor(new Type[1] { typeof(byte[]) });
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Nebula API is ready!");
			}
		}

		public static void RegisterPackets(Assembly assembly)
		{
			TargetAssemblies.Add(assembly);
		}

		public static IWriterProvider GetBinaryWriter()
		{
			if (!NebulaIsInstalled)
			{
				return null;
			}
			return (IWriterProvider)binaryWriterConstructor.Invoke(Array.Empty<object>());
		}

		public static IReaderProvider GetBinaryReader(byte[] bytes)
		{
			if (!NebulaIsInstalled)
			{
				return null;
			}
			return (IReaderProvider)binaryReaderConstructor.Invoke(new object[1] { bytes });
		}
	}
}
namespace NebulaAPI.Packets
{
	public abstract class BasePacketProcessor<T>
	{
		protected bool IsHost;

		protected bool IsClient => !IsHost;

		internal void Initialize(bool isHost)
		{
			IsHost = isHost;
		}

		public abstract void ProcessPacket(T packet, INebulaConnection conn);
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
	public class HidePacketInDebugLogsAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
	public class RegisterNestedTypeAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class)]
	public class RegisterPacketProcessorAttribute : Attribute
	{
	}
}
namespace NebulaAPI.Networking
{
	public enum DisconnectionReason
	{
		Normal = 1000,
		ProtocolError = 1002,
		InvalidData = 1007,
		HostStillLoading = 2000,
		ClientRequestedDisconnect = 2001,
		ModVersionMismatch = 2002,
		GameVersionMismatch = 2003,
		ModIsMissing = 2500,
		ModIsMissingOnServer = 2501
	}
	public enum EConnectionStatus
	{
		Undefined,
		Pending,
		Syncing,
		Connected
	}
	public interface INebulaConnection : IEquatable<INebulaConnection>
	{
		bool IsAlive { get; }

		int Id { get; }

		EConnectionStatus ConnectionStatus { get; set; }

		void SendPacket<T>(T packet) where T : class, new();

		void SendRawPacket(byte[] rawData);
	}
	public interface INetPacketProcessor
	{
		bool SimulateLatency { get; set; }

		bool EnablePacketProcessing { get; set; }

		void EnqueuePacketForProcessing<T>(T packet, object userData) where T : class, new();

		void EnqueuePacketForProcessing(byte[] rawData, object userData);

		byte[] Write<T>(T packet) where T : class, new();

		void ProcessPacketQueue();
	}
}
namespace NebulaAPI.Interfaces
{
	public interface IWriterProvider : IDisposable
	{
		BinaryWriter BinaryWriter { get; }

		byte[] CloseAndGetBytes();
	}
	public interface IReaderProvider : IDisposable
	{
		BinaryReader BinaryReader { get; }
	}
	public interface IMultiplayerMod
	{
		string Version { get; }

		bool CheckVersion(string hostVersion, string clientVersion);
	}
	public interface IMultiplayerModWithSettings : IMultiplayerMod
	{
		void Export(BinaryWriter w);

		void Import(BinaryReader r);
	}
	public interface INetDataReader
	{
		byte[] RawData
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		int RawDataSize
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		int UserDataOffset
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		int UserDataSize
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		bool IsNull
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		int Position
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		bool EndOfData
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		int AvailableBytes
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		void SkipBytes(int count);

		void SetPosition(int position);

		void SetSource(INetDataWriter dataWriter);

		void SetSource(byte[] source);

		void SetSource(byte[] source, int offset, int maxSize);

		IPEndPoint GetNetEndPoint();

		byte GetByte();

		sbyte GetSByte();

		T[] GetArray<T>(int size);

		bool[] GetBoolArray();

		ushort[] GetUShortArray();

		short[] GetShortArray();

		int[] GetIntArray();

		uint[] GetUIntArray();

		float[] GetFloatArray();

		double[] GetDoubleArray();

		long[] GetLongArray();

		ulong[] GetULongArray();

		string[] GetStringArray();

		string[] GetStringArray(int maxStringLength);

		bool GetBool();

		char GetChar();

		ushort GetUShort();

		short GetShort();

		long GetLong();

		ulong GetULong();

		int GetInt();

		uint GetUInt();

		float GetFloat();

		double GetDouble();

		string GetString(int maxLength);

		string GetString();

		ArraySegment<byte> GetBytesSegment(int count);

		ArraySegment<byte> GetRemainingBytesSegment();

		T Get<T>() where T : struct, INetSerializable;

		T Get<T>(Func<T> constructor) where T : class, INetSerializable;

		byte[] GetRemainingBytes();

		void GetBytes(byte[] destination, int start, int count);

		void GetBytes(byte[] destination, int count);

		sbyte[] GetSBytesWithLength();

		byte[] GetBytesWithLength();

		byte PeekByte();

		sbyte PeekSByte();

		bool PeekBool();

		char PeekChar();

		ushort PeekUShort();

		short PeekShort();

		long PeekLong();

		ulong PeekULong();

		int PeekInt();

		uint PeekUInt();

		float PeekFloat();

		double PeekDouble();

		string PeekString(int maxLength);

		string PeekString();

		bool TryGetByte(out byte result);

		bool TryGetSByte(out sbyte result);

		bool TryGetBool(out bool result);

		bool TryGetChar(out char result);

		bool TryGetShort(out short result);

		bool TryGetUShort(out ushort result);

		bool TryGetInt(out int result);

		bool TryGetUInt(out uint result);

		bool TryGetLong(out long result);

		bool TryGetULong(out ulong result);

		bool TryGetFloat(out float result);

		bool TryGetDouble(out double result);

		bool TryGetString(out string result);

		bool TryGetStringArray(out string[] result);

		bool TryGetBytesWithLength(out byte[] result);

		void Clear();
	}
	public interface INetDataWriter
	{
		int Capacity
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		byte[] Data
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		int Length
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get;
		}

		void ResizeIfNeed(int newSize);

		void EnsureFit(int additionalSize);

		void Reset(int size);

		void Reset();

		byte[] CopyData();

		int SetPosition(int position);

		void Put(float value);

		void Put(double value);

		void Put(long value);

		void Put(ulong value);

		void Put(int value);

		void Put(uint value);

		void Put(char value);

		void Put(ushort value);

		void Put(short value);

		void Put(sbyte value);

		void Put(byte value);

		void Put(byte[] data, int offset, int length);

		void Put(byte[] data);

		void Put(bool value);

		void Put(IPEndPoint endPoint);

		void Put(string value);

		void Put(string value, int maxLength);

		void Put<T>(T obj) where T : INetSerializable;

		void PutSBytesWithLength(sbyte[] data, int offset, int length);

		void PutSBytesWithLength(sbyte[] data);

		void PutBytesWithLength(byte[] data, int offset, int length);

		void PutBytesWithLength(byte[] data);

		void PutArray(Array arr, int sz);

		void PutArray(float[] value);

		void PutArray(double[] value);

		void PutArray(long[] value);

		void PutArray(ulong[] value);

		void PutArray(int[] value);

		void PutArray(uint[] value);

		void PutArray(ushort[] value);

		void PutArray(short[] value);

		void PutArray(bool[] value);

		void PutArray(string[] value);

		void PutArray(string[] value, int strMaxLength);
	}
	public interface INetSerializable
	{
		void Serialize(INetDataWriter writer);

		void Deserialize(INetDataReader reader);
	}
	public interface IToggle
	{
		bool Value { get; }

		IDisposable On();
	}
}
namespace NebulaAPI.GameState
{
	public interface IFactoryManager : IDisposable
	{
		IToggle IsIncomingRequest { get; }

		int PacketAuthor { get; set; }

		int TargetPlanet { get; set; }

		PlanetFactory EventFactory { get; set; }

		void AddPlanetTimer(int planetId);

		void LoadPlanetData(int planetId);

		void UnloadPlanetData(int planetId);

		void InitializePrebuildRequests();

		void SetPrebuildRequest(int planetId, int prebuildId, ushort playerId);

		bool RemovePrebuildRequest(int planetId, int prebuildId);

		bool ContainsPrebuildRequest(int planetId, int prebuildId);

		int GetNextPrebuildId(int planetId);

		int GetNextPrebuildId(PlanetFactory factory);
	}
	public interface ILocalPlayer : IDisposable
	{
		bool IsInitialDataReceived { get; set; }

		bool IsHost { get; set; }

		bool IsClient { get; }

		bool IsNewPlayer { get; set; }

		ushort Id { get; }

		IPlayerData Data { get; set; }
	}
	public interface IMultiplayerSession
	{
		INetworkProvider Network { get; set; }

		ILocalPlayer LocalPlayer { get; set; }

		IFactoryManager Factories { get; set; }

		bool IsDedicated { get; }

		bool IsServer { get; }

		bool IsClient { get; }

		bool IsGameLoaded { get; set; }
	}
	public interface INebulaPlayer
	{
		INebulaConnection Connection { get; set; }

		IPlayerData Data { get; set; }

		ushort Id { get; }

		void SendPacket<T>(T packet) where T : class, new();

		void LoadUserData(IPlayerData data);
	}
	public interface INetworkProvider : IDisposable
	{
		INetPacketProcessor PacketProcessor { get; }

		void SendPacket<T>(T packet) where T : class, new();

		void SendToMatching<T>(T packet, Predicate<INebulaPlayer> condition) where T : class, new();

		void SendPacketToLocalStar<T>(T packet) where T : class, new();

		void SendPacketToLocalPlanet<T>(T packet) where T : class, new();

		void SendPacketToPlanet<T>(T packet, int planetId) where T : class, new();

		void SendPacketToStar<T>(T packet, int starId) where T : class, new();

		void SendPacketExclude<T>(T packet, INebulaConnection exclude) where T : class, new();

		void SendPacketToStarExclude<T>(T packet, int starId, INebulaConnection exclude) where T : class, new();
	}
	public interface IPlayerData : INetSerializable
	{
		string Username { get; set; }

		ushort PlayerId { get; set; }

		int LocalPlanetId { get; set; }

		Float3 LocalPlanetPosition { get; set; }

		Double3 UPosition { get; set; }

		Float3 Rotation { get; set; }

		Float3 BodyRotation { get; set; }

		int LocalStarId { get; set; }

		IMechaData Mecha { get; set; }

		MechaAppearance Appearance { get; set; }

		MechaAppearance DIYAppearance { get; set; }

		int[] DIYItemId { get; set; }

		int[] DIYItemValue { get; set; }

		IPlayerData CreateCopyWithoutMechaData();
	}
}
namespace NebulaAPI.DataStructures
{
	public static class CollectionExtensions
	{
		public static Locker Lock(this ICollection collection)
		{
			return new Locker(collection.SyncRoot);
		}

		public static Locker GetLocked<T>(this T collection, out T result) where T : ICollection
		{
			result = collection;
			return new Locker(collection.SyncRoot);
		}
	}
	public readonly struct Locker : IDisposable
	{
		private readonly object lockObject;

		public Locker(object lockObject)
		{
			this.lockObject = lockObject;
			Monitor.Enter(lockObject);
		}

		public void Dispose()
		{
			Monitor.Exit(lockObject);
		}
	}
	public class ConcurrentPlayerCollection
	{
		private class ReducedConcurrentDictionary<TKey, TValue> : ConcurrentDictionary<TKey, TValue>
		{
			public new ICollection<TKey> Keys
			{
				get
				{
					throw new InvalidOperationException("Accessing keys directly is not allowed.");
				}
			}

			public new ICollection<TValue> Values
			{
				get
				{
					throw new InvalidOperationException("Accessing keys directly is not allowed.");
				}
			}
		}

		private readonly Dictionary<EConnectionStatus, ReducedConcurrentDictionary<INebulaConnection, INebulaPlayer>> playerCollections = new Dictionary<EConnectionStatus, ReducedConcurrentDictionary<INebulaConnection, INebulaPlayer>>
		{
			{
				EConnectionStatus.Pending,
				new ReducedConcurrentDictionary<INebulaConnection, INebulaPlayer>()
			},
			{
				EConnectionStatus.Syncing,
				new ReducedConcurrentDictionary<INebulaConnection, INebulaPlayer>()
			},
			{
				EConnectionStatus.Connected,
				new ReducedConcurrentDictionary<INebulaConnection, INebulaPlayer>()
			}
		};

		public IReadOnlyDictionary<INebulaConnection, INebulaPlayer> Pending => playerCollections[EConnectionStatus.Pending];

		public IReadOnlyDictionary<INebulaConnection, INebulaPlayer> Syncing => playerCollections[EConnectionStatus.Syncing];

		public IReadOnlyDictionary<INebulaConnection, INebulaPlayer> Connected => playerCollections[EConnectionStatus.Connected];

		public bool TryAdd(INebulaConnection conn, INebulaPlayer newPlayer)
		{
			if (conn.ConnectionStatus == EConnectionStatus.Undefined)
			{
				throw new InvalidOperationException("Could not add a player of undefined connection status.");
			}
			return playerCollections[conn.ConnectionStatus].TryAdd(conn, newPlayer);
		}

		public bool TryRemove(INebulaConnection conn, out INebulaPlayer removedPlayer)
		{
			return playerCollections[conn.ConnectionStatus].TryRemove(conn, out removedPlayer);
		}

		public bool TryUpgrade(INebulaPlayer player, EConnectionStatus newStatus)
		{
			if (!playerCollections[player.Connection.ConnectionStatus].TryRemove(player.Connection, out var _))
			{
				return false;
			}
			if (!playerCollections[newStatus].TryAdd(player.Connection, player))
			{
				return true;
			}
			player.Connection.ConnectionStatus = newStatus;
			return true;
		}

		public INebulaPlayer Get(INebulaConnection conn, EConnectionStatus connectionStatus = EConnectionStatus.Connected)
		{
			playerCollections[connectionStatus].TryGetValue(conn, out var value);
			return value;
		}

		public INebulaPlayer Get(string username, EConnectionStatus connectionStatus = EConnectionStatus.Connected)
		{
			ReducedConcurrentDictionary<INebulaConnection, INebulaPlayer> reducedConcurrentDictionary = playerCollections[connectionStatus];
			foreach (KeyValuePair<INebulaConnection, INebulaPlayer> item in reducedConcurrentDictionary)
			{
				if (item.Value.Data.Username == username)
				{
					return item.Value;
				}
			}
			return null;
		}

		public INebulaPlayer Get(ushort playerId, EConnectionStatus connectionStatus = EConnectionStatus.Connected)
		{
			ReducedConcurrentDictionary<INebulaConnection, INebulaPlayer> reducedConcurrentDictionary = playerCollections[connectionStatus];
			foreach (KeyValuePair<INebulaConnection, INebulaPlayer> item in reducedConcurrentDictionary)
			{
				if (item.Value.Id == playerId)
				{
					return item.Value;
				}
			}
			return null;
		}

		public IEnumerable<IPlayerData> GetAllPlayerData()
		{
			List<IPlayerData> list = playerCollections[EConnectionStatus.Connected].Select((KeyValuePair<INebulaConnection, INebulaPlayer> p) => p.Value.Data).ToList();
			if (!NebulaModAPI.MultiplayerSession.IsDedicated)
			{
				list.Add(NebulaModAPI.MultiplayerSession.LocalPlayer.Data);
			}
			return list;
		}
	}
	public static class DataStructureExtensions
	{
		public static Vector3 ToVector3(this Float3 value)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(value.x, value.y, value.z);
		}

		public static VectorLF3 ToVectorLF3(this Double3 value)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new VectorLF3(value.x, value.y, value.z);
		}

		public static Float3 ToFloat3(this Vector3 value)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return new Float3(value.x, value.y, value.z);
		}

		public static Quaternion ToQuaternion(this Float4 value)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Quaternion(value.x, value.y, value.z, value.w);
		}

		public static Float4 ToFloat4(this Quaternion value)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new Float4(value.x, value.y, value.z, value.w);
		}
	}
	[RegisterNestedType]
	public struct Double3 : INetSerializable
	{
		public double x;

		public double y;

		public double z;

		public Double3(double x, double y, double z)
		{
			this.x = x;
			this.y = y;
			this.z = z;
		}

		public void Serialize(INetDataWriter writer)
		{
			writer.Put(x);
			writer.Put(y);
			writer.Put(z);
		}

		public void Deserialize(INetDataReader reader)
		{
			x = reader.GetDouble();
			y = reader.GetDouble();
			z = reader.GetDouble();
		}

		public override string ToString()
		{
			return $"x: {x}, y: {y}, z: {z}";
		}
	}
	[RegisterNestedType]
	public struct Float3 : INetSerializable
	{
		public float x;

		public float y;

		public float z;

		public Float3(float x, float y, float z)
		{
			this.x = x;
			this.y = y;
			this.z = z;
		}

		public Float3(Vector3 value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			x = value.x;
			y = value.y;
			z = value.z;
		}

		public Color ToColor()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new Color(x, y, z);
		}

		public void Serialize(INetDataWriter writer)
		{
			writer.Put(x);
			writer.Put(y);
			writer.Put(z);
		}

		public void Deserialize(INetDataReader reader)
		{
			x = reader.GetFloat();
			y = reader.GetFloat();
			z = reader.GetFloat();
		}

		public override string ToString()
		{
			return $"(x: {x}, y: {y}, z: {z})";
		}
	}
	[RegisterNestedType]
	public struct Float4 : INetSerializable
	{
		public float x;

		public float y;

		public float z;

		public float w;

		public Float4(float x, float y, float z, float w)
		{
			this.x = x;
			this.y = y;
			this.z = z;
			this.w = w;
		}

		public Float4(Quaternion value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			x = value.x;
			y = value.y;
			z = value.z;
			w = value.w;
		}

		public Color ToColor()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Color(x, y, z, w);
		}

		public Color32 ToColor32()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			return new Color32((byte)x, (byte)y, (byte)z, (byte)w);
		}

		public static Color32[] ToColor32(Float4[] float4s)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			Color32[] array = (Color32[])(object)new Color32[float4s.Length];
			for (int i = 0; i < float4s.Length; i++)
			{
				array[i] = float4s[i].ToColor32();
			}
			return array;
		}

		public static Float4 ToFloat4(Color32 color32)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			return new Float4((int)color32.r, (int)color32.g, (int)color32.b, (int)color32.a);
		}

		public static Float4[] ToFloat4(Color32[] color32s)
		{
			Float4[] array = new Float4[color32s.Length];
			for (int i = 0; i < color32s.Length; i++)
			{
				array[i] = new Float4((int)color32s[i].r, (int)color32s[i].g, (int)color32s[i].b, (int)color32s[i].a);
			}
			return array;
		}

		public void Serialize(INetDataWriter writer)
		{
			writer.Put(x);
			writer.Put(y);
			writer.Put(z);
			writer.Put(w);
		}

		public void Deserialize(INetDataReader reader)
		{
			x = reader.GetFloat();
			y = reader.GetFloat();
			z = reader.GetFloat();
			w = reader.GetFloat();
		}

		public override string ToString()
		{
			return $"x: {x}, y: {y}, z: {z}, w: {w}";
		}
	}
	public interface IMechaData : INetSerializable
	{
		long SandCount { get; set; }

		double CoreEnergy { get; set; }

		double ReactorEnergy { get; set; }

		StorageComponent Inventory { get; set; }

		DeliveryPackage DeliveryPackage { get; set; }

		StorageComponent ReactorStorage { get; set; }

		StorageComponent WarpStorage { get; set; }

		MechaForge Forge { get; set; }

		ConstructionModuleComponent ConstructionModule { get; set; }

		IMechaFightData FightData { get; set; }

		void UpdateMech(Player destination);
	}
	public interface IMechaFightData
	{
		bool AutoReplenishFuel { get; set; }

		bool AutoReplenishAmmo { get; set; }

		bool AutoReplenishHangar { get; set; }

		int Hp { get; set; }

		long EnergyShieldEnergy { get; set; }

		int AmmoItemId { get; set; }

		int AmmoInc { get; set; }

		int AmmoBulletCount { get; set; }

		int AmmoSelectSlot { get; set; }

		int AmmoMuzzleFire { get; set; }

		int AmmoRoundFire { get; set; }

		int AmmoMuzzleIndex { get; set; }

		bool LaserActive { get; set; }

		bool LaserRecharging { get; set; }

		long LaserEnergy { get; set; }

		int LaserFire { get; set; }

		int BombFire { get; set; }

		StorageComponent AmmoStorage { get; set; }

		StorageComponent BombStorage { get; set; }

		EnemyHatredTarget AmmoHatredTarget { get; set; }

		EnemyHatredTarget LaserHatredTarget { get; set; }

		StorageComponent FighterStorage { get; set; }

		CombatModuleComponent GroundCombatModule { get; set; }

		CombatModuleComponent SpaceCombatModule { get; set; }

		void Serialize(INetDataWriter writer);

		void Deserialize(INetDataReader reader);

		void UpdateMech(Player destination);
	}
	public interface IPlayerTechBonuses : INetSerializable
	{
		double coreEnergyCap { get; set; }

		double corePowerGen { get; set; }

		double reactorPowerGen { get; set; }

		double walkPower { get; set; }

		double jumpEnergy { get; set; }

		double thrustPowerPerAcc { get; set; }

		double warpKeepingPowerPerSpeed { get; set; }

		double warpStartPowerPerSpeed { get; set; }

		double miningPower { get; set; }

		double replicatePower { get; set; }

		double researchPower { get; set; }

		double droneEjectEnergy { get; set; }

		double droneEnergyPerMeter { get; set; }

		int coreLevel { get; set; }

		int thrusterLevel { get; set; }

		float miningSpeed { get; set; }

		float replicateSpeed { get; set; }

		float walkSpeed { get; set; }

		float jumpSpeed { get; set; }

		float maxSailSpeed { get; set; }

		float maxWarpSpeed { get; set; }

		float buildArea { get; set; }

		int droneCount { get; set; }

		int inventorySize { get; set; }

		bool deliveryPackageUnlocked { get; set; }

		int deliveryPackageColCount { get; set; }

		int deliveryPackageStackSizeMultiplier { get; set; }

		double instantBuildEnergy { get; set; }

		int hpMaxUpgrade { get; set; }

		bool energyShieldUnlocked { get; set; }

		float energyShieldRadius { get; set; }

		long energyShieldCapacity { get; set; }

		long laserEnergyCapacity { get; set; }

		float laserLocalAttackRange { get; set; }

		float laserSpaceAttackRange { get; set; }

		int laserLocalEnergyCost { get; set; }

		int laserSpaceEnergyCost { get; set; }

		int laserLocalDamage { get; set; }

		int laserSpaceDamage { get; set; }

		int groundFleetCount { get; set; }

		int spaceFleetCount { get; set; }
	}
}