2024-12-08 10:56:05 +08:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Org.BouncyCastle.Asn1.Pkcs;
|
|
|
|
|
using PSO2SERVER.Protocol.Packets;
|
2024-12-08 11:33:06 +08:00
|
|
|
|
using PSO2SERVER.Zone;
|
2024-12-08 10:56:05 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2024-12-08 11:33:06 +08:00
|
|
|
|
namespace PSO2SERVER.Json
|
2024-12-08 10:56:05 +08:00
|
|
|
|
{
|
|
|
|
|
public class MapData
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("map_data")]
|
|
|
|
|
public LoadingLevelPacket Mapdata { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("objects")]
|
|
|
|
|
public List<ObjectData> Objects { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("events")]
|
|
|
|
|
public List<EventData> Events { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("npcs")]
|
|
|
|
|
public List<NPCData> Npcs { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("transporters")]
|
|
|
|
|
public List<TransporterData> Transporters { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("luas")]
|
|
|
|
|
public Dictionary<string, string> Luas { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("init_map")]
|
2024-12-08 11:33:06 +08:00
|
|
|
|
public uint InitMap { get; set; }//zone_id
|
2024-12-08 10:56:05 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty("zones")]
|
|
|
|
|
public List<ZoneData> Zones { get; set; }
|
|
|
|
|
|
|
|
|
|
// 默认构造函数
|
|
|
|
|
public MapData()
|
|
|
|
|
{
|
|
|
|
|
// 使用默认值初始化字段
|
|
|
|
|
Mapdata = new LoadingLevelPacket();
|
|
|
|
|
Objects = new List<ObjectData>();
|
|
|
|
|
Events = new List<EventData>();
|
|
|
|
|
Npcs = new List<NPCData>();
|
|
|
|
|
Transporters = new List<TransporterData>();
|
|
|
|
|
Luas = new Dictionary<string, string>();
|
|
|
|
|
InitMap = new uint();
|
|
|
|
|
Zones = new List<ZoneData>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ObjectData
|
|
|
|
|
{
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("zone_id")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public uint zone_id { get; set; }
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("is_active")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public bool is_active { get; set; }
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("data")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public ObjectSpawnPacket data { get; set; }
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("lua_data")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public string lua_data { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-08 11:33:06 +08:00
|
|
|
|
public class EventData
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("zone_id")]
|
|
|
|
|
public uint zone_id { get; set; }
|
|
|
|
|
[JsonProperty("is_active")]
|
|
|
|
|
public bool is_active { get; set; }
|
|
|
|
|
[JsonProperty("data")]
|
|
|
|
|
public EventSpawnPacket data { get; set; }
|
|
|
|
|
[JsonProperty("lua_data")]
|
|
|
|
|
public string lua_data { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class NPCData
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("zone_id")]
|
|
|
|
|
public uint zone_id { get; set; }
|
|
|
|
|
[JsonProperty("is_active")]
|
|
|
|
|
public bool is_active { get; set; }
|
|
|
|
|
[JsonProperty("data")]
|
|
|
|
|
public NPCSpawnPacket data { get; set; }
|
|
|
|
|
[JsonProperty("lua_data")]
|
|
|
|
|
public string lua_data { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class TransporterData
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("zone_id")]
|
|
|
|
|
public uint zone_id { get; set; }
|
|
|
|
|
[JsonProperty("is_active")]
|
|
|
|
|
public bool is_active { get; set; }
|
|
|
|
|
[JsonProperty("data")]
|
|
|
|
|
public TransporterSpawnPacket data { get; set; }
|
|
|
|
|
[JsonProperty("lua_data")]
|
|
|
|
|
public string lua_data { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class EnemySpawn
|
|
|
|
|
{
|
|
|
|
|
public string EnemyName { get; set; }
|
|
|
|
|
public uint SpawnCategory { get; set; }
|
|
|
|
|
|
|
|
|
|
// 默认构造函数
|
|
|
|
|
public EnemySpawn()
|
|
|
|
|
{
|
|
|
|
|
EnemyName = string.Empty;
|
|
|
|
|
SpawnCategory = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 带参构造函数
|
|
|
|
|
public EnemySpawn(string enemyName, uint spawnCategory)
|
|
|
|
|
{
|
|
|
|
|
EnemyName = enemyName;
|
|
|
|
|
SpawnCategory = spawnCategory;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public class ZoneData
|
|
|
|
|
{
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("name")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public string Name { get; set; }
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("is_special_zone")]
|
|
|
|
|
public bool Is_special_zone { get; set; }
|
|
|
|
|
[JsonProperty("zone_id")]
|
|
|
|
|
public uint Zone_id { get; set; }
|
|
|
|
|
[JsonProperty("settings")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public ZoneSettings Settings { get; set; }
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("default_location")]
|
|
|
|
|
public PSOLocation Default_location { get; set; }
|
|
|
|
|
[JsonProperty("enemies")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public List<EnemySpawn> Enemies { get; set; }
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("chunks")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public List<ZoneChunk> Chunks { get; set; }
|
|
|
|
|
|
|
|
|
|
// 默认构造函数
|
|
|
|
|
public ZoneData()
|
|
|
|
|
{
|
|
|
|
|
Name = string.Empty;
|
2024-12-08 11:33:06 +08:00
|
|
|
|
Is_special_zone = false;
|
|
|
|
|
Zone_id = new uint();
|
2024-12-08 10:56:05 +08:00
|
|
|
|
Settings = new ZoneSettings();
|
2024-12-08 11:33:06 +08:00
|
|
|
|
Default_location = new PSOLocation();
|
2024-12-08 10:56:05 +08:00
|
|
|
|
Enemies = new List<EnemySpawn>();
|
|
|
|
|
Chunks = new List<ZoneChunk>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ZoneChunk
|
|
|
|
|
{
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("zone_id")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public uint ZoneId { get; set; }
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("chunk_id")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public uint ChunkId { get; set; }
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("enemy_spawn_type")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public EnemySpawnType EnemySpawnType { get; set; }
|
2024-12-08 11:33:06 +08:00
|
|
|
|
[JsonProperty("enemy_spawn_points")]
|
2024-12-08 10:56:05 +08:00
|
|
|
|
public List<PSOLocation> EnemySpawnPoints { get; set; }
|
|
|
|
|
|
|
|
|
|
// 默认构造函数
|
|
|
|
|
public ZoneChunk()
|
|
|
|
|
{
|
|
|
|
|
ZoneId = new uint();
|
|
|
|
|
ChunkId = 0;
|
|
|
|
|
EnemySpawnType = new Disabled();
|
|
|
|
|
EnemySpawnPoints = new List<PSOLocation>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public abstract class EnemySpawnType
|
|
|
|
|
{
|
|
|
|
|
// 基类方法,用来获取默认值
|
|
|
|
|
public static EnemySpawnType Default => new Disabled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Disabled : EnemySpawnType { }
|
|
|
|
|
|
|
|
|
|
public class Automatic : EnemySpawnType
|
|
|
|
|
{
|
|
|
|
|
public uint Min { get; set; }
|
|
|
|
|
public uint Max { get; set; }
|
|
|
|
|
|
|
|
|
|
public Automatic(uint min, uint max)
|
|
|
|
|
{
|
|
|
|
|
Min = min;
|
|
|
|
|
Max = max;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class AutomaticWithRespawn : EnemySpawnType
|
|
|
|
|
{
|
|
|
|
|
public uint Min { get; set; }
|
|
|
|
|
public uint Max { get; set; }
|
|
|
|
|
public TimeSpan RespawnTime { get; set; }
|
|
|
|
|
|
|
|
|
|
public AutomaticWithRespawn(uint min, uint max, TimeSpan respawnTime)
|
|
|
|
|
{
|
|
|
|
|
Min = min;
|
|
|
|
|
Max = max;
|
|
|
|
|
RespawnTime = respawnTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Manual : EnemySpawnType { }
|
|
|
|
|
}
|