121212
This commit is contained in:
@@ -11,10 +11,13 @@ public class MapBusController : ControllerBase
|
||||
{
|
||||
private readonly IGameMapService _mapService;
|
||||
private readonly IMessageService _messageService;
|
||||
public MapBusController(IGameMapService mapService,IMessageService messageService)
|
||||
private readonly IGameMagicService _magicService;
|
||||
|
||||
public MapBusController(IGameMapService mapService, IMessageService messageService, IGameMagicService magicService)
|
||||
{
|
||||
_mapService = mapService;
|
||||
_messageService = messageService;
|
||||
_magicService = magicService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -52,6 +55,7 @@ public class MapBusController : ControllerBase
|
||||
public async Task<IPoAction> MapBusTo(int id, int num)
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
int areaId = StateHelper.areaId;
|
||||
var busData = await _mapService.GetMapBusInfo(id);
|
||||
if (busData == null)
|
||||
{
|
||||
@@ -63,39 +67,59 @@ public class MapBusController : ControllerBase
|
||||
return PoAction.Message("业务不存在!");
|
||||
}
|
||||
|
||||
var toData = JsonConvert.DeserializeObject<List<MapBusTo> >(busData.busContent);
|
||||
var toData = JsonConvert.DeserializeObject<List<MapBusTo>>(busData.busContent);
|
||||
if (num > (toData.Count - 1))
|
||||
{
|
||||
return PoAction.Message("业务不存在!");
|
||||
}
|
||||
|
||||
var onMap = await _mapService.GetUserOnMapId(userId);
|
||||
if (busData.busCode != onMap)
|
||||
{
|
||||
return PoAction.Message("业务不存在!");
|
||||
}
|
||||
|
||||
var mapToData = toData[num];
|
||||
if (TimeAssist.GetHourNum < mapToData.sTime || TimeAssist.GetHourNum > mapToData.eTime)
|
||||
{
|
||||
return PoAction.Message($"当前时间不允许进入");
|
||||
}
|
||||
|
||||
|
||||
#region 验证机制
|
||||
|
||||
if (mapToData.code == nameof(MapEnum.MapCode.Magic_Map)) //魔城场景,验证否否进入过
|
||||
{
|
||||
if (await _magicService.CheckInMagic(userId) == false)
|
||||
{
|
||||
return PoAction.Message($"您的魔城记录冷却中,冷却时间为7天!");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
var checkResult = await GameBus.CheckNeed(userId, busData.busNeed, 1);
|
||||
if (checkResult.result==false)
|
||||
if (checkResult.result == false)
|
||||
{
|
||||
return PoAction.Message("不满足传送要求!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (await GameBus.UpdateBag(userId, 0, busData.busNeed, "业务传送"))
|
||||
{
|
||||
var ResultMap = await _mapService.GetToMapInfo(userId, mapToData.mapId, true, true);
|
||||
if (ResultMap != null)
|
||||
{
|
||||
if (mapToData.code == nameof(MapEnum.MapCode.Magic_Map)) //魔城场景
|
||||
{
|
||||
await _magicService.UpdateUserMagicTime(userId,areaId);
|
||||
}
|
||||
|
||||
return PoAction.Ok(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("操作失败,请稍后尝试!");
|
||||
return PoAction.Message("操作失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -103,7 +127,7 @@ public class MapBusController : ControllerBase
|
||||
return PoAction.Message("操作失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 打开宝箱
|
||||
/// </summary>
|
||||
@@ -129,13 +153,13 @@ public class MapBusController : ControllerBase
|
||||
{
|
||||
return PoAction.Message("业务不存在!");
|
||||
}
|
||||
|
||||
|
||||
var checkResult = await GameBus.CheckNeed(userId, busData.busNeed, 1);
|
||||
if (checkResult.result==false)
|
||||
if (checkResult.result == false)
|
||||
{
|
||||
return PoAction.Message("不满足开启要求!");
|
||||
}
|
||||
|
||||
|
||||
if (await GameBus.UpdateBag(userId, 0, busData.busNeed, "业务传送"))
|
||||
{
|
||||
string message = "";
|
||||
@@ -158,7 +182,8 @@ public class MapBusController : ControllerBase
|
||||
{
|
||||
message = "空空如也,什么也没有得到!";
|
||||
}
|
||||
return PoAction.Ok(true,message);
|
||||
|
||||
return PoAction.Ok(true, message);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user