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

@@ -5,6 +5,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJwtHelper_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6b089d08a87d4ddd82371ae63e754ba05000_003Fe2_003F86047f24_003FJwtHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJwtSecurityTokenHandler_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003Ff9d3fc33fd2fba97d4e718534a67f1d3c61e492634cd51c4798ce5621f780f3_003FJwtSecurityTokenHandler_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_00601_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F51505665371d472f8bdbc333fa4d888cf49938_003F0e_003F7279c963_003FList_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANullable_00601_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F51505665371d472f8bdbc333fa4d888cf49938_003F58_003F4ed88c93_003FNullable_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APoAction_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F8fb1d14dca1046e78e0684daa8bc3a1b7800_003Fb7_003F35e46383_003FPoAction_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARandomAssist_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa380d649d5b2495d9bfa0fa24f13662b6400_003F90_003F676312fd_003FRandomAssist_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASqlSetup_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F72993acb059c49dcbba437a858c0b0942000_003F46_003F2e14505d_003FSqlSetup_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

View File

@@ -0,0 +1,7 @@
namespace Application.Domain.Entity;
public class RandomDataBase
{
public double random { get; set; }
public object data { get; set; }
}

View File

@@ -0,0 +1,81 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Resource")]
public class game_equ_attr
{
/// <summary>
/// erId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string erId { get; set; }
/// <summary>
/// equCode
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? equCode { get; set; }
/// <summary>
/// minLev
/// </summary>
[SugarColumn(IsNullable = true)]
public int? minLev { get; set; }
/// <summary>
/// maxLev
/// </summary>
[SugarColumn(IsNullable = true)]
public int? maxLev { get; set; }
/// <summary>
/// 权重
/// </summary>
[SugarColumn(IsNullable = true)]
public int? random { get; set; }
/// <summary>
/// 属性类型Number 数值 float 百分比
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? nt { get; set; }
/// <summary>
/// 属性
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? code { get; set; }
/// <summary>
/// compute
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? compute { get; set; }
/// <summary>
/// min_v
/// </summary>
[SugarColumn(Length = 18, IsNullable = true)]
public decimal? min_v { get; set; }
/// <summary>
/// max_v
/// </summary>
[SugarColumn(Length = 18, IsNullable = true)]
public decimal? max_v { get; set; }
/// <summary>
/// tips
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? tips { get; set; }
/// <summary>
/// remark
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? remark { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Resource")]
public class game_equ_make
{
/// <summary>
/// mkId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string mkId { get; set; }
/// <summary>
/// goodsId
/// </summary>
[SugarColumn(IsNullable = true)]
public int? goodsId { get; set; }
/// <summary>
/// equId
/// </summary>
[SugarColumn(IsNullable = true)]
public int? equId { get; set; }
/// <summary>
/// equName
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? equName { get; set; }
/// <summary>
/// random
/// </summary>
[SugarColumn(IsNullable = true)]
public int? random { get; set; }
/// <summary>
/// 是否随机特性
/// </summary>
[SugarColumn(IsNullable = true)]
public int? rdAttr { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace Application.Domain.Entity;
public class MakePaperView
{
public game_goods goods { get; set; }
public long count { get; set; }
}

View File

@@ -17,4 +17,5 @@ public static class GameConfig
public const int GameAutoDrugGoodsId = 10001;//急救箱物品ID
public const int GameToMapNeedCopper = 5;//传送每海里费用
public const int TeamCacheTime = 300;//队伍缓存时间
public const int GameEquApprGoods = 10001;//鉴定装备道具
}

View File

@@ -55,11 +55,15 @@ public static class GameEnum
RetBlood,
RetMorale,
RetVigour,
RetEqu,
MapTo,
Store,
Make,
}
public enum DicCode
{
Awaken,//觉醒配置
Quality,//洗练配置
}
}

View File

@@ -20,7 +20,8 @@ public interface IGameEquService
Task<int> GetUserEquByEquIdCount(string userId, int equId);
Task<List<unit_user_equ>> GetUserEquByEquId(string userId, int equId);
Task<bool> AddUserEqu(string userId, int equId, int count, string remark);
Task<bool> AddUserEqu(unit_user_equ equData, string remark);
Task<unit_user_equ> AddUserEqu(string userId, int equId, bool rdAttr = false, string remark = "");
Task<bool> UpdateUserEquInfo(unit_user_equ equData, bool isAddLog = false, string code = "",
string remark = "");
@@ -44,14 +45,22 @@ public interface IGameEquService
#endregion
#region /
Task<List<AttrItem>> GetRandomEquAttr(string equCode, int lev);
#endregion
#region
Task<game_equ_up> GetUserEquUpData(int lev);
#endregion
#region
Task<int> GetUserEquWeightSum(string userId);
Task<game_equ_make> GetMakeEquByGoodsId(int goodsId);
#endregion
}

View File

@@ -180,6 +180,115 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
return result;
}
public async Task<bool> AddUserEqu(unit_user_equ equData, string remark)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
var result = await db.Insertable(equData).ExecuteCommandAsync() > 0;
if (result)
{
//添加日志
await AddEquLogs([equData], 1, remark, true);
//更新负重
int weightCount = Convert.ToInt32(equData.weight);
if (weightCount > 0)
{
var attrService = App.GetService<IUnitUserWeight>();
await attrService.UpdateUserWeight(equData.userId, 1, weightCount);
}
}
return result;
}
public async Task<unit_user_equ> AddUserEqu(string userId, int equId, bool rdAttr = false, string remark = "")
{
var equ = await GetEquInfo(equId);
if (equ == null)
{
return null;
}
unit_user_equ ue = new unit_user_equ();
string ueId = StringAssist.NewGuid;
ue.ueId = ueId;
ue.userId = userId;
ue.owerId = userId;
ue.equId = equ.equId;
ue.equName = equ.equName;
ue.unitEquName = equ.equName;
ue.img = equ.img;
ue.sign = "";
ue.isAppr = 1;
if (equ.isAppr == 0)
{
ue.minAtk = equ.minAtk;
ue.maxAtk = equ.maxAtk;
ue.Defense = Convert.ToInt32(equ.defense);
ue.Agility = Convert.ToInt32(equ.agility);
ue.Morale = Convert.ToInt32(equ.morale);
ue.Blood = Convert.ToInt32(equ.blood);
}
else
{
ue.minAtk = RandomAssist.GetFormatedNumeric((int)equ.minAtk, (int)equ.maxAtk);
ue.maxAtk = RandomAssist.GetFormatedNumeric((int)equ.minAtk, (int)equ.maxAtk);
string[] def = equ.defense.Split('-');
ue.Defense = RandomAssist.GetFormatedNumeric(Convert.ToInt32(def[0]), Convert.ToInt32(def[1]));
string[] agi = equ.agility.Split('-');
ue.Agility = RandomAssist.GetFormatedNumeric(Convert.ToInt32(agi[0]), Convert.ToInt32(agi[1]));
string[] mor = equ.morale.Split('-');
ue.Morale = RandomAssist.GetFormatedNumeric(Convert.ToInt32(mor[0]), Convert.ToInt32(mor[1]));
string[] blo = equ.blood.Split('-');
ue.Blood = RandomAssist.GetFormatedNumeric(Convert.ToInt32(blo[0]), Convert.ToInt32(blo[1]));
}
ue.code = equ.code;
ue.suitCode = equ.suitCode;
ue.lev = equ.lev;
ue.durability = equ.durability;
ue.maxdurability = equ.durability;
ue.isIntensify = equ.isIntensify;
ue.intensifyLev = 0;
ue.isLock = 0;
ue.holeCount = equ.holeCount;
ue.sex = equ.sex;
ue.weight = equ.weight;
ue.sysPrice = equ.sysPrice;
ue.qualityAttr = new List<AttrItem>();
if (rdAttr == false)
{
ue.quality = equ.quality;
ue.qualityName = GameTool.GetEquQualityName((int)ue.quality);
ue.EquAttr = equ.equAttr;
}
else
{
var randomAttr = await GetRandomEquAttr(equ.code, (int)equ.lev);
ue.quality = randomAttr.Count;
ue.qualityName = GameTool.GetEquQualityName((int)ue.quality);
ue.EquAttr = randomAttr;
}
ue.canEqualUp = equ.canEqualUp;
ue.isDeal = equ.isDeal;
ue.isGive = equ.isGive;
ue.opTime = 0;
ue.start = 0;
ue.EquMent = new EquMent();
ue.EquAwaken = new List<EquAwaken>();
ue.GemMent = new List<EquGem>();
ue.useEndTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddYears(20));
ue.isOn = 0;
if (await AddUserEqu(ue, remark))
{
return ue;
}
else
{
return null;
}
}
public async Task<bool> UpdateUserEquInfo(unit_user_equ equData, bool isAddLog = false, string code = "",
string remark = "")
{
@@ -507,6 +616,93 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
#endregion
#region /
private async Task<List<game_equ_attr>> GetEquAttrData(string erCode)
{
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquAttrData");
if (await redis.HExistsHashAsync(key, erCode))
{
return await redis.GetHashAsync<List<game_equ_attr>>(key, erCode);
}
var db = DbClient.AsTenant().GetConnectionWithAttr<game_equ_attr>();
var data = await db.Queryable<game_equ_attr>().Where(it => it.equCode == erCode).ToListAsync();
await redis.AddHashAsync(key, erCode, data);
return data;
}
public async Task<List<AttrItem>> GetRandomEquAttr(string equCode, int lev)
{
//计算出的数量
List<RandomDataBase> numData = new List<RandomDataBase>()
{
new RandomDataBase() { random = 100, data = 1 },
new RandomDataBase() { random = 90, data = 2 },
new RandomDataBase() { random = 80, data = 3 },
new RandomDataBase() { random = 50, data = 4 },
new RandomDataBase() { random = 30, data = 5 },
new RandomDataBase() { random = 15, data = 6 },
new RandomDataBase() { random = 5, data = 7 },
};
var numR = GameBus.GetRandomByWeight(numData);
int onNum = Convert.ToInt32(numR.data);
var attrData = await GetEquAttrData(equCode);
attrData = attrData.FindAll(it => it.minLev <= lev && it.maxLev >= lev);
//开始随机拿属性权重
List<object> data = new List<object>();
List<ushort> weights = new List<ushort>();
List<object> attrResult = new List<object>();
Random rand = new Random();
foreach (var item in attrData)
{
data.Add(item);
weights.Add(ushort.Parse(item.random.ToString()));
}
RandomAssist random = new RandomAssist(onNum);
attrResult = random.ControllerRandomExtract(rand, data, weights);
List<AttrItem> result = new List<AttrItem>();
if (attrResult.Count > 0)
{
foreach (var item in attrResult)
{
var onAttr = item as game_equ_attr;
AttrItem temp = new AttrItem();
temp.code = onAttr.code;
temp.compute = onAttr.compute;
if (onAttr.nt == "Number")
{
int onMin = Convert.ToInt32(onAttr.min_v);
int onMax = Convert.ToInt32(onAttr.max_v);
int onPar = RandomAssist.GetFormatedNumeric(onMin, onMax + 1);
temp.parameter = onPar;
string onTip = temp.parameter.ToString().TrimEnd('0').TrimEnd('.');
temp.tip = string.Format(onAttr.tips, onTip);
}
else
{
int onMin = Convert.ToInt32(onAttr.min_v * 100);
int onMax = Convert.ToInt32(onAttr.max_v * 100);
int onPar = RandomAssist.GetFormatedNumeric(onMin, onMax + 1);
temp.parameter = Math.Round(Convert.ToDecimal(onPar / 100.000M), 2);
string onTip = (temp.parameter * 100).ToString().TrimEnd('0').TrimEnd('.');
temp.tip = string.Format(onAttr.tips, onTip);
}
result.Add(temp);
}
}
return result;
}
#endregion
#region
public async Task<game_equ_up> GetUserEquUpData(int lev)
@@ -522,9 +718,9 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
await redis.AddHashAsync(key, lev.ToString(), data);
}
}
return data;
}
#endregion
@@ -537,5 +733,43 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
return data.Sum(it => (int)it.weight);
}
private async Task<List<game_equ_make>> GetEquMakeData(int goodsId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquUpData");
if (await redis.HExistsHashAsync(key, goodsId.ToString()))
{
return await redis.GetHashAsync<List<game_equ_make>>(key, goodsId.ToString());
}
var db = DbClient.AsTenant().GetConnectionWithAttr<game_equ_make>();
var data = await db.Queryable<game_equ_make>().Where(it => it.goodsId == goodsId).ToListAsync();
await redis.AddHashAsync(key, goodsId.ToString(), data);
return data;
}
public async Task<game_equ_make> GetMakeEquByGoodsId(int goodsId)
{
//构建随机数据
List<RandomDataBase> equBase = new List<RandomDataBase>();
var equData = await GetEquMakeData(goodsId);
foreach (var me in equData)
{
RandomDataBase temp = new RandomDataBase();
temp.random = (double)me.random;
temp.data = me;
equBase.Add(temp);
}
var makeEqu = GameBus.GetRandomByWeight(equBase);
if (makeEqu == null)
{
return null;
}
var onMakeEqu = makeEqu.data as game_equ_make;
return onMakeEqu;
}
#endregion
}

View File

@@ -64,6 +64,11 @@ public static class GameBus
isok = await accService.UpdateUserAcc(userId, operate, nameof(AccEnum.AccType.teach), count,
nameof(AccEnum.Name.), remark);
}
else if (goodsType.Equals(nameof(GameEnum.PropCode.map)))
{
var mapService = App.GetService<IGameMapService>();
isok = await mapService.AddUserCityMap(userId, Convert.ToInt32(parameter));
}
return isok;
}
@@ -338,6 +343,7 @@ public static class GameBus
isok = false;
}
}
result.Needs.Add(item);
}
@@ -351,6 +357,28 @@ public static class GameBus
#region
public static RandomDataBase GetRandomByWeight(List<RandomDataBase> data)
{
var _randomInstance = new Random();
if (data.Count == 0)
{
return null;
}
double totalWeight = data.Sum(it => it.random);
int rnd = _randomInstance.Next(Convert.ToInt32(totalWeight) + 1);
double current = 0;
foreach (var item in data)
{
current += item.random;
if (rnd < current)
{
return item;
}
}
return null;
}
public static List<TowerGet> GetRandomGoods(RandomModel random, int count = 1, int luck = 0)
{
List<TowerGet> result = new List<TowerGet>();

View File

@@ -138,7 +138,41 @@ public class GameTool
return result;
}
public static string GetEquQualityName(int count)
{
string result = "白";
switch (count)
{
case 1:
result = "红";
break;
case 2:
result = "橙";
break;
case 3:
result = "黄";
break;
case 4:
result = "绿";
break;
case 5:
result = "青";
break;
case 6:
result = "粉";
break;
case 7:
result = "紫";
break;
case 8:
result = "金";
break;
}
return result;
}
#region
/// <summary>

View File

@@ -50,6 +50,10 @@ public class StoreController : ControllerBase
{
return PoAction.Message("Npc不存在!");
}
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.Store)))
{
return PoAction.Message("业务不可用!");
}
var onMap = await _mapService.GetUserOnMapId(userId);
if (npcInfo.mapId != onMap)
@@ -84,6 +88,10 @@ public class StoreController : ControllerBase
{
return PoAction.Message("Npc不存在!");
}
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.Store)))
{
return PoAction.Message("业务不可用!");
}
var onMap = await _mapService.GetUserOnMapId(userId);
if (npcInfo.mapId != onMap)
@@ -157,7 +165,10 @@ public class StoreController : ControllerBase
{
return PoAction.Message("Npc不存在!");
}
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.Store)))
{
return PoAction.Message("业务不可用!");
}
var onMap = await _mapService.GetUserOnMapId(userId);
if (npcInfo.mapId != onMap)
{

View File

@@ -0,0 +1,134 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace Application.Web.Controllers.Pub;
/// <summary>
/// 业务操作接口
/// </summary>
[Route("[controller]/[action]")]
[ApiController]
[Authorize]
public class BusinessController : ControllerBase
{
private readonly IGameMapService _mapService;
private readonly IGameEquService _equService;
private readonly IGameGoodsService _goodsService;
public BusinessController(IGameEquService equService, IGameGoodsService goodsService, IGameMapService mapService)
{
_equService = equService;
_goodsService = goodsService;
_mapService = mapService;
}
/// <summary>
/// 获取打造图纸
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetEquPaper()
{
string userId = StateHelper.userId;
var data = await _goodsService.GetUserGoodsData(userId, nameof(GoodsEnum.Code.Paper));
List<MakePaperView> result = new List<MakePaperView>();
foreach (var item in data)
{
MakePaperView temp = new MakePaperView();
temp.goods = await _goodsService.GetGoodsInfo((int)item.goodsId);
temp.count = (long)item.count;
result.Add(temp);
}
return PoAction.Ok(result);
}
/// <summary>
/// 打造装备
/// </summary>
/// <param name="npcId"></param>
/// <param name="goodsId"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> HandleEquPaper(int npcId, int goodsId)
{
string userId = StateHelper.userId;
#region NPC验证
var npcInfo = await _mapService.GetNpcInfo(npcId);
if (npcInfo == null)
{
return PoAction.Message("Npc不存在!");
}
if (npcInfo.status != 1)
{
return PoAction.Message("Npc不存在!");
}
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.Make)))
{
return PoAction.Message("业务不可用!");
}
var onMap = await _mapService.GetUserOnMapId(userId);
if (npcInfo.mapId != onMap)
{
return PoAction.Message("Npc不存在!");
}
#endregion
var myGoods = await _goodsService.GetUserGoodsInfo(userId, goodsId);
if (myGoods == null)
{
return PoAction.Message("暂无图纸!");
}
if (myGoods.count < 1)
{
return PoAction.Message("暂无图纸!");
}
if (myGoods.code != nameof(GoodsEnum.Code.Paper))
{
return PoAction.Message("非图纸材料,无法打造!");
}
string needstr = await _goodsService.GetGoodsContent(goodsId);
var needs = JsonConvert.DeserializeObject<List<TowerNeed>>(needstr);
var check = await GameBus.CheckNeed(userId, needs);
if (check.result)
{
if (await GameBus.UpdateBag(userId, 0, needs, "装备打造"))
{
var onEqu = await _equService.GetMakeEquByGoodsId(goodsId);
if (onEqu == null)
{
return PoAction.Message("打造失败,请联系客服!");
}
//发放装备
bool isRd = onEqu.rdAttr != 0;
var getEqu = await _equService.AddUserEqu(userId, (int)onEqu.equId, isRd, "打造装备");
if (getEqu != null)
{
return PoAction.Ok(getEqu.ueId, $"打造成功,获得装备[{onEqu.equName}]");
}
else
{
return PoAction.Message("打造失败,请稍后尝试!");
}
}
else
{
return PoAction.Message("打造失败,请稍后尝试!");
}
}
else
{
return PoAction.Message("材料不足!");
}
}
}

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("洗练失败,请稍后尝试!");
}
}
}

View File

@@ -12,11 +12,15 @@ public class RecoverController : ControllerBase
{
private readonly IUnitUserAttrService _attrService;
private readonly IGameMapService _mapService;
private readonly IUnitUserAccService _accService;
private readonly IGameEquService _equService;
public RecoverController(IUnitUserAttrService attrService, IGameMapService mapService)
public RecoverController(IUnitUserAttrService attrService, IGameMapService mapService,IUnitUserAccService accService,IGameEquService equService)
{
_attrService = attrService;
_mapService = mapService;
_accService = accService;
_equService = equService;
}
/// <summary>
@@ -179,6 +183,194 @@ public class RecoverController : ControllerBase
#endregion
var data = await _attrService.GetUserVigourInfo(userId);
string time = TimeAssist.GetDateTimeYMDString(0);
if (data.upTime == time)
{
return PoAction.Message("今天已恢复过活力啦!");
}
if (data.vitality >= data.upVitality)
{
return PoAction.Message("活力满满,无需恢复!");
}
bool result = await _attrService.UpdateUserVigour(userId, 2, (long)data.upVitality,time);
if (result)
{
return PoAction.Ok(true);
}
else
{
return PoAction.Message("恢复失败,请稍后尝试!");
}
}
/// <summary>
/// 获取恢复耐久的装备
/// </summary>
/// <param name="npcId"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetUserRecoverEqu(int npcId)
{
string userId = StateHelper.userId;
#region NPC验证
var npcInfo = await _mapService.GetNpcInfo(npcId);
if (npcInfo == null)
{
return PoAction.Message("Npc不存在!");
}
if (npcInfo.status != 1)
{
return PoAction.Message("Npc不存在!");
}
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.RetEqu)))
{
return PoAction.Message("业务不可用!");
}
var onMap = await _mapService.GetUserOnMapId(userId);
if (npcInfo.mapId != onMap)
{
return PoAction.Message("Npc不存在!");
}
#endregion
int need = 0;
var data = await _equService.GetUserOnEqu(userId);
var needData = data.FindAll(it =>
it.isAppr == 1 && it.durability < it.maxdurability && it.useEndTime > TimeExtend.GetTimeStampSeconds);
need = needData.Sum(it => (int)it.maxdurability - (int)it.durability);
return PoAction.Ok(new { data, need });
}
/// <summary>
/// 恢复装备耐久
/// </summary>
/// <param name="npcId"></param>
/// <param name="ueId"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> RecoverEqu(int npcId,string? ueId)
{
string userId = StateHelper.userId;
#region NPC验证
var npcInfo = await _mapService.GetNpcInfo(npcId);
if (npcInfo == null)
{
return PoAction.Message("Npc不存在!");
}
if (npcInfo.status != 1)
{
return PoAction.Message("Npc不存在!");
}
if (!npcInfo.bus.Any(it => it.code == nameof(GameEnum.NpcBusCode.RetEqu)))
{
return PoAction.Message("业务不可用!");
}
var onMap = await _mapService.GetUserOnMapId(userId);
if (npcInfo.mapId != onMap)
{
return PoAction.Message("Npc不存在!");
}
#endregion
if (string.IsNullOrEmpty(ueId))
{
var myEqu = await _equService.GetUserOnEqu(userId);
myEqu = myEqu.FindAll(it =>
it.isAppr == 1 && it.durability < it.maxdurability && it.useEndTime > TimeExtend.GetTimeStampSeconds);
int need = myEqu.Sum(it => (int)it.maxdurability - (int)it.durability);
if (need < 1)
{
return PoAction.Message("耐久已满,无需恢复!");
}
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
if (need > myAcc)
{
return PoAction.Message("铜贝不足!");
}
if (await _accService.UpdateUserCopper(userId, 0, need, "修复装备"))
{
foreach (var item in myEqu)
{
item.durability = item.maxdurability;
await _equService.UpdateUserEquInfo(item);
}
return PoAction.Ok(true, $"恢复成功,花费{need}铜贝!");
}
else
{
return PoAction.Message("恢复失败,请稍后尝试!");
}
}
else
{
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("装备未鉴定!");
}
if (equInfo.useEndTime < TimeExtend.GetTimeStampSeconds)
{
return PoAction.Message("装备已过期!");
}
if (equInfo.durability >= equInfo.maxdurability)
{
return PoAction.Message("耐久已满,无需恢复!");
}
int need = (int)equInfo.maxdurability - (int)equInfo.durability;
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
if (need > myAcc)
{
return PoAction.Message("铜贝不足!");
}
if (await _accService.UpdateUserCopper(userId, 0, need, "修复装备"))
{
equInfo.durability = equInfo.maxdurability;
if (await _equService.UpdateUserEquInfo(equInfo))
{
return PoAction.Ok(true, $"恢复成功,花费{need}铜贝!");
}
else
{
return PoAction.Message("恢复失败,请稍后尝试!");
}
}
else
{
return PoAction.Message("恢复失败,请稍后尝试!");
}
}
var data = await _attrService.GetUserVigourInfo(userId);
string time = TimeAssist.GetDateTimeYMDString(0);
if (data.upTime == time)

View File

@@ -136,8 +136,18 @@ public class BagController : ControllerBase
public async Task<IPoAction> CheckUserProp([FromBody] CheckUserPropParms parms)
{
string userId = StateHelper.userId;
List<TowerNeeds> needs = JsonConvert.DeserializeObject<List<TowerNeeds>>(parms.needs);
var result = await GameBus.CheckNeeds(userId, needs, 1);
return PoAction.Ok(result);
parms.count = parms.count < 1 ? 1 : parms.count;
if (parms.type == 0)
{
List<TowerNeed> needs = JsonConvert.DeserializeObject<List<TowerNeed>>(parms.needs);
var result = await GameBus.CheckNeed(userId, needs, parms.count);
return PoAction.Ok(result);
}
else
{
List<TowerNeeds> needs = JsonConvert.DeserializeObject<List<TowerNeeds>>(parms.needs);
var result = await GameBus.CheckNeeds(userId, needs, parms.count);
return PoAction.Ok(result);
}
}
}

View File

@@ -2,5 +2,7 @@
public class CheckUserPropParms
{
public int type { get; set; }
public int count { get; set; }
public string needs { get; set; }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
Web/public/images/equ/l.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
Web/public/images/equ/r.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -106,9 +106,11 @@ a:focus {
margin-right: 2px;
vertical-align: middle;
}
.border-btm {
border-bottom: 1px solid #E3E6EB;
}
.input {
line-height: 30px;
}
@@ -124,30 +126,33 @@ a:focus {
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.ipt-btn-gray-m {
width: 60px;
height: 20px;
border: none;
}
.serch{
display: flex;
.serch {
display: flex;
align-items: flex-end;
}
.search-ipt{
.search-ipt {
width: 80px;
font-size: 11px;
padding: 0 ;
padding: 0;
}
.ipt-btn{
.ipt-btn {
width: 61px;
height: 21px;
font-size: 13px;
border: none;
margin-top: 5px;
background: url(/css/images/btn_b_gold.gif) no-repeat;
background: url(/css/images/btn_b_gold.gif) no-repeat;
color: #af4c00;
}
@@ -155,14 +160,16 @@ a:focus {
word-wrap: break-word;
}
.chat img {
margin-right: 2px;
vertical-align: middle;
}
.chat img {
margin-right: 2px;
vertical-align: middle;
}
.em {
height: 30px;
width: 30px;
}
.badge {
max-height: 25px;
max-width: 25px;
@@ -205,3 +212,141 @@ a:focus {
background: 0 0;
color: #666;
}
/******装备样式******/
.equImg {
max-width: 130px;
max-height: 230px;
}
.tq {
background-image: url('/images/equ/tq.png');
background-repeat: no-repeat;
display: inline-block;
width: 15px;
height: 15px;
background-size: 15px;
/*设置图片大小*/
}
.ty {
background-image: url('/images/equ/ty.png');
background-repeat: no-repeat;
display: inline-block;
width: 15px;
height: 15px;
background-size: 15px;
/*设置图片大小*/
}
.ms {
background-image: url('/images/equ/ms.png');
background-repeat: no-repeat;
display: inline-block;
width: 15px;
height: 15px;
background-size: 15px;
/*设置图片大小*/
}
.zx {
background-image: url('/images/equ/zx.png');
background-repeat: no-repeat;
display: inline-block;
width: 15px;
height: 15px;
background-size: 15px;
/*设置图片大小*/
}
.sy {
background-image: url('/images/equ/sy.png');
background-repeat: no-repeat;
display: inline-block;
width: 15px;
height: 15px;
background-size: 15px;
/*设置图片大小*/
}
.gw {
background-image: url('/images/equ/gw.png');
background-repeat: no-repeat;
display: inline-block;
width: 15px;
height: 15px;
background-size: 15px;
/*设置图片大小*/
}
.ly {
background-image: url('/images/equ/ly.gif');
background-repeat: no-repeat;
display: inline-block;
width: 15px;
height: 15px;
background-size: 15px;
/*设置图片大小*/
}
.hm {
background-image: url('/images/equ/hm.gif');
background-repeat: no-repeat;
display: inline-block;
width: 15px;
height: 15px;
background-size: 15px;
/*设置图片大小*/
}
.j_r {
background-image: url('/images/equ/r.gif');
background-repeat: no-repeat;
display: inline-block;
width: 15px;
height: 15px;
background-size: 15px;
/*设置图片大小*/
}
.j_l {
background-image: url('/images/equ/l.gif');
background-repeat: no-repeat;
display: inline-block;
width: 15px;
height: 15px;
background-size: 15px;
/*设置图片大小*/
}
.equ_red {
color: #912334;
}
.equ_orange {
color: #c75e18;
}
.equ_yellow {
color: #c28a10;
}
.equ_green {
color: #2f9130;
}
.equ_cyan {
color: #269680;
}
.equ_blue {
color: #c94868;
}
.equ_purple {
color: #873ea1;
}
.equ_glod {
color: #e6b020;
}

View File

@@ -1,10 +1,10 @@
<template>
<span v-if="showUrl == false">
{{ equData.equName }}({{ equData.lev }})
</span>
<router-link v-if="showUrl" :to='"/prop/equ?ue=" + equData.ueId'>
{{ equData.equName }}({{ equData.lev }})
</router-link>
<span v-if="showUrl == false">
<span v-html="EquTool.ConvertEquName(equData,showLev)"></span>
</span>
<router-link v-if="showUrl" :to='"/prop/equ?ue=" + equData.ueId'>
<span v-html="EquTool.ConvertEquName(equData,showLev)"></span>
</router-link>
</template>
<script setup lang="ts">
// 1. 定义接收父组件传来的参数 props
@@ -16,6 +16,10 @@ const props = defineProps({
equData: {
type: Object,
default: () => ({})
},
showLev: {
type: Number,
default: 0
}
})
</script>

View File

@@ -0,0 +1,105 @@
<template>
<div class="content">
打造装备<Abutton @click="showPaper = true">选择</Abutton> <br>
</div>
<div class="content">
<div v-if="useGoods.goodsId != undefined">
<div class="common">
当前选择:{{ useGoods.goodsName }}
</div>
<div class="common">
<strong>打造所需</strong><br>
<GamePropVerify :data="verifyData.needs"></GamePropVerify>
</div>
<div class="common" v-if="verifyData.result == true">
[<Abutton @click="MakeEqu">立即打造</Abutton>]
</div>
</div>
<div v-else>
暂未选择打造图.
</div>
</div>
<div class="clear"></div>
<div class="content" style="font-size: 15px;">
说明:<br>
1.使用打造图后随机获得一件装备装备等级按照打造图纸中的说明<br>
2.打造出的装备无需鉴定<br>
3.打造方式先选择打造图纸然后收集足够的材料即可完成打造
</div>
<GamePopup v-model:show="showPaper" title="【选择图纸】" style="width: 60%;max-height: 30%;">
<!-- 自定义内容 -->
<div class="content" style="margin-top: 15px;">
<div v-if="goods.length == 0">
暂无图纸.
</div>
<div class="item" v-for="(item, index) in goods" :key="index">
{{ index + 1 }}.<Abutton @click="ChoosePaper(item.goods)">{{ item.goods.goodsName }}</Abutton>({{
item.count }})
</div>
</div>
</GamePopup>
</template>
<script setup lang="ts">
definePageMeta({
layout: layout.default,
middleware: 'page-loading'
})
const goods = ref<Array<any>>([]);
const useGoods = ref<any>({});
const verifyData = ref<any>({});
const needs = ref<Array<any>>([]);
onMounted(async () => {
try {
await BindData();
}
finally {
PageLoading.Close();
}
})
const BindData = async (): Promise<void> => {
let result = await BusinessService.GetEquPaper();
if (result.code == 0) {
goods.value = result.data;
}
else {
MessageExtend.ShowDialog("装备打造", result.msg);
}
};
const showPaper = ref(false);
const ChoosePaper = async (data: any) => {
useGoods.value = data;
MessageExtend.LoadingToast("操作中...");
let result = await BagService.CheckUserProp(0, 1, data.content);
MessageExtend.LoadingClose();
if (result.code == 0) {
verifyData.value = result.data;
needs.value = verifyData.value.needs;
showPaper.value = false;
}
else {
MessageExtend.ShowDialog("选择图纸", result.msg);
}
}
const MakeEqu = async () => {
MessageExtend.LoadingToast("打造中...");
let npcId = LocalStorageHelper.GetOnNpc();
let result = await BusinessService.HandleEquPaper(Number(npcId), useGoods.value.goodsId);
MessageExtend.LoadingClose();
if (result.code == 0) {
return PageExtend.Redirect("/prop/equ?ue=" + result.data);
}
else {
MessageExtend.ShowDialog("打造装备", result.msg);
}
}
</script>

View File

@@ -0,0 +1,71 @@
<template>
<div class="content">
修复装备
</div>
<div class="content">
请选择:
<div v-if="equData.length > 0">
<span v-if="allCopper > 0">
<Abutton @click="retEqu('')">全部修复({{ allCopper }})</Abutton>
</span>
<div class="item" v-for="(item, index) in equData" :key="index">
{{ index + 1 }}.<GameEqu :equ-data="item" :show-lev="1" :show-url="true"></GameEqu>
<span>({{ item.durability }}/{{ item.maxdurability }})</span>
<span v-if="item.durability < item.maxdurability">
[<Abutton @click="retEqu(item.ueId)">修复({{ item.maxdurability - item.durability }})</Abutton>]
</span>
</div>
</div>
<div v-else>
暂无穿戴中的装备.
</div>
</div>
<div class="clear"></div>
<div class="content" style="font-size: 16px;">
说明:<br>
1.装备仅可修复当前穿戴中的装备<br>
2.每修复1点耐久消耗1铜贝
</div>
</template>
<script setup lang="ts">
definePageMeta({
layout: layout.default,
middleware: 'page-loading'
})
const equData = ref<Array<any>>([]);
const allCopper = ref(0);
onMounted(async () => {
try {
await BindData();
}
finally {
PageLoading.Close();
}
})
const BindData = async (): Promise<void> => {
let npcId = LocalStorageHelper.GetOnNpc();
let result = await RecoverService.GetUserRecoverEqu(Number(npcId));
if (result.code == 0) {
equData.value = result.data.data;
allCopper.value = result.data.need;
}
else {
MessageExtend.ShowDialog("强化装备", result.msg);
}
};
const retEqu = async (ueId: string) => {
let npcId = LocalStorageHelper.GetOnNpc();
MessageExtend.LoadingToast("修复中...");
let result = await RecoverService.RecoverEqu(Number(npcId), ueId);
MessageExtend.LoadingClose();
if (result.code == 0) {
MessageExtend.Notify(result.msg, "success");
await BindData();
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
}
</script>

View File

@@ -1,8 +1,5 @@
<template>
<GameBroadcast :data="broadcast"></GameBroadcast>
<div class="item" style="font-size:15px;">
<span>[在线奖励]:3分钟后可领取.</span>
</div>
<GameBroadcast :data="broadcast"></GameBroadcast>
<div class="content">
{{ cityInfo.cityName }}·{{ mapInfo.mapName }}
<Abutton @click="Refresh">刷新</Abutton>

View File

@@ -49,15 +49,13 @@
</div>
</div>
<div class="common" v-if="ueId != ''">
名称:{{ equData.equName }}<br>
名称:<span v-html="EquTool.ConvertEquName(equData, 0)"></span> <br>
<span v-if="equData.equName != equData.unitEquName">
装备名称:{{ equData.unitEquName }}<br>
</span>
部位:{{ EquTool.GetEquPlaceName(equData.code) }}<br>
等级:{{ equData.lev }}<br>
<span v-if="equData.quality > 0">
品质:<Abar href="">equData.qualityName</Abar><br>
</span>
品质:{{ equData.qualityName }}<br>
交易:{{ equData.isDeal == 1 ? "可交易" : "不可交易" }}<br>
赠送:{{ equData.isGive == 1 ? "可赠送" : "不可赠送" }}<br>
获取途径:{{ equInfo.source }}<br>
@@ -127,7 +125,10 @@
<Abutton @click="btnOpenAwaken">觉醒</Abutton><br>
</span>
<span v-if="equData.isAppr == 1">
<Abutton>洗练</Abutton><br>
<Abar :href='"/user/equ/quality?ue=" + equData.ueId'>洗练</Abar><br>
</span>
<span v-if="equData.isAppr == 0">
<Abutton @click="ApprEqu">鉴定</Abutton><br>
</span>
<span>
<Abutton @click="LockEqu">{{ equData.isLock == 0 ? "绑定" : "解绑" }}</Abutton><br>
@@ -275,4 +276,20 @@ const btnEquAwaken = async (type: number) => {
}
}
/**鉴定 */
const ApprEqu = async () => {
MessageExtend.ShowConfirmDialogAsyc("鉴定装备", `鉴定装备需要消耗1张【装备鉴定符】,是否要鉴定?`, async () => {
let result = await EquService.ApprEqu(ueId);
if (result.code == 0) {
await BindData();
MessageExtend.Notify(result.msg, "success");
}
else {
MessageExtend.Notify(result.msg, "danger");
}
return true;
});
}
</script>

View File

@@ -11,9 +11,12 @@
<div class="content">
<div class="common">
<Acheak @click="ChangeBag('0')" :on-value="type" on-cheak="0">装备</Acheak>|<Acheak @click="ChangeBag('1')"
:on-value="type" on-cheak="1">药品</Acheak>|<Acheak @click="ChangeBag('2')" :on-value="type" on-cheak="2">
物品</Acheak>|<Acheak @click="ChangeBag('3')" :on-value="type" on-cheak="3">坐骑</Acheak>
<Acheak @click="ChangeBag('0')" :on-value="type" on-cheak="0">装备</Acheak>|
<Acheak @click="ChangeBag('1')" :on-value="type" on-cheak="1">药品</Acheak>|
<Acheak @click="ChangeBag('2')" :on-value="type" on-cheak="2">物品</Acheak>|
<Acheak @click="ChangeBag('3')" :on-value="type" on-cheak="3">坐骑</Acheak>|
<Acheak @click="ChangeBag('4')" :on-value="type" on-cheak="4">九宫</Acheak>|
<Acheak @click="ChangeBag('5')" :on-value="type" on-cheak="5">十方</Acheak>
</div>
<div class="common">
@@ -49,7 +52,7 @@
<div class="common" v-if="type == '0'">
<div class="item" v-for="(item, index) in data" :key="index">
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}.
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
<span v-if="item.isOn == 1">()</span>
<span v-if="item.isAppr == 0">(未鉴定)</span>
<span v-if="item.useEndTime < onTime" style="color: red;">(过期)</span>
@@ -131,7 +134,7 @@ const BindData = async (): Promise<void> => {
let result = await BagService.GetUserBagProp(Number(type.value), Number(type_ch.value), serch.value, currentPage.value)
if (result.code == 0) {
data.value = result.data.data;
total.value = result.data.total;
total.value = result.data.total;
//存储请求参数
let addLocalData: bagStorage = { type: type.value, type_ch: type_ch.value, page: currentPage.value, serch: serch.value };
@@ -146,14 +149,14 @@ const BindData = async (): Promise<void> => {
const ChangeBag = async (_type: string): Promise<void> => {
currentPage.value = 1;
type.value = _type;
type_ch.value = '0';
serch.value='';
type_ch.value = '0';
serch.value = '';
await BindData();
}
const ChangeChildBag = async (ch: string): Promise<void> => {
currentPage.value = 1;
type_ch.value = ch;
type_ch.value = ch;
await BindData();
}
@@ -163,14 +166,14 @@ const Refresh = async (): Promise<void> => {
onTime.value = TimeExtend.GetSecondStamp();
MessageExtend.LoadingToast("刷新中...");
currentPage.value = 1;
await BindData();
await BindData();
MessageExtend.LoadingClose();
PageExtend.ScrollToTop();
}
/**翻页 */
const handlePageChange = async (page: number): Promise<void> => {
currentPage.value = page;
currentPage.value = page;
await BindData();
};

View File

@@ -2,69 +2,69 @@
<div class="content">
手持: <Abutton @click="chooseEqu(1, Hold)">[+]</Abutton>
<div class="item" v-for="item in Hold">
<GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>[<Abutton @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>
<div class="content">
副手: <Abutton @click="chooseEqu(2, Vice)">[+]</Abutton>
<div class="item" v-for="item in Vice">
<GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>[<Abutton
@click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>
<div class="content">
头戴: <Abutton @click="chooseEqu(3, Head)">[+]</Abutton>
<div class="item" v-for="item in Head">
<GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>[<Abutton
@click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>
<div class="content">
身穿: <Abutton @click="chooseEqu(4, Wear)">[+]</Abutton>
<div class="item" v-for="item in Wear">
<GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>[<Abutton
@click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>
<div class="content">
腰带: <Abutton @click="chooseEqu(5, Waist)">[+]</Abutton>
<div class="item" v-for="item in Waist">
<GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>[<Abutton
@click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>
<div class="content">
脚穿: <Abutton @click="chooseEqu(6, Foot)">[+]</Abutton>
<div class="item" v-for="item in Foot">
<GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>[<Abutton
@click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>
<div class="content">
佩戴: <Abutton @click="chooseEqu(7, Ornaments)">[+]</Abutton>
<div class="item" v-for="item in Ornaments">
<GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>[<Abutton
@click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>
<div class="content">
时装: <Abutton @click="chooseEqu(8, Fashion)">[+]</Abutton>
<div class="item" v-for="item in Fashion">
<GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>[<Abutton
@click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>
<div class="content">
羽翼: <Abutton @click="chooseEqu(9, Wing)">[+]</Abutton>
<div class="item" v-for="item in Wing">
<GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>[<Abutton
@click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>
<div class="content">
装饰: <Abutton @click="chooseEqu(10, Decorate)">[+]</Abutton>
<div class="item" v-for="item in Decorate">
<GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>[<Abutton
@click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>

View File

@@ -0,0 +1,147 @@
<template>
<div class="content">
装备洗练<br>
名称: <GameEqu :equ-data="equData" :show-url="false"></GameEqu><br>
<span v-if="equData.equName != equData.unitEquName">
装备名称:{{ equData.unitEquName }}<br>
</span>
部位:{{ EquTool.GetEquPlaceName(equData.code) }}<br>
等级:{{ equData.lev }}<br>
</div>
<div class="content">
当前品质:{{ equData.qualityName }}<br>
品质等级:{{ equData.quality }}<br>
当前特性:<br>
<div :class='"equip equip-lv" + (index + 1)' v-for="(item, index) in equAttr" :key="index">
{{ index + 1 }}.{{ item.tip }}
</div>
</div>
<div class="content">
洗练所需:<br>
<GamePropVerify :data="verifyData.needs"></GamePropVerify>
</div>
<div class="content" v-if="verifyData.result">
[<Abutton @click="btnHandleEquUp">立即洗练</Abutton>]
</div>
<div class="clear"></div>
<div class="content" style="font-size: 16px;;">
洗练说明:<br>
1.洗练会随机重置装备词条,且不可恢复<br>
2.装备词条数即为装备品质分别为<br>>>>>绿>>>><br>
3.洗练最多可以获得7个特性词条,只有特殊装备会有8个特性词条<br>
</div>
</template>
<script setup lang="ts">
definePageMeta({
layout: layout.default,
middleware: 'page-loading'
})
const equData = ref<any>({});
const equAttr = ref<Array<any>>([]);
const verifyData = ref<any>({});
const needs = ref<Array<any>>([]);
let ueId = PageExtend.QueryString("ue");
onMounted(async () => {
try {
await BindData();
}
finally {
PageLoading.Close();
}
})
const BindData = async (): Promise<void> => {
let result = await EquService.GetEquQualityInfo(ueId);
if (result.code == 0) {
equData.value = result.data.equData;
equAttr.value = equData.value.equAttr;
verifyData.value = result.data.result;
needs.value = verifyData.value.needs;
}
else {
MessageExtend.ShowDialog("装备洗练", result.msg);
}
};
/**洗练装备 */
const btnHandleEquUp = async () => {
MessageExtend.LoadingToast("洗练中...");
let result = await EquService.HandleEquQuality(ueId);
MessageExtend.LoadingClose();
if (result.code == 0) {
await BindData();
MessageExtend.Notify(result.msg, "success");
}
else {
MessageExtend.Notify(result.msg, "danger");
}
}
</script>
<style>
/* 装备等级基础通用样式 */
.equip {
width: 220px;
padding: 5px;
margin: 8px 0;
border-radius: 8px;
font-size: 15px;
}
/* 1级 普通 · 浅灰银 */
.equip-lv1 {
color: #868b94; /* 文字色 */
background-color: #f2f3f5; /* 背景底色 */
border: 1px solid #d0d3d9; /* 边框描边 */
}
/* 2级 优秀 · 浅青灰 */
.equip-lv2 {
color: #589999;
background-color: #f0f8f8;
border: 1px solid #b2d8d8;
}
/* 3级 精良 · 柔和绿 */
.equip-lv3 {
color: #4a9966;
background-color: #f2faf5;
border: 1px solid #a6d9bb;
}
/* 4级 稀有 · 暖黄琥珀(低饱和不刺眼) */
.equip-lv4 {
color: #b38628;
background-color: #fff9eb;
border: 1px solid #f0d090;
}
/* 5级 史诗 · 淡紫柔紫 */
.equip-lv5 {
color: #805cb3;
background-color: #f7f2ff;
border: 1px solid #ccb8e6;
}
/* 6级 传说 · 浅天蓝 */
.equip-lv6 {
color: #3b7cb8;
background-color: #f0f7ff;
border: 1px solid #a3c6e8;
}
/* 7级 神话 · 柔暗红(复古酒红) */
.equip-lv7 {
color: #a84f4f;
background-color: #fdf2f2;
border: 1px solid #e8b3b3;
}
/* 8级 不朽 · 鎏金暗金(高级质感,不荧光) */
.equip-lv8 {
color: #b88c36;
background-color: #fffbf0;
border: 1px solid #e6c280;
/* 顶级增加微弱渐变质感 */
background-image: linear-gradient(135deg, #fffbf0, #fff6e0);
}
</style>

View File

@@ -74,7 +74,7 @@ onMounted(async () => {
}
})
const BindData = async (): Promise<void> => {
let result = await EquService.GetEquUpInfo(ueId);
let result = await EquService.GetEquUpInfo(ueId);
if (result.code == 0) {
equData.value = result.data.equData;
isMax.value = result.data.isMax;
@@ -104,10 +104,12 @@ const ChangePropOk = async (data: any) => {
it.code = data.code;
it.parameter = data.parameter;
it.count = data.count;
it.isOp = data.isOp;
it.retCount = data.retCount;
}
});
let _needs = JSON.stringify(needs.value);
let result = await BagService.CheckUserProp(_needs);
let result = await BagService.CheckUserProp(1, 1, _needs);
MessageExtend.LoadingClose();
if (result.code == 0) {
verifyData.value = result.data;

View File

@@ -0,0 +1,17 @@
export class BusinessService {
/**
* 获取打造图纸
* GET /Business/GetEquPaper
*/
static async GetEquPaper() {
return await ApiService.Request("get", "/Business/GetEquPaper");
}
/**
* 打造装备
* GET /Business/HandleEquPaper
*/
static async HandleEquPaper(npcId: number, goodsId: number) {
return await ApiService.Request("get", "/Business/HandleEquPaper", { npcId, goodsId });
}
}

View File

@@ -31,6 +31,14 @@ export class EquService {
return await ApiService.Request("get", "/Equ/GetUserOnEqu");
}
/**
* 鉴定装备
* GET /Equ/ApprEqu
*/
static async ApprEqu(ueId: string) {
return await ApiService.Request("get", "/Equ/ApprEqu", { ueId });
}
/**
* 穿/卸装备
* GET /Equ/DownOrUpEqu
@@ -89,4 +97,20 @@ export class EquService {
static async HandleEquUp(ueId: string, needs: string) {
return await ApiService.Request("post", "/Equ/HandleEquUp", { ueId, needs });
}
/**
* 获取洗练装备属性
* GET /Equ/GetEquQualityInfo
*/
static async GetEquQualityInfo(ueId: string) {
return await ApiService.Request("get", "/Equ/GetEquQualityInfo", { ueId });
}
/**
* 洗练装备
* GET /Equ/HandleEquQuality
*/
static async HandleEquQuality(ueId: string) {
return await ApiService.Request("get", "/Equ/HandleEquQuality", { ueId });
}
}

View File

@@ -30,4 +30,20 @@ export class RecoverService {
static async RecoverVigour(npcId: number) {
return await ApiService.Request("get", "/Recover/RecoverVigour", { npcId });
}
/**
* 获取恢复耐久的装备
* GET /Recover/GetUserRecoverEqu
*/
static async GetUserRecoverEqu(npcId: number) {
return await ApiService.Request("get", "/Recover/GetUserRecoverEqu", { npcId });
}
/**
* 恢复装备耐久
* GET /Recover/RecoverEqu
*/
static async RecoverEqu(npcId: number, ueId: string) {
return await ApiService.Request("get", "/Recover/RecoverEqu", { npcId, ueId });
}
}

View File

@@ -18,9 +18,11 @@ export class BagService {
/**
* 验证用户道具
* POST /User/Bag/CheckUserProp
* @param type body
* @param count body
* @param needs body
*/
static async CheckUserProp(needs: string) {
return await ApiService.Request("post", "/User/Bag/CheckUserProp", { needs });
static async CheckUserProp(type: number, count: number, needs: string) {
return await ApiService.Request("post", "/User/Bag/CheckUserProp", { type, count, needs });
}
}

View File

@@ -82,4 +82,101 @@ export class EquTool {
}
return result;
}
public static ConvertEquName(data: any, showLev: number) {
let equName = data.equName;
let tips = '';
if (data.quality > 0) {
tips = "✡";//洗练
}
tips = this.GetEquNameAttr(tips, data.intensifyLev);
if (data.EquAwaken != null) {
if (data.EquAwaken.Count > 0) {
tips += "✪";//觉醒
}
}
if (data.suitCode != "0")//套装
{
tips += "+";
}
if (showLev == 1) {
equName = `${tips}${data.equName}(${data.lev}级)`;
if (data.quality > 4) {
equName = `<i class='j_l'></i>${equName}<i class='j_r'></i>`;
}
}
else {
equName = `${tips}${data.equName}`;
}
return `<span class='${this.GetEquColorName(data.quality)}'>${equName}</span>`; ;
}
private static GetEquNameAttr(tips: string, lev: number) {
let result = '';
if (lev <= 4) {
result = `${tips}`;
}
else if (lev > 4 && lev <= 20) {
let igName = ["红", "橙", "黄", "绿", "青", "蓝", "紫", "粉", "幻", "天", "弑", "神", "灵", "真", "玄", "尊"];
result = `${tips}${igName[lev - 5]}`;
}
else if (lev > 20 && lev <= 30) {
result = `${tips}`;
}
else if (lev > 30 && lev <= 40) {
result = `<i class='tq'></i>${tips}天启`;
}
else if (lev > 40 && lev <= 50) {
result = `<i class='ty'></i>${tips}天陨`;
}
else if (lev > 50 && lev <= 60) {
result = `<i class='ms'></i>${tips}灭世`;
}
else if (lev > 60 && lev <= 70) {
result = `<i class='zx'></i>${tips}诛仙`;
}
else if (lev > 70 && lev <= 80) {
result = `<i class='sy'></i>${tips}神音`;
}
else if (lev > 80 && lev <= 90) {
result = `<i class='gw'></i>${tips}归无`;
}
else if (lev > 90 && lev <= 99) {
result = `<i class='ly'></i>${tips}灵韵`;
}
else {
result = `<i class='hm'></i>${tips}鸿蒙`;
}
return result;
}
private static GetEquColorName(lev: number) {
let result = '';
switch (lev) {
case 1:
result = 'equ_red';
break;
case 2:
result = 'equ_orange';
break;
case 3:
result = 'equ_yellow';
break;
case 4:
result = 'equ_green';
break;
case 5:
result = 'equ_cyan';
break;
case 6:
result = 'equ_blue';
break;
case 7:
result = 'equ_purple';
break;
case 8:
result = 'equ_glod';
break;
}
return result;
}
}