mirror of
https://github.com/rafi1212122/BLHX.Server.git
synced 2025-12-12 22:44:36 +01:00
sendchat and packet handler options
This commit is contained in:
30
BLHX.Server.Game/Managers/ChatManager.cs
Normal file
30
BLHX.Server.Game/Managers/ChatManager.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user