This commit is contained in:
Putoo
2026-06-18 18:54:22 +08:00
parent 4297019836
commit ad49fbb1b1
42 changed files with 1694 additions and 62 deletions

View File

@@ -16,15 +16,17 @@ public class EquController : ControllerBase
private readonly IUnitUserService _userService;
private readonly IGameDicService _dicService;
private readonly IMessageService _messageService;
private readonly IGameGoodsService _goodsService;
public EquController(IGameEquService equService, IUnitUserAttrService attrService, IUnitUserService userService,
IGameDicService dicService, IMessageService messageService)
IGameDicService dicService, IMessageService messageService, IGameGoodsService goodsService)
{
_equService = equService;
_attrService = attrService;
_userService = userService;
_dicService = dicService;
_messageService = messageService;
_goodsService = goodsService;
}
/// <summary>
@@ -142,6 +144,71 @@ public class EquController : ControllerBase
return PoAction.Ok(new { data, suit });
}
/// <summary>
/// 鉴定装备
/// </summary>
/// <param name="ueId"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> ApprEqu(string ueId)
{
string userId = StateHelper.userId;
var equInfo = await _equService.GetUserEquInfo(ueId);
if (equInfo == null)
{
return PoAction.Message("装备不存在!");
}
if (equInfo.userId != userId)
{
return PoAction.Message("装备不存在!");
}
if (equInfo.isAppr == 1)
{
return PoAction.Message("装备已鉴定!");
}
var resEqu = await _equService.GetEquInfo((int)equInfo.equId);
if (resEqu.isAppr == 0)
{
return PoAction.Message("装备数据异常,联系客服!");
}
var myGoods = await _goodsService.GetUserGoodsCount(userId, GameConfig.GameEquApprGoods);
if (myGoods < 1)
{
return PoAction.Message("暂无装备鉴定符!");
}
if (await _goodsService.UpdateUserGoods(userId, 0, GameConfig.GameEquApprGoods, 1, "鉴定装备"))
{
equInfo.minAtk = RandomAssist.GetFormatedNumeric((int)resEqu.minAtk, (int)resEqu.maxAtk);
equInfo.maxAtk = RandomAssist.GetFormatedNumeric((int)equInfo.minAtk, (int)resEqu.maxAtk);
string[] def = resEqu.defense.Split('-');
equInfo.Defense = RandomAssist.GetFormatedNumeric(Convert.ToInt32(def[0]), Convert.ToInt32(def[1]));
string[] agi = resEqu.agility.Split('-');
equInfo.Agility = RandomAssist.GetFormatedNumeric(Convert.ToInt32(agi[0]), Convert.ToInt32(agi[1]));
string[] mor = resEqu.morale.Split('-');
equInfo.Morale = RandomAssist.GetFormatedNumeric(Convert.ToInt32(mor[0]), Convert.ToInt32(mor[1]));
string[] blo = resEqu.blood.Split('-');
equInfo.Blood = RandomAssist.GetFormatedNumeric(Convert.ToInt32(blo[0]), Convert.ToInt32(blo[1]));
equInfo.isAppr = 1;
if (await _equService.UpdateUserEquInfo(equInfo))
{
return PoAction.Ok(true, "装备鉴定成功!");
}
else
{
return PoAction.Message("鉴定失败,请稍后尝试!");
}
}
else
{
return PoAction.Message("鉴定失败,请稍后尝试!");
}
}
/// <summary>
/// 穿/卸装备
/// </summary>
@@ -680,7 +747,7 @@ public class EquController : ControllerBase
}
var nextNeeds = await _equService.GetUserEquUpData((int)equInfo.intensifyLev + 1);
if (needs == null)
if (nextNeeds == null)
{
isMax = true;
}
@@ -693,7 +760,7 @@ public class EquController : ControllerBase
if (equInfo.intensifyLev >= 60)
{
string msg = $"[{equInfo.equName}]装备强化至{equInfo.intensifyLev}级!";
await _messageService.SendBroadcast(userId, nameof(MessageEnum.BroadcastCode.Promote), msg);
await _messageService.SendBroadcast(userId, nameof(MessageEnum.BroadcastCode.Promote), msg);
}
}
else //执行材料返还
@@ -708,7 +775,7 @@ public class EquController : ControllerBase
code = item.code,
name = item.name,
parameter = item.parameter,
count = item.count
count = item.retCount
};
retProp.Add(temp);
}
@@ -736,4 +803,122 @@ public class EquController : ControllerBase
return PoAction.Message("强化错误,请稍后尝试!");
}
}
/// <summary>
/// 获取洗练装备属性
/// </summary>
/// <param name="ueId"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetEquQualityInfo(string ueId)
{
string userId = StateHelper.userId;
var equInfo = await _equService.GetUserEquInfo(ueId);
if (equInfo == null)
{
return PoAction.Message("装备不存在!");
}
if (equInfo.userId != userId)
{
return PoAction.Message("装备不存在!");
}
if (equInfo.isAppr == 0)
{
return PoAction.Message("装备未鉴定!");
}
long time = TimeExtend.GetTimeStampSeconds;
if (equInfo.useEndTime < time)
{
return PoAction.Message("装备已过期!");
}
List<string> CanOp = new List<string>()
{ "Hold", "Vice", "Head", "Wear", "Waist", "Foot", "Ornaments" };
if (!CanOp.Contains(equInfo.code))
{
return PoAction.Message("该部件不可洗练!");
}
var dicConfig = await _dicService.GetDicInfo(nameof(GameEnum.DicCode.Quality));
List<TowerNeed> need = JsonConvert.DeserializeObject<List<TowerNeed>>(dicConfig.sign);
CheckTowerNeed result = await GameBus.CheckNeed(userId, need);
return PoAction.Ok(new
{
equData = equInfo,
result
});
}
/// <summary>
/// 洗练装备
/// </summary>
/// <param name="ueId"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> HandleEquQuality(string ueId)
{
string userId = StateHelper.userId;
var equInfo = await _equService.GetUserEquInfo(ueId);
if (equInfo == null)
{
return PoAction.Message("装备不存在!");
}
if (equInfo.userId != userId)
{
return PoAction.Message("装备不存在!");
}
if (equInfo.isAppr == 0)
{
return PoAction.Message("装备未鉴定!");
}
long time = TimeExtend.GetTimeStampSeconds;
if (equInfo.useEndTime < time)
{
return PoAction.Message("装备已过期!");
}
List<string> CanOp = new List<string>()
{ "Hold", "Vice", "Head", "Wear", "Waist", "Foot", "Ornaments" };
if (!CanOp.Contains(equInfo.code))
{
return PoAction.Message("该部件不可洗练!");
}
var dicConfig = await _dicService.GetDicInfo(nameof(GameEnum.DicCode.Quality));
List<TowerNeed> need = JsonConvert.DeserializeObject<List<TowerNeed>>(dicConfig.sign);
CheckTowerNeed result = await GameBus.CheckNeed(userId, need);
if (result.result)
{
if (await GameBus.UpdateBag(userId, 0, need, "洗练装备"))
{
var attr = await _equService.GetRandomEquAttr(equInfo.code, (int)equInfo.lev);
equInfo.quality = attr.Count;
equInfo.qualityName = GameTool.GetEquQualityName(attr.Count);
equInfo.EquAttr = attr;
if (await _equService.UpdateUserEquInfo(equInfo, true, "洗练装备", "洗练装备"))
{
return PoAction.Ok(true, "洗练成功!");
}
else
{
return PoAction.Message("洗练失败,请稍后尝试!");
}
}
else
{
return PoAction.Message("洗练失败,请稍后尝试!");
}
}
else
{
return PoAction.Message("洗练失败,请稍后尝试!");
}
}
}