2222
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user