Half the handlers were still answering with a bare 0 or -1 even though the whole retcode table is generated. Values on the wire are unchanged, they just read properly now. Same for the item hint reasons. ActionReasonType is a generated enum and we were redeclaring six of its members as private consts in four different files.
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using Yuanshen.Gameserver.Controllers.Attributes;
|
|
using Yuanshen.Gameserver.Controllers.Result;
|
|
using Yuanshen.Gameserver.Game;
|
|
using Yuanshen.Protocol;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Yuanshen.Gameserver.Controllers;
|
|
|
|
[NetController]
|
|
internal sealed class GmTalkController : ControllerBase
|
|
{
|
|
private static readonly char[] Separators = { ';', '\n', '\r' };
|
|
|
|
[NetCommand(CmdType.GmTalkReq)]
|
|
public async ValueTask<IResult> OnGmTalkReq(GmCommandService gm, ILogger<GmTalkController> logger)
|
|
{
|
|
GmTalkReq req = Packet!.DecodeBody<GmTalkReq>();
|
|
string message = req.Msg ?? string.Empty;
|
|
|
|
logger.LogInformation("GmTalk: {message}", message);
|
|
|
|
List<string> reply = new();
|
|
foreach (string part in message.Split(Separators, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
|
|
reply.AddRange(await gm.ExecuteAsync(part));
|
|
|
|
return Response(CmdType.GmTalkRsp, new GmTalkRsp
|
|
{
|
|
Retcode = Retcode.RET_SUCC,
|
|
Msg = message,
|
|
Retmsg = string.Join('\n', reply)
|
|
});
|
|
}
|
|
}
|