diff --git a/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.deps.json b/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.deps.json index 4e00fa23a5..1a28e5f5ea 100644 --- a/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.deps.json +++ b/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.deps.json @@ -1,130 +1,130 @@ -{ - "runtimeTarget": { - "name": ".NETStandard,Version=v2.1/", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETStandard,Version=v2.1": {}, - ".NETStandard,Version=v2.1/": { - "CSNetwork/1.0.0": { - "dependencies": { - "System.Reflection.Metadata": "9.0.8" - }, - "runtime": { - "CSNetwork.dll": {} - } - }, - "System.Buffers/4.5.1": { - "runtime": { - "lib/netstandard2.0/System.Buffers.dll": { - "assemblyVersion": "4.0.3.0", - "fileVersion": "4.6.28619.1" - } - } - }, - "System.Collections.Immutable/9.0.8": { - "dependencies": { - "System.Memory": "4.5.5", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - }, - "runtime": { - "lib/netstandard2.0/System.Collections.Immutable.dll": { - "assemblyVersion": "9.0.0.0", - "fileVersion": "9.0.825.36511" - } - } - }, - "System.Memory/4.5.5": { - "dependencies": { - "System.Buffers": "4.5.1", - "System.Numerics.Vectors": "4.4.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - }, - "runtime": { - "lib/netstandard2.0/System.Memory.dll": { - "assemblyVersion": "4.0.1.2", - "fileVersion": "4.6.31308.1" - } - } - }, - "System.Numerics.Vectors/4.4.0": { - "runtime": { - "lib/netstandard2.0/System.Numerics.Vectors.dll": { - "assemblyVersion": "4.1.3.0", - "fileVersion": "4.6.25519.3" - } - } - }, - "System.Reflection.Metadata/9.0.8": { - "dependencies": { - "System.Collections.Immutable": "9.0.8", - "System.Memory": "4.5.5" - }, - "runtime": { - "lib/netstandard2.0/System.Reflection.Metadata.dll": { - "assemblyVersion": "9.0.0.0", - "fileVersion": "9.0.825.36511" - } - } - }, - "System.Runtime.CompilerServices.Unsafe/6.0.0": { - "runtime": { - "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": { - "assemblyVersion": "6.0.0.0", - "fileVersion": "6.0.21.52210" - } - } - } - } - }, - "libraries": { - "CSNetwork/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "System.Buffers/4.5.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", - "path": "system.buffers/4.5.1", - "hashPath": "system.buffers.4.5.1.nupkg.sha512" - }, - "System.Collections.Immutable/9.0.8": { - "type": "package", - "serviceable": true, - "sha512": "sha512-Eje6exD7AGKPg5SIkmjyWTBq0KK6SpfTBfdFUmpGG07mNbYimFJ+jyVnILcs0ikFOXoYTBpBOxKYgAk2hhjYOw==", - "path": "system.collections.immutable/9.0.8", - "hashPath": "system.collections.immutable.9.0.8.nupkg.sha512" - }, - "System.Memory/4.5.5": { - "type": "package", - "serviceable": true, - "sha512": "sha512-XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", - "path": "system.memory/4.5.5", - "hashPath": "system.memory.4.5.5.nupkg.sha512" - }, - "System.Numerics.Vectors/4.4.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==", - "path": "system.numerics.vectors/4.4.0", - "hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512" - }, - "System.Reflection.Metadata/9.0.8": { - "type": "package", - "serviceable": true, - "sha512": "sha512-oJQezcASFomKvSp+06pzvSFRTnzdUJtiO19peAdZ9RwiqZinBV56u7zW5fEGf2/VrQFL3qZSV7UapgG31XRWQA==", - "path": "system.reflection.metadata/9.0.8", - "hashPath": "system.reflection.metadata.9.0.8.nupkg.sha512" - }, - "System.Runtime.CompilerServices.Unsafe/6.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", - "path": "system.runtime.compilerservices.unsafe/6.0.0", - "hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512" - } - } +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.1/", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.1": {}, + ".NETStandard,Version=v2.1/": { + "CSNetwork/1.0.0": { + "dependencies": { + "System.Reflection.Metadata": "9.0.8" + }, + "runtime": { + "CSNetwork.dll": {} + } + }, + "System.Buffers/4.5.1": { + "runtime": { + "lib/netstandard2.0/System.Buffers.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Collections.Immutable/9.0.8": { + "dependencies": { + "System.Memory": "4.5.5", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + }, + "runtime": { + "lib/netstandard2.0/System.Collections.Immutable.dll": { + "assemblyVersion": "9.0.0.0", + "fileVersion": "9.0.825.36511" + } + } + }, + "System.Memory/4.5.5": { + "dependencies": { + "System.Buffers": "4.5.1", + "System.Numerics.Vectors": "4.4.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.dll": { + "assemblyVersion": "4.0.1.2", + "fileVersion": "4.6.31308.1" + } + } + }, + "System.Numerics.Vectors/4.4.0": { + "runtime": { + "lib/netstandard2.0/System.Numerics.Vectors.dll": { + "assemblyVersion": "4.1.3.0", + "fileVersion": "4.6.25519.3" + } + } + }, + "System.Reflection.Metadata/9.0.8": { + "dependencies": { + "System.Collections.Immutable": "9.0.8", + "System.Memory": "4.5.5" + }, + "runtime": { + "lib/netstandard2.0/System.Reflection.Metadata.dll": { + "assemblyVersion": "9.0.0.0", + "fileVersion": "9.0.825.36511" + } + } + }, + "System.Runtime.CompilerServices.Unsafe/6.0.0": { + "runtime": { + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" + } + } + } + } + }, + "libraries": { + "CSNetwork/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "System.Buffers/4.5.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", + "path": "system.buffers/4.5.1", + "hashPath": "system.buffers.4.5.1.nupkg.sha512" + }, + "System.Collections.Immutable/9.0.8": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Eje6exD7AGKPg5SIkmjyWTBq0KK6SpfTBfdFUmpGG07mNbYimFJ+jyVnILcs0ikFOXoYTBpBOxKYgAk2hhjYOw==", + "path": "system.collections.immutable/9.0.8", + "hashPath": "system.collections.immutable.9.0.8.nupkg.sha512" + }, + "System.Memory/4.5.5": { + "type": "package", + "serviceable": true, + "sha512": "sha512-XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", + "path": "system.memory/4.5.5", + "hashPath": "system.memory.4.5.5.nupkg.sha512" + }, + "System.Numerics.Vectors/4.4.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==", + "path": "system.numerics.vectors/4.4.0", + "hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512" + }, + "System.Reflection.Metadata/9.0.8": { + "type": "package", + "serviceable": true, + "sha512": "sha512-oJQezcASFomKvSp+06pzvSFRTnzdUJtiO19peAdZ9RwiqZinBV56u7zW5fEGf2/VrQFL3qZSV7UapgG31XRWQA==", + "path": "system.reflection.metadata/9.0.8", + "hashPath": "system.reflection.metadata.9.0.8.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/6.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", + "path": "system.runtime.compilerservices.unsafe/6.0.0", + "hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512" + } + } } \ No newline at end of file diff --git a/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.dll b/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.dll index 8d0a3481ff..f6fbc4c6a9 100644 Binary files a/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.dll and b/Assets/NetworkLib/Debug/netstandard2.1/CSNetwork.dll differ diff --git a/Assets/PerfectWorld/Scripts/Common/AutoInitializer.cs b/Assets/PerfectWorld/Scripts/Common/AutoInitializer.cs index 98e9cec713..ff057fee5a 100644 --- a/Assets/PerfectWorld/Scripts/Common/AutoInitializer.cs +++ b/Assets/PerfectWorld/Scripts/Common/AutoInitializer.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Reflection; using UnityEngine; @@ -6,9 +7,21 @@ namespace BrewMonster { public class AutoInitializer : MonoBehaviour { + private List _autoInitializers = new(); + private void Awake() { Initialize(); + DontDestroyOnLoad(gameObject); + } + + void OnDestroy() + { + foreach (var autoInitializer in _autoInitializers) + { + autoInitializer.Dispose(); + } + _autoInitializers.Clear(); } @@ -77,6 +90,7 @@ namespace BrewMonster try { (instance as IAutoInitialize)?.Initialize(); + _autoInitializers.Add(instance as IAutoInitialize); } catch (Exception ex) { diff --git a/Assets/PerfectWorld/Scripts/Common/ByteToStringUtils.cs b/Assets/PerfectWorld/Scripts/Common/ByteToStringUtils.cs new file mode 100644 index 0000000000..3175d971c3 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/ByteToStringUtils.cs @@ -0,0 +1,74 @@ +using System; +using System.Text; + +namespace ModelRenderer.Scripts.Common +{ + public class ByteToStringUtils + { + public static string UshortArrayToUnicodeString(ushort[] ushortArray) + { + if (ushortArray == null || ushortArray.Length == 0) + return string.Empty; + + // First convert ushort array to byte array + // Each ushort (16 bits) can be up to two bytes in GBK + byte[] byteArray = new byte[ushortArray.Length * 2]; + + Buffer.BlockCopy(ushortArray, 0, byteArray, 0, byteArray.Length); + + // Convert bytes to string using GBK encoding + try + { + return Encoding.Unicode.GetString(byteArray); + } + catch (Exception ex) + { + UnityEngine.Debug.LogError($"Error converting bytes to GBK string: {ex.Message}"); + return string.Empty; + } + } + + public static string UshortArrayToCP936String(ushort[] ushortArray) + { + if (ushortArray == null || ushortArray.Length == 0) + return string.Empty; + + // First convert ushort array to byte array + // Each ushort (16 bits) can be up to two bytes in GBK + byte[] byteArray = new byte[ushortArray.Length * 2]; + + Buffer.BlockCopy(ushortArray, 0, byteArray, 0, byteArray.Length); + + return ByteArrayToCP936String(byteArray); + } + + public static string ByteArrayToCP936String(byte[] byteArray) + { + if (byteArray == null || byteArray.Length == 0) + return string.Empty; + + try + { + // Code page 936 is the code page for Simplified Chinese (GB2312/GBK) + // You may need to import System.Text.Encoding.CodePages package for Unity/modern .NET + Encoding cp936Encoding = Encoding.GetEncoding(936); + + // Convert the byte array to a string using code page 936 encoding + return cp936Encoding.GetString(byteArray); + } + catch (Exception ex) + { + UnityEngine.Debug.LogError($"Error converting bytes to CP936 string: {ex.Message}"); + return string.Empty; + } + } + + public static string ByteArrayToUnicodeString(byte[] byteArray) + { + if (byteArray == null || byteArray.Length == 0) + return string.Empty; + + return Encoding.Unicode.GetString(byteArray); + } + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/ByteToStringUtils.cs.meta b/Assets/PerfectWorld/Scripts/Common/ByteToStringUtils.cs.meta new file mode 100644 index 0000000000..3f44d0b50f --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/ByteToStringUtils.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 88f3ebc7691e645f6a19f5f6c712d2c5 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess.meta b/Assets/PerfectWorld/Scripts/Common/DataProcess.meta new file mode 100644 index 0000000000..750c877006 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fb577bf0f012e483c822630365667cd4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/AAssit.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/AAssit.cs new file mode 100644 index 0000000000..6a34d52b94 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/AAssit.cs @@ -0,0 +1,675 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using UnityEngine; + +public class AAssit +{ + public static T ReadFromBinaryOf(Stream stream, ref long readBytes, long fileOffset = -1) + { + // If fileOffset >= 0, seek to that position in the file + if (fileOffset >= 0) + { + stream.Seek(fileOffset, SeekOrigin.Begin); + } + + int size = Marshal.SizeOf(typeof(T)); + byte[] buffer = new byte[size]; + + // Read `size` bytes into `buffer[0..size]` + int bytesRead = stream.Read(buffer, 0, size); + if (bytesRead < size) + { + Console.WriteLine($"ERROR::Not enough data in stream to read {typeof(T).Name}. Expected {size} bytes, but only read {bytesRead}."); + return default(T); + } + + // Accumulate the number of bytes read + readBytes += bytesRead; + + // Pin and marshal + GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); + try + { + return (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T)); + } + finally + { + handle.Free(); + } + } + + public static T[] ReadArrayFromBinary(Stream stream, int arraySize, ref long readBytes, long fileOffset = -1) + { + T[] array = new T[arraySize]; + for (int i = 0; i < arraySize; i++) + { + array[i] = ReadFromBinaryOf(stream, ref readBytes, fileOffset); + } + + return array; + } + + public static T[] ReadArrayFromBinary(FileStream stream, ref long readBytes, long fileOffset = -1) + { + // seek to the fileOffset if it's >= 0 + if (fileOffset >= 0) + { + stream.Seek(fileOffset, SeekOrigin.Begin); + } + + // Read the first 4 bytes to get the array size + int arraySize = GetIntFromFileStream(stream, ref readBytes); + if (arraySize <= 0) return null; + + T[] array = new T[arraySize]; + for (int i = 0; i < arraySize; i++) + { + array[i] = ReadFromBinaryOf(stream, ref readBytes, fileOffset); + } + + return array; + } + + public static byte[] ReadByArray(Stream stream, ref long readBytes, int size, long fileOffset = -1) + { + // If fileOffset >= 0, seek to that position in the file + if (fileOffset >= 0) + { + stream.Seek(fileOffset, SeekOrigin.Begin); + } + + byte[] buffer = new byte[size]; + + // Read `size` bytes into `buffer[0..size]` + int bytesRead = stream.Read(buffer, 0, size); + if (bytesRead < size) + { + Console.WriteLine($"ERROR::Not enough data in stream to read byte array. Expected {size} bytes, but only read {bytesRead}."); + return null; + } + + // Accumulate the number of bytes read + readBytes += bytesRead; + + return buffer; + } + + public static bool GetBoolFromFileStream(FileStream fs, ref long readBytes) + { + byte[] buffer = new byte[1]; + int bytesRead = fs.Read(buffer, 0, 1); + if (bytesRead < 1) + throw new EndOfStreamException("Not enough data in stream to read bool."); + + readBytes += bytesRead; + return buffer[0] != 0; + } + + public static int GetIntFromFileStream(FileStream fs, ref long readBytes) + { + byte[] buffer = new byte[4]; + int bytesRead = fs.Read(buffer, 0, 4); + if (bytesRead < 4) + throw new EndOfStreamException("Not enough data in stream to read int."); + + readBytes += bytesRead; + return BitConverter.ToInt32(buffer, 0); + } + + public static uint GetUIntFromFileStream(FileStream fs, ref long readBytes) + { + byte[] buffer = new byte[4]; + int bytesRead = fs.Read(buffer, 0, 4); + if (bytesRead < 4) + throw new EndOfStreamException("Not enough data in stream to read uint."); + + readBytes += bytesRead; + return BitConverter.ToUInt32(buffer, 0); + } + + public static long GetLongFromFileStream(FileStream fs, ref long readBytes) + { + byte[] buffer = new byte[8]; + int bytesRead = fs.Read(buffer, 0, 8); + if (bytesRead < 8) + throw new EndOfStreamException("Not enough data in stream to read long."); + + readBytes += bytesRead; + return BitConverter.ToInt64(buffer, 0); + } + + /// + /// Get the substring after if starts with . + /// + /// The full string to check. + /// The tag string to look for at the beginning of . + /// + /// Outputs the substring of that appears immediately after , + /// if does indeed start with . + /// + /// + /// True if starts with ; false otherwise. + /// + public static bool GetStringFromCharsAfter(char[] buffer, string tag, out string result) + { + // from buffer to string + string source = new string(buffer); + + return GetStringAfter(source, tag, out result); + } + + public static bool GetStringAfter(string source, string tag, out string result) + { + // Initialize the output in case we return false + result = string.Empty; + + // Check if buffer starts with the specified tag + if (!source.StartsWith(tag)) + return false; + + // If it starts with tag, skip tag.Length characters + // and copy the rest to result + result = source.Substring(tag.Length); + + return true; + } + + /// + /// Reads a string from a binary stream at the position indicated by . + /// 1) Seeks to from the start of the stream (SeekOrigin.Begin). + /// 2) Reads 4 bytes (an int) that specify the string length (in bytes). + /// 3) If length is 0, returns "". + /// 4) Otherwise, reads the specified number of bytes and decodes to a string. + /// 5) Updates to the new position after reading. + /// + /// The stream from which to read. + /// + /// On entry, this indicates where to seek in the stream (from the beginning). + /// On exit, this will be updated to the new position after reading. + /// + /// Outputs the decoded string. + /// True if successful; otherwise false (e.g., not enough data). + public static bool ReadString(Stream stream, ref long readBytes, out string result) + { + result = ReadString(stream, ref readBytes); + return result != null; + } + + public static string ReadString(Stream stream, ref long readBytes) + { + var result = string.Empty; + + try + { + int length = 0; + byte[] buffer = new byte[4]; + + int byteRead = stream.Read(buffer, 0, 4); + if (byteRead < 4) + return null; + + readBytes += byteRead; + + length = BitConverter.ToInt32(buffer, 0); + + if (length == 0) + return null; + + buffer = new byte[length]; + byteRead = stream.Read(buffer, 0, length); + if (byteRead < length) + return null; + + readBytes += byteRead; + // Encoding encoding = + result = Encoding.GetEncoding(936).GetString(buffer); + + return result; + } + catch (Exception e) + { + // Could be EndOfStreamException, IOException, etc. + // Handle or log the exception as needed + return null; + } + } + + public static void ReadLine(Stream stream, ref long bytesRead, out string result) + { + result = Fgets(stream, 1024, Encoding.GetEncoding(936)); + bytesRead += result.Length; + } + + /// + /// Reads a null-terminated string from , starting at . + /// - Seeks to in the file. + /// - Reads one byte at a time until encountering a null (0x00) or reaching - 1. + /// - Decodes the collected bytes using the specified . + /// - Appends how many bytes it actually read to . + /// + /// Returns true on success (string in ), or false if an error occurs + /// (EOF, buffer overflow, etc.). + /// + /// Open, readable . + /// Absolute offset in the file to seek before reading. + /// Maximum number of characters to collect (like the C++ dwBufferLength). + /// Accumulates how many bytes we've read so far across calls. + /// Encoding used to interpret the raw bytes (e.g. ). + /// Outputs the decoded string (excluding the null terminator). + /// True if a string was successfully read, false otherwise. + public static bool ReadString(Stream stream,long fileOffset,int bufferLength,ref long alreadyReadBytes, Encoding encoding,out string result) + { + result = null; + + // Basic argument checks + if (stream == null) + throw new ArgumentNullException(nameof(stream)); + if (!stream.CanRead) + throw new ArgumentException("Stream must be readable.", nameof(stream)); + if (bufferLength < 2) + throw new ArgumentOutOfRangeException(nameof(bufferLength), "Buffer length must be >= 2."); + if (encoding == null) + throw new ArgumentNullException(nameof(encoding)); + + // 1) Seek to the specified offset from the beginning of the file + stream.Seek(fileOffset, SeekOrigin.Begin); + + // 2) We will collect bytes into this temporary array (exclude the null terminator) + byte[] buffer = new byte[bufferLength - 1]; + int index = 0; + + // Try reading first byte + int firstByte = stream.ReadByte(); + if (firstByte == -1) + { + // EOF immediately + return false; + } + + // We have read 1 byte so far in this call + long localRead = 1; + byte b = (byte)firstByte; + + // 3) Read until we hit a zero byte (null terminator) or fill the buffer + while (b != 0) + { + buffer[index++] = b; + + // Check for overflow + if (index >= bufferLength - 1) + { + // We would overflow if we read more data + return false; + } + + int nextByte = stream.ReadByte(); + if (nextByte == -1) + { + // EOF before we found a null terminator + return false; + } + + localRead++; + b = (byte)nextByte; + + // Loop continues until b == 0 + } + + // If we get here, b == 0 => null terminator found. + // localRead already includes the byte we used for the null terminator + + // 4) Update total bytes read (across calls) + alreadyReadBytes += localRead; + + // 5) Convert the collected bytes to a string + result = encoding.GetString(buffer, 0, index); + + return true; + } + + /// + /// Reads up to - 1 characters from , + /// stopping at newline or EOF. Returns the line (including the newline) or null if no bytes were read. + /// + /// An open readable Stream. + /// + /// The maximum number of characters to read (like the buffer size in fgets). + /// The actual string can have up to maxLength - 1 characters plus a null terminator in C terms. + /// + /// The character encoding (ASCII, UTF8, etc.). + /// A string containing the line, or null if no data was read. + public static string Fgets(Stream stream, int maxLength, Encoding encoding) + { + if (stream == null) throw new ArgumentNullException(nameof(stream)); + if (!stream.CanRead) throw new ArgumentException("Stream is not readable.", nameof(stream)); + if (maxLength <= 1) throw new ArgumentOutOfRangeException(nameof(maxLength), "Must be at least 2."); + + // We'll store the raw bytes in a temporary buffer. + // maxLength - 1 because, in the C analogy, one char is reserved for '\0'. + // But in C#, we'll just use that as a ceiling. + byte[] buffer = new byte[maxLength - 1]; + int totalRead = 0; + + while (true) + { + int b = stream.ReadByte(); + if (b == -1) + { + // EOF reached, stop reading + break; + } + + // Put this byte into our buffer + buffer[totalRead++] = (byte)b; + + // If we hit a newline, stop (mimicking fgets which stops at '\n') + if (b == '\n') + { + break; + } + + // If we've filled up the buffer (maxLength - 1 bytes), stop + if (totalRead >= buffer.Length) + { + break; + } + } + + // If we didn't read anything at all, return null (like fgets returning NULL on EOF) + if (totalRead == 0) + { + return null; + } + + // Convert the bytes we read into a string + return encoding.GetString(buffer, 0, totalRead); + } + + private static readonly uint[] l_aCRC32Table = new uint[] + { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d + }; + + public static uint MakeIDFromString(string str) + { + if (str == null) + throw new ArgumentNullException(nameof(str)); + + uint c = 0xffffffff; // shift register contents + byte[] bytes = Encoding.ASCII.GetBytes(str); + + foreach (byte b in bytes) + { + c = l_aCRC32Table[(c ^ b) & 0xff] ^ (c >> 8); + } + + return c ^ 0xffffffff; + } + + // load the DXT texture from the byte array. + // The byte array is loaded after loading the A3DSkin + public static Texture2D LoadTextureDXT(byte[] ddsBytes) + { + // from 72 to 76 is the texture format + // get the texture format from the ddsBytes + byte[] formatBytes = new byte[4]; + Array.Copy(ddsBytes, 84, formatBytes, 0, 4); + + // Convert the byte array to a string (assume it's ASCII-encoded) + string textureFormat = Encoding.UTF8.GetString(formatBytes); + + TextureFormat.TryParse(textureFormat, out TextureFormat textureFormatEnum); + if (textureFormatEnum != TextureFormat.DXT1 && textureFormatEnum != TextureFormat.DXT5) + { + Console.WriteLine($"ERROR::Expected DXT1 or DXT5 texture format, but got {textureFormat}. Using DXT5 instead."); + textureFormatEnum = TextureFormat.DXT5; + } + + byte ddsSizeCheck = ddsBytes[4]; + if (ddsSizeCheck != 124) + { + Console.WriteLine("ERROR::Invalid DDS DXTn texture. Unable to read"); //this header byte should be 124 for DDS image files + return Texture2D.whiteTexture; + } + + int height = ddsBytes[13] * 256 + ddsBytes[12]; + int width = ddsBytes[17] * 256 + ddsBytes[16]; + + int DDS_HEADER_SIZE = 128; + byte[] dxtBytes = new byte[ddsBytes.Length - DDS_HEADER_SIZE]; + Buffer.BlockCopy(ddsBytes, DDS_HEADER_SIZE, dxtBytes, 0, ddsBytes.Length - DDS_HEADER_SIZE); + + Texture2D texture = new Texture2D(width, height, textureFormatEnum, false); + texture.LoadRawTextureData(dxtBytes); + texture.Apply(); + + return (texture); + } + + public static Texture2D LoadTextureTGA(string filePath) + { + if (!File.Exists(filePath)) return Texture2D.whiteTexture; + + using (var tgaStream = File.OpenRead(filePath)) + using (BinaryReader r = new BinaryReader(tgaStream)) + { + // Skip some header info we don't care about. + // Even if we did care, we have to move the stream seek point to the beginning, + // as the previous method in the workflow left it at the end. + r.BaseStream.Seek(12, SeekOrigin.Begin); + + short width = r.ReadInt16(); + short height = r.ReadInt16(); + int bitDepth = r.ReadByte(); + + // Skip a byte of header information we don't care about. + r.BaseStream.Seek(1, SeekOrigin.Current); + + Texture2D tex = new Texture2D(width, height); + Color32[] pulledColors = new Color32[width * height]; + + if (bitDepth == 32) + { + for (int i = 0; i < width * height; i++) + { + byte red = r.ReadByte(); + byte green = r.ReadByte(); + byte blue = r.ReadByte(); + byte alpha = r.ReadByte(); + + pulledColors[i] = new Color32(blue, green, red, alpha); + } + } + else if (bitDepth == 24) + { + for (int i = 0; i < width * height; i++) + { + byte red = r.ReadByte(); + byte green = r.ReadByte(); + byte blue = r.ReadByte(); + + pulledColors[i] = new Color32(blue, green, red, 1); + } + } + else + { + throw new Exception("TGA texture had non 32/24 bit depth."); + } + + tex.SetPixels32(pulledColors); + tex.Apply(); + return tex; + } + } + + /// + /// Saves a Texture2D to a PNG file at the specified absolute path. + /// If a file already exists at the path, returns true without overwriting. + /// If the file doesn't exist, creates a new PNG file and saves the texture. + /// + /// The Texture2D to save as PNG + /// The absolute file path where to save the PNG + /// True if file already exists or was successfully saved, false on error + public static bool SaveTexture2DToPNG(Texture2D texture, string absolutePath, bool compressedTexture = false) + { + // Check if texture parameter is valid + if (texture == null) + { + Debug.LogError("SaveTexture2DToPNG: Texture is null"); + return false; + } + + // Check if the absolute path is valid + if (string.IsNullOrEmpty(absolutePath)) + { + Debug.LogError("SaveTexture2DToPNG: Absolute path is null or empty"); + return false; + } + + // Check if file already exists + if (File.Exists(absolutePath)) + { + return true; // File already exists, return true + } + + try + { + // Ensure the directory exists + string directory = Path.GetDirectoryName(absolutePath); + if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + + if (compressedTexture) + { + // Create a temporary RenderTexture with same dimensions as source + RenderTexture tempRT = RenderTexture.GetTemporary( + texture.width, + texture.height, + 0, + RenderTextureFormat.ARGB32 + ); + + // Copy compressed texture to RT, decompressing on GPU + Graphics.Blit(texture, tempRT); + + // Create new uncompressed texture + Texture2D uncompressedTex = new Texture2D( + texture.width, + texture.height, + TextureFormat.ARGB32, + false + ); + + // Store active RT and switch to temp + RenderTexture prevRT = RenderTexture.active; + RenderTexture.active = tempRT; + + // Read pixels from RT into uncompressed texture + uncompressedTex.ReadPixels(new Rect(0, 0, tempRT.width, tempRT.height), 0, 0); + uncompressedTex.Apply(); + + // Restore previous RT and release temp + RenderTexture.active = prevRT; + RenderTexture.ReleaseTemporary(tempRT); + + // Use uncompressed texture instead of original + texture = uncompressedTex; + } + + // Encode texture to PNG + byte[] pngBytes = texture.EncodeToPNG(); + + if (pngBytes == null || pngBytes.Length == 0) + { + Debug.LogError("SaveTexture2DToPNG: Failed to encode texture to PNG"); + return false; + } + + // Write PNG bytes to file + File.WriteAllBytes(absolutePath, pngBytes); + + Debug.Log($"SaveTexture2DToPNG: Successfully saved texture to {absolutePath}"); + return true; + } + catch (Exception e) + { + Debug.LogError($"SaveTexture2DToPNG: Error saving texture to {absolutePath}: {e.Message}"); + return false; + } + } + + /// + /// This is for when we load a byte buffer for string. \ + /// We have to remove the empty byte at the end so the string can be decoded correctly. + /// + /// + public static void RemoveEmptyByte(ref byte[] buffer) + { + int firstEmptyByte = Array.IndexOf(buffer, (byte)0); + if (firstEmptyByte != -1) + { + Array.Resize(ref buffer, firstEmptyByte); + } + } +} + +public struct StringStruct +{ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2048)] + public char[] value; +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/AAssit.cs.meta b/Assets/PerfectWorld/Scripts/Common/DataProcess/AAssit.cs.meta new file mode 100644 index 0000000000..35661cd1a5 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/AAssit.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a80dd3d13d411402590a158039cb737c \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs new file mode 100644 index 0000000000..c7a9d5def9 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs @@ -0,0 +1,37 @@ +using System; +using ModelRenderer.Scripts.GameData; + +namespace BrewMonster +{ + public class ElementDataManProvider : IAutoInitialize + { + private static ElementDataManProvider _instance; + private elementdataman _elementDataMan; + + public static elementdataman GetElementDataMan() + { + return _instance._elementDataMan; + } + + public void Initialize() + { + _elementDataMan = new(); + _instance = this; + + try + { + _elementDataMan.load_data(); + } + catch (Exception ex) + { + Logger.LogError($"ElementDataManProvider: Failed to load element data: {ex}"); + } + } + + public void Dispose() + { + _elementDataMan = null; + _instance = null; + } + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs.meta b/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs.meta new file mode 100644 index 0000000000..5d7eca95ce --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 63743217e486c458c898f68ece49e459 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs new file mode 100644 index 0000000000..a04b82e2a3 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs @@ -0,0 +1,721 @@ +using System.Collections.Generic; +using System.IO; +using System.Text; +using BrewMonster; + +namespace ModelRenderer.Scripts.GameData +{ + public class elementdataman + { + + private static elementdataman instance; + public static elementdataman Instance + { + get + { + if (instance == null) + { + instance = new elementdataman(); + } + return instance; + } + } + + public Dictionary essence_id_data_type_map = new Dictionary(); + public Dictionary essence_id_data_map = new Dictionary(); + + public EQUIPMENT_ADDON[] equipment_addon_array = new EQUIPMENT_ADDON[0]; + public WEAPON_MAJOR_TYPE[] weapon_major_type_array = new WEAPON_MAJOR_TYPE[0]; + public WEAPON_SUB_TYPE[] weapon_sub_type_array = new WEAPON_SUB_TYPE[0]; + public WEAPON_ESSENCE[] weapon_essence_array = new WEAPON_ESSENCE[0]; + public ARMOR_MAJOR_TYPE[] armor_major_type_array = new ARMOR_MAJOR_TYPE[0]; + + public ARMOR_SUB_TYPE[] armor_sub_type_array = new ARMOR_SUB_TYPE[0]; + public ARMOR_ESSENCE[] armor_essence_array = new ARMOR_ESSENCE[0]; + public DECORATION_MAJOR_TYPE[] decoration_major_type_array = new DECORATION_MAJOR_TYPE[0]; + public DECORATION_SUB_TYPE[] decoration_sub_type_array = new DECORATION_SUB_TYPE[0]; + public DECORATION_ESSENCE[] decoration_essence_array = new DECORATION_ESSENCE[0]; + + public MEDICINE_MAJOR_TYPE[] medicine_major_type_array = new MEDICINE_MAJOR_TYPE[0]; + public MEDICINE_SUB_TYPE[] medicine_sub_type_array = new MEDICINE_SUB_TYPE[0]; + public MEDICINE_ESSENCE[] medicine_essence_array = new MEDICINE_ESSENCE[0]; + public MATERIAL_MAJOR_TYPE[] material_major_type_array = new MATERIAL_MAJOR_TYPE[0]; + public MATERIAL_SUB_TYPE[] material_sub_type_array = new MATERIAL_SUB_TYPE[0]; + + public MATERIAL_ESSENCE[] material_essence_array = new MATERIAL_ESSENCE[0]; + public DAMAGERUNE_SUB_TYPE[] damagerune_sub_type_array = new DAMAGERUNE_SUB_TYPE[0]; + public DAMAGERUNE_ESSENCE[] damagerune_essence_array = new DAMAGERUNE_ESSENCE[0]; + public ARMORRUNE_SUB_TYPE[] armorrune_sub_type_array = new ARMORRUNE_SUB_TYPE[0]; + public ARMORRUNE_ESSENCE[] armorrune_essence_array = new ARMORRUNE_ESSENCE[0]; + + public SKILLTOME_SUB_TYPE[] skilltome_sub_type_array = new SKILLTOME_SUB_TYPE[0]; + public SKILLTOME_ESSENCE[] skilltome_essence_array = new SKILLTOME_ESSENCE[0]; + public FLYSWORD_ESSENCE[] flysword_essence_array = new FLYSWORD_ESSENCE[0]; + public WINGMANWING_ESSENCE[] wingmanwing_essence_array = new WINGMANWING_ESSENCE[0]; + public TOWNSCROLL_ESSENCE[] townscroll_essence_array = new TOWNSCROLL_ESSENCE[0]; + + public UNIONSCROLL_ESSENCE[] unionscroll_essence_array = new UNIONSCROLL_ESSENCE[0]; + public REVIVESCROLL_ESSENCE[] revivescroll_essence_array = new REVIVESCROLL_ESSENCE[0]; + public ELEMENT_ESSENCE[] element_essence_array = new ELEMENT_ESSENCE[0]; + public TASKMATTER_ESSENCE[] taskmatter_essence_array = new TASKMATTER_ESSENCE[0]; + public TOSSMATTER_ESSENCE[] tossmatter_essence_array = new TOSSMATTER_ESSENCE[0]; + + public PROJECTILE_TYPE[] projectile_type_array = new PROJECTILE_TYPE[0]; + public PROJECTILE_ESSENCE[] projectile_essence_array = new PROJECTILE_ESSENCE[0]; + public QUIVER_SUB_TYPE[] quiver_sub_type_array = new QUIVER_SUB_TYPE[0]; + public QUIVER_ESSENCE[] quiver_essence_array = new QUIVER_ESSENCE[0]; + public STONE_SUB_TYPE[] stone_sub_type_array = new STONE_SUB_TYPE[0]; + + public STONE_ESSENCE[] stone_essence_array = new STONE_ESSENCE[0]; + public MONSTER_ADDON[] monster_addon_array = new MONSTER_ADDON[0]; + public MONSTER_TYPE[] monster_type_array = new MONSTER_TYPE[0]; + public MONSTER_ESSENCE[] monster_essence_array = new MONSTER_ESSENCE[0]; + public NPC_TALK_SERVICE[] npc_talk_service_array = new NPC_TALK_SERVICE[0]; + + public NPC_SELL_SERVICE[] npc_sell_service_array = new NPC_SELL_SERVICE[0]; + public NPC_BUY_SERVICE[] npc_buy_service_array = new NPC_BUY_SERVICE[0]; + public NPC_REPAIR_SERVICE[] npc_repair_service_array = new NPC_REPAIR_SERVICE[0]; + public NPC_INSTALL_SERVICE[] npc_install_service_array = new NPC_INSTALL_SERVICE[0]; + public NPC_UNINSTALL_SERVICE[] npc_uninstall_service_array = new NPC_UNINSTALL_SERVICE[0]; + + public NPC_TASK_IN_SERVICE[] npc_task_in_service_array = new NPC_TASK_IN_SERVICE[0]; + public NPC_TASK_OUT_SERVICE[] npc_task_out_service_array = new NPC_TASK_OUT_SERVICE[0]; + public NPC_TASK_MATTER_SERVICE[] npc_task_matter_service_array = new NPC_TASK_MATTER_SERVICE[0]; + public NPC_SKILL_SERVICE[] npc_skill_service_array = new NPC_SKILL_SERVICE[0]; + public NPC_HEAL_SERVICE[] npc_heal_service_array = new NPC_HEAL_SERVICE[0]; + + public NPC_TRANSMIT_SERVICE[] npc_transmit_service_array = new NPC_TRANSMIT_SERVICE[0]; + public NPC_TRANSPORT_SERVICE[] npc_transport_service_array = new NPC_TRANSPORT_SERVICE[0]; + public NPC_PROXY_SERVICE[] npc_proxy_service_array = new NPC_PROXY_SERVICE[0]; + public NPC_STORAGE_SERVICE[] npc_storage_service_array = new NPC_STORAGE_SERVICE[0]; + public NPC_MAKE_SERVICE[] npc_make_service_array = new NPC_MAKE_SERVICE[0]; + + public NPC_DECOMPOSE_SERVICE[] npc_decompose_service_array = new NPC_DECOMPOSE_SERVICE[0]; + public NPC_TYPE[] npc_type_array = new NPC_TYPE[0]; + public NPC_ESSENCE[] npc_essence_array = new NPC_ESSENCE[0]; + public talk_proc[] talk_proc_array = new talk_proc[0]; + public FACE_TEXTURE_ESSENCE[] face_texture_essence_array = new FACE_TEXTURE_ESSENCE[0]; + + public FACE_SHAPE_ESSENCE[] face_shape_essence_array = new FACE_SHAPE_ESSENCE[0]; + public FACE_EMOTION_TYPE[] face_emotion_type_array = new FACE_EMOTION_TYPE[0]; + public FACE_EXPRESSION_ESSENCE[] face_expression_essence_array = new FACE_EXPRESSION_ESSENCE[0]; + public FACE_HAIR_ESSENCE[] face_hair_essence_array = new FACE_HAIR_ESSENCE[0]; + public FACE_MOUSTACHE_ESSENCE[] face_moustache_essence_array = new FACE_MOUSTACHE_ESSENCE[0]; + public COLORPICKER_ESSENCE[] colorpicker_essence_array = new COLORPICKER_ESSENCE[0]; + public CUSTOMIZEDATA_ESSENCE[] customizedata_essence_array = new CUSTOMIZEDATA_ESSENCE[0]; + + public RECIPE_MAJOR_TYPE[] recipe_major_type_array = new RECIPE_MAJOR_TYPE[0]; + public RECIPE_SUB_TYPE[] recipe_sub_type_array = new RECIPE_SUB_TYPE[0]; + public RECIPE_ESSENCE[] recipe_essence_array = new RECIPE_ESSENCE[0]; + + public ENEMY_FACTION_CONFIG[] enemy_faction_config_array = new ENEMY_FACTION_CONFIG[0]; + public CHARACTER_CLASS_CONFIG[] character_class_config_array = new CHARACTER_CLASS_CONFIG[0]; + public PARAM_ADJUST_CONFIG[] param_adjust_config_array = new PARAM_ADJUST_CONFIG[0]; + public PLAYER_ACTION_INFO_CONFIG[] player_action_info_config_array = new PLAYER_ACTION_INFO_CONFIG[0]; + public TASKDICE_ESSENCE[] taskdice_essence_array = new TASKDICE_ESSENCE[0]; + + public TASKNORMALMATTER_ESSENCE[] tasknormalmatter_essence_array = new TASKNORMALMATTER_ESSENCE[0]; + public FACE_FALING_ESSENCE[] face_faling_essence_array = new FACE_FALING_ESSENCE[0]; + public PLAYER_LEVELEXP_CONFIG[] player_levelexp_config_array = new PLAYER_LEVELEXP_CONFIG[0]; + public MINE_TYPE[] mine_type_array = new MINE_TYPE[0]; + public MINE_ESSENCE[] mine_essence_array = new MINE_ESSENCE[0]; + + public NPC_IDENTIFY_SERVICE[] npc_identify_service_array = new NPC_IDENTIFY_SERVICE[0]; + + public FASHION_MAJOR_TYPE[] fashion_major_type_array = new FASHION_MAJOR_TYPE[0]; + public FASHION_SUB_TYPE[] fashion_sub_type_array = new FASHION_SUB_TYPE[0]; + public FASHION_ESSENCE[] fashion_essence_array = new FASHION_ESSENCE[0]; + + public FACETICKET_MAJOR_TYPE[] faceticket_major_type_array = new FACETICKET_MAJOR_TYPE[0]; + public FACETICKET_SUB_TYPE[] faceticket_sub_type_array = new FACETICKET_SUB_TYPE[0]; + public FACETICKET_ESSENCE[] faceticket_essence_array = new FACETICKET_ESSENCE[0]; + public FACEPILL_MAJOR_TYPE[] facepill_major_type_array = new FACEPILL_MAJOR_TYPE[0]; + public FACEPILL_SUB_TYPE[] facepill_sub_type_array = new FACEPILL_SUB_TYPE[0]; + public FACEPILL_ESSENCE[] facepill_essence_array = new FACEPILL_ESSENCE[0]; + + public SUITE_ESSENCE[] suite_essence_array = new SUITE_ESSENCE[0]; + public GM_GENERATOR_TYPE[] gm_generator_type_array = new GM_GENERATOR_TYPE[0]; + public GM_GENERATOR_ESSENCE[] gm_generator_essence_array = new GM_GENERATOR_ESSENCE[0]; + public PET_TYPE[] pet_type_array = new PET_TYPE[0]; + public PET_ESSENCE[] pet_essence_array = new PET_ESSENCE[0]; + public PET_EGG_ESSENCE[] pet_egg_essence_array = new PET_EGG_ESSENCE[0]; + public PET_FOOD_ESSENCE[] pet_food_essence_array = new PET_FOOD_ESSENCE[0]; + public PET_FACETICKET_ESSENCE[] pet_faceticket_essence_array = new PET_FACETICKET_ESSENCE[0]; + public FIREWORKS_ESSENCE[] fireworks_essence_array = new FIREWORKS_ESSENCE[0]; + + public WAR_TANKCALLIN_ESSENCE[] war_tankcallin_essence_array = new WAR_TANKCALLIN_ESSENCE[0]; + public NPC_WAR_TOWERBUILD_SERVICE[] npc_war_towerbuild_service_array = new NPC_WAR_TOWERBUILD_SERVICE[0]; + public PLAYER_SECONDLEVEL_CONFIG[] player_secondlevel_config_array = new PLAYER_SECONDLEVEL_CONFIG[0]; + public NPC_RESETPROP_SERVICE[] npc_resetprop_service_array = new NPC_RESETPROP_SERVICE[0]; + public NPC_PETNAME_SERVICE[] npc_petname_service_array = new NPC_PETNAME_SERVICE[0]; + + public NPC_PETLEARNSKILL_SERVICE[] npc_petlearnskill_service_array = new NPC_PETLEARNSKILL_SERVICE[0]; + public NPC_PETFORGETSKILL_SERVICE[] npc_petforgetskill_service_array = new NPC_PETFORGETSKILL_SERVICE[0]; + public SKILLMATTER_ESSENCE[] skillmatter_essence_array = new SKILLMATTER_ESSENCE[0]; + public REFINE_TICKET_ESSENCE[] refine_ticket_essence_array = new REFINE_TICKET_ESSENCE[0]; + public DESTROYING_ESSENCE[] destroying_essence_array = new DESTROYING_ESSENCE[0]; + + public NPC_EQUIPBIND_SERVICE[] npc_equipbind_service_array = new NPC_EQUIPBIND_SERVICE[0]; + public NPC_EQUIPDESTROY_SERVICE[] npc_equipdestroy_service_array = new NPC_EQUIPDESTROY_SERVICE[0]; + public NPC_EQUIPUNDESTROY_SERVICE[] npc_equipundestroy_service_array = new NPC_EQUIPUNDESTROY_SERVICE[0]; + public BIBLE_ESSENCE[] bible_essence_array = new BIBLE_ESSENCE[0]; + public SPEAKER_ESSENCE[] speaker_essence_array = new SPEAKER_ESSENCE[0]; + + public AUTOMP_ESSENCE[] automp_essence_array = new AUTOMP_ESSENCE[0]; + public AUTOHP_ESSENCE[] autohp_essence_array = new AUTOHP_ESSENCE[0]; + public DOUBLE_EXP_ESSENCE[] double_exp_essence_array = new DOUBLE_EXP_ESSENCE[0]; + public TRANSMITSCROLL_ESSENCE[] transmitscroll_essence_array = new TRANSMITSCROLL_ESSENCE[0]; + public DYE_TICKET_ESSENCE[] dye_ticket_essence_array = new DYE_TICKET_ESSENCE[0]; + + public GOBLIN_ESSENCE[] goblin_essence_array = new GOBLIN_ESSENCE[0]; + public GOBLIN_EQUIP_TYPE[] goblin_equip_type_array = new GOBLIN_EQUIP_TYPE[0]; + public GOBLIN_EQUIP_ESSENCE[] goblin_equip_essence_array = new GOBLIN_EQUIP_ESSENCE[0]; + public GOBLIN_EXPPILL_ESSENCE[] goblin_exppill_essence_array = new GOBLIN_EXPPILL_ESSENCE[0]; + public SELL_CERTIFICATE_ESSENCE[] sell_certificate_essence_array = new SELL_CERTIFICATE_ESSENCE[0]; + + public TARGET_ITEM_ESSENCE[] target_item_essence_array = new TARGET_ITEM_ESSENCE[0]; + public LOOK_INFO_ESSENCE[] look_info_essence_array = new LOOK_INFO_ESSENCE[0]; + public UPGRADE_PRODUCTION_CONFIG[] upgrade_production_config_array = new UPGRADE_PRODUCTION_CONFIG[0]; + public ACC_STORAGE_BLACKLIST_CONFIG[] acc_storage_blacklist_config_array = new ACC_STORAGE_BLACKLIST_CONFIG[0]; + public FACE_HAIR_TEXTURE_MAP[] face_hair_texture_map_array = new FACE_HAIR_TEXTURE_MAP[0]; + + public MULTI_EXP_CONFIG[] multi_exp_config_array = new MULTI_EXP_CONFIG[0]; + public INC_SKILL_ABILITY_ESSENCE[] inc_skill_ability_essence_array = new INC_SKILL_ABILITY_ESSENCE[0]; + public GOD_EVIL_CONVERT_CONFIG[] god_evil_convert_config_array = new GOD_EVIL_CONVERT_CONFIG[0]; + public WEDDING_CONFIG[] wedding_config_array = new WEDDING_CONFIG[0]; + public WEDDING_BOOKCARD_ESSENCE[] wedding_bookcard_essence_array = new WEDDING_BOOKCARD_ESSENCE[0]; + + public WEDDING_INVITECARD_ESSENCE[] wedding_invitecard_essence_array = new WEDDING_INVITECARD_ESSENCE[0]; + public SHARPENER_ESSENCE[] sharpener_essence_array = new SHARPENER_ESSENCE[0]; + public FACE_THIRDEYE_ESSENCE[] face_thirdeye_essence_array = new FACE_THIRDEYE_ESSENCE[0]; + public FACTION_FORTRESS_CONFIG[] faction_fortress_config_array = new FACTION_FORTRESS_CONFIG[0]; + public FACTION_BUILDING_SUB_TYPE[] faction_building_sub_type_array = new FACTION_BUILDING_SUB_TYPE[0]; + + public FACTION_BUILDING_ESSENCE[] faction_building_essence_array = new FACTION_BUILDING_ESSENCE[0]; + public FACTION_MATERIAL_ESSENCE[] faction_material_essence_array = new FACTION_MATERIAL_ESSENCE[0]; + public CONGREGATE_ESSENCE[] congregate_essence_array = new CONGREGATE_ESSENCE[0]; + + public ENGRAVE_MAJOR_TYPE[] engrave_major_type_array = new ENGRAVE_MAJOR_TYPE[0]; + public ENGRAVE_SUB_TYPE[] engrave_sub_type_array = new ENGRAVE_SUB_TYPE[0]; + public ENGRAVE_ESSENCE[] engrave_essence_array = new ENGRAVE_ESSENCE[0]; + public NPC_ENGRAVE_SERVICE[] npc_engrave_service_array = new NPC_ENGRAVE_SERVICE[0]; + public NPC_RANDPROP_SERVICE[] npc_randprop_service_array = new NPC_RANDPROP_SERVICE[0]; + + public RANDPROP_TYPE[] randprop_type_array = new RANDPROP_TYPE[0]; + public RANDPROP_ESSENCE[] randprop_essence_array = new RANDPROP_ESSENCE[0]; + public WIKI_TABOO_CONFIG[] wiki_taboo_config_array = new WIKI_TABOO_CONFIG[0]; + public FORCE_CONFIG[] force_config_array = new FORCE_CONFIG[0]; + public FORCE_TOKEN_ESSENCE[] force_token_essence_array = new FORCE_TOKEN_ESSENCE[0]; + + public NPC_FORCE_SERVICE[] npc_force_service_array = new NPC_FORCE_SERVICE[0]; + public PLAYER_DEATH_DROP_CONFIG[] player_death_drop_config_array = new PLAYER_DEATH_DROP_CONFIG[0]; + public DYNSKILLEQUIP_ESSENCE[] dynskillequip_essence_array = new DYNSKILLEQUIP_ESSENCE[0]; + public CONSUME_POINTS_CONFIG[] consume_points_config_array = new CONSUME_POINTS_CONFIG[0]; + public ONLINE_AWARDS_CONFIG[] online_awards_config_array = new ONLINE_AWARDS_CONFIG[0]; + + public COUNTRY_CONFIG[] country_config_array = new COUNTRY_CONFIG[0]; + public GM_ACTIVITY_CONFIG[] gm_activity_config_array = new GM_ACTIVITY_CONFIG[0]; + public FASHION_WEAPON_CONFIG[] fashion_weapon_config_array = new FASHION_WEAPON_CONFIG[0]; + public PET_EVOLVE_CONFIG[] pet_evolve_config_array = new PET_EVOLVE_CONFIG[0]; + public PET_EVOLVED_SKILL_CONFIG[] pet_evolved_skill_config_array = new PET_EVOLVED_SKILL_CONFIG[0]; + + public MONEY_CONVERTIBLE_ESSENCE[] money_convertible_essence_array = new MONEY_CONVERTIBLE_ESSENCE[0]; + public STONE_CHANGE_RECIPE_TYPE[] stone_change_recipe_type_array = new STONE_CHANGE_RECIPE_TYPE[0]; + public STONE_CHANGE_RECIPE[] stone_change_recipe_array = new STONE_CHANGE_RECIPE[0]; + public MERIDIAN_CONFIG[] meridian_config_array = new MERIDIAN_CONFIG[0]; + public PET_EVOLVED_SKILL_RAND_CONFIG[] pet_evolved_skill_rand_config_array = new PET_EVOLVED_SKILL_RAND_CONFIG[0]; + + public AUTOTASK_DISPLAY_CONFIG[] autotask_display_config_array = new AUTOTASK_DISPLAY_CONFIG[0]; + public TOUCH_SHOP_CONFIG[] touch_shop_config_array = new TOUCH_SHOP_CONFIG[0]; + public TITLE_CONFIG[] title_config_array = new TITLE_CONFIG[0]; + public COMPLEX_TITLE_CONFIG[] complex_title_config_array = new COMPLEX_TITLE_CONFIG[0]; + public MONSTER_SPIRIT_ESSENCE[] monster_spirit_essence_array = new MONSTER_SPIRIT_ESSENCE[0]; + + public PLAYER_SPIRIT_CONFIG[] player_spirit_config_array = new PLAYER_SPIRIT_CONFIG[0]; + public PLAYER_REINCARNATION_CONFIG[] player_reincarnation_config_array = new PLAYER_REINCARNATION_CONFIG[0]; + public HISTORY_STAGE_CONFIG[] history_stage_config_array = new HISTORY_STAGE_CONFIG[0]; + public HISTORY_ADVANCE_CONFIG[] history_advance_config_array = new HISTORY_ADVANCE_CONFIG[0]; + public AUTOTEAM_CONFIG[] autoteam_config_array = new AUTOTEAM_CONFIG[0]; + + public PLAYER_REALM_CONFIG[] player_realm_config_array = new PLAYER_REALM_CONFIG[0]; + public CHARIOT_CONFIG[] chariot_config_array = new CHARIOT_CONFIG[0]; + public CHARIOT_WAR_CONFIG[] chariot_war_config_array = new CHARIOT_WAR_CONFIG[0]; + public POKER_LEVELEXP_CONFIG[] poker_levelexp_config_array = new POKER_LEVELEXP_CONFIG[0]; + public POKER_SUITE_ESSENCE[] poker_suite_essence_array = new POKER_SUITE_ESSENCE[0]; + + public POKER_DICE_ESSENCE[] poker_dice_essence_array = new POKER_DICE_ESSENCE[0]; + public POKER_SUB_TYPE[] poker_sub_type_array = new POKER_SUB_TYPE[0]; + public POKER_ESSENCE[] poker_essence_array = new POKER_ESSENCE[0]; + public TOKEN_SHOP_CONFIG[] token_shop_config_array = new TOKEN_SHOP_CONFIG[0]; + public SHOP_TOKEN_ESSENCE[] shop_token_essence_array = new SHOP_TOKEN_ESSENCE[0]; + + public GT_CONFIG[] gt_config_array = new GT_CONFIG[0]; + public RAND_SHOP_CONFIG[] rand_shop_config_array = new RAND_SHOP_CONFIG[0]; + public PROFIT_TIME_CONFIG[] profit_time_config_array = new PROFIT_TIME_CONFIG[0]; + public FACTION_PVP_CONFIG[] faction_pvp_config_array = new FACTION_PVP_CONFIG[0]; + public UNIVERSAL_TOKEN_ESSENCE[] universal_token_essence_array = new UNIVERSAL_TOKEN_ESSENCE[0]; + + public TASK_LIST_CONFIG[] task_list_config_array = new TASK_LIST_CONFIG[0]; + public TASK_DICE_BY_WEIGHT_CONFIG[] task_dice_by_weight_config_array = new TASK_DICE_BY_WEIGHT_CONFIG[0]; + public FASHION_SUITE_ESSENCE[] fashion_suite_essence_array = new FASHION_SUITE_ESSENCE[0]; + public FASHION_BEST_COLOR_CONFIG[] fashion_best_color_config_array = new FASHION_BEST_COLOR_CONFIG[0]; + public SIGN_AWARD_CONFIG[] sign_award_config_array = new SIGN_AWARD_CONFIG[0]; + + public int load_data(string pathname = "") + { + if (string.IsNullOrEmpty(pathname)) + { + pathname = Path.Combine(UnityEngine.Application.streamingAssetsPath, "elements.data"); + } + + if (!File.Exists(pathname)) return -1; + + using (var file = new FileStream(pathname, FileMode.Open, FileAccess.Read)) + { + long dwRead = 0; + int version = AAssit.GetIntFromFileStream(file, ref dwRead); + + if (version != 805306495) + { + Logger.LogError("ERROR:: File version mismatch"); + return -1; + } + + //time_t + long t = AAssit.GetIntFromFileStream(file, ref dwRead); + + // if(equipment_addon_array.load(file) != 0) return -1; + equipment_addon_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // if(weapon_major_type_array.load(file) != 0) return -1; + weapon_major_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // if(weapon_sub_type_array.load(file) != 0) return -1; + weapon_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // if(weapon_essence_array.load(file) != 0) return -1; + weapon_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // if(armor_major_type_array.load(file) != 0) return -1; + armor_major_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // if(armor_sub_type_array.load(file) != 0) return -1; + armor_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // if(armor_essence_array.load(file) != 0) return -1; + armor_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // if(decoration_major_type_array.load(file) != 0) return -1; + decoration_major_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // if(decoration_sub_type_array.load(file) != 0) return -1; + decoration_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // if(decoration_essence_array.load(file) != 0) return -1; + decoration_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + medicine_major_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + medicine_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + medicine_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + material_major_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + material_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + material_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + damagerune_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + damagerune_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + armorrune_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + armorrune_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // skip the computer's name of the exporter + int tag = AAssit.GetIntFromFileStream(file, ref dwRead); + AAssit.ReadString(file, ref dwRead, out var result); + t = AAssit.GetIntFromFileStream(file, ref dwRead); + + skilltome_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + skilltome_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + flysword_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + wingmanwing_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + townscroll_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + unionscroll_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + revivescroll_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + element_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + taskmatter_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + tossmatter_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + projectile_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + projectile_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + quiver_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + quiver_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + stone_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + stone_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + monster_addon_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + monster_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + monster_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + npc_talk_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_sell_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_buy_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_repair_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_install_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_uninstall_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_task_in_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_task_out_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_task_matter_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_skill_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_heal_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_transmit_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + npc_transport_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_proxy_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_storage_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_make_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_decompose_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + npc_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + uint sz = AAssit.GetUIntFromFileStream(file, ref dwRead); + if (sz <= 0) return -1; + talk_proc_array = new talk_proc[sz]; + for (int i = 0; i < sz; i++) + { + talk_proc tp = new talk_proc(); + tp.Read(file); + talk_proc_array[i] = tp; + } + + face_texture_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + face_shape_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + face_emotion_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + face_expression_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + face_hair_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + face_moustache_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + colorpicker_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + customizedata_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + recipe_major_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + recipe_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + recipe_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + enemy_faction_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + character_class_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + param_adjust_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + player_action_info_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + taskdice_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + tasknormalmatter_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + face_faling_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + player_levelexp_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + mine_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + mine_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + npc_identify_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + fashion_major_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + fashion_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + fashion_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + faceticket_major_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + faceticket_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + faceticket_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + facepill_major_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + facepill_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + facepill_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + suite_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + gm_generator_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + gm_generator_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + pet_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + pet_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + pet_egg_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + pet_food_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + pet_faceticket_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + fireworks_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + war_tankcallin_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + tag = AAssit.GetIntFromFileStream(file, ref dwRead); + AAssit.ReadString(file, ref dwRead, out result); + + npc_war_towerbuild_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + player_secondlevel_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_resetprop_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_petname_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + npc_petlearnskill_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_petforgetskill_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + skillmatter_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + refine_ticket_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + destroying_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + npc_equipbind_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_equipdestroy_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + npc_equipundestroy_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + bible_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + speaker_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + autohp_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + automp_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + double_exp_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + transmitscroll_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + dye_ticket_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + goblin_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + goblin_equip_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + goblin_equip_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + goblin_exppill_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + sell_certificate_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // target_item_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // look_info_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // upgrade_production_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // acc_storage_blacklist_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // face_hair_texture_map_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // multi_exp_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // inc_skill_ability_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // god_evil_convert_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // wedding_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // wedding_bookcard_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // wedding_invitecard_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // sharpener_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // face_thirdeye_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // faction_fortress_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // faction_building_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // faction_building_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // faction_material_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // congregate_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // engrave_major_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // engrave_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // engrave_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // npc_engrave_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // npc_randprop_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // randprop_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // randprop_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // wiki_taboo_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // force_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // force_token_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // npc_force_service_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // player_death_drop_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // dynskillequip_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // consume_points_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // online_awards_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // country_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // gm_activity_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // fashion_weapon_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // pet_evolve_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // pet_evolved_skill_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // money_convertible_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // stone_change_recipe_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // stone_change_recipe_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // meridian_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // pet_evolved_skill_rand_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // autotask_display_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // touch_shop_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // title_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // complex_title_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // monster_spirit_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // player_spirit_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // player_reincarnation_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // history_stage_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // history_advance_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // autoteam_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // player_realm_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // chariot_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // chariot_war_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // poker_levelexp_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // poker_suite_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // poker_dice_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // poker_sub_type_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // poker_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // token_shop_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // shop_token_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // gt_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // rand_shop_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // profit_time_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // faction_pvp_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // universal_token_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + + // task_list_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // task_dice_by_weight_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // fashion_suite_essence_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // fashion_best_color_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + // sign_award_config_array = AAssit.ReadArrayFromBinary(file, ref dwRead); + } + + SetupDataMap(); + + return 0; + } + + public void SetupDataMap() + { + foreach (var item in equipment_addon_array) + { + add_id_index(ID_SPACE.ID_SPACE_ADDON, item.id, DATA_TYPE.DT_EQUIPMENT_ADDON); + add_id_data(ID_SPACE.ID_SPACE_ADDON, item.id, item); + } + + foreach (var item in weapon_major_type_array) + { + add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_WEAPON_MAJOR_TYPE); + add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item); + } + + foreach (var item in weapon_sub_type_array) + { + add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_WEAPON_SUB_TYPE); + add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item); + } + + foreach (var item in npc_essence_array) + { + add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_NPC_ESSENCE); + add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item); + } + + foreach (var item in weapon_essence_array) + { + add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_WEAPON_ESSENCE); + add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item); + } + + foreach (var item in unionscroll_essence_array) + { + add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_UNIONSCROLL_ESSENCE); + add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item); + } + } + + public void SaveDataToTextFile() + { + StringBuilder sb = new(); + + // foreach (var weaponEssence in weapon_essence_array) + // { + // sb.AppendLine(weaponEssence.ToString()); + // } + // Write the StringBuilder content to a text file + // string filePath = " weapon_names.txt"; + // using (StreamWriter writer = new StreamWriter(filePath)) + // { + // writer.Write(sb.ToString()); + // writer.Close(); + // } + + + // foreach (var item in npc_type_array) + // { + // sb.AppendLine(item.ToString()); + // } + // string filePath = " NPC_INFO.txt"; + // using (StreamWriter writer = new StreamWriter(filePath)) + // { + // writer.Write(sb.ToString()); + // writer.Close(); + // } + + // foreach (var item in npc_essence_array) + // { + // sb.AppendLine($"NPC {item.Name} FILE: {item.FileModel} MSG: {item.HelloMsg}"); + // } + // string filePath = "npc_essence_hello.txt"; + // using (StreamWriter writer = new StreamWriter(filePath)) + // { + // writer.Write(sb.ToString()); + // writer.Close(); + // } + + // foreach (var item in face_hair_essence_array) + // { + // sb.AppendLine(item.ToString()); + // } + // string filePath = " face_hair_essence_array.txt"; + // using (StreamWriter writer = new StreamWriter(filePath)) + // { + // writer.Write(sb.ToString()); + // writer.Close(); + // } + + // save player_action_info_config_array to text file + sb.Clear(); + foreach (var item in player_action_info_config_array) + { + sb.AppendLine(item.ToString()); + } + string filePath = "player_action_info_config_array.txt"; + using (StreamWriter writer = new StreamWriter(filePath)) + { + writer.Write(sb.ToString()); + writer.Close(); + } + } + + void add_id_index(ID_SPACE idSpace, uint id, DATA_TYPE type) + { + switch (idSpace) + { + case ID_SPACE.ID_SPACE_ESSENCE: + essence_id_data_type_map[id] = type; + break; + + default: + break; + } + } + + void add_id_data(ID_SPACE idSpace, uint id, object data) + { + switch (idSpace) + { + case ID_SPACE.ID_SPACE_ESSENCE: + essence_id_data_map[id] = data; + break; + + default: + break; + } + } + + public DATA_TYPE get_data_type(uint id, ID_SPACE idspace) + { + switch (idspace) + { + case ID_SPACE.ID_SPACE_ESSENCE: + if (essence_id_data_type_map.TryGetValue(id, out DATA_TYPE type)) + { + return type; + } + break; + + default: + break; + } + return DATA_TYPE.DT_INVALID; + } + + public object get_data_ptr(uint id, ID_SPACE idspace) + { + switch (idspace) + { + case ID_SPACE.ID_SPACE_ESSENCE: + if (essence_id_data_map.TryGetValue(id, out object data)) + { + return data; + } + break; + + default: + return null; + } + + return null; + } + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs.meta b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs.meta new file mode 100644 index 0000000000..3db5d86bfb --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f663d3335e04a41b1bb64e834321388b \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/IAutoInitialize.cs b/Assets/PerfectWorld/Scripts/Common/IAutoInitialize.cs index d879983ebe..7c6e58e5eb 100644 --- a/Assets/PerfectWorld/Scripts/Common/IAutoInitialize.cs +++ b/Assets/PerfectWorld/Scripts/Common/IAutoInitialize.cs @@ -3,5 +3,6 @@ public interface IAutoInitialize { void Initialize(); + void Dispose(); } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/GameData.meta b/Assets/PerfectWorld/Scripts/GameData.meta new file mode 100644 index 0000000000..ffa066414c --- /dev/null +++ b/Assets/PerfectWorld/Scripts/GameData.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ffefaa73e3c3149e48a3ffd4483f8724 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs new file mode 100644 index 0000000000..a6e4127cf5 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs @@ -0,0 +1,5530 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; +using ModelRenderer.Scripts.Common; + +namespace BrewMonster +{ + public class ElementDataConstants + { + public const int ELEMENTDATA_NUM_PROFESSION = 12; // Number of professions + public const int ELEMENTDATA_NUM_POKER_TYPE = 6; // Number of poker types + public const int ELEMENTDATA_NUM_POKER_RANK = 5; // Number of poker quality ranks + public const int ELEMENTDATA_MAX_POKER_LEVEL = 100; // Maximum poker level + public const int ELEMENTDATA_MAX_UNIVERSAL_TOKEN_USAGE = 32; // Maximum universal token usage formats + public const int ELEMENTDATA_MAX_ENGRAVE_ADDON_COUNT = 3; // Maximum number of engrave add-ons + public const int ELEMENTDATA_MAX_INHERIT_ADDON_COUNT = 5; // Maximum number of inherit add-ons + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct EQUIPMENT_ADDON + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name + + public int num_params; // Number of parameters + public int param1; // Parameter 1 + public int param2; // Parameter 2 + public int param3; // Parameter 3 + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct WEAPON_MAJOR_TYPE + { + public uint id; // Weapon major type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Weapon major type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct WEAPON_SUB_TYPE + { + public uint id; // Weapon sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Weapon sub-type name + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_hitgfx; // Hit effect file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_hitsfx; // Hit sound effect file path + + public float probability_fastest; // Attack frequency probability: Fastest -0.1 + public float probability_fast; // Attack frequency probability: Fast -0.05 + public float probability_normal; // Attack frequency probability: Normal 0 + public float probability_slow; // Attack frequency probability: Slow +0.05 + public float probability_slowest; // Attack frequency probability: Slowest +0.1 + + public float attack_speed; // Attack speed (cooldown time), unit: seconds + public float attack_short_range; // Minimum attack range, for melee weapons = 0.0 + + public uint action_type; // Action type for attack animation + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct WEAPON_ESSENCE + { + // Basic information + public uint id; // Weapon ID + public uint id_major_type; // Major type ID + public uint id_sub_type; // Sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Weapon name, max 15 characters + + public uint require_projectile; // Required projectile type + + // Display information + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model_right; // Right-hand model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model_left; // Left-hand model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + // Equipment requirements + public int require_strength; // Required strength + public int require_agility; // Required agility + public int require_energy; // Required energy + public int require_tili; // Required tili + + public uint character_combo_id; // Class combo ID mask + + public int require_level; // Required level + public int require_reputation; // Required reputation + + // Weapon attributes + public int level; // Weapon level + + public int fixed_props; // Fixed properties (0~3) + + public int damage_low; // Minimum physical damage + public int damage_high_min; // Minimum of maximum physical damage range + public int damage_high_max; // Maximum of maximum physical damage range + + public int magic_damage_low; // Minimum magic damage + public int magic_damage_high_min; // Minimum of maximum magic damage range + public int magic_damage_high_max; // Maximum of maximum magic damage range + + public float attack_range; // Attack range + public uint short_range_mode; // Range mode: 0-Long, 1-Short, 2-Both + + public int durability_min; // Minimum durability + public int durability_max; // Maximum durability + + public int levelup_addon; // Level up effect + public int material_need; // Required material for upgrade + + // Money + public int price; // Base price + public int shop_price; // Shop price + + public int repairfee; // Repair fee + + // Drop rates + public float drop_probability_socket0; // Probability of 0 sockets when dropped + public float drop_probability_socket1; // Probability of 1 socket when dropped + public float drop_probability_socket2; // Probability of 2 sockets when dropped + + // Crafting rates + public float make_probability_socket0; // Probability of 0 sockets when crafted + public float make_probability_socket1; // Probability of 1 socket when crafted + public float make_probability_socket2; // Probability of 2 sockets when crafted + + // Addon probabilities + public float probability_addon_num0; // Probability of 0 addons + public float probability_addon_num1; // Probability of 1 addon + public float probability_addon_num2; // Probability of 2 addons + public float probability_addon_num3; // Probability of 3 addons + public float probability_addon_num4; // Probability of 4 addons + public float probability_addon_num5; // Probability of 5 addons + public float probability_unique; // Probability of unique addon + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct AddonInfo + { + public uint id_addon; // Addon ID + public float probability_addon; // Addon probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public AddonInfo[] addons; // Addon array + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct RandInfo + { + public uint id_rand; // Random attribute ID + public float probability_rand; // Random attribute probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public RandInfo[] rands; // Random attributes array + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct UniqueInfo + { + public uint id_unique; // Unique attribute ID + public float probability_unique; // Unique attribute probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public UniqueInfo[] uniques; // Unique attributes array + + public int durability_drop_min; // Minimum durability when dropped + public int durability_drop_max; // Maximum durability when dropped + + // Decomposition + public int decompose_price; // Decomposition price + public int decompose_time; // Decomposition time + public uint element_id; // Element ID from decomposition + public int element_num; // Element number from decomposition + + public uint id_drop_after_damaged; // ID to drop after damage + public int num_drop_after_damaged; // Number to drop after damage + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + + public override string ToString() + { + return ByteToStringUtils.UshortArrayToUnicodeString(name) + + "\n" + + ByteToStringUtils.ByteArrayToCP936String(file_model_right) + "\n" + + ByteToStringUtils.ByteArrayToCP936String(file_model_left) + "\n"; + } + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ARMOR_MAJOR_TYPE + { + public uint id; // Armor major type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Armor major type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ARMOR_SUB_TYPE + { + public uint id; // Armor sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Armor sub-type name + + public uint equip_mask; // Equipment slot mask + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ARMOR_ESSENCE + { + // Basic information + public uint id; // Armor ID + public uint id_major_type; // Major type ID + public uint id_sub_type; // Sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Armor name, max 15 characters + + public string Name => ByteToStringUtils.UshortArrayToCP936String(name); + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] realname; // Real armor name + + public string RealName => ByteToStringUtils.ByteArrayToCP936String(realname); + + // Display information + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + public string FileMatter => ByteToStringUtils.ByteArrayToCP936String(file_matter); + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public string FileIcon => ByteToStringUtils.ByteArrayToCP936String(file_icon); + + public uint equip_location; // Equipment location + + public int level; // Armor level + + // Equipment requirements + public int require_strength; // Required strength + public int require_agility; // Required agility + public int require_energy; // Required energy + public int require_tili; // Required tili + + public uint character_combo_id; // Class combo ID mask + + public int require_level; // Required level + public int require_reputation; // Required reputation + + public int fixed_props; // Fixed properties (0~3) + + // Defense attributes + public int defence_low; // Minimum physical defense + public int defence_high; // Maximum physical defense + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct MagicDefence + { + public int low; // Minimum magic defense + public int high; // Maximum magic defense + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public MagicDefence[] magic_defences; // Magic defenses for 5 elements + + public int mp_enhance_low; // Minimum MP enhancement + public int mp_enhance_high; // Maximum MP enhancement + + public int hp_enhance_low; // Minimum HP enhancement + public int hp_enhance_high; // Maximum HP enhancement + + public int armor_enhance_low; // Minimum armor enhancement + public int armor_enhance_high; // Maximum armor enhancement + + public int durability_min; // Minimum durability + public int durability_max; // Maximum durability + + public int levelup_addon; // Level up effect + public int material_need; // Required material for upgrade + + // Money + public int price; // Base price + public int shop_price; // Shop price + + public int repairfee; // Repair fee + + // Drop rates + public float drop_probability_socket0; // Probability of 0 sockets when dropped + public float drop_probability_socket1; // Probability of 1 socket when dropped + public float drop_probability_socket2; // Probability of 2 sockets when dropped + public float drop_probability_socket3; // Probability of 3 sockets when dropped + public float drop_probability_socket4; // Probability of 4 sockets when dropped + + // Crafting rates + public float make_probability_socket0; // Probability of 0 sockets when crafted + public float make_probability_socket1; // Probability of 1 socket when crafted + public float make_probability_socket2; // Probability of 2 sockets when crafted + public float make_probability_socket3; // Probability of 3 sockets when crafted + public float make_probability_socket4; // Probability of 4 sockets when crafted + + // Addon probabilities + public float probability_addon_num0; // Probability of 0 addons + public float probability_addon_num1; // Probability of 1 addon + public float probability_addon_num2; // Probability of 2 addons + public float probability_addon_num3; // Probability of 3 addons + public float probability_addon_num4; // Probability of 4 addons + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct AddonInfo + { + public uint id_addon; // Addon ID + public float probability_addon; // Addon probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public AddonInfo[] addons; // Addon array + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct RandInfo + { + public uint id_rand; // Random attribute ID + public float probability_rand; // Random attribute probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public RandInfo[] rands; // Random attributes array + + public int durability_drop_min; // Minimum durability when dropped + public int durability_drop_max; // Maximum durability when dropped + + // Decomposition + public int decompose_price; // Decomposition price + public int decompose_time; // Decomposition time + public uint element_id; // Element ID from decomposition + public int element_num; // Element number from decomposition + + public uint id_drop_after_damaged; // ID to drop after damage + public int num_drop_after_damaged; // Number to drop after damage + + public uint id_hair; // Hair model ID + public uint id_hair_texture; // Hair texture ID + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + + public uint force_all_magic_defences; // Force all magic defenses + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DECORATION_MAJOR_TYPE + { + public uint id; // Decoration major type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Decoration major type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DECORATION_SUB_TYPE + { + public uint id; // Decoration sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Decoration sub-type name + + public uint equip_mask; // Equipment slot mask + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DECORATION_ESSENCE + { + // Basic information + public uint id; // Decoration ID + public uint id_major_type; // Major type ID + public uint id_sub_type; // Sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Decoration name, max 15 characters + + // Display information + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model; // Model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int level; // Decoration level + + // Equipment requirements + public int require_strength; // Required strength + public int require_agility; // Required agility + public int require_energy; // Required energy + public int require_tili; // Required tili + + public uint character_combo_id; // Class combo ID mask + + public int require_level; // Required level + public int require_reputation; // Required reputation + + public int fixed_props; // Fixed properties (0~3) + + // Attributes + public int damage_low; // Minimum physical damage + public int damage_high; // Maximum physical damage + + public int magic_damage_low; // Minimum magic damage + public int magic_damage_high; // Maximum magic damage + + public int defence_low; // Minimum physical defense + public int defence_high; // Maximum physical defense + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct MagicDefence + { + public int low; // Minimum magic defense + public int high; // Maximum magic defense + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public MagicDefence[] magic_defences; // Magic defenses for 5 elements + + public int armor_enhance_low; // Minimum armor enhancement + public int armor_enhance_high; // Maximum armor enhancement + + public int durability_min; // Minimum durability + public int durability_max; // Maximum durability + + public int levelup_addon; // Level up effect + public int material_need; // Required material for upgrade + + // Money + public int price; // Base price + public int shop_price; // Shop price + + public int repairfee; // Repair fee + + // Addon probabilities + public float probability_addon_num0; // Probability of 0 addons + public float probability_addon_num1; // Probability of 1 addon + public float probability_addon_num2; // Probability of 2 addons + public float probability_addon_num3; // Probability of 3 addons + public float probability_addon_num4; // Probability of 4 addons + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct AddonInfo + { + public uint id_addon; // Addon ID + public float probability_addon; // Addon probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public AddonInfo[] addons; // Addon array + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct RandInfo + { + public uint id_rand; // Random attribute ID + public float probability_rand; // Random attribute probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public RandInfo[] rands; // Random attributes array + + public int durability_drop_min; // Minimum durability when dropped + public int durability_drop_max; // Maximum durability when dropped + + // Decomposition + public int decompose_price; // Decomposition price + public int decompose_time; // Decomposition time + public uint element_id; // Element ID from decomposition + public int element_num; // Element number from decomposition + + public uint id_drop_after_damaged; // ID to drop after damage + public int num_drop_after_damaged; // Number to drop after damage + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct SUITE_ESSENCE + { + // Basic information + public uint id; // Suite ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Suite name, max 15 characters + + public int max_equips; // Maximum equipment in suite + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct EquipmentInfo + { + public uint id; // Equipment ID 1~12 + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public EquipmentInfo[] equipments; // Equipment array + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct AddonInfo + { + public uint id; // Addon ID + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] + public AddonInfo[] addons; // Addon array + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_gfx; // Effect file path + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct POKER_SUITE_ESSENCE + { + // Basic information + public uint id; // Suite ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Suite name, max 15 characters + + public float promote_ratio; // Promotion ratio + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public uint[] list; // Suite list + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct POKER_DICE_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int swallow_exp; // Experience provided when consumed + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ListItem + { + public uint id; // List item ID + public float probability; // List item probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public ListItem[] list; // Item list + + public int price; // Base price + public int shop_price; // Shop price + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct POKER_SUB_TYPE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + public int type; // Type + + [StructLayout(LayoutKind.Explicit)] + public struct EquipMaskUnion + { + [FieldOffset(0)] public uint equip_mask1; // Equipment mask 1 + + [FieldOffset(4)] public uint equip_mask2; // Equipment mask 2 + + [FieldOffset(0)] public ulong equip_mask; // Combined equipment mask + } + + public EquipMaskUnion equip_mask_union; // Equipment mask union + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct POKER_ESSENCE + { + public uint id; // ID + public uint id_sub_type; // Sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_img; // Display resource path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_gfx; // Effect file path + + public int require_level; // Required level + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public int[] require_control_point; // Required control points + + public int rank; // Rank + public int max_level; // Maximum level + + public int hp; // Initial HP + public int damage; // Initial physical damage + public int magic_damage; // Initial magic damage + public int defence; // Initial defense + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public int[] magic_defence; // Initial magic defense + + public int vigour; // Initial vigor + + public int inc_hp; // HP increase per level + public int inc_damage; // Physical damage increase per level + public int inc_magic_damage; // Magic damage increase per level + public int inc_defence; // Defense increase per level + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public int[] inc_magic_defence; // Magic defense increase per level + + public int inc_vigour; // Vigor increase per level + + public int swallow_exp; // Experience provided when consumed + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public int[] addon; // Addons + + public int show_order; // Display order + + public int price; // Base price + public int shop_price; // Shop price + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FASHION_MAJOR_TYPE + { + public uint id; // Fashion major type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Fashion major type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FASHION_SUB_TYPE + { + public uint id; // Fashion sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Fashion sub-type name + + public uint equip_fashion_mask; // Fashion equipment slot mask + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FASHION_ESSENCE + { + // Basic information + public uint id; // Fashion ID + public uint id_major_type; // Major type ID + public uint id_sub_type; // Sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Fashion name, max 15 characters + + public string Name => ByteToStringUtils.UshortArrayToCP936String(name); + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] realname; // Real fashion name + + public string RealName => ByteToStringUtils.ByteArrayToUnicodeString(realname); + + // Display information + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public uint equip_location; // Equipment location + + public int level; // Fashion level + + // Equipment requirements + public int require_level; // Required level + + // Dye + public int require_dye_count; // Required dye count + + // Money + public int price; // Base price + public int shop_price; // Shop price + + // Gender + public int gender; // Usable gender: 0-Male, 1-Female + + public uint id_hair; // Hair model ID + public uint id_hair_texture; // Hair texture ID + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] wear_action; // Wear action + + public string WearAction => ByteToStringUtils.ByteArrayToUnicodeString(wear_action); + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model_right; // Right-hand model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model_left; // Left-hand model file path + + public uint character_combo_id; // Class combo ID mask + public uint action_type; // Action type + + public uint combined_switch; // Combined switch + + public float h_min; // Minimum hue + public float h_max; // Maximum hue + public float s_min; // Minimum saturation + public float s_max; // Maximum saturation + public float v_min; // Minimum value + public float v_max; // Maximum value + } + + public enum FASHION_COMBINED_SWITCH + { + FCS_RANDOM_COLOR_IN_RANGE = 0x00000001, // Random color in range + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct MEDICINE_MAJOR_TYPE + { + public uint id; // Medicine major type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Medicine major type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct MEDICINE_SUB_TYPE + { + public uint id; // Medicine sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Medicine sub-type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct MEDICINE_ESSENCE + { + public uint id; // Medicine ID + public uint id_major_type; // Medicine major type ID + public uint id_sub_type; // Medicine sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Medicine name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int require_level; // Required level + public int cool_time; // Cooldown time (seconds) + + public int hp_add_total; // Total HP recovery amount + public int hp_add_time; // HP recovery duration in seconds + public int mp_add_total; // Total MP recovery amount + public int mp_add_time; // MP recovery duration in seconds + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct BIBLE_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] + public uint[] id_addons; // 10 addon IDs + + public int price; // Base price + public int shop_price; // Shop price + + public uint id_drop_after_damaged; // ID to drop after damage + public int num_drop_after_damaged; // Number to drop after damage + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct SPEAKER_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int id_icon_set; // Icon set ID + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct AUTOHP_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int total_hp; // Total HP recovery + public float trigger_amount; // Trigger HP threshold + public int cool_time; // Cooldown time (seconds) + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct AUTOMP_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int total_mp; // Total MP recovery + public float trigger_amount; // Trigger MP threshold + public int cool_time; // Cooldown time (seconds) + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FORCE_TOKEN_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public uint require_force; // Required force + public int reputation_add; // Reputation addition + public int reputation_increase_ratio; // Reputation increase ratio (percentage) + + public int price; // Base price + public int shop_price; // Shop price + + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DYNSKILLEQUIP_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public int[] id_skill; // Skill IDs + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct MATERIAL_MAJOR_TYPE + { + public uint id; // Material major type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Material major type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct MATERIAL_SUB_TYPE + { + public uint id; // Material sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Material sub-type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct MATERIAL_ESSENCE + { + public uint id; // Material ID + public uint id_major_type; // Material major type ID + public uint id_sub_type; // Material sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Material name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int price; // Base price + public int shop_price; // Shop price + + // Decomposition + public int decompose_price; // Decomposition price + public int decompose_time; // Decomposition time + public uint element_id; // Element ID from decomposition + public int element_num; // Element number from decomposition + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct REFINE_TICKET_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public ushort[] desc; // Description + + public float ext_reserved_prob; // Extended reserved probability + public float ext_succeed_prob; // Extended success probability + + public uint fail_reserve_level; // Failure reserve level + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public float[] fail_ext_succeed_prob; // Extended success probability on failure by level + + public uint binding_only; // Only bind to one equipment + public int require_level_max; // Maximum required item level + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DOUBLE_EXP_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int double_exp_time; // Double experience time (seconds) + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DYE_TICKET_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public float h_min; // Minimum hue + public float h_max; // Maximum hue + public float s_min; // Minimum saturation + public float s_max; // Maximum saturation + public float v_min; // Minimum value + public float v_max; // Maximum value + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + + public uint usage; // Usage: 0-Normal dye for fashion, 1-Ink for signature + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DESTROYING_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DAMAGERUNE_SUB_TYPE + { + public uint id; // Damage rune sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Damage rune sub-type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DAMAGERUNE_ESSENCE + { + public uint id; // ID + public uint id_sub_type; // Damage rune sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public uint damage_type; // Damage type (0-Physical, 1-Magical) + + public int price; // Base price + public int shop_price; // Shop price + + public int require_weapon_level_min; // Minimum required weapon level + public int require_weapon_level_max; // Maximum required weapon level + + public int damage_increased; // Damage increase amount + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ARMORRUNE_SUB_TYPE + { + public uint id; // Armor rune sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Armor rune sub-type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ARMORRUNE_ESSENCE + { + public uint id; // ID + public uint id_sub_type; // Armor rune sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_gfx; // Effect file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_sfx; // Sound effect file path + + public uint damage_type; // Damage type (0-Physical, 1-Magical) + + public int price; // Base price + public int shop_price; // Shop price + + public int require_player_level_min; // Minimum required player level + public int require_player_level_max; // Maximum required player level + + public float damage_reduce_percent; // Damage reduction percentage + public int damage_reduce_time; // Damage reduction duration + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct SKILLTOME_SUB_TYPE + { + public uint id; // Skill tome sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Skill tome sub-type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct SKILLTOME_ESSENCE + { + public uint id; // ID + public uint id_sub_type; // Skill tome sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct SHOP_TOKEN_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public uint id_token_shop; // Corresponding shop + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct UNIVERSAL_TOKEN_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public uint combined_switch; // Combined switch flags, see UNIVERSAL_TOKEN_COMBINED_SWITCH + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = ElementDataConstants.ELEMENTDATA_MAX_UNIVERSAL_TOKEN_USAGE)] + public int[] config_id; // Configuration IDs + + public int price; // Base price + public int shop_price; // Shop price + + // Other info + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + public enum UNIVERSAL_TOKEN_COMBINED_SWITCH + { + UTCS_VISIT_HTTP_WITH_TOKEN = 0x00000001, // Visit HTTP with token + } + + public enum FashionSuiteItemIndex + { + FASHION_SUITE_HEAD, + FASHION_SUITE_UPPER_BODY, + FASHION_SUITE_WRIST, + FASHION_SUITE_LOWER, + FASHION_SUITE_FOOT, + FASHION_SUITE_WEAPON, + FASHION_SUITE_NUM, + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FASHION_SUITE_ESSENCE + { + // Basic information + public uint id; // Suite ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Suite name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] // Using the constant value from FashionSuiteItemIndex.FASHION_SUITE_NUM + public uint[] list; // Item ID list + + public int show_order; // Display order + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FACTION_BUILDING_SUB_TYPE + { + public uint id; // Faction building sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Faction building sub-type name + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FACTION_BUILDING_ESSENCE + { + public uint id; // ID + public uint id_sub_type; // Faction building sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int level; // Level + + public int require_level; // Required faction level + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public int[] technology; // Required technology + + public int money; // Required money + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public int[] material; // Required materials + + public int base_time; // Base construction time + public int delta_time; // Additional time per level + + public int controller_id0; // Controller ID 0 + public int controller_id1; // Controller ID 1 + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FACTION_MATERIAL_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Matter model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public int[] material_count; // Material counts + + public int price; // Base price + public int shop_price; // Shop price + + public int pile_num_max; // Maximum stack size + public uint has_guid; // Whether has GUID: 0-No, 1-Yes + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FLYSWORD_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model; // Model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model2; // Second model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Material file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int price; // Price + public int shop_price; // Shop price + + public int level; // Flying sword level + public int require_player_level_min; // Minimum player level required + + public float speed_increase_min; // Minimum speed increase + public float speed_increase_max; // Maximum speed increase + public float speed_rush_increase_min; // Minimum rush speed increase + public float speed_rush_increase_max; // Maximum rush speed increase + + public float time_max_min; // Minimum max time + public float time_max_max; // Maximum max time + + public float time_increase_per_element; // Time increase per element stone + + public uint fly_mode; // Flying mode: 0-Flying sword, 1-Dragon, 2-Flying vehicle + + public uint character_combo_id; // Character combo ID, each bit position: 0-Warrior, 1-Mage, 2-Priest, 3-?, 4-?, 5-?, 6-?, 7-?, 8-?, 9-? + + public uint id_drop_after_damaged; // Drop item ID after damage + public int num_drop_after_damaged; // Number of items dropped after damage + + public int max_improve_level; // Max improvement level + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct IMPROVE_CONFIG + { + public uint require_item_num; // Required item count + public float speed_increase; // Speed increase + public float speed_rush_increase; // Rush speed increase + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] + public IMPROVE_CONFIG[] improve_config; // Improvement config array + + public int pile_num_max; // Max stack count + public uint has_guid; // Whether item has GUID + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct WINGMANWING_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model; // Model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Material file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int price; // Price + public int shop_price; // Shop price + + public int require_player_level_min; // Minimum player level required + public float speed_increase; // Speed increase + + public int mp_launch; // MP required to launch + public int mp_per_second; // MP consumed per second + + public int pile_num_max; // Max stack count + public uint has_guid; // Whether item has GUID + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct TOWNSCROLL_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Material file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public float use_time; // Use time (seconds) + + public int price; // Price + public int shop_price; // Shop price + + public int pile_num_max; // Max stack count + public uint has_guid; // Whether item has GUID + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct TRANSMITSCROLL_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Material file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int price; // Price + public int shop_price; // Shop price + + public int pile_num_max; // Max stack count + public uint has_guid; // Whether item has GUID + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct UNIONSCROLL_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Material file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public float use_time; // Use time (seconds) + + public int price; // Price + public int shop_price; // Shop price + + public int pile_num_max; // Max stack count + public uint has_guid; // Whether item has GUID + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct REVIVESCROLL_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Material file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public float use_time; // Use time (seconds) + public int cool_time; // Cooldown time (milliseconds) + + public int price; // Price + public int shop_price; // Shop price + + public int pile_num_max; // Max stack count + public uint has_guid; // Whether item has GUID + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ELEMENT_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Material file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int level; // Element stone level + + public int price; // Price + public int shop_price; // Shop price + + public int pile_num_max; // Max stack count + public uint has_guid; // Whether item has GUID + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct MONEY_CONVERTIBLE_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Material file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int price; // Price + public int shop_price; // Shop price + + public int pile_num_max; // Max stack count + public uint has_guid; // Whether item has GUID + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct TASKMATTER_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int pile_num_max; // Max stack count + public uint has_guid; // Whether item has GUID + public uint proc_type; // Processing type + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct TASKNORMALMATTER_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // Name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // Material file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // Icon file path + + public int price; // Price + public int shop_price; // Shop price + + public int pile_num_max; // Max stack count + public uint has_guid; // Whether item has GUID + public uint proc_type; // Processing type + } + + public struct TASKDICE_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + [StructLayout(LayoutKind.Sequential)] + public struct TaskList + { + public uint id; // task id + public float probability; // probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] + public TaskList[] task_lists; + + public uint use_on_pick; // true or false + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + public int no_use_in_combat; // can't use in combat flag: 1-yes, 0-no + } + + public struct TOSSMATTER_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model; // model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_firegfx; // fire effect file + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_hitgfx; // hit effect file + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_hitsfx; // hit sound effect file + + public int require_strength; // strength requirement + public int require_agility; // agility requirement + public int require_level; // level requirement + + public int damage_low; // lower damage value + public int damage_high_min; // high damage min value + public int damage_high_max; // high damage max value + + public float use_time; // use time (seconds) + public float attack_range; // attack range + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct PROJECTILE_TYPE + { + public uint id; // projectile type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct PROJECTILE_ESSENCE + { + public uint id; // ID + public uint type; // projectile type + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model; // model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_firegfx; // fire effect file + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_hitgfx; // hit effect file + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_hitsfx; // hit sound effect file + + public int require_weapon_level_min; // minimum weapon level required + public int require_weapon_level_max; // maximum weapon level required + + public int damage_enhance; // damage enhancement + public int damage_scale_enhance; // damage scale enhancement + + public int price; // price + public int shop_price; // shop price + + public uint id_addon0; // addon ID 0 + public uint id_addon1; // addon ID 1 + public uint id_addon2; // addon ID 2 + public uint id_addon3; // addon ID 3 + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct QUIVER_SUB_TYPE + { + public uint id; // sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct QUIVER_ESSENCE + { + public uint id; // ID + public uint id_sub_type; // sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public uint id_projectile; // contained projectile type + public int num_min; // minimum number + public int num_max; // maximum number + } + + public struct STONE_SUB_TYPE + { + public uint id; // stone sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct STONE_ESSENCE + { + public uint id; // ID + public uint id_sub_type; // stone sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int level; // level + public int color; // color (0-7) + + public int price; // price + public int shop_price; // shop price + + public int install_price; // installation price + public int uninstall_price; // uninstallation price + + public uint id_addon_damage; // damage addon ID + public uint id_addon_defence; // defence addon ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public ushort[] weapon_desc; // weapon description + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public ushort[] armor_desc; // armor description + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct FACETICKET_MAJOR_TYPE + { + public uint id; // major type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct FACETICKET_SUB_TYPE + { + public uint id; // sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct FACETICKET_ESSENCE + { + public uint id; // ID + public uint id_major_type; // major type ID + public uint id_sub_type; // sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int require_level; // level requirement + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] bound_file; // binding file + + public uint unsymmetrical; // asymmetrical flag + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct FACEPILL_MAJOR_TYPE + { + public uint id; // major type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct FACEPILL_SUB_TYPE + { + public uint id; // sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct FACEPILL_ESSENCE + { + public uint id; // ID + public uint id_major_type; // major type ID + public uint id_sub_type; // sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int duration; // effect duration (seconds) + + public float camera_scale; // camera scale + + public uint character_combo_id; // profession combo ID + + [StructLayout(LayoutKind.Sequential)] + public struct PllfFile + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file; // file path + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] // ELEMENTDATA_NUM_PROFESSION * 2 + public PllfFile[] pllfiles; // profession files + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct GM_GENERATOR_TYPE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct GM_GENERATOR_ESSENCE + { + public uint id; // ID + public uint id_type; // type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public uint id_object; // object ID + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct PET_EGG_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int id_pet; // pet ID + + public int money_hatched; // hatching fee + public int money_restored; // restoration fee + + public int honor_point; // initial honor points + public int level; // initial level + public int exp; // initial experience + public int skill_point; // initial skill points + + [StructLayout(LayoutKind.Sequential)] + public struct PetSkill + { + public int id_skill; // skill ID + public int level; // skill level + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public PetSkill[] skills; // initial skills + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct PET_FOOD_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int level; // level + + public int hornor; // honor points + public int exp; // experience points + + public int food_type; // food type mask + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct PET_FACETICKET_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct FIREWORKS_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_fw; // fireworks file + + public int level; // level + + public int time_to_fire; // burning time (seconds) + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct WAR_TANKCALLIN_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct SKILLMATTER_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int level_required; // level requirement + + public int id_skill; // skill ID + public int level_skill; // skill level + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct INC_SKILL_ABILITY_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int id_skill; // skill ID + public int level_required; // skill level prerequisite + public float inc_ratio; // increase ratio + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct WEDDING_BOOKCARD_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int year; // booking year + public int month; // booking month + public int day; // booking day + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct WEDDING_INVITECARD_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct SHARPENER_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int level; // level + + public uint equip_mask; // equipment mask + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] addon; // addon IDs + + public int addon_time; // addon effect duration (seconds) + + public int gfx_index; // effect index (0~15) + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct CONGREGATE_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public uint congregate_type; // congregate type + + [StructLayout(LayoutKind.Sequential)] + public struct Area + { + public int id; // map ID + public int require_level; // level requirement + public int require_reply_level; // response level requirement + public int require_reply_level2; // additional response level requirement + public int require_reply_reincarnation_times; // reincarnation requirement + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public Area[] area; // area information + + public int price; // price + public int shop_price; // shop price + + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct MONSTER_SPIRIT_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int type; // type + public int level; // level + public int power; // power + + public int price; // price + public int shop_price; // shop price + public int pile_num_max; // max stack count + public uint has_guid; // has GUID flag: 0-no, 1-yes + public uint proc_type; // processing type + } + + public struct RECIPE_MAJOR_TYPE + { + public uint id; // major type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct RECIPE_SUB_TYPE + { + public uint id; // sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct RECIPE_ESSENCE + { + public uint id; // recipe ID + public uint id_major_type; // major type ID + public uint id_sub_type; // sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + public int recipe_level; // recipe level + + public uint id_skill; // required skill ID + public int skill_level; // required skill level + public int bind_type; // binding type + + [StructLayout(LayoutKind.Sequential)] + public struct Target + { + public uint id_to_make; // ID of the item to make + public float probability; // success probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public Target[] targets; // targets to make + + public float fail_probability; // fail probability + public int num_to_make; // number of items to make at once, default 1 + public int price; // price + public float duration; // duration to make: time in seconds + + public int exp; // experience earned per craft + public int skillpoint; // skill points earned per craft + + [StructLayout(LayoutKind.Sequential)] + public struct Material + { + public uint id; // material ID + public int num; // material count + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public Material[] materials; // required materials + + public uint id_upgrade_equip; // equipment ID to upgrade + public float upgrade_rate; // upgrade rate, default 1, range 0.01-2 + + public uint proc_type; // processing type + + public uint character_combo_id; // profession combo ID, 0 means no restriction + public float engrave_upgrade_rate; // engrave upgrade rate, default 1, range 0.01-10 + public float addon_inherit_fee_rate; // addon inheritance fee rate, range 0.01~2 + } + + public struct ENGRAVE_MAJOR_TYPE + { + public uint id; // major type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct ENGRAVE_SUB_TYPE + { + public uint id; // sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct ENGRAVE_ESSENCE + { + public uint id; // ID + public uint id_major_type; // major type ID + public uint id_sub_type; // sub-type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file path + + public int level; // level + + public uint equip_mask; // equipment mask + + public int require_level_min; // minimum level requirement + public int require_level_max; // maximum level requirement + + public int duration; // engrave duration + + [StructLayout(LayoutKind.Sequential)] + public struct Material + { + public uint id; // material ID + public int num; // material count + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public Material[] materials; // required materials + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] // ELEMENTDATA_MAX_ENGRAVE_ADDON_COUNT+1 + public float[] probability_addon_num; // addon count probability % + + [StructLayout(LayoutKind.Sequential)] + public struct Addon + { + public uint id; // addon ID + public float probability; // probability of this addon + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public Addon[] addons; // possible addons + } + + public struct RANDPROP_TYPE + { + public uint id; // type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct RANDPROP_ESSENCE + { + public uint id; // random property ID + public uint id_type; // type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + public uint id_skill; // required skill ID + public int skill_level; // required skill level + + public int money; // price + public int duration; // duration + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public uint[] equip_id; // equipment IDs + + [StructLayout(LayoutKind.Sequential)] + public struct Material + { + public uint id; // material ID + public int num; // material count + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public Material[] materials; // required materials + } + + public struct STONE_CHANGE_RECIPE_TYPE + { + public uint id; // type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + } + + public struct STONE_CHANGE_RECIPE + { + public uint id; // ID + public uint id_type; // type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + public uint id_old_stone; // old stone ID + public uint id_new_stone; // new stone ID + + public int money; // price + + [StructLayout(LayoutKind.Sequential)] + public struct Material + { + public uint id; // material ID + public int num; // material count + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public Material[] materials; // required materials + } + + public struct MONSTER_ADDON + { + public uint id; // addon ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + public int num_params; // number of parameters + public int param1; // parameter 1 + public int param2; // parameter 2 + public int param3; // parameter 3 + } + + public struct MONSTER_TYPE + { + public uint id; // type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [StructLayout(LayoutKind.Sequential)] + public struct Addon + { + public uint id_addon; // addon ID + public float probability_addon; // probability of this addon + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public Addon[] addons; // possible addons + } + + public struct MONSTER_ESSENCE + { + public uint id; // monster ID + public uint id_type; // type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 chars + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public ushort[] prop; // properties + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public ushort[] desc; // description + + public uint faction; // faction + public uint monster_faction; // monster faction + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model; // model file path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_gfx_short; // short range effect file + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_gfx_short_hit; // short range hit effect file + + public float size; // size + + public float damage_delay; // damage delay + + public uint id_strategy; // strategy ID + + public uint role_in_war; // role in war + + public int level; // level + public int show_level; // display level + public uint id_pet_egg_captured; // pet egg ID when captured + + public int life; // life value + public int defence; // defense value + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public int[] magic_defences; // magic defense values for 5 elements + + public uint immune_type; // immunity types (mask) + + public int exp; // experience + public int skillpoint; // skill points + + public int money_average; // average money + public int money_var; // money variation + + public uint short_range_mode; // short range attack mode: 1-short range, 0-long range + + public int sight_range; // sight range + + public int attack; // attack value + public int armor; // armor value + + public int damage_min; // minimum damage + public int damage_max; // maximum damage + + [StructLayout(LayoutKind.Sequential)] + public struct MagicDamage + { + public int damage_min; // minimum magic damage + public int damage_max; // maximum magic damage + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public MagicDamage[] magic_damages_ext; // magic damage for each element + + public float attack_range; // attack range + public float attack_speed; // attack speed + + public int magic_damage_min; // minimum magic damage + public int magic_damage_max; // maximum magic damage + + public uint id_skill; // skill ID + public int skill_level; // skill level + + public int hp_regenerate; // HP regeneration rate per second + + public uint aggressive_mode; // aggressive mode: 0-passive, 1-aggressive + + public uint monster_faction_ask_help; // faction that can ask for help + public uint monster_faction_can_help; // faction that can provide help + + public float aggro_range; // aggro range + public float aggro_time; // aggro time + + public uint inhabit_type; // inhabit type + public uint patroll_mode; // patrol mode + public uint stand_mode; // standing mode + + public float walk_speed; // walking speed + public float run_speed; // running speed + public float fly_speed; // flying speed + public float swim_speed; // swimming speed + + public int attack_degree; // attack degree + public int defend_degree; // defense degree + + public uint common_strategy; // common strategy + + [StructLayout(LayoutKind.Sequential)] + public struct AggroStrategy + { + public uint id; // strategy ID + public float probability; // probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public AggroStrategy[] aggro_strategy; // aggro strategies + + [StructLayout(LayoutKind.Sequential)] + public struct SkillProb + { + public uint id_skill; // skill ID + public int level; // skill level + public float probability; // probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public SkillProb[] skill_hp75; // skills to use when HP < 75% + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public SkillProb[] skill_hp50; // skills to use when HP < 50% + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public SkillProb[] skill_hp25; // skills to use when HP < 25% + + public uint after_death; // after death action + + [StructLayout(LayoutKind.Sequential)] + public struct MonsterSkill + { + public uint id_skill; // skill ID + public int level; // skill level + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public MonsterSkill[] skills; // normal skills + + public float probability_drop_num0; // probability of dropping 0 items + public float probability_drop_num1; // probability of dropping 1 item + public float probability_drop_num2; // probability of dropping 2 items + public float probability_drop_num3; // probability of dropping 3 items + public int drop_times; // drop times (1-10) + public int drop_protected; // drop protected + + [StructLayout(LayoutKind.Sequential)] + public struct DropMatter + { + public uint id; // drop item ID + public float probability; // probability + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public DropMatter[] drop_matters; // droppable items + + public uint highest_frequency; // highest frequency + public int no_accept_player_buff; // no accept player buff + + public int invisible_lvl; // invisible level + public int uninvisible_lvl; // uninvisible level + + public int no_auto_fight; // no auto fight flag + public int fixed_direction; // fixed direction flag + public uint id_building; // related building + + public uint combined_switch; // combined switch + + public int hp_adjust_common_value; // HP adjustment common value + public int defence_adjust_common_value; // defense adjustment common value + public int attack_adjust_common_value; // attack adjustment common value + + public float max_move_range; // maximum movement range + public uint drop_for_no_profit_time; // drop for no profit time + + public int drop_mine_condition_flag; // drop mine condition flag + public float drop_mine_probability; // drop mine probability + + [StructLayout(LayoutKind.Sequential)] + public struct DropMine + { + public uint id; // mine ID + public float probability; // probability + public int life; // life duration (seconds) + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public DropMine[] drop_mines; // droppable mines + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public ushort[] label; // label + + public uint domain_related; // domain related flag + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] local_var; // local variable initial values + } + + public enum MONSTER_COMBINED_SWITCH + { + MCS_SUMMONER_ATTACK_ONLY = 0x00000001, // Only attack summoner + MCS_FORBID_SELECTION = 0x00000002, // Forbid selection + MCS_HIDE_IMMUNE = 0x00000004, // Hide immune status + MCS_RECORD_DPS_RANK = 0x00000008, // Record DPS rank + } + + public struct PET_TYPE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + } + +// Pet essence structure + public struct PET_ESSENCE + { + public uint id; // ID + public uint id_type; // Type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model; // model path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file + + public uint character_combo_id; // character combo id + + public int level_max; // max level + public int level_require; // required level + + public uint pet_snd_type; // pet sound type + + // Coefficients for level-related attributes + public float hp_a; // hp coefficient A + public float hp_b; // hp coefficient B + public float hp_c; // hp coefficient C + + public float hp_gen_a; // hp generation coefficient A + public float hp_gen_b; // hp generation coefficient B + public float hp_gen_c; // hp generation coefficient C + + public float damage_a; // damage coefficient A + public float damage_b; // damage coefficient B + public float damage_c; // damage coefficient C + public float damage_d; // damage coefficient D + + public float speed_a; // speed coefficient A + public float speed_b; // speed coefficient B + + public float attack_a; // attack coefficient A + public float attack_b; // attack coefficient B + public float attack_c; // attack coefficient C + + public float armor_a; // armor coefficient A + public float armor_b; // armor coefficient B + public float armor_c; // armor coefficient C + + public float physic_defence_a; // physical defense coefficient A + public float physic_defence_b; // physical defense coefficient B + public float physic_defence_c; // physical defense coefficient C + public float physic_defence_d; // physical defense coefficient D + + public float magic_defence_a; // magic defense coefficient A + public float magic_defence_b; // magic defense coefficient B + public float magic_defence_c; // magic defense coefficient C + public float magic_defence_d; // magic defense coefficient D + + public float mp_a; // mp coefficient A + public float mp_gen_a; // mp generation coefficient A + public float attack_degree_a; // attack degree coefficient A + public float defence_degree_a; // defense degree coefficient A + + // Fixed values + public float size; // size + public float damage_delay; // damage response delay time + public float attack_range; // attack distance + public float attack_speed; // attack speed + public int sight_range; // sight range + + public uint food_mask; // food type mask + + public uint inhabit_type; // habitat type + public uint stand_mode; // standing mode + + public uint plant_group; // plant group + public int group_limit; // plant group limit + + public uint immune_type; // immunity type mask + + public int player_gain_skill; // player gain skill + public int require_dye_count; // required dye count + + public uint id_pet_egg_evolved; // evolved pet egg ID + public int cost_index; // cost index + + public int hp_inherit_max_rate; // hp inheritance max rate (0~100) + public int attack_inherit_max_rate; // attack inheritance max rate (0~100) + public int defence_inherit_max_rate; // defense inheritance max rate (0~100) + public int attack_level_inherit_max_rate; // attack level inheritance max rate (0~100) + public int defence_level_inherit_max_rate; // defense level inheritance max rate (0~100) + public int specific_skill; // specific skill + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_gfx_short; // short effect file path + + public uint id_evolved_skill_rand; // evolved skill random ID + + public uint combined_switch; // combined switch, see PET_COMBINED_SWITCH + } + + public enum PET_COMBINED_SWITCH + { + PCS_USE_MASTER_MODEL = 0x00000001, // Use master model + PCS_FORBID_SELECTION = 0x00000002, // Forbid selection + PCS_HIDE_IMMUNE = 0x00000004, // Hide immune in header + PCS_HIDE_NAME = 0x00000008, // Hide name in header + } + +// Goblin essence + public struct GOBLIN_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model1; // state 1 model file + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model2; // state 2 model file + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model3; // state 3 model file + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model4; // state 4 model file + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter model path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon1; // state 1 icon path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon2; // state 2 icon path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon3; // state 3 icon path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon4; // state 4 icon path + + public float exp_factor; // experience factor + public int init_strength; // initial strength + public int init_agility; // initial agility + public int init_energy; // initial energy + public int init_tili; // initial tili + public int max_refine_lvl; // max refine level + + public int price; // price + public int shop_price; // shop price + + public int default_skill1; // default skill 1 + public int default_skill2; // default skill 2 + public int default_skill3; // default skill 3 + + [StructLayout(LayoutKind.Sequential)] + public struct RandProp + { + public int rand_num; // random number + public float rand_rate; // random rate + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] + public RandProp[] rand_prop; // random properties + + // Stack info + public int pile_num_max; // max stack number + + // GUID info + public uint has_guid; // has GUID or not, 0-no, 1-yes + + // Processing type + public uint proc_type; // processing type + } + +// Goblin equipment type + public struct GOBLIN_EQUIP_TYPE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + } + +// Goblin equipment essence + public struct GOBLIN_EQUIP_ESSENCE + { + public uint id; // ID + public uint id_type; // Type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model; // model path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon file + + public int equip_type; // equipment type, 0-armor, 1-weapon, 2-shield, 3-hat + public int req_goblin_level; // required goblin level + public int strength; // strength + public int agility; // agility + public int energy; // energy + public int tili; // tili + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public int[] magic; // magic attributes + + public int price; // price + public int shop_price; // shop price + + // Stack info + public int pile_num_max; // max stack number + + // GUID info + public uint has_guid; // has GUID or not, 0-no, 1-yes + + // Processing type + public uint proc_type; // processing type + } + +// Goblin experience pill essence + public struct GOBLIN_EXPPILL_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter model path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon path + + public uint exp; // experience points + public int level; // level + + public int price; // price + public int shop_price; // shop price + + // Stack info + public int pile_num_max; // max stack number + + // GUID info + public uint has_guid; // has GUID or not, 0-no, 1-yes + + // Processing type + public uint proc_type; // processing type + } + +// Sell certificate essence + public struct SELL_CERTIFICATE_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] show_model; // display model path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter model path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon path + + public uint num_sell_item; // number of items to sell + public uint num_buy_item; // number of items to buy + + public uint max_name_length; // max name length + + public int price; // price + public int shop_price; // shop price + + // Stack info + public int pile_num_max; // max stack number + + // GUID info + public uint has_guid; // has GUID or not, 0-no, 1-yes + + // Processing type + public uint proc_type; // processing type + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] name_image; // name image path + } + +// Target item essence + public struct TARGET_ITEM_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter model path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon path + + public int num_use_pertime; // number of items used per time, 0 means infinite, 1 means 1 item + + public int num_area; // number of use areas, 0-10 + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] + public int[] area_id; // area IDs for use + + public uint id_skill; // skill ID + public int skill_level; // skill level + + public int use_in_combat; // usable in combat, 1-yes, 0-no + public int price; // price + public int shop_price; // shop price + + // Stack info + public int pile_num_max; // max stack number + + // GUID info + public uint has_guid; // has GUID or not, 0-no, 1-yes + + // Processing type + public uint proc_type; // processing type + + public uint use_in_sanctuary_only; // use only in sanctuary, 0-no, 1-yes + + public uint combined_switch; // combined switch, see TARGET_ITEM_COMBINED_SWITCH + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public int[] target_id_for_pop; // target IDs for popup display, 0 means none + + public uint target_faction; // target faction filter + public int require_level; // required level + } + + public enum TARGET_ITEM_COMBINED_SWITCH + { + TICS_CAN_POP = 0x00000001, // Can popup display for use + TICS_TARGET_MY_FACTION_OBJECT = 0x00000002, // Only target objects in my faction + } + +// Look info essence + public struct LOOK_INFO_ESSENCE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_matter; // matter model path + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_icon; // icon path + + public int price; // price + public int shop_price; // shop price + + // Stack info + public int pile_num_max; // max stack number + + // GUID info + public uint has_guid; // has GUID or not, 0-no, 1-yes + + // Processing type + public uint proc_type; // processing type + } + +// NPC Talk Service + public struct NPC_TALK_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public uint id_dialog; // dialog ID + } + +// NPC Sell Service + public struct NPC_SELL_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [StructLayout(LayoutKind.Sequential)] + public struct SellGood + { + public uint id; // item ID + public int contrib_cost; // contribution cost + public int force_contribution_cost; // force contribution cost + } + + [StructLayout(LayoutKind.Sequential)] + public struct SellPage + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public ushort[] page_title; // page title, max 7 characters + + public int require_contrib; // required contribution + + public uint require_force; // required force + public int require_force_reputation; // required force reputation + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public SellGood[] goods; // goods list + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public SellPage[] pages; // pages + + public uint id_dialog; // dialog ID + } + +// NPC Buy Service + public struct NPC_BUY_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public uint id_dialog; // dialog ID + } + +// NPC Repair Service + public struct NPC_REPAIR_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public uint id_dialog; // dialog ID + } + +// NPC Install Service + public struct NPC_INSTALL_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public uint[] id_goods; // goods list for installation + + public uint id_dialog; // dialog ID + } + +// NPC Uninstall Service + public struct NPC_UNINSTALL_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public uint[] id_goods; // goods list for uninstallation + + public uint id_dialog; // dialog ID + } + +// NPC Task Out Service + public struct NPC_TASK_OUT_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public uint storage_id; // storage ID + public uint storage_open_item; // storage open item + public uint storage_refresh_item; // storage refresh item + public int storage_refresh_per_day; // storage refresh per day + public int storage_refresh_count_min; // min count of items refreshed each time + public int storage_refresh_count_max; // max count of items refreshed each time + public int storage_deliver_per_day; // storage deliveries per day, 0-255 + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public uint[] id_tasks; // task list + + public uint storage_refresh_on_crossserver; // refresh storage on cross-server + } + +// NPC Task In Service + public struct NPC_TASK_IN_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public uint[] id_tasks; // task list + } + +// NPC Task Matter Service + public struct NPC_TASK_MATTER_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [StructLayout(LayoutKind.Sequential)] + public struct TaskMatter + { + public uint id_matter; // matter ID + public int num_matter; // number of matter + } + + [StructLayout(LayoutKind.Sequential)] + public struct Task + { + public uint id_task; // task ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public TaskMatter[] taks_matters; // task matters + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public Task[] tasks; // tasks + } + +// NPC Skill Service + public struct NPC_SKILL_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public uint[] id_skills; // skill list + + public uint id_dialog; // dialog ID + } + +// NPC Heal Service + public struct NPC_HEAL_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public uint id_dialog; // dialog ID + } + +// NPC Transmit Service + public struct NPC_TRANSMIT_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public int num_targets; // number of targets + + [StructLayout(LayoutKind.Sequential)] + public struct Target + { + public int idTarget; // target ID + public int fee; // fee + public int required_level; // required level + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public Target[] targets; // targets + + public uint id_dialog; // dialog ID + } + +// NPC Transport Service + public struct NPC_TRANSPORT_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [StructLayout(LayoutKind.Sequential)] + public struct Route + { + public uint id; // route ID + public uint fee; // fee + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public Route[] routes; // routes + + public uint id_dialog; // dialog ID + } + +// NPC Proxy Service + public struct NPC_PROXY_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public uint id_dialog; // dialog ID + } + +// NPC Storage Service + public struct NPC_STORAGE_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + } + +// NPC Make Service + public struct NPC_MAKE_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public uint id_make_skill; // make skill ID + public int produce_type; // production type, 0-normal, 1-synthesis, 2-decomposition, 3-item making, 4-preset making, 5-special making + + [StructLayout(LayoutKind.Sequential)] + public struct Page + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public ushort[] page_title; // page title, max 7 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public uint[] id_goods; // goods list for making + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public Page[] pages; // pages + } + +// NPC Decompose Service + public struct NPC_DECOMPOSE_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public uint id_decompose_skill; // decompose skill ID + } + +// NPC Identify Service + public struct NPC_IDENTIFY_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public int fee; // fee + } + +// NPC War Tower Build Service + public struct NPC_WAR_TOWERBUILD_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [StructLayout(LayoutKind.Sequential)] + public struct BuildInfo + { + public int id_in_build; // ID in build + public int id_buildup; // build up ID + public int id_object_need; // required object + public int time_use; // time to use + public int fee; // fee + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public BuildInfo[] build_info; // build info + } + + // NPC Reset Property Service + public struct NPC_RESETPROP_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [StructLayout(LayoutKind.Sequential)] + public struct PropEntry + { + public int id_object_need; // required object + public int strength_delta; // strength change + public int agility_delta; // agility change + public int vital_delta; // vital change + public int energy_delta; // energy change + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] + public PropEntry[] prop_entry; // property entries + } + +// NPC Pet Name Service + public struct NPC_PETNAME_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public int id_object_need; // required object + public int price; // required money + } + +// NPC Pet Learn Skill Service + public struct NPC_PETLEARNSKILL_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public uint[] id_skills; // skill list + + public uint id_dialog; // dialog ID + } + +// NPC Pet Forget Skill Service + public struct NPC_PETFORGETSKILL_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public int id_object_need; // required object + public int price; // required money + } + +// NPC Equipment Bind Service + public struct NPC_EQUIPBIND_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public int[] id_object_need; // required objects + + public int price; // required money + + public uint bind_type; // bind type (ITEM_BIND_TYPE) + } + + public enum ITEM_BIND_TYPE + { + ITEM_BIND_DEFAULT = 0x0, // Default binding + ITEM_BIND_WEBTRADE = 0x1, // Web trade binding + } + +// NPC Equipment Destroy Service + public struct NPC_EQUIPDESTROY_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public int id_object_need; // required object + public int price; // required money + } + +// NPC Equipment Undestroy Service + public struct NPC_EQUIPUNDESTROY_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public int id_object_need; // required object + public int price; // required money + } + +// NPC Engrave Service + public struct NPC_ENGRAVE_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public uint[] id_engrave; // engrave models + } + +// NPC Random Property Service + public struct NPC_RANDPROP_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + [StructLayout(LayoutKind.Sequential)] + public struct Page + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] page_title; // page title + + public uint id_recipe; // recipe ID + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public Page[] pages; // pages + } + +// NPC Force Service + public struct NPC_FORCE_SERVICE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public uint force_id; // force ID + } + +// NPC Type + public struct NPC_TYPE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public override string ToString() + { + return $"{id}: {ByteToStringUtils.UshortArrayToUnicodeString(name)}"; + } + } + +// NPC Essence + public struct NPC_ESSENCE + { + public uint id; // NPC ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public string Name { get { return ByteToStringUtils.UshortArrayToUnicodeString(name); } } + + public uint id_type; // NPC type, select from NPC_TYPE + + public float refresh_time; // refresh time + + public uint attack_rule; // attack rule: 0-cannot be attacked, 1-can be attacked in combat mode, 2-can be attacked in action mode + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model; // model path + + public string FileModel { get { return ByteToStringUtils.ByteArrayToCP936String(file_model); } } + + public float tax_rate; // tax rate, default 0.05 + + public uint id_src_monster; // source monster ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public ushort[] hello_msg; // greeting message + + public string HelloMsg { get { return ByteToStringUtils.UshortArrayToUnicodeString(hello_msg); } } + + public uint id_to_discover; // discovery ID + + public uint domain_related; // domain related: 0-no, 1-yes + + // Service list + public uint id_talk_service; // talk service ID + public uint id_sell_service; // sell service ID + public uint id_buy_service; // buy service ID + public uint id_repair_service; // repair service ID + public uint id_install_service; // install service ID + public uint id_uninstall_service; // uninstall service ID + public uint id_task_out_service; // task out service ID + public uint id_task_in_service; // task in service ID + public uint id_task_matter_service; // task matter service ID + public uint id_skill_service; // skill service ID + public uint id_heal_service; // heal service ID + public uint id_transmit_service; // transmit service ID + public uint id_transport_service; // transport service ID + public uint id_proxy_service; // proxy service ID + public uint id_storage_service; // storage service ID + public uint id_make_service; // make service ID + public uint id_decompose_service; // decompose service ID + public uint id_identify_service; // identify service ID + public uint id_war_towerbuild_service; // war tower build service ID + public uint id_resetprop_service; // reset property service ID + public uint id_petname_service; // pet name service ID + public uint id_petlearnskill_service; // pet learn skill service ID + public uint id_petforgetskill_service; // pet forget skill service ID + public uint id_equipbind_service; // equipment bind service ID + public uint id_equipdestroy_service; // equipment destroy service ID + public uint id_equipundestroy_service; // equipment undestroy service ID + public uint id_goblin_skill_service; // goblin skill service ID + public uint combined_services; // combined services mask + public uint id_mine; // mine ID + public uint no_collision; // no collision with NPC + public uint id_engrave_service; // engrave service ID + public uint id_randprop_service; // random property service ID + public uint combined_services2; // combined services mask 2 + public uint id_force_service; // force service ID + public uint combined_switch; // combined switch, see NPC_COMBINED_SWITCH + } + + public enum NPC_COMBINED_SWITCH + { + NCS_IGNORE_DISTANCE_CHECK = 0x00000001, // Ignore distance check + } + + // Mine Type + public struct MINE_TYPE + { + public uint id; // ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + } + +// Mine Essence + public struct MINE_ESSENCE + { + public uint id; // ID + public uint id_type; // Type ID + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; // name, max 15 characters + + public uint level; // level + public uint level_required; // required level + public uint id_equipment_required; // required equipment + public uint eliminate_tool; // eliminate tool (true or false) + public uint time_min; // minimum time (seconds) + public uint time_max; // maximum time (seconds) + + public int exp; // experience gained per mining + public int skillpoint; // skill points gained per mining + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] file_model; // model path + + [StructLayout(LayoutKind.Sequential)] + public struct Material + { + public uint id; // material ID + public float probability; // probability (sum = 1) + public int life; // life time (seconds) + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public Material[] materials; // materials + + public int num1; // material count 1 + public float probability1; // probability 1 + public int num2; // material count 2 + public float probability2; // probability 2 + + public uint task_in; // required task ID + public uint task_out; // completed task ID + + public uint uninterruptable; // uninterruptable flag + + [StructLayout(LayoutKind.Sequential)] + public struct NpcGen + { + public uint id_monster; // monster ID + public int num; // monster count + public float radius; // spawn radius + public int life_time; // life time (seconds) + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public NpcGen[] npcgen; // NPC generators + + [StructLayout(LayoutKind.Sequential)] + public struct Aggro + { + public uint monster_faction; // monster faction + public float radius; // radius + public int num; // count + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] + public Aggro[] aggros; // aggros + + public uint permenent; // permanent flag + + public uint combined_switch; // combined switch, see MINE_COMBINED_SWITCH + + public int max_gatherer; // max simultaneous gatherers + public int mine_type; // mine type (0: default, 1: mine type) + public float gather_dist; // gather distance + public float material_gain_ratio; // material gain ratio + + public uint gather_start_action_config; // gather start action config ID + public uint gather_loop_action_config; // gather loop action config ID + } + + public enum MINE_COMBINED_SWITCH + { + MCS_MINE_BELONG_TO_SOMEONE = 0x00000001, // Mine belongs to someone + MCS_MINE_BROADCAST_ON_GAIN = 0x00000002, // Broadcast on gain + } + +// Talk Procedure + public struct talk_proc + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] + public ushort[] text; // talk text, max 63 characters + + public string Text { get { return ByteToStringUtils.UshortArrayToCP936String(text); } } + + [StructLayout(LayoutKind.Sequential)] + public struct option + { + public uint id; // option ID, highest bit 1 means predefined procedure, 0 means direct talk + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] + public ushort[] text; // option text, max 63 characters + + public string Text { get { return ByteToStringUtils.UshortArrayToUnicodeString(text); } } + + public uint param; // option parameter + } + + [StructLayout(LayoutKind.Sequential)] + public struct window + { + public int id; // window ID, starts from 1 + public int id_parent; // parent window ID, -1 means no parent + + public int talk_text_len; // talk text length + public ushort[] talk_text; // talk text pointer + + public int num_option; // number of options + public option[] options; // options pointer + + public void Read(FileStream file) + { + long dwRead = file.Position; + id = AAssit.GetIntFromFileStream(file, ref dwRead); + id_parent = AAssit.GetIntFromFileStream(file, ref dwRead); + talk_text_len = AAssit.GetIntFromFileStream(file, ref dwRead); + talk_text = AAssit.ReadArrayFromBinary(file, talk_text_len, ref dwRead); + num_option = AAssit.GetIntFromFileStream(file, ref dwRead); + options = AAssit.ReadArrayFromBinary