diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/globaldataman.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/globaldataman.cs new file mode 100644 index 0000000000..882cef3a0e --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/globaldataman.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.IO; +using UnityEngine; + +[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) +} + +[System.Serializable] +public struct GShopMainType +{ + public string name; // Main category name (64 chars) + public List subTypes; // Sub-category names +} + +public class GShopData +{ + public List items; + public List mainTypes; + public uint timestamp; + + public GShopData() + { + items = new List(); + mainTypes = new List(); + 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.UTF8.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'); + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/globaldataman.cs.meta b/Assets/PerfectWorld/Scripts/Common/DataProcess/globaldataman.cs.meta new file mode 100644 index 0000000000..3bd13722c1 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/globaldataman.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 7a383c75c23026f4097fb53388429788 \ No newline at end of file