mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-14 01:24:35 +01:00
🤯 chatters
This commit is contained in:
27
GameServer/Handlers/EnterWorldChatroomReqHandler.cs
Normal file
27
GameServer/Handlers/EnterWorldChatroomReqHandler.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Common.Resources.Proto;
|
||||
using PemukulPaku.GameServer.Game.Chatrooms;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.EnterWorldChatroomReq)]
|
||||
internal class EnterWorldChatroomReqHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
EnterWorldChatroomReq Data = packet.GetDecodedBody<EnterWorldChatroomReq>();
|
||||
WorldChatroom.GetInstance().Left(session);
|
||||
Chatroom JoinedChatroom = WorldChatroom.GetInstance().Join(session, Data.ChatroomId == 0 ? 1 : Data.ChatroomId);
|
||||
|
||||
EnterWorldChatroomRsp Rsp = new()
|
||||
{
|
||||
retcode = EnterWorldChatroomRsp.Retcode.Succ,
|
||||
ChatroomId = JoinedChatroom.Id,
|
||||
ActivityType = ActivityWorldChatroomType.ActivityWorldChatroomTypeNone,
|
||||
PlayerNum = (uint)JoinedChatroom.Members.Count
|
||||
};
|
||||
Rsp.HisChatMsgLists.AddRange(JoinedChatroom.Messages.Skip(JoinedChatroom.Messages.Count - 5).ToList());
|
||||
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.EnterWorldChatroomRsp));
|
||||
}
|
||||
}
|
||||
}
|
||||
15
GameServer/Handlers/SendChatMsgNotifyHandler.cs
Normal file
15
GameServer/Handlers/SendChatMsgNotifyHandler.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Common.Resources.Proto;
|
||||
using PemukulPaku.GameServer.Game.Chatrooms;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.SendChatMsgNotify)]
|
||||
internal class SendChatMsgNotifyHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
SendChatMsgNotify Data = packet.GetDecodedBody<SendChatMsgNotify>();
|
||||
WorldChatroom.GetInstance().GetChatroom(session).OnSendChat(session, Data.ChatMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user