2024-09-20 11:48:27 +08:00
|
|
|
|
using PSO2SERVER.Models;
|
2024-11-27 18:05:53 +08:00
|
|
|
|
using PSO2SERVER.Protocol.Packets;
|
2024-09-20 11:48:27 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2024-11-27 18:05:53 +08:00
|
|
|
|
namespace PSO2SERVER.Protocol.Handlers
|
2024-09-20 11:48:27 +08:00
|
|
|
|
{
|
|
|
|
|
[PacketHandlerAttr(0x03, 0x10)]
|
|
|
|
|
public class MapLoaded : PacketHandler
|
|
|
|
|
{
|
2024-12-10 13:33:57 +08:00
|
|
|
|
public unsafe struct MapLoadedPacket
|
2024-09-20 11:48:27 +08:00
|
|
|
|
{
|
|
|
|
|
/// Loaded zone object.
|
2024-12-11 03:39:12 +08:00
|
|
|
|
public ObjectHeader MapObject;
|
2024-09-20 11:48:27 +08:00
|
|
|
|
/// Unknown data, 32 bytes.
|
2024-12-10 13:33:57 +08:00
|
|
|
|
public fixed byte Unk[0x20];
|
2024-09-20 11:48:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region implemented abstract members of PacketHandler
|
|
|
|
|
|
|
|
|
|
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
|
|
|
|
|
{
|
2024-12-10 13:33:57 +08:00
|
|
|
|
if (context._account == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var reader = new PacketReader(data, position, size);
|
|
|
|
|
var pkt = reader.ReadStruct<MapLoadedPacket>();
|
|
|
|
|
|
|
|
|
|
Logger.Write($"MapObject {pkt.MapObject.ToString()}");
|
|
|
|
|
|
|
|
|
|
//TODO 这里才是完整的让角色在地图生成的地方
|
|
|
|
|
context.SendPacket(new LobbyMonitorPacket(1));
|
|
|
|
|
|
|
|
|
|
if(context.Character == null)
|
|
|
|
|
{
|
|
|
|
|
Logger.WriteError("Character should be loaded here");
|
2024-09-20 11:48:27 +08:00
|
|
|
|
return;
|
2024-12-10 13:33:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-20 11:48:27 +08:00
|
|
|
|
|
2024-11-30 02:58:35 +08:00
|
|
|
|
// Unlock Controls
|
|
|
|
|
context.SendPacket(new UnlockControlsPacket()); // Inital spawn only, move this!
|
|
|
|
|
|
2024-09-20 11:48:27 +08:00
|
|
|
|
context.SendPacket(new LoadingScreenRemovePacket());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|