增加区域设置

This commit is contained in:
Longfeng Qin 2024-12-07 23:01:27 +08:00
parent b57d7543fe
commit eb61517b5e
3 changed files with 143 additions and 42 deletions

View File

@ -39,7 +39,7 @@ namespace PSO2SERVER
public const int ServerShipListProt_NA = 13001;
public const string ServerSettingsKey = "Resources\\settings.txt";
//public const string ServerMemoryPacket = "Resources\\setMemoryPacket.bin"; TODO
public const string ServerMemoryPacket = "Resources\\setMemoryPacket.bin"; //TODO
// 密钥BLOB格式
public const string ServerPrivateKeyBlob_JP = "key\\privateKey_jp.blob";

View File

@ -13,11 +13,17 @@ namespace PSO2SERVER.Protocol.Packets
{
private readonly Map _map;
private readonly int _playerid;
private ZoneSettings _zonesettings;
public MapTransferPacket(Map map, int PlayerId)
{
_map = map;
_playerid = PlayerId;
_zonesettings = new ZoneSettings
{
WorldId = 1,
Unk1 = 0,
};
}
#region implemented abstract members of Packet

View File

@ -6,6 +6,7 @@ using PSO2SERVER.Models;
using PSO2SERVER.Object;
using PSO2SERVER.Protocol;
using PSO2SERVER.Protocol.Packets;
using static PSO2SERVER.Zone.Map;
namespace PSO2SERVER.Zone
{
@ -108,47 +109,6 @@ namespace PSO2SERVER.Zone
return location;
}
public struct ZoneSettings
{
public uint WorldId;
public uint Unk1;
public uint ZoneId;
public uint MapId; // Map layout id.
public uint ZoneType;
public uint Seed;
public uint Args;
public uint SizeX;
public uint SizeY;
public uint Unk2;
public uint AreaIndex;
public uint SubArea;
public uint Unk3;
// 构造函数
public ZoneSettings(uint worldId, uint unk1, uint zoneId, uint mapId, uint zoneType, uint seed,
uint args, uint sizeX, uint sizeY, uint unk2, uint areaIndex, uint subArea, uint unk3)
{
WorldId = worldId;
Unk1 = unk1;
ZoneId = zoneId;
MapId = mapId;
ZoneType = zoneType;
Seed = seed;
Args = args;
SizeX = sizeX;
SizeY = sizeY;
Unk2 = unk2;
AreaIndex = areaIndex;
SubArea = subArea;
Unk3 = unk3;
}
// 重写 ToString 方法(可选)
public override string ToString()
{
return $"WorldId: {WorldId}, ZoneId: {ZoneId}, MapId: {MapId}, SizeX: {SizeX}, SizeY: {SizeY}";
}
}
/// <summary>
/// Spawns a client into a map at a given location
@ -287,4 +247,139 @@ namespace PSO2SERVER.Zone
public uint seed, xsize, ysize;
}
}
public struct ZoneSettings
{
public uint WorldId;
public uint Unk1;
public uint ZoneId;
public uint MapId; // Map layout id.
public uint ZoneType;
public uint Seed;
public uint Args;
public uint SizeX;
public uint SizeY;
public uint Unk2;
public uint AreaIndex;
public uint SubArea;
public uint Unk3;
// 构造函数
public ZoneSettings(uint worldId, uint unk1, uint zoneId, uint mapId, uint zoneType, uint seed,
uint args, uint sizeX, uint sizeY, uint unk2, uint areaIndex, uint subArea, uint unk3)
{
WorldId = worldId;
Unk1 = unk1;
ZoneId = zoneId;
MapId = mapId;
ZoneType = zoneType;
Seed = seed;
Args = args;
SizeX = sizeX;
SizeY = sizeY;
Unk2 = unk2;
AreaIndex = areaIndex;
SubArea = subArea;
Unk3 = unk3;
}
// 重写 ToString 方法(可选)
public override string ToString()
{
return $"WorldId: {WorldId}, ZoneId: {ZoneId}, MapId: {MapId}, SizeX: {SizeX}, SizeY: {SizeY}";
}
}
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;
}
}
public class ZoneData
{
public string Name { get; set; }
public bool IsSpecialZone { get; set; }
public uint ZoneId { get; set; }
public ZoneSettings Settings { get; set; }
public PSOLocation DefaultLocation { get; set; }
public List<EnemySpawn> Enemies { get; set; }
public List<ZoneChunk> Chunks { get; set; }
// 默认构造函数
public ZoneData()
{
Name = string.Empty;
IsSpecialZone = false;
ZoneId = new uint();
Settings = new ZoneSettings();
DefaultLocation = new PSOLocation();
Enemies = new List<EnemySpawn>();
Chunks = new List<ZoneChunk>();
}
}
public class ZoneChunk
{
public uint ZoneId { get; set; }
public uint ChunkId { get; set; }
public EnemySpawnType EnemySpawnType { get; set; }
public List<PSOLocation> EnemySpawnPoints { get; set; }
// 默认构造函数
public ZoneChunk()
{
ZoneId = new uint();
ChunkId = 0;
EnemySpawnType = EnemySpawnType.Disabled;
EnemySpawnPoints = new List<PSOLocation>();
}
}
public enum EnemySpawnType
{
Disabled,
Automatic,
AutomaticWithRespawn,
Manual
}
public class AutomaticEnemySpawn
{
public uint Min { get; set; }
public uint Max { get; set; }
public AutomaticEnemySpawn() { }
public AutomaticEnemySpawn(uint min, uint max)
{
Min = min;
Max = max;
}
}
public class AutomaticWithRespawnEnemySpawn : AutomaticEnemySpawn
{
public TimeSpan RespawnTime { get; set; }
public AutomaticWithRespawnEnemySpawn() { }
public AutomaticWithRespawnEnemySpawn(uint min, uint max, TimeSpan respawnTime)
: base(min, max)
{
RespawnTime = respawnTime;
}
}
}