PSO2SERVER/Server/Protocol/Handlers/03-ServerHandler/03-12-CampshipTeleport.cs
2024-12-10 23:22:43 +08:00

42 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PSO2SERVER.Models;
using PSO2SERVER.Zone;
using static PSO2SERVER.Protocol.Handlers.TeleportCasinoToLobby;
namespace PSO2SERVER.Protocol.Handlers
{
[PacketHandlerAttr(0x03, 0x12)]
public class CampshipTeleport : PacketHandler
{
public struct ToCampshipPacket
{
public uint unk1;
public uint unk2;
public uint unk3;
public uint unk4;
}
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
if (context.currentParty.currentQuest == null)
return;
var reader = new PacketReader(data, position, size);
var pkt = reader.ReadStruct<ToCampshipPacket>();
Logger.Write($"unk1 {pkt.unk1} unk2 {pkt.unk2} unk3 {pkt.unk3} unk4 {pkt.unk4}");
var instanceName = String.Format("{0}-{1}", context.currentParty.currentQuest.name, context._account.Nickname);
ZoneManager.Instance.NewInstance(instanceName, new Map("campship", 150, 0, Map.MapType.Campship, 0));
// todo: add next map
ZoneManager.Instance.AddMapToInstance(instanceName, new Map("area1", 311, -1, Map.MapType.Other, (Map.MapFlags)0x6) { GenerationArgs = new Map.GenParam((uint)new Random().Next(), 2, 3)});
Map campship = ZoneManager.Instance.MapFromInstance("campship", instanceName);
campship.SpawnClient(context, new PSOLocation(0, 1, 0, 0, 0, 0, 0), context.currentParty.currentQuest.name);
}
}
}