mirror of
https://git.lewd.wtf/PGR/ascnet
synced 2025-12-14 11:24:36 +01:00
premature chat command + hardcoded stage for chat on any state
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using AscNet.Common.MsgPack;
|
||||
using AscNet.GameServer.Commands;
|
||||
using AscNet.Table.share.chat;
|
||||
using MessagePack;
|
||||
|
||||
@@ -152,6 +153,26 @@ internal class ChatModule
|
||||
request.ChatData.Icon = (int)session.player.PlayerData.CurrHeadPortraitId;
|
||||
request.ChatData.NickName = session.player.PlayerData.Name;
|
||||
|
||||
if (request.ChatData.Content is not null && request.ChatData.Content.StartsWith('/'))
|
||||
{
|
||||
var cmdStrings = request.ChatData.Content.Split(" ");
|
||||
|
||||
try
|
||||
{
|
||||
Command? cmd = CommandFactory.CreateCommand(cmdStrings.First().Split('/').Last(), session, cmdStrings[1..]);
|
||||
if (cmd is null)
|
||||
{
|
||||
// Invalid command
|
||||
}
|
||||
|
||||
cmd?.Execute();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Failed to execute command
|
||||
}
|
||||
}
|
||||
|
||||
NotifyWorldChat notifyWorldChat = new();
|
||||
notifyWorldChat.ChatMessages.Add(request.ChatData);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user