PSO2SERVER/Server/Protocol/Handlers/03-ServerHandler/03-10-MapLoaded.cs
2024-12-10 13:33:57 +08:00

61 lines
1.5 KiB
C#

using PSO2SERVER.Models;
using PSO2SERVER.Protocol.Packets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace PSO2SERVER.Protocol.Handlers
{
[PacketHandlerAttr(0x03, 0x10)]
public class MapLoaded : PacketHandler
{
public unsafe struct MapLoadedPacket
{
/// Loaded zone object.
public ObjectHeader.ObjHeaderStruct MapObject;
/// Unknown data, 32 bytes.
public fixed byte Unk[0x20];
}
#region implemented abstract members of PacketHandler
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
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");
return;
}
// Unlock Controls
context.SendPacket(new UnlockControlsPacket()); // Inital spawn only, move this!
context.SendPacket(new LoadingScreenRemovePacket());
}
#endregion
}
}