This commit is contained in:
Putoo
2026-05-27 18:26:50 +08:00
parent 36a7575990
commit 0d5443ef36
28 changed files with 1043 additions and 25 deletions

View File

@@ -162,4 +162,38 @@ public class MapController : ControllerBase
return PoAction.Message("无法自动寻路!");
}
}
#region npc相关
/// <summary>
/// 获取NPC相关信息
/// </summary>
/// <param name="npcId"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetNpcInfo(int npcId)
{
string userId = StateHelper.userId;
var data = await _mapService.GetNpcInfo(npcId);
if (data == null)
{
return PoAction.Message("Npc不存在!");
}
if (data.status != 1)
{
return PoAction.Message("Npc不存在!");
}
var onMap = await _mapService.GetUserOnMapId(userId);
if (data.mapId != onMap)
{
return PoAction.Message("Npc不存在!");
}
return PoAction.Ok(data);
}
#endregion
}