Merge branch 'develop' into feature/inventory

This commit is contained in:
HungDK
2025-09-13 15:07:21 +07:00
19 changed files with 7223 additions and 130 deletions
@@ -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"
}
}
}
Binary file not shown.
@@ -1,4 +1,5 @@
using System;
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
@@ -6,9 +7,21 @@ namespace BrewMonster
{
public class AutoInitializer : MonoBehaviour
{
private List<IAutoInitialize> _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)
{
@@ -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);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 88f3ebc7691e645f6a19f5f6c712d2c5
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fb577bf0f012e483c822630365667cd4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -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<T>(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<T>(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<T>(stream, ref readBytes, fileOffset);
}
return array;
}
public static T[] ReadArrayFromBinary<T>(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<T>(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);
}
/// <summary>
/// Get the substring after <paramref name="tag"/> if <paramref name="buffer"/> starts with <paramref name="tag"/>.
/// </summary>
/// <param name="buffer">The full string to check.</param>
/// <param name="tag">The tag string to look for at the beginning of <paramref name="buffer"/>.</param>
/// <param name="result">
/// Outputs the substring of <paramref name="buffer"/> that appears immediately after <paramref name="tag"/>,
/// if <paramref name="buffer"/> does indeed start with <paramref name="tag"/>.
/// </param>
/// <returns>
/// True if <paramref name="buffer"/> starts with <paramref name="tag"/>; false otherwise.
/// </returns>
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;
}
/// <summary>
/// Reads a string from a binary stream at the position indicated by <paramref name="readBytes"/>.
/// 1) Seeks to <paramref name="readBytes"/> 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 <paramref name="readBytes"/> to the new position after reading.
/// </summary>
/// <param name="stream">The stream from which to read.</param>
/// <param name="readBytes">
/// 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.
/// </param>
/// <param name="result">Outputs the decoded string.</param>
/// <returns>True if successful; otherwise false (e.g., not enough data).</returns>
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;
}
/// <summary>
/// Reads a null-terminated string from <paramref name="stream"/>, starting at <paramref name="fileOffset"/>.
/// - Seeks to <paramref name="fileOffset"/> in the file.
/// - Reads one byte at a time until encountering a null (0x00) or reaching <paramref name="bufferLength"/> - 1.
/// - Decodes the collected bytes using the specified <paramref name="encoding"/>.
/// - Appends how many bytes it actually read to <paramref name="alreadyReadBytes"/>.
///
/// Returns true on success (string in <paramref name="result"/>), or false if an error occurs
/// (EOF, buffer overflow, etc.).
/// </summary>
/// <param name="stream">Open, readable <see cref="Stream"/>.</param>
/// <param name="fileOffset">Absolute offset in the file to seek before reading.</param>
/// <param name="bufferLength">Maximum number of characters to collect (like the C++ dwBufferLength).</param>
/// <param name="alreadyReadBytes">Accumulates how many bytes we've read so far across calls.</param>
/// <param name="encoding">Encoding used to interpret the raw bytes (e.g. <see cref="Encoding.ASCII"/>).</param>
/// <param name="result">Outputs the decoded string (excluding the null terminator).</param>
/// <returns>True if a string was successfully read, false otherwise.</returns>
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;
}
/// <summary>
/// Reads up to <paramref name="maxLength"/> - 1 characters from <paramref name="stream"/>,
/// stopping at newline or EOF. Returns the line (including the newline) or null if no bytes were read.
/// </summary>
/// <param name="stream">An open readable Stream.</param>
/// <param name="maxLength">
/// 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.
/// </param>
/// <param name="encoding">The character encoding (ASCII, UTF8, etc.).</param>
/// <returns>A string containing the line, or null if no data was read.</returns>
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;
}
}
/// <summary>
/// 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.
/// </summary>
/// <param name="texture">The Texture2D to save as PNG</param>
/// <param name="absolutePath">The absolute file path where to save the PNG</param>
/// <returns>True if file already exists or was successfully saved, false on error</returns>
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;
}
}
/// <summary>
/// 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.
/// </summary>
/// <param name="buffer"></param>
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;
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a80dd3d13d411402590a158039cb737c
@@ -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;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 63743217e486c458c898f68ece49e459
@@ -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<uint, DATA_TYPE> essence_id_data_type_map = new Dictionary<uint, DATA_TYPE>();
public Dictionary<uint, object> essence_id_data_map = new Dictionary<uint, object>();
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<EQUIPMENT_ADDON>(file, ref dwRead);
// if(weapon_major_type_array.load(file) != 0) return -1;
weapon_major_type_array = AAssit.ReadArrayFromBinary<WEAPON_MAJOR_TYPE>(file, ref dwRead);
// if(weapon_sub_type_array.load(file) != 0) return -1;
weapon_sub_type_array = AAssit.ReadArrayFromBinary<WEAPON_SUB_TYPE>(file, ref dwRead);
// if(weapon_essence_array.load(file) != 0) return -1;
weapon_essence_array = AAssit.ReadArrayFromBinary<WEAPON_ESSENCE>(file, ref dwRead);
// if(armor_major_type_array.load(file) != 0) return -1;
armor_major_type_array = AAssit.ReadArrayFromBinary<ARMOR_MAJOR_TYPE>(file, ref dwRead);
// if(armor_sub_type_array.load(file) != 0) return -1;
armor_sub_type_array = AAssit.ReadArrayFromBinary<ARMOR_SUB_TYPE>(file, ref dwRead);
// if(armor_essence_array.load(file) != 0) return -1;
armor_essence_array = AAssit.ReadArrayFromBinary<ARMOR_ESSENCE>(file, ref dwRead);
// if(decoration_major_type_array.load(file) != 0) return -1;
decoration_major_type_array = AAssit.ReadArrayFromBinary<DECORATION_MAJOR_TYPE>(file, ref dwRead);
// if(decoration_sub_type_array.load(file) != 0) return -1;
decoration_sub_type_array = AAssit.ReadArrayFromBinary<DECORATION_SUB_TYPE>(file, ref dwRead);
// if(decoration_essence_array.load(file) != 0) return -1;
decoration_essence_array = AAssit.ReadArrayFromBinary<DECORATION_ESSENCE>(file, ref dwRead);
medicine_major_type_array = AAssit.ReadArrayFromBinary<MEDICINE_MAJOR_TYPE>(file, ref dwRead);
medicine_sub_type_array = AAssit.ReadArrayFromBinary<MEDICINE_SUB_TYPE>(file, ref dwRead);
medicine_essence_array = AAssit.ReadArrayFromBinary<MEDICINE_ESSENCE>(file, ref dwRead);
material_major_type_array = AAssit.ReadArrayFromBinary<MATERIAL_MAJOR_TYPE>(file, ref dwRead);
material_sub_type_array = AAssit.ReadArrayFromBinary<MATERIAL_SUB_TYPE>(file, ref dwRead);
material_essence_array = AAssit.ReadArrayFromBinary<MATERIAL_ESSENCE>(file, ref dwRead);
damagerune_sub_type_array = AAssit.ReadArrayFromBinary<DAMAGERUNE_SUB_TYPE>(file, ref dwRead);
damagerune_essence_array = AAssit.ReadArrayFromBinary<DAMAGERUNE_ESSENCE>(file, ref dwRead);
armorrune_sub_type_array = AAssit.ReadArrayFromBinary<ARMORRUNE_SUB_TYPE>(file, ref dwRead);
armorrune_essence_array = AAssit.ReadArrayFromBinary<ARMORRUNE_ESSENCE>(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<SKILLTOME_SUB_TYPE>(file, ref dwRead);
skilltome_essence_array = AAssit.ReadArrayFromBinary<SKILLTOME_ESSENCE>(file, ref dwRead);
flysword_essence_array = AAssit.ReadArrayFromBinary<FLYSWORD_ESSENCE>(file, ref dwRead);
wingmanwing_essence_array = AAssit.ReadArrayFromBinary<WINGMANWING_ESSENCE>(file, ref dwRead);
townscroll_essence_array = AAssit.ReadArrayFromBinary<TOWNSCROLL_ESSENCE>(file, ref dwRead);
unionscroll_essence_array = AAssit.ReadArrayFromBinary<UNIONSCROLL_ESSENCE>(file, ref dwRead);
revivescroll_essence_array = AAssit.ReadArrayFromBinary<REVIVESCROLL_ESSENCE>(file, ref dwRead);
element_essence_array = AAssit.ReadArrayFromBinary<ELEMENT_ESSENCE>(file, ref dwRead);
taskmatter_essence_array = AAssit.ReadArrayFromBinary<TASKMATTER_ESSENCE>(file, ref dwRead);
tossmatter_essence_array = AAssit.ReadArrayFromBinary<TOSSMATTER_ESSENCE>(file, ref dwRead);
projectile_type_array = AAssit.ReadArrayFromBinary<PROJECTILE_TYPE>(file, ref dwRead);
projectile_essence_array = AAssit.ReadArrayFromBinary<PROJECTILE_ESSENCE>(file, ref dwRead);
quiver_sub_type_array = AAssit.ReadArrayFromBinary<QUIVER_SUB_TYPE>(file, ref dwRead);
quiver_essence_array = AAssit.ReadArrayFromBinary<QUIVER_ESSENCE>(file, ref dwRead);
stone_sub_type_array = AAssit.ReadArrayFromBinary<STONE_SUB_TYPE>(file, ref dwRead);
stone_essence_array = AAssit.ReadArrayFromBinary<STONE_ESSENCE>(file, ref dwRead);
monster_addon_array = AAssit.ReadArrayFromBinary<MONSTER_ADDON>(file, ref dwRead);
monster_type_array = AAssit.ReadArrayFromBinary<MONSTER_TYPE>(file, ref dwRead);
monster_essence_array = AAssit.ReadArrayFromBinary<MONSTER_ESSENCE>(file, ref dwRead);
npc_talk_service_array = AAssit.ReadArrayFromBinary<NPC_TALK_SERVICE>(file, ref dwRead);
npc_sell_service_array = AAssit.ReadArrayFromBinary<NPC_SELL_SERVICE>(file, ref dwRead);
npc_buy_service_array = AAssit.ReadArrayFromBinary<NPC_BUY_SERVICE>(file, ref dwRead);
npc_repair_service_array = AAssit.ReadArrayFromBinary<NPC_REPAIR_SERVICE>(file, ref dwRead);
npc_install_service_array = AAssit.ReadArrayFromBinary<NPC_INSTALL_SERVICE>(file, ref dwRead);
npc_uninstall_service_array = AAssit.ReadArrayFromBinary<NPC_UNINSTALL_SERVICE>(file, ref dwRead);
npc_task_in_service_array = AAssit.ReadArrayFromBinary<NPC_TASK_IN_SERVICE>(file, ref dwRead);
npc_task_out_service_array = AAssit.ReadArrayFromBinary<NPC_TASK_OUT_SERVICE>(file, ref dwRead);
npc_task_matter_service_array = AAssit.ReadArrayFromBinary<NPC_TASK_MATTER_SERVICE>(file, ref dwRead);
npc_skill_service_array = AAssit.ReadArrayFromBinary<NPC_SKILL_SERVICE>(file, ref dwRead);
npc_heal_service_array = AAssit.ReadArrayFromBinary<NPC_HEAL_SERVICE>(file, ref dwRead);
npc_transmit_service_array = AAssit.ReadArrayFromBinary<NPC_TRANSMIT_SERVICE>(file, ref dwRead);
npc_transport_service_array = AAssit.ReadArrayFromBinary<NPC_TRANSPORT_SERVICE>(file, ref dwRead);
npc_proxy_service_array = AAssit.ReadArrayFromBinary<NPC_PROXY_SERVICE>(file, ref dwRead);
npc_storage_service_array = AAssit.ReadArrayFromBinary<NPC_STORAGE_SERVICE>(file, ref dwRead);
npc_make_service_array = AAssit.ReadArrayFromBinary<NPC_MAKE_SERVICE>(file, ref dwRead);
npc_decompose_service_array = AAssit.ReadArrayFromBinary<NPC_DECOMPOSE_SERVICE>(file, ref dwRead);
npc_type_array = AAssit.ReadArrayFromBinary<NPC_TYPE>(file, ref dwRead);
npc_essence_array = AAssit.ReadArrayFromBinary<NPC_ESSENCE>(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<FACE_TEXTURE_ESSENCE>(file, ref dwRead);
face_shape_essence_array = AAssit.ReadArrayFromBinary<FACE_SHAPE_ESSENCE>(file, ref dwRead);
face_emotion_type_array = AAssit.ReadArrayFromBinary<FACE_EMOTION_TYPE>(file, ref dwRead);
face_expression_essence_array = AAssit.ReadArrayFromBinary<FACE_EXPRESSION_ESSENCE>(file, ref dwRead);
face_hair_essence_array = AAssit.ReadArrayFromBinary<FACE_HAIR_ESSENCE>(file, ref dwRead);
face_moustache_essence_array = AAssit.ReadArrayFromBinary<FACE_MOUSTACHE_ESSENCE>(file, ref dwRead);
colorpicker_essence_array = AAssit.ReadArrayFromBinary<COLORPICKER_ESSENCE>(file, ref dwRead);
customizedata_essence_array = AAssit.ReadArrayFromBinary<CUSTOMIZEDATA_ESSENCE>(file, ref dwRead);
recipe_major_type_array = AAssit.ReadArrayFromBinary<RECIPE_MAJOR_TYPE>(file, ref dwRead);
recipe_sub_type_array = AAssit.ReadArrayFromBinary<RECIPE_SUB_TYPE>(file, ref dwRead);
recipe_essence_array = AAssit.ReadArrayFromBinary<RECIPE_ESSENCE>(file, ref dwRead);
enemy_faction_config_array = AAssit.ReadArrayFromBinary<ENEMY_FACTION_CONFIG>(file, ref dwRead);
character_class_config_array = AAssit.ReadArrayFromBinary<CHARACTER_CLASS_CONFIG>(file, ref dwRead);
param_adjust_config_array = AAssit.ReadArrayFromBinary<PARAM_ADJUST_CONFIG>(file, ref dwRead);
player_action_info_config_array = AAssit.ReadArrayFromBinary<PLAYER_ACTION_INFO_CONFIG>(file, ref dwRead);
taskdice_essence_array = AAssit.ReadArrayFromBinary<TASKDICE_ESSENCE>(file, ref dwRead);
tasknormalmatter_essence_array = AAssit.ReadArrayFromBinary<TASKNORMALMATTER_ESSENCE>(file, ref dwRead);
face_faling_essence_array = AAssit.ReadArrayFromBinary<FACE_FALING_ESSENCE>(file, ref dwRead);
player_levelexp_config_array = AAssit.ReadArrayFromBinary<PLAYER_LEVELEXP_CONFIG>(file, ref dwRead);
mine_type_array = AAssit.ReadArrayFromBinary<MINE_TYPE>(file, ref dwRead);
mine_essence_array = AAssit.ReadArrayFromBinary<MINE_ESSENCE>(file, ref dwRead);
npc_identify_service_array = AAssit.ReadArrayFromBinary<NPC_IDENTIFY_SERVICE>(file, ref dwRead);
fashion_major_type_array = AAssit.ReadArrayFromBinary<FASHION_MAJOR_TYPE>(file, ref dwRead);
fashion_sub_type_array = AAssit.ReadArrayFromBinary<FASHION_SUB_TYPE>(file, ref dwRead);
fashion_essence_array = AAssit.ReadArrayFromBinary<FASHION_ESSENCE>(file, ref dwRead);
faceticket_major_type_array = AAssit.ReadArrayFromBinary<FACETICKET_MAJOR_TYPE>(file, ref dwRead);
faceticket_sub_type_array = AAssit.ReadArrayFromBinary<FACETICKET_SUB_TYPE>(file, ref dwRead);
faceticket_essence_array = AAssit.ReadArrayFromBinary<FACETICKET_ESSENCE>(file, ref dwRead);
facepill_major_type_array = AAssit.ReadArrayFromBinary<FACEPILL_MAJOR_TYPE>(file, ref dwRead);
facepill_sub_type_array = AAssit.ReadArrayFromBinary<FACEPILL_SUB_TYPE>(file, ref dwRead);
facepill_essence_array = AAssit.ReadArrayFromBinary<FACEPILL_ESSENCE>(file, ref dwRead);
suite_essence_array = AAssit.ReadArrayFromBinary<SUITE_ESSENCE>(file, ref dwRead);
gm_generator_type_array = AAssit.ReadArrayFromBinary<GM_GENERATOR_TYPE>(file, ref dwRead);
gm_generator_essence_array = AAssit.ReadArrayFromBinary<GM_GENERATOR_ESSENCE>(file, ref dwRead);
pet_type_array = AAssit.ReadArrayFromBinary<PET_TYPE>(file, ref dwRead);
pet_essence_array = AAssit.ReadArrayFromBinary<PET_ESSENCE>(file, ref dwRead);
pet_egg_essence_array = AAssit.ReadArrayFromBinary<PET_EGG_ESSENCE>(file, ref dwRead);
pet_food_essence_array = AAssit.ReadArrayFromBinary<PET_FOOD_ESSENCE>(file, ref dwRead);
pet_faceticket_essence_array = AAssit.ReadArrayFromBinary<PET_FACETICKET_ESSENCE>(file, ref dwRead);
fireworks_essence_array = AAssit.ReadArrayFromBinary<FIREWORKS_ESSENCE>(file, ref dwRead);
war_tankcallin_essence_array = AAssit.ReadArrayFromBinary<WAR_TANKCALLIN_ESSENCE>(file, ref dwRead);
tag = AAssit.GetIntFromFileStream(file, ref dwRead);
AAssit.ReadString(file, ref dwRead, out result);
npc_war_towerbuild_service_array = AAssit.ReadArrayFromBinary<NPC_WAR_TOWERBUILD_SERVICE>(file, ref dwRead);
player_secondlevel_config_array = AAssit.ReadArrayFromBinary<PLAYER_SECONDLEVEL_CONFIG>(file, ref dwRead);
npc_resetprop_service_array = AAssit.ReadArrayFromBinary<NPC_RESETPROP_SERVICE>(file, ref dwRead);
npc_petname_service_array = AAssit.ReadArrayFromBinary<NPC_PETNAME_SERVICE>(file, ref dwRead);
npc_petlearnskill_service_array = AAssit.ReadArrayFromBinary<NPC_PETLEARNSKILL_SERVICE>(file, ref dwRead);
npc_petforgetskill_service_array = AAssit.ReadArrayFromBinary<NPC_PETFORGETSKILL_SERVICE>(file, ref dwRead);
skillmatter_essence_array = AAssit.ReadArrayFromBinary<SKILLMATTER_ESSENCE>(file, ref dwRead);
refine_ticket_essence_array = AAssit.ReadArrayFromBinary<REFINE_TICKET_ESSENCE>(file, ref dwRead);
destroying_essence_array = AAssit.ReadArrayFromBinary<DESTROYING_ESSENCE>(file, ref dwRead);
npc_equipbind_service_array = AAssit.ReadArrayFromBinary<NPC_EQUIPBIND_SERVICE>(file, ref dwRead);
npc_equipdestroy_service_array = AAssit.ReadArrayFromBinary<NPC_EQUIPDESTROY_SERVICE>(file, ref dwRead);
npc_equipundestroy_service_array = AAssit.ReadArrayFromBinary<NPC_EQUIPUNDESTROY_SERVICE>(file, ref dwRead);
bible_essence_array = AAssit.ReadArrayFromBinary<BIBLE_ESSENCE>(file, ref dwRead);
speaker_essence_array = AAssit.ReadArrayFromBinary<SPEAKER_ESSENCE>(file, ref dwRead);
autohp_essence_array = AAssit.ReadArrayFromBinary<AUTOHP_ESSENCE>(file, ref dwRead);
automp_essence_array = AAssit.ReadArrayFromBinary<AUTOMP_ESSENCE>(file, ref dwRead);
double_exp_essence_array = AAssit.ReadArrayFromBinary<DOUBLE_EXP_ESSENCE>(file, ref dwRead);
transmitscroll_essence_array = AAssit.ReadArrayFromBinary<TRANSMITSCROLL_ESSENCE>(file, ref dwRead);
dye_ticket_essence_array = AAssit.ReadArrayFromBinary<DYE_TICKET_ESSENCE>(file, ref dwRead);
goblin_essence_array = AAssit.ReadArrayFromBinary<GOBLIN_ESSENCE>(file, ref dwRead);
goblin_equip_type_array = AAssit.ReadArrayFromBinary<GOBLIN_EQUIP_TYPE>(file, ref dwRead);
goblin_equip_essence_array = AAssit.ReadArrayFromBinary<GOBLIN_EQUIP_ESSENCE>(file, ref dwRead);
goblin_exppill_essence_array = AAssit.ReadArrayFromBinary<GOBLIN_EXPPILL_ESSENCE>(file, ref dwRead);
sell_certificate_essence_array = AAssit.ReadArrayFromBinary<SELL_CERTIFICATE_ESSENCE>(file, ref dwRead);
// target_item_essence_array = AAssit.ReadArrayFromBinary<TARGET_ITEM_ESSENCE>(file, ref dwRead);
// look_info_essence_array = AAssit.ReadArrayFromBinary<LOOK_INFO_ESSENCE>(file, ref dwRead);
// upgrade_production_config_array = AAssit.ReadArrayFromBinary<UPGRADE_PRODUCTION_CONFIG>(file, ref dwRead);
// acc_storage_blacklist_config_array = AAssit.ReadArrayFromBinary<ACC_STORAGE_BLACKLIST_CONFIG>(file, ref dwRead);
// face_hair_texture_map_array = AAssit.ReadArrayFromBinary<FACE_HAIR_TEXTURE_MAP>(file, ref dwRead);
// multi_exp_config_array = AAssit.ReadArrayFromBinary<MULTI_EXP_CONFIG>(file, ref dwRead);
// inc_skill_ability_essence_array = AAssit.ReadArrayFromBinary<INC_SKILL_ABILITY_ESSENCE>(file, ref dwRead);
// god_evil_convert_config_array = AAssit.ReadArrayFromBinary<GOD_EVIL_CONVERT_CONFIG>(file, ref dwRead);
// wedding_config_array = AAssit.ReadArrayFromBinary<WEDDING_CONFIG>(file, ref dwRead);
// wedding_bookcard_essence_array = AAssit.ReadArrayFromBinary<WEDDING_BOOKCARD_ESSENCE>(file, ref dwRead);
// wedding_invitecard_essence_array = AAssit.ReadArrayFromBinary<WEDDING_INVITECARD_ESSENCE>(file, ref dwRead);
// sharpener_essence_array = AAssit.ReadArrayFromBinary<SHARPENER_ESSENCE>(file, ref dwRead);
// face_thirdeye_essence_array = AAssit.ReadArrayFromBinary<FACE_THIRDEYE_ESSENCE>(file, ref dwRead);
// faction_fortress_config_array = AAssit.ReadArrayFromBinary<FACTION_FORTRESS_CONFIG>(file, ref dwRead);
// faction_building_sub_type_array = AAssit.ReadArrayFromBinary<FACTION_BUILDING_SUB_TYPE>(file, ref dwRead);
// faction_building_essence_array = AAssit.ReadArrayFromBinary<FACTION_BUILDING_ESSENCE>(file, ref dwRead);
// faction_material_essence_array = AAssit.ReadArrayFromBinary<FACTION_MATERIAL_ESSENCE>(file, ref dwRead);
// congregate_essence_array = AAssit.ReadArrayFromBinary<CONGREGATE_ESSENCE>(file, ref dwRead);
// engrave_major_type_array = AAssit.ReadArrayFromBinary<ENGRAVE_MAJOR_TYPE>(file, ref dwRead);
// engrave_sub_type_array = AAssit.ReadArrayFromBinary<ENGRAVE_SUB_TYPE>(file, ref dwRead);
// engrave_essence_array = AAssit.ReadArrayFromBinary<ENGRAVE_ESSENCE>(file, ref dwRead);
// npc_engrave_service_array = AAssit.ReadArrayFromBinary<NPC_ENGRAVE_SERVICE>(file, ref dwRead);
// npc_randprop_service_array = AAssit.ReadArrayFromBinary<NPC_RANDPROP_SERVICE>(file, ref dwRead);
// randprop_type_array = AAssit.ReadArrayFromBinary<RANDPROP_TYPE>(file, ref dwRead);
// randprop_essence_array = AAssit.ReadArrayFromBinary<RANDPROP_ESSENCE>(file, ref dwRead);
// wiki_taboo_config_array = AAssit.ReadArrayFromBinary<WIKI_TABOO_CONFIG>(file, ref dwRead);
// force_config_array = AAssit.ReadArrayFromBinary<FORCE_CONFIG>(file, ref dwRead);
// force_token_essence_array = AAssit.ReadArrayFromBinary<FORCE_TOKEN_ESSENCE>(file, ref dwRead);
// npc_force_service_array = AAssit.ReadArrayFromBinary<NPC_FORCE_SERVICE>(file, ref dwRead);
// player_death_drop_config_array = AAssit.ReadArrayFromBinary<PLAYER_DEATH_DROP_CONFIG>(file, ref dwRead);
// dynskillequip_essence_array = AAssit.ReadArrayFromBinary<DYNSKILLEQUIP_ESSENCE>(file, ref dwRead);
// consume_points_config_array = AAssit.ReadArrayFromBinary<CONSUME_POINTS_CONFIG>(file, ref dwRead);
// online_awards_config_array = AAssit.ReadArrayFromBinary<ONLINE_AWARDS_CONFIG>(file, ref dwRead);
// country_config_array = AAssit.ReadArrayFromBinary<COUNTRY_CONFIG>(file, ref dwRead);
// gm_activity_config_array = AAssit.ReadArrayFromBinary<GM_ACTIVITY_CONFIG>(file, ref dwRead);
// fashion_weapon_config_array = AAssit.ReadArrayFromBinary<FASHION_WEAPON_CONFIG>(file, ref dwRead);
// pet_evolve_config_array = AAssit.ReadArrayFromBinary<PET_EVOLVE_CONFIG>(file, ref dwRead);
// pet_evolved_skill_config_array = AAssit.ReadArrayFromBinary<PET_EVOLVED_SKILL_CONFIG>(file, ref dwRead);
// money_convertible_essence_array = AAssit.ReadArrayFromBinary<MONEY_CONVERTIBLE_ESSENCE>(file, ref dwRead);
// stone_change_recipe_type_array = AAssit.ReadArrayFromBinary<STONE_CHANGE_RECIPE_TYPE>(file, ref dwRead);
// stone_change_recipe_array = AAssit.ReadArrayFromBinary<STONE_CHANGE_RECIPE>(file, ref dwRead);
// meridian_config_array = AAssit.ReadArrayFromBinary<MERIDIAN_CONFIG>(file, ref dwRead);
// pet_evolved_skill_rand_config_array = AAssit.ReadArrayFromBinary<PET_EVOLVED_SKILL_RAND_CONFIG>(file, ref dwRead);
// autotask_display_config_array = AAssit.ReadArrayFromBinary<AUTOTASK_DISPLAY_CONFIG>(file, ref dwRead);
// touch_shop_config_array = AAssit.ReadArrayFromBinary<TOUCH_SHOP_CONFIG>(file, ref dwRead);
// title_config_array = AAssit.ReadArrayFromBinary<TITLE_CONFIG>(file, ref dwRead);
// complex_title_config_array = AAssit.ReadArrayFromBinary<COMPLEX_TITLE_CONFIG>(file, ref dwRead);
// monster_spirit_essence_array = AAssit.ReadArrayFromBinary<MONSTER_SPIRIT_ESSENCE>(file, ref dwRead);
// player_spirit_config_array = AAssit.ReadArrayFromBinary<PLAYER_SPIRIT_CONFIG>(file, ref dwRead);
// player_reincarnation_config_array = AAssit.ReadArrayFromBinary<PLAYER_REINCARNATION_CONFIG>(file, ref dwRead);
// history_stage_config_array = AAssit.ReadArrayFromBinary<HISTORY_STAGE_CONFIG>(file, ref dwRead);
// history_advance_config_array = AAssit.ReadArrayFromBinary<HISTORY_ADVANCE_CONFIG>(file, ref dwRead);
// autoteam_config_array = AAssit.ReadArrayFromBinary<AUTOTEAM_CONFIG>(file, ref dwRead);
// player_realm_config_array = AAssit.ReadArrayFromBinary<PLAYER_REALM_CONFIG>(file, ref dwRead);
// chariot_config_array = AAssit.ReadArrayFromBinary<CHARIOT_CONFIG>(file, ref dwRead);
// chariot_war_config_array = AAssit.ReadArrayFromBinary<CHARIOT_WAR_CONFIG>(file, ref dwRead);
// poker_levelexp_config_array = AAssit.ReadArrayFromBinary<POKER_LEVELEXP_CONFIG>(file, ref dwRead);
// poker_suite_essence_array = AAssit.ReadArrayFromBinary<POKER_SUITE_ESSENCE>(file, ref dwRead);
// poker_dice_essence_array = AAssit.ReadArrayFromBinary<POKER_DICE_ESSENCE>(file, ref dwRead);
// poker_sub_type_array = AAssit.ReadArrayFromBinary<POKER_SUB_TYPE>(file, ref dwRead);
// poker_essence_array = AAssit.ReadArrayFromBinary<POKER_ESSENCE>(file, ref dwRead);
// token_shop_config_array = AAssit.ReadArrayFromBinary<TOKEN_SHOP_CONFIG>(file, ref dwRead);
// shop_token_essence_array = AAssit.ReadArrayFromBinary<SHOP_TOKEN_ESSENCE>(file, ref dwRead);
// gt_config_array = AAssit.ReadArrayFromBinary<GT_CONFIG>(file, ref dwRead);
// rand_shop_config_array = AAssit.ReadArrayFromBinary<RAND_SHOP_CONFIG>(file, ref dwRead);
// profit_time_config_array = AAssit.ReadArrayFromBinary<PROFIT_TIME_CONFIG>(file, ref dwRead);
// faction_pvp_config_array = AAssit.ReadArrayFromBinary<FACTION_PVP_CONFIG>(file, ref dwRead);
// universal_token_essence_array = AAssit.ReadArrayFromBinary<UNIVERSAL_TOKEN_ESSENCE>(file, ref dwRead);
// task_list_config_array = AAssit.ReadArrayFromBinary<TASK_LIST_CONFIG>(file, ref dwRead);
// task_dice_by_weight_config_array = AAssit.ReadArrayFromBinary<TASK_DICE_BY_WEIGHT_CONFIG>(file, ref dwRead);
// fashion_suite_essence_array = AAssit.ReadArrayFromBinary<FASHION_SUITE_ESSENCE>(file, ref dwRead);
// fashion_best_color_config_array = AAssit.ReadArrayFromBinary<FASHION_BEST_COLOR_CONFIG>(file, ref dwRead);
// sign_award_config_array = AAssit.ReadArrayFromBinary<SIGN_AWARD_CONFIG>(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;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f663d3335e04a41b1bb64e834321388b
@@ -3,5 +3,6 @@
public interface IAutoInitialize
{
void Initialize();
void Dispose();
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ffefaa73e3c3149e48a3ffd4483f8724
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8c492cf21479148e48c82b1c08e8e4ec
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b757a79b0fc6f4adcbf4960449c6471f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 26c8460e0031e4a668625e9e08a5eceb
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: