sendchat and packet handler options

This commit is contained in:
rfi
2024-02-21 23:33:11 +07:00
parent c3bcb16f72
commit 9b6673138e
6 changed files with 79 additions and 11 deletions

View File

@@ -0,0 +1,30 @@
using BLHX.Server.Common.Proto.p50;
namespace BLHX.Server.Game.Managers
{
public class ChatManager
{
List<MsgInfo> messages = [];
public void SendChat(MsgInfo msgInfo)
{
msgInfo.Timestamp = (uint)DateTimeOffset.Now.ToUnixTimeSeconds();
messages.Add(msgInfo);
BroadcastChat(msgInfo);
}
void BroadcastChat(MsgInfo msgInfo)
{
var ntf = new Sc50101()
{
Content = msgInfo.Content,
Player = msgInfo.Player,
Type = 1
};
foreach (var conn in GameServer.connections.Values)
conn.Send(ntf);
}
}
}