62 lines
2.1 KiB
C#
62 lines
2.1 KiB
C#
using PSO2SERVER.Json;
|
|
using PSO2SERVER.Models;
|
|
using PSO2SERVER.Zone;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace PSO2SERVER.Protocol.Packets
|
|
{
|
|
public class MapTransferPacket : Packet
|
|
{
|
|
public ObjectHeader map { get; set; } = new ObjectHeader();
|
|
public ObjectHeader target { get; set; } = new ObjectHeader();
|
|
public ZoneSettings _zonesettings { get; set; } = new ZoneSettings();
|
|
|
|
public MapTransferPacket(ZoneData zone, uint mapid, uint PlayerId)
|
|
{
|
|
//_map = map;
|
|
map = new ObjectHeader(mapid, ObjectType.Map);
|
|
target = new ObjectHeader(PlayerId, ObjectType.Player);
|
|
_zonesettings = zone.Settings;
|
|
}
|
|
|
|
#region implemented abstract members of Packet
|
|
|
|
public override byte[] Build()
|
|
{
|
|
//PacketWriter writer = new PacketWriter();
|
|
//writer.WriteStruct(new ObjectHeader(3, ObjectType.Map));
|
|
//writer.WriteStruct(target);
|
|
//writer.Write(0x1); // 8 Zeros
|
|
//writer.Write(0); // 8 Zeros
|
|
//writer.Write(~(uint)_map.Type); // F4 FF FF FF
|
|
//writer.Write(_map.MapID); // Map ID maybe
|
|
//writer.Write((uint)_map.Flags);
|
|
//writer.Write(_map.GenerationArgs.seed); // 81 8F E6 19 (Maybe seed)
|
|
//writer.Write(_map.VariantID); // Randomgen enable / disable maybe
|
|
//writer.Write(_map.GenerationArgs.xsize); // X Size
|
|
//writer.Write(_map.GenerationArgs.ysize); // Y Size
|
|
//writer.Write(1);
|
|
//writer.Write(1);
|
|
//writer.Write(~0); // FF FF FF FF FF FF FF FF
|
|
//writer.Write(0x301);
|
|
|
|
//return writer.ToArray();
|
|
PacketWriter pkt = new PacketWriter();
|
|
pkt.WriteObjectHeader(map);
|
|
pkt.WriteObjectHeader(target);
|
|
pkt.WriteStruct(_zonesettings);
|
|
return pkt.ToArray();
|
|
}
|
|
|
|
public override PacketHeader GetHeader()
|
|
{
|
|
return new PacketHeader(0x03, 0x00, PacketFlags.None);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |