enter part2 world

This commit is contained in:
Revsain
2025-06-29 16:51:27 +08:00
parent 540486ab94
commit f8a9c19035
17 changed files with 278 additions and 3 deletions

View File

@@ -0,0 +1,14 @@
using KianaBH.GameServer.Server.Packet.Send.Pjms;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Pjms;
[Opcode(CmdIds.PjmsEnterWorldReq)]
public class HandlerPjmsEnterWorldReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = PjmsEnterWorldReq.Parser.ParseFrom(data);
await connection.SendPacket(new PacketPjmsEnterWorldRsp(req.WorldId, req.TeleportId));
}
}

View File

@@ -0,0 +1,13 @@
using KianaBH.GameServer.Server.Packet.Send.Pjms;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Pjms;
[Opcode(CmdIds.PjmsGetAvatarStatusReq)]
public class HandlerPjmsGetAvatarStatusReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
await connection.SendPacket(new PacketPjmsGetAvatarStatusRsp());
}
}

View File

@@ -0,0 +1,13 @@
using KianaBH.GameServer.Server.Packet.Send.Pjms;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Pjms;
[Opcode(CmdIds.PjmsGetHomeDataReq)]
public class HandlerPjmsGetHomeDataReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
await connection.SendPacket(new PacketPjmsGetHomeDataRsp());
}
}

View File

@@ -0,0 +1,14 @@
using KianaBH.GameServer.Server.Packet.Send.Pjms;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Pjms;
[Opcode(CmdIds.PjmsSetCurAvatarReq)]
public class HandlerPjmsSetCurAvatarReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = PjmsSetCurAvatarReq.Parser.ParseFrom(data);
await connection.SendPacket(new PacketPjmsSetCurAvatarRsp(req.ChapterId, req.CurAvatarId, req.IsElfMode));
}
}

View File

@@ -0,0 +1,14 @@
using KianaBH.GameServer.Server.Packet.Send.Pjms;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Pjms;
[Opcode(CmdIds.PjmsSetWorldTimeReq)]
public class HandlerPjmsSetWorldTimeReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = PjmsSetWorldTimeReq.Parser.ParseFrom(data);
await connection.SendPacket(new PacketPjmsSetWorldTimeRsp(req.TargetTime));
}
}

View File

@@ -0,0 +1,14 @@
using KianaBH.GameServer.Server.Packet.Send.Pjms;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Pjms;
[Opcode(CmdIds.PjmsUpdateAvatarStatusReq)]
public class HandlerPjmsUpdateAvatarStatusReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = PjmsUpdateAvatarStatusReq.Parser.ParseFrom(data);
await connection.SendPacket(new PacketPjmsUpdateAvatarStatusRsp(req));
}
}

View File

@@ -0,0 +1,14 @@
using KianaBH.GameServer.Server.Packet.Send.Pjms;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Pjms;
[Opcode(CmdIds.PjmsUpdateFormationReq)]
public class HandlerPjmsUpdateFormationReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = PjmsUpdateFormationReq.Parser.ParseFrom(data);
await connection.SendPacket(new PacketPjmsUpdateFormationRsp(req));
}
}

View File

@@ -0,0 +1,27 @@
using KianaBH.KcpSharp;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Send.Pjms;
public class PacketPjmsEnterWorldRsp : BasePacket
{
public PacketPjmsEnterWorldRsp(uint WorldId, uint TeleportId) : base(CmdIds.PjmsEnterWorldRsp)
{
var proto = new PjmsEnterWorldRsp
{
World = new() { WorldId = WorldId },
TeleportId = TeleportId,
// Read from db table after creating it
Formation = new()
{
CurAvatarId = 4223,
ElfId = 120,
StarRingEnergy = 150,
AvatarIdList = { 4223, 4224, 4225 }
},
WorldTransactionStr = "0"
};
SetData(proto);
}
}

View File

@@ -0,0 +1,17 @@
using KianaBH.KcpSharp;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Send.Pjms;
public class PacketPjmsGetAvatarStatusRsp : BasePacket
{
public PacketPjmsGetAvatarStatusRsp() : base(CmdIds.PjmsGetAvatarStatusRsp)
{
var proto = new PjmsGetAvatarStatusRsp
{
};
SetData(proto);
}
}

View File

@@ -10,7 +10,7 @@ public class PacketPjmsGetChapterDataRsp : BasePacket
// TODO: Hardcoded
var proto = new PjmsGetChapterDataRsp
{
CurChapterId = 100,
CurChapterId = 200,
IsAll = true,
ChapterList =
{
@@ -76,6 +76,31 @@ public class PacketPjmsGetChapterDataRsp : BasePacket
new PjmsUnitSet { SetId = 5 }
}
}
},
new PjmsChapter
{
ChapterId = 200,
Formation = new()
{
CurAvatarId = 4223,
ElfId = 120,
StarRingEnergy = 150,
AvatarIdList = { 4223, 4224, 4225 }
},
UnitInfo = new()
{
CurUnitSetId = 1,
UnitSetList =
{
new PjmsUnitSet { SetId = 1 },
new PjmsUnitSet { SetId = 2 },
new PjmsUnitSet { SetId = 3 },
new PjmsUnitSet { SetId = 4 },
new PjmsUnitSet { SetId = 5 }
}
},
PlayingBgmId = 59,
CurSectionId = 1
}
}
};

View File

@@ -9,7 +9,7 @@ public class PacketPjmsGetCurWorldRsp : BasePacket
{
var proto = new PjmsGetCurWorldRsp
{
World = new() { WorldId = 400 }
};
SetData(proto);

View File

@@ -0,0 +1,17 @@
using KianaBH.KcpSharp;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Send.Pjms;
public class PacketPjmsGetHomeDataRsp : BasePacket
{
public PacketPjmsGetHomeDataRsp() : base(CmdIds.PjmsGetHomeDataRsp)
{
var proto = new PjmsGetHomeDataRsp
{
UnlockBgmIdList = { 51, 59, 60, 61 } // Read from excel
};
SetData(proto);
}
}

View File

@@ -9,8 +9,19 @@ public class PacketPjmsGetMainDataRsp : BasePacket
{
var proto = new PjmsGetMainDataRsp
{
World = new() { WorldId = 400 },
Map = new()
{ // Fog and Teleport read from excel
UnlockFogIdList = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 90202, 90203, 90204, 90205, 90207, 90208, 90209 },
},
GenderType = 1,
WorldTime = 43200,
Name = "Dreamseeker",
NameCdEndTime = 14400,
GenderCdEndTime = 14400,
WorldTransactionStr = "0"
};
proto.Map.TeleportList.AddRange(new uint[] { 128, 13, 110, 136, 183, 125, 129, 153, 106, 9, 103, 124, 101, 14, 111, 134, 120, 133, 135, 151, 104, 131, 113, 16, 137, 114, 301, 10, 107, 123, 122, 118, 127, 12, 109, 15, 112, 132, 121, 130, 116, 1, 126, 102, 152, 8, 105, 108, 11, 117, 2, 115, 119 }.Select(x => new PjmsTeleport { TeleportId = x, Status = PjmsTeleport.Types.Status.PjmsTeleportStatusActive }));
SetData(proto);
}

View File

@@ -0,0 +1,20 @@
using KianaBH.KcpSharp;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Send.Pjms;
public class PacketPjmsSetCurAvatarRsp : BasePacket
{
public PacketPjmsSetCurAvatarRsp(uint ChapterId, uint CurAvatarId, bool IsElfMode) : base(CmdIds.PjmsSetCurAvatarRsp)
{
var proto = new PjmsSetCurAvatarRsp
{
ChapterId = ChapterId,
CurAvatarId = CurAvatarId,
IsElfMode = IsElfMode
};
// TODO: Create a part2 table to save changes
SetData(proto);
}
}

View File

@@ -0,0 +1,17 @@
using KianaBH.KcpSharp;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Send.Pjms;
public class PacketPjmsSetWorldTimeRsp : BasePacket
{
public PacketPjmsSetWorldTimeRsp(uint TargetTime) : base(CmdIds.PjmsSetWorldTimeRsp)
{
var proto = new PjmsSetWorldTimeRsp
{
CurTime = TargetTime
};
SetData(proto);
}
}

View File

@@ -0,0 +1,20 @@
using KianaBH.KcpSharp;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Send.Pjms;
public class PacketPjmsUpdateAvatarStatusRsp : BasePacket
{
public PacketPjmsUpdateAvatarStatusRsp(PjmsUpdateAvatarStatusReq req) : base(CmdIds.PjmsUpdateAvatarStatusRsp)
{
var proto = new PjmsUpdateAvatarStatusRsp
{
ChapterId = req.ChapterId,
StarRingEnergy = req.StarRingEnergy
};
proto.AvatarStatusList.AddRange(req.AvatarStatusList);
// TODO: Create a part2 table to save changes
SetData(proto);
}
}

View File

@@ -0,0 +1,25 @@
using KianaBH.KcpSharp;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Send.Pjms;
public class PacketPjmsUpdateFormationRsp : BasePacket
{
public PacketPjmsUpdateFormationRsp(PjmsUpdateFormationReq req) : base(CmdIds.PjmsUpdateFormationRsp)
{
var proto = new PjmsUpdateFormationRsp
{
ChapterId = req.ChapterId,
Formation = new()
{
CurAvatarId = req.AvatarList[0],
ElfId = req.ElfId,
StarRingEnergy = 150
}
};
proto.Formation.AvatarIdList.AddRange(req.AvatarList);
// TODO: Create a part2 table to save changes
SetData(proto);
}
}