107 lines
3.2 KiB
C#
107 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
using CSNetwork.GPDataType;
|
|
using UnityEngine;
|
|
|
|
[System.Serializable]
|
|
public struct TRANS_TARGET
|
|
{
|
|
public int id;
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
|
public ushort[] name;
|
|
public int world_id;
|
|
public A3DVECTOR3 vecPos;
|
|
public int domain_id;
|
|
|
|
}
|
|
|
|
[System.Serializable]
|
|
public struct TRANS_TARGET_SERV
|
|
{
|
|
public int id;
|
|
public int world_id;
|
|
public A3DVECTOR3 vecPos;
|
|
public int domain_id;
|
|
|
|
}
|
|
|
|
[System.Serializable]
|
|
public struct GShopBuyOption
|
|
{
|
|
public uint price; // Item price
|
|
public uint endTime; // End time (year/month/day/hour/minute/second)
|
|
public uint time; // Duration in seconds (0 = permanent)
|
|
public uint startTime; // Start time
|
|
public int type; // Time type: 0=permanent, 1=weekly, 2=monthly, -1=invalid
|
|
public uint day; // Day mask for weekly/monthly
|
|
public uint status; // Item status: 0=none, 1=hot, 2=new, 3=recommended, 4-12=discount levels, 13=sold out
|
|
public uint flag; // Additional flags
|
|
}
|
|
|
|
[System.Serializable]
|
|
public struct GShopItem
|
|
{
|
|
public int localId; // Localization ID
|
|
public int mainType; // Main category index
|
|
public int subType; // Sub-category index
|
|
public string icon; // Icon file path (128 chars)
|
|
public uint id; // Item object ID
|
|
public uint num; // Item quantity
|
|
public GShopBuyOption[] buy; // Up to 4 different pricing options
|
|
public string desc; // Item description (512 chars)
|
|
public string name; // Item display name (32 chars)
|
|
public uint idGift; // Gift item ID
|
|
public uint giftNum; // Gift quantity
|
|
public uint giftTime; // Gift duration
|
|
public uint logPrice; // Log price
|
|
public uint[] ownerNpcs; // NPCs that own this item (8 max)
|
|
public int itemIndex;
|
|
}
|
|
|
|
[System.Serializable]
|
|
public struct GShopMainType
|
|
{
|
|
public string name; // Main category name (64 chars)
|
|
public List<string> subTypes; // Sub-category names
|
|
}
|
|
|
|
public class GShopData
|
|
{
|
|
public List<GShopItem> items;
|
|
public List<GShopMainType> mainTypes;
|
|
public uint timestamp;
|
|
|
|
public GShopData()
|
|
{
|
|
items = new List<GShopItem>();
|
|
mainTypes = new List<GShopMainType>();
|
|
timestamp = 0;
|
|
}
|
|
}
|
|
|
|
// Extension methods for BinaryReader
|
|
public static class BinaryReaderExtensions
|
|
{
|
|
public static string ReadString(this BinaryReader reader, int length)
|
|
{
|
|
byte[] bytes = reader.ReadBytes(length);
|
|
return System.Text.Encoding.GetEncoding(936).GetString(bytes).TrimEnd('\0');
|
|
}
|
|
|
|
public static string ReadWideString(this BinaryReader reader, int length)
|
|
{
|
|
byte[] bytes = reader.ReadBytes(length * 2); // Wide chars are 2 bytes each
|
|
return System.Text.Encoding.Unicode.GetString(bytes).TrimEnd('\0');
|
|
}
|
|
}
|
|
|
|
public class GlobalTransmitData
|
|
{
|
|
private static List<TRANS_TARGET> global_trans_targets = new();
|
|
private static List<TRANS_TARGET_SERV> global_trans_targets_server = new();
|
|
|
|
public static List<TRANS_TARGET> globaldata_gettranstargets => global_trans_targets;
|
|
} |