126 lines
3.6 KiB
C#
126 lines
3.6 KiB
C#
using RPG.GameCore.Excel;
|
|
using RPG.Network.Proto;
|
|
using RPG.Services.Gameserver.Modules.Attributes;
|
|
using RPG.Services.Gameserver.Session;
|
|
|
|
namespace RPG.Services.Gameserver.Modules;
|
|
|
|
[GMAlias("adventure")]
|
|
internal class AdventureModule : BaseModule
|
|
{
|
|
private readonly ExcelTables _tables;
|
|
|
|
public AdventureModule(ExcelTables excelTables)
|
|
{
|
|
_tables = excelTables;
|
|
}
|
|
|
|
[GMCommand("maze")]
|
|
public Task OnGmEnterMaze(PlayerSession session, string[] args)
|
|
{
|
|
if (args.Length != 1) return Task.CompletedTask;
|
|
|
|
if (!uint.TryParse(args[0], out uint entryId))
|
|
return Task.CompletedTask;
|
|
|
|
MapEntryRow? entry = _tables.GetExcelRow<MapEntryRow>(ExcelType.MapEntry, entryId);
|
|
if (entry == null) return Task.CompletedTask;
|
|
|
|
Send(session, CmdType.CmdEnterMazeByServerScNotify, new EnterMazeByServerScNotify
|
|
{
|
|
Maze = new Maze
|
|
{
|
|
MapEntryId = entry.ID,
|
|
Id = entry.PlaneID,
|
|
Floor = new MazeFloor
|
|
{
|
|
FloorId = entry.FloorID,
|
|
Scene = new SceneInfo
|
|
{
|
|
EntryId = entry.ID,
|
|
PlaneId = entry.PlaneID,
|
|
FloorId = entry.FloorID
|
|
}
|
|
}
|
|
},
|
|
});
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
[OnCommand(CmdType.CmdGetCurSceneInfoCsReq)]
|
|
public Task OnCmdGetCurSceneInfoCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
|
|
{
|
|
Send(session, CmdType.CmdGetCurSceneInfoScRsp, new GetCurSceneInfoScRsp
|
|
{
|
|
Retcode = 0,
|
|
Scene = new SceneInfo
|
|
{
|
|
PlaneId = 20121,
|
|
FloorId = 20121001,
|
|
EntryId = 2012101,
|
|
EntityList = { },
|
|
LeaderEntityId = 0
|
|
}
|
|
});
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
[OnCommand(CmdType.CmdGetMazeMapInfoCsReq)]
|
|
public Task OnCmdGetMazeMapInfoCsReq(PlayerSession session, ReadOnlyMemory<byte> body)
|
|
{
|
|
GetMazeMapInfoCsReq req = GetMazeMapInfoCsReq.Parser.ParseFrom(body.Span);
|
|
|
|
Send(session, CmdType.CmdGetMazeMapInfoScRsp, new GetMazeMapInfoScRsp
|
|
{
|
|
Retcode = 0,
|
|
EntryId = req.EntryId,
|
|
|
|
// TODO:
|
|
LightenSectionList = { },
|
|
MazeGroupList = { },
|
|
MazePropList = { }
|
|
});
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
[OnCommand(CmdType.CmdEnterMazeCsReq)]
|
|
public Task OnCmdEnterMazeCsReq(PlayerSession session, ReadOnlyMemory<byte> body)
|
|
{
|
|
EnterMazeCsReq req = EnterMazeCsReq.Parser.ParseFrom(body.Span);
|
|
|
|
MapEntryRow? entry = _tables.GetExcelRow<MapEntryRow>(ExcelType.MapEntry, req.EntryId);
|
|
if (entry == null)
|
|
{
|
|
Send(session, CmdType.CmdEnterMazeScRsp, new EnterMazeScRsp
|
|
{
|
|
Retcode = Retcode.RET_MAZE_MAP_NOT_EXIST
|
|
});
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
Send(session, CmdType.CmdEnterMazeScRsp, new EnterMazeScRsp
|
|
{
|
|
Retcode = 0,
|
|
Maze = new Maze
|
|
{
|
|
MapEntryId = entry.ID,
|
|
Id = entry.PlaneID,
|
|
Floor = new MazeFloor
|
|
{
|
|
FloorId = entry.FloorID,
|
|
Scene = new SceneInfo
|
|
{
|
|
EntryId = entry.ID,
|
|
PlaneId = entry.PlaneID,
|
|
FloorId = entry.FloorID
|
|
}
|
|
}
|
|
},
|
|
});
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|