feat: add in game command handler

This commit is contained in:
Naruse
2025-06-14 14:13:48 +08:00
parent 684eab933b
commit 07ec2f9abf
10 changed files with 201 additions and 34 deletions

View File

@@ -0,0 +1,56 @@
using KianaBH.KcpSharp;
using KianaBH.Proto;
using KianaBH.Util;
using KianaBH.Util.Extensions;
namespace KianaBH.GameServer.Server.Packet.Send.Chat;
public class PacketRecvChatMsgNotify : BasePacket
{
public PacketRecvChatMsgNotify(ChatMsg msgs) : base(CmdIds.RecvChatMsgNotify)
{
var proto = new RecvChatMsgNotify
{
ChatMsgList = { msgs }
};
SetData(proto);
}
public PacketRecvChatMsgNotify(string message) : base(CmdIds.RecvChatMsgNotify)
{
var proto = new RecvChatMsgNotify
{
ChatMsgList =
{
new ChatMsg
{
Uid = (uint)ConfigManager.Config.ServerOption.ServerProfile.Uid,
Nickname = ConfigManager.Config.ServerOption.ServerProfile.Name,
Time = (uint)Extensions.GetUnixSec(),
Msg = message,
Channel = ChatMsg.Types.MsgChannel.World,
AvatarId = (uint)ConfigManager.Config.ServerOption.ServerProfile.AvatarId,
DressId = (uint)ConfigManager.Config.ServerOption.ServerProfile.DressId,
FrameId = (uint)ConfigManager.Config.ServerOption.ServerProfile.FrameId,
CustomHeadId = (uint)ConfigManager.Config.ServerOption.ServerProfile.HeadId,
CheckResult = new ChatMsgSensitiveCheckResult
{
RewriteText = message
},
Content = new ChatMsgContent
{
Items =
{
new ChatMsgItem
{
MsgStr = message,
}
}
}
}
}
};
SetData(proto);
}
}