This commit is contained in:
Putoo
2026-06-17 19:22:35 +08:00
parent 5cd6151b96
commit 3b0f1e37ee
40 changed files with 1856 additions and 55 deletions

View File

@@ -0,0 +1,13 @@
namespace Application.Domain.Entity;
public class game_broadcast
{
public string Id { get; set; }
public int area { get; set; }
public string code { get; set; }
public string userId { get; set; }
public string userNo { get; set; }
public string nick { get; set; }
public string msg { get; set; }
public long endTime { get; set; }
}

View File

@@ -0,0 +1,30 @@
namespace Application.Domain.Entity;
public class CheckTowerNeeds
{
private bool _result;
public bool result
{ get { return this._result; } set { this._result = value; } }
private System.Int32 _isDeal;
/// <summary>
/// 0不可交易1可交易
/// </summary>
public System.Int32 isDeal
{ get { return this._isDeal; } set { this._isDeal = value; } }
private System.Int32 _isGive;
/// <summary>
/// 0不可交易1可交易
/// </summary>
public System.Int32 isGive
{ get { return this._isGive; } set { this._isGive = value; } }
private List<TowerNeeds> _Needs;
public List<TowerNeeds> Needs
{ get { return this._Needs; } set { this._Needs = value; } }
}

View File

@@ -31,7 +31,6 @@ public class EquAwaken
/// <summary>
///
/// </summary>
[SqlSugar.SugarColumn(ColumnDataType = "varchar(max)", IsJson = true)]
public List<AttrItem> awaken
{ get { return this._awaken; } set { this._awaken = value; } }
}

View File

@@ -0,0 +1,36 @@
namespace Application.Domain.Entity;
public class EquAwakenData
{
private System.Int32 _lev;
/// <summary>
///
/// </summary>
public System.Int32 lev
{ get { return this._lev; } set { this._lev = value; } }
private System.Int32 _success;
/// <summary>
///
/// </summary>
public System.Int32 success
{ get { return this._success; } set { this._success = value; } }
private List<TowerNeed> _need;
/// <summary>
///
/// </summary>
public List<TowerNeed> need
{ get { return this._need; } set { this._need = value; } }
private List<AttrItem> _attr;
/// <summary>
///
/// </summary>
public List<AttrItem> attr
{ get { return this._attr; } set { this._attr = value; } }
}

View File

@@ -26,20 +26,20 @@ public class TowerNeed
public System.String parameter
{ get { return this._parameter; } set { this._parameter = value; } }
private System.Int32 _count;
private long _count;
/// <summary>
///
/// </summary>
public System.Int32 count
public long count
{ get { return this._count; } set { this._count = value; } }
private System.Int32 _retCount;
private long _retCount;
/// <summary>
///
/// </summary>
public System.Int32 retCount
public long retCount
{ get { return this._retCount; } set { this._retCount = value; } }
private System.Int32 _isOp;
@@ -57,4 +57,12 @@ public class TowerNeed
/// </summary>
public System.Int32 isAsk
{ get { return this._isAsk; } set { this._isAsk = value; } }
private long _onCount;
/// <summary>
///
/// </summary>
public long onCount
{ get { return this._onCount; } set { this._onCount = value; } }
}

View File

@@ -0,0 +1,111 @@
namespace Application.Domain.Entity;
public class TowerNeeds
{
private System.Int32 _Id;
/// <summary>
///
/// </summary>
public System.Int32 Id
{
get { return this._Id; }
set { this._Id = value; }
}
private System.String _code;
/// <summary>
///
/// </summary>
public System.String code
{
get { return this._code; }
set { this._code = value; }
}
private System.String _name;
/// <summary>
///
/// </summary>
public System.String name
{
get { return this._name; }
set { this._name = value; }
}
private System.String _parameter;
/// <summary>
///
/// </summary>
public System.String parameter
{
get { return this._parameter; }
set { this._parameter = value; }
}
private long _count;
/// <summary>
///
/// </summary>
public long count
{
get { return this._count; }
set { this._count = value; }
}
private long _retCount;
/// <summary>
///
/// </summary>
public long retCount
{
get { return this._retCount; }
set { this._retCount = value; }
}
private System.Int32 _isOp;
/// <summary>
///
/// </summary>
public System.Int32 isOp
{
get { return this._isOp; }
set { this._isOp = value; }
}
private System.Int32 _isAsk;
/// <summary>
///
/// </summary>
public System.Int32 isAsk
{
get { return this._isAsk; }
set { this._isAsk = value; }
}
private long _onCount;
/// <summary>
///
/// </summary>
public long onCount
{
get { return this._onCount; }
set { this._onCount = value; }
}
private List<TowerNeed> _NeedItem;
public List<TowerNeed> NeedItem
{
get { return this._NeedItem; }
set { this._NeedItem = value; }
}
}

View File

@@ -0,0 +1,27 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Resource")]
public class game_dic
{
/// <summary>
/// code
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? code { get; set; }
/// <summary>
/// sign
/// </summary>
[SugarColumn(IsNullable = true)]
public string? sign { get; set; }
/// <summary>
/// remark
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? remark { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Resource")]
public class game_equ_awaken
{
/// <summary>
/// 特性表
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string atId { get; set; }
/// <summary>
/// 特性名称
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? name { get; set; }
/// <summary>
/// levAttr
/// </summary>
[SugarColumn(IsNullable = true,IsJson = true)]
public List<EquAwakenData> levAttr { get; set; }
/// <summary>
/// 权重
/// </summary>
[SugarColumn(IsNullable = true)]
public int? random { get; set; }
/// <summary>
/// 可觉醒装备
/// </summary>
[SugarColumn(IsNullable = true)]
public string? position { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Resource")]
public class game_equ_up
{
/// <summary>
/// euId
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public int euId { get; set; }
/// <summary>
/// onLev
/// </summary>
[SugarColumn(IsNullable = true)]
public int? onLev { get; set; }
/// <summary>
/// maxLev
/// </summary>
[SugarColumn(IsNullable = true)]
public int? maxLev { get; set; }
/// <summary>
/// okChance
/// </summary>
[SugarColumn(IsNullable = true)]
public int? okChance { get; set; }
/// <summary>
/// needData
/// </summary>
[SugarColumn(IsNullable = true,IsJson = true)]
public List<TowerNeeds> needData { get; set; }
}
}

View File

@@ -57,4 +57,9 @@ public static class GameEnum
RetVigour,
MapTo,
}
public enum DicCode
{
Awaken,//觉醒配置
}
}

View File

@@ -8,4 +8,12 @@ public static class MessageEnum
Marry,//婚姻消息
Trade,//交易通知
}
public enum BroadcastCode
{
Gift,
System,
Award,
Remind,
Promote
}
}

View File

@@ -6,7 +6,9 @@ public interface IGameEquService
Task<game_equ> GetEquInfo(int equId);
Task<game_equ_suit> GetEuqSuitInfo(string suitCode);
#endregion
#region
Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex, int PageSize,
@@ -21,6 +23,7 @@ public interface IGameEquService
Task<bool> UpdateUserEquInfo(unit_user_equ equData, bool isAddLog = false, string code = "",
string remark = "");
Task<bool> DeductUserEqu(string userId, List<unit_user_equ> equData, string remark);
Task<bool> DeductUserEqu(string userId, int equId, int count, string remark);
@@ -30,12 +33,25 @@ public interface IGameEquService
Task<List<unit_user_equ>> GetUserOnEqu(string userId);
Task<bool> EquOnOrDown(unit_user_equ data, int state);
Task<List<UserEquSuit>> GetUserEquSuit(string userId);
#endregion
#region
#region
Task<game_equ_awaken> GetEquAwakenInfo(string atId);
Task<game_equ_awaken> GetRandomOneAwakenByCode(string code);
Task<EquAwakenData> GetEquAwakenInfoByLev(string atId, int lev);
#endregion
#region
Task<game_equ_up> GetUserEquUpData(int lev);
#endregion
#region
Task<int> GetUserEquWeightSum(string userId);
#endregion
}

View File

@@ -0,0 +1,6 @@
namespace Application.Domain;
public interface IGameDicService
{
Task<game_dic> GetDicInfo(string code);
}

View File

@@ -43,4 +43,11 @@ public interface IMessageService
List<MsgEventBtn> btns = null, int days = 10);
#endregion
#region 广
Task<List<game_broadcast>> GetBroadcastData(int area);
Task<bool> SendBroadcast(string userId, string code, string msg);
#endregion
}

View File

@@ -191,6 +191,11 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
{
await AddEquLog(equData, code, remark);
}
if (equData.isOn == 1)
{
await ClearUserOnEqu(equData.userId);
}
}
return result;
@@ -429,6 +434,98 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
return result;
}
#endregion
#region
public async Task<game_equ_awaken> GetEquAwakenInfo(string atId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "AwakenData");
var data = await redis.GetHashAsync<game_equ_awaken>(key, atId);
if (data == null)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<game_equ_awaken>();
data = await db.Queryable<game_equ_awaken>().Where(i => i.atId == atId).SingleAsync();
if (data != null)
{
await redis.AddHashAsync(key, atId, data);
}
}
return data;
}
public async Task<game_equ_awaken> GetRandomOneAwakenByCode(string code)
{
game_equ_awaken attr = new game_equ_awaken();
var db = DbClient.AsTenant().GetConnectionWithAttr<game_equ_awaken>();
var list = await db.Queryable<game_equ_awaken>().Where(i => i.position.Contains(code)).ToListAsync();
if (list.Count == 0)
{
return null;
}
List<object> data = new List<object>();
List<ushort> weights = new List<ushort>();
List<object> result = new List<object>();
Random rand = new Random();
foreach (var item in list)
{
data.Add(item);
weights.Add(ushort.Parse(item.random.ToString()));
}
RandomAssist random = new RandomAssist(1);
result = random.ControllerRandomExtract(rand, data, weights);
if (result.Count > 0)
{
attr = result[0] as game_equ_awaken;
return attr;
}
else
{
return null;
}
}
public async Task<EquAwakenData> GetEquAwakenInfoByLev(string atId, int lev)
{
var awakenInfo = await GetEquAwakenInfo(atId);
EquAwakenData awaken = new EquAwakenData();
foreach (var item in awakenInfo.levAttr)
{
if (item.lev == lev)
{
return item;
}
}
return null;
}
#endregion
#region
public async Task<game_equ_up> GetUserEquUpData(int lev)
{
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquUpData");
var data = await redis.GetHashAsync<game_equ_up>(key, lev.ToString());
if (data == null)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<game_equ_up>();
data = await db.Queryable<game_equ_up>().Where(i => i.onLev <= lev && i.maxLev >= lev).FirstAsync();
if (data != null)
{
await redis.AddHashAsync(key, lev.ToString(), data);
}
}
return data;
}
#endregion
#region

View File

@@ -832,7 +832,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
if (!string.IsNullOrEmpty(offSet))
{
var offsetData = JsonConvert.DeserializeObject<TowerNeed>(offSet);
var chekResult = await GameBus.CheakNeed(userId, offsetData, "");
var chekResult = await GameBus.CheckNeed(userId, offsetData);
if (chekResult.result)
{
if (offsetData.isOp == 0)
@@ -858,7 +858,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
public async Task<List<game_city_map_bus>> GetMapBus(string BusCode, int v, int l)
{
string key = string.Format(BaseCache.BaseCacheKeys, "CITY_MAP_BUS", BusCode);
string key = string.Format(BaseCache.BaseCacheKeys, "CityMapBus", BusCode);
var data = await redis.GetAsync<List<game_city_map_bus>>(key);
if (data == null)
{
@@ -877,7 +877,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
public async Task<game_city_map_bus> GetMapBusInfo(int busId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "CITY_MAP_BUS", "BUS_INFO");
string key = string.Format(BaseCache.BaseCacheKeys, "CityMapBus", "BUS_INFO");
if (await redis.HExistsHashAsync(key, busId.ToString()))
{
return await redis.GetHashAsync<game_city_map_bus>(key, busId.ToString());
@@ -925,6 +925,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
#endregion
#region
public async Task<game_city_map_res> GetMapResInfo(string resId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "CityData", "MapResInfo");
@@ -938,6 +939,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
return data;
}
public async Task<List<game_city_map_res>> GetMapRes(string mapId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "CityData", "MapRes");

View File

@@ -0,0 +1,19 @@
namespace Application.Domain;
public class GameDicService(ISqlSugarClient DbClient, IRedisCache redis) : IGameDicService, ITransient
{
public async Task<game_dic> GetDicInfo(string code)
{
string key = string.Format(BaseCache.BaseCacheKey, "DicData");
if (await redis.HExistsHashAsync(key, code))
{
return await redis.GetHashAsync<game_dic>(key, code);
}
var db = DbClient.AsTenant().GetConnectionWithAttr<game_dic>();
var data = await db.Queryable<game_dic>().Where(it => it.code == code).SingleAsync();
await redis.AddHashAsync(key, code, data);
return data;
}
}

View File

@@ -311,8 +311,9 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
return await db.Queryable<unit_user_message_event>().Where(it => it.state == 0 && it.token == token).AnyAsync();
}
public async Task<bool> SendEventMsg(string userId, string code, string name, string sign, string pars,string token,
List<MsgEventBtn> btns=null, int days = 10)
public async Task<bool> SendEventMsg(string userId, string code, string name, string sign, string pars,
string token,
List<MsgEventBtn> btns = null, int days = 10)
{
unit_user_message_event data = new unit_user_message_event();
data.eventId = StringAssist.NewGuid;
@@ -331,8 +332,9 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
}
else
{
data.btns = btns;
data.btns = btns;
}
data.addTime = DateTime.Now;
data.endTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddDays(days));
data.token = token;
@@ -347,4 +349,54 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
}
#endregion
#region 广
public async Task<List<game_broadcast>> GetBroadcastData(int area)
{
List<game_broadcast> data = new List<game_broadcast>();
string key = string.Format(BaseCache.BaseCacheKey, "GameBroadcast");
var result = await redis.GetHashAllAsync<game_broadcast>(key);
if (result.Count > 0)
{
data = result.Values.ToList();
}
long time = TimeExtend.GetTimeStampSeconds;
data = data.FindAll(it => (it.area == area || it.area == 0) && it.endTime > time);
data = data.OrderByDescending(it => it.endTime).Take(2).ToList();
return data;
}
public async Task<bool> SendBroadcast(string userId, string code, string msg)
{
game_broadcast add = new game_broadcast();
add.Id = StringAssist.NewGuid;
add.userId = userId;
add.code = code;
add.msg = msg;
int area = 0;
if (add.userId == "0")
{
add.area = 0;
add.userNo = "0";
add.nick = "海精灵";
}
else
{
var userService = App.GetService<IUnitUserService>();
var userInfo = await userService.GetUserInfoByUserId(userId);
add.area = (int)userInfo.areaId;
add.userNo = userInfo.userNo;
add.nick = userInfo.nick;
area = add.area;
}
add.endTime = TimeExtend.GetTimeStampSeconds + 300;
string key = string.Format(BaseCache.BaseCacheKey, "GameBroadcast");
bool result = await redis.AddHashAsync(key, add.Id, add);
return result;
}
#endregion
}

View File

@@ -1,6 +1,6 @@
namespace Application.Domain;
public class GameBus
public static class GameBus
{
#region
@@ -96,20 +96,24 @@ public class GameBus
#region
public static async Task<CheckTowerNeed> CheakNeed(string userId, TowerNeed item, string sid, int count = 1)
public static async Task<CheckTowerNeed> CheckNeed(string userId, TowerNeed item, int count = 1)
{
CheckTowerNeed result = new CheckTowerNeed();
result.Needs = new List<TowerNeed>();
bool isok = true;
int isDeal = 1;
int isGive = 1;
item.isAsk = 1;
if (item.code == nameof(GameEnum.PropCode.Equ))
{
var equService = App.GetService<IGameEquService>();
int MyCount = await equService.GetUserEquByEquIdCount(userId, Convert.ToInt32(item.parameter));
int neecCount = item.count * count;
if (MyCount < neecCount)
long needCount = item.count * count;
item.count = needCount;
item.onCount = MyCount;
if (MyCount < needCount)
{
item.isAsk = 0;
isok = false;
}
}
@@ -132,29 +136,38 @@ public class GameBus
}
}
int needCount = item.count * count;
long needCount = item.count * count;
item.count = needCount;
item.onCount = MyCount;
if (MyCount < needCount)
{
isok = false;
item.isAsk = 0;
}
}
else if (item.code == nameof(GameEnum.PropCode.copper))
{
var accService = App.GetService<IUnitUserAccService>();
var MyAcc = await accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
decimal needAcc = item.count * count;
long needAcc = item.count * count;
item.count = needAcc;
item.onCount = MyAcc;
if (MyAcc < needAcc)
{
isok = false;
item.isAsk = 0;
}
}
else if (item.code == nameof(GameEnum.PropCode.gold))
{
var accService = App.GetService<IUnitUserAccService>();
var MyAcc = await accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.gold));
decimal needAcc = item.count * count;
long needAcc = item.count * count;
item.count = needAcc;
item.onCount = MyAcc;
if (MyAcc < needAcc)
{
item.isAsk = 0;
isok = false;
}
}
@@ -162,9 +175,12 @@ public class GameBus
{
var attrService = App.GetService<IUnitUserAttrService>();
var MyAcc = await attrService.GetUserVigourInfo(userId);
decimal neecAcc = item.count * count;
if (MyAcc.vitality < neecAcc)
long needAcc = item.count * count;
item.count = needAcc;
item.onCount = (long)MyAcc.vitality;
if (MyAcc.vitality < needAcc)
{
item.isAsk = 0;
isok = false;
}
}
@@ -172,6 +188,8 @@ public class GameBus
{
var attrService = App.GetService<IUnitUserAttrService>();
var MyLev = await attrService.GetUserLev(userId);
item.count = item.count;
item.onCount = MyLev;
if (MyLev < item.count)
{
isok = false;
@@ -181,18 +199,20 @@ public class GameBus
result.result = isok;
result.isDeal = isDeal;
result.isGive = isGive;
result.Needs.Add(item);
return result;
}
public static async Task<CheckTowerNeed> CheakNeed(string userId, List<TowerNeed> needs, string sid, int count = 1)
public static async Task<CheckTowerNeed> CheckNeed(string userId, List<TowerNeed> needs, int count = 1)
{
CheckTowerNeed result = new CheckTowerNeed();
result.Needs = new List<TowerNeed>();
bool isok = true;
int isDeal = 1;
int isGive = 1;
foreach (var item in needs)
{
var cheakResult = await CheakNeed(userId, item, sid, count);
var cheakResult = await CheckNeed(userId, item, count);
if (isok)
{
isok = cheakResult.result;
@@ -208,7 +228,116 @@ public class GameBus
isGive = 0;
}
item.isAsk = cheakResult.result ? 1 : 0;
result.Needs.AddRange(cheakResult.Needs);
}
result.result = isok;
result.isDeal = isDeal;
result.isGive = isGive;
return result;
}
public static async Task<CheckTowerNeeds> CheckNeeds(string userId, List<TowerNeeds> needs, int count = 1)
{
CheckTowerNeeds result = new CheckTowerNeeds();
bool isok = true;
int isDeal = 1;
int isGive = 1;
result.Needs = new List<TowerNeeds>();
foreach (var item in needs)
{
item.isAsk = 1;
if (item.code == nameof(GameEnum.PropCode.Equ))
{
var equService = App.GetService<IGameEquService>();
int MyCount = await equService.GetUserEquByEquIdCount(userId, Convert.ToInt32(item.parameter));
long needCount = item.count * count;
item.count = needCount;
item.onCount = MyCount;
if (MyCount < needCount)
{
item.isAsk = 0;
isok = false;
}
}
else if (item.code == nameof(GameEnum.PropCode.Goods))
{
int MyCount = 0;
var goodsService = App.GetService<IGameGoodsService>();
var goodsInfo = await goodsService.GetUserGoodsInfo(userId, Convert.ToInt32(item.parameter));
if (goodsInfo != null)
{
MyCount = (int)goodsInfo.count;
if (goodsInfo.isDeal == 0)
{
isDeal = 0;
}
if (goodsInfo.isGive == 0)
{
isGive = 0;
}
}
long needCount = item.count * count;
item.count = needCount;
item.onCount = MyCount;
if (MyCount < needCount)
{
isok = false;
item.isAsk = 0;
}
}
else if (item.code == nameof(GameEnum.PropCode.copper))
{
var accService = App.GetService<IUnitUserAccService>();
var MyAcc = await accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
long needAcc = item.count * count;
item.count = needAcc;
item.onCount = MyAcc;
if (MyAcc < needAcc)
{
isok = false;
item.isAsk = 0;
}
}
else if (item.code == nameof(GameEnum.PropCode.gold))
{
var accService = App.GetService<IUnitUserAccService>();
var MyAcc = await accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.gold));
long needAcc = item.count * count;
item.count = needAcc;
item.onCount = MyAcc;
if (MyAcc < needAcc)
{
item.isAsk = 0;
isok = false;
}
}
else if (item.code == nameof(GameEnum.PropCode.vigour)) //活力
{
var attrService = App.GetService<IUnitUserAttrService>();
var MyAcc = await attrService.GetUserVigourInfo(userId);
long needAcc = item.count * count;
item.count = needAcc;
item.onCount = (long)MyAcc.vitality;
if (MyAcc.vitality < needAcc)
{
item.isAsk = 0;
isok = false;
}
}
else if (item.code == nameof(GameEnum.PropCode.lev))
{
var attrService = App.GetService<IUnitUserAttrService>();
var MyLev = await attrService.GetUserLev(userId);
item.count = item.count;
item.onCount = MyLev;
if (MyLev < item.count)
{
isok = false;
}
}
result.Needs.Add(item);
}
@@ -240,7 +369,7 @@ public class GameBus
foreach (var item in timeAward)
{
var onAward = result.FindIndex(it => it.code == item.code && it.parameter == item.par);
if(onAward>-1)
if (onAward > -1)
{
result[onAward].count += item.count;
}
@@ -256,7 +385,6 @@ public class GameBus
result.Add(add);
}
}
}
return result;
@@ -271,10 +399,12 @@ public class GameBus
{
return result;
}
if (random.data.Count == 0)
{
return result;
}
double totalWeight = random.data.Sum(it => it.chance);
int rnd = _randomInstance.Next(Convert.ToInt32(totalWeight) + 1);
double current = 0;
@@ -290,6 +420,7 @@ public class GameBus
return result;
}
private static List<RandomData> RandomHandleByChance(RandomModel random, int luck = 0)
{
var _randomInstance = new Random();
@@ -299,11 +430,12 @@ public class GameBus
{
return result;
}
if (random.data.Count == 0)
{
return result;
}
foreach (var item in random.data)
{
double rnd = _randomInstance.NextDouble();
@@ -313,6 +445,7 @@ public class GameBus
result.Add(item);
}
}
return result;
}

View File

@@ -132,6 +132,7 @@ public class MapController : ControllerBase
#endregion
var broadcast = await _messageService.GetBroadcastData(area);
object ret = new
{
@@ -143,7 +144,8 @@ public class MapController : ControllerBase
nearUser,
noReadMsg = noReadMsg[3],
business,
mapRes
mapRes,
broadcast
};
return PoAction.Ok(ret);

View File

@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace Application.Web.Controllers.Pub;
@@ -13,12 +14,17 @@ public class EquController : ControllerBase
private readonly IGameEquService _equService;
private readonly IUnitUserAttrService _attrService;
private readonly IUnitUserService _userService;
private readonly IGameDicService _dicService;
private readonly IMessageService _messageService;
public EquController(IGameEquService equService, IUnitUserAttrService attrService, IUnitUserService userService)
public EquController(IGameEquService equService, IUnitUserAttrService attrService, IUnitUserService userService,
IGameDicService dicService, IMessageService messageService)
{
_equService = equService;
_attrService = attrService;
_userService = userService;
_dicService = dicService;
_messageService = messageService;
}
/// <summary>
@@ -109,12 +115,6 @@ public class EquController : ControllerBase
return PoAction.Message("装备不存在!");
}
if (equInfo.isAppr == 0)
{
return PoAction.Message("装备未鉴定!");
}
equInfo.isLock = equInfo.isLock == 0 ? 1 : 0;
bool result = await _equService.UpdateUserEquInfo(equInfo);
@@ -341,4 +341,393 @@ public class EquController : ControllerBase
return PoAction.Ok(new { data, suit });
}
/// <summary>
/// 获取装备觉醒所需
/// </summary>
/// <param name="ue"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetEquAwakenInfo(string ue)
{
string userId = StateHelper.userId;
var equData = await _equService.GetUserEquInfo(ue);
if (equData == null)
{
return PoAction.Message("装备不存在!");
}
if (equData.userId != userId)
{
return PoAction.Message("装备不存在!");
}
if (equData.isAppr == 0)
{
return PoAction.Message("装备未鉴定!");
}
if (equData.useEndTime < TimeExtend.GetTimeStampSeconds)
{
return PoAction.Message("装备已过期!");
}
CheckTowerNeed result = new CheckTowerNeed();
if (equData.EquAwaken.Count == 0)
{
var dicConfig = await _dicService.GetDicInfo(nameof(GameEnum.DicCode.Awaken));
List<TowerNeed> need = JsonConvert.DeserializeObject<List<TowerNeed>>(dicConfig.sign);
result = await GameBus.CheckNeed(userId, need);
}
else
{
var upAwaken =
await _equService.GetEquAwakenInfoByLev(equData.EquAwaken[0].atId, equData.EquAwaken[0].lev + 1);
if (upAwaken == null)
{
return PoAction.Message("觉醒已达到上限!");
}
result = await GameBus.CheckNeed(userId, upAwaken.need);
}
return PoAction.Ok(result);
}
/// <summary>
/// 觉醒装备
/// </summary>
/// <param name="ue"></param>
/// <param name="type">0重置1正常觉醒</param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> HandleEquAwaken(string ue, int type)
{
string userId = StateHelper.userId;
var equData = await _equService.GetUserEquInfo(ue);
if (equData == null)
{
return PoAction.Message("装备不存在!");
}
if (equData.userId != userId)
{
return PoAction.Message("装备不存在!");
}
if (equData.isAppr == 0)
{
return PoAction.Message("装备未鉴定!");
}
if (equData.useEndTime < TimeExtend.GetTimeStampSeconds)
{
return PoAction.Message("装备已过期!");
}
EquAwakenData onAwaken = new EquAwakenData();
game_equ_awaken newAwaken = new game_equ_awaken();
CheckTowerNeed result = new CheckTowerNeed();
if (type == 0) //重置
{
newAwaken = await _equService.GetRandomOneAwakenByCode(equData.code);
if (newAwaken == null)
{
return PoAction.Message("该部件装备不可觉醒!");
}
onAwaken = newAwaken.levAttr.Find(it => it.lev == 1);
var dicConfig = await _dicService.GetDicInfo(nameof(GameEnum.DicCode.Awaken));
List<TowerNeed> need = JsonConvert.DeserializeObject<List<TowerNeed>>(dicConfig.sign);
result = await GameBus.CheckNeed(userId, need);
}
else
{
if (equData.EquAwaken.Count == 0)
{
newAwaken = await _equService.GetRandomOneAwakenByCode(equData.code);
if (newAwaken == null)
{
return PoAction.Message("该部件装备不可觉醒!");
}
onAwaken = newAwaken.levAttr.Find(it => it.lev == 1);
var dicConfig = await _dicService.GetDicInfo(nameof(GameEnum.DicCode.Awaken));
List<TowerNeed> need = JsonConvert.DeserializeObject<List<TowerNeed>>(dicConfig.sign);
result = await GameBus.CheckNeed(userId, need);
}
else
{
var upAwaken =
await _equService.GetEquAwakenInfoByLev(equData.EquAwaken[0].atId, equData.EquAwaken[0].lev + 1);
if (upAwaken == null)
{
return PoAction.Message("觉醒已达到上限!");
}
newAwaken = await _equService.GetEquAwakenInfo(equData.EquAwaken[0].atId);
onAwaken = upAwaken;
result = await GameBus.CheckNeed(userId, upAwaken.need);
}
}
if (result.result == false)
{
return PoAction.Message("不满足觉醒条件!");
}
if (await GameBus.UpdateBag(userId, 0, result.Needs, "觉醒装备"))
{
if (RandomAssist.CheakRandom(onAwaken.success))
{
EquAwaken awaken = new EquAwaken();
awaken.atId = newAwaken.atId;
awaken.name = newAwaken.name;
awaken.lev = onAwaken.lev;
awaken.awaken = onAwaken.attr;
equData.EquAwaken = [awaken];
if (await _equService.UpdateUserEquInfo(equData, true, "觉醒", "装备觉醒"))
{
string msg = $"[{equData.equName}]装备的特性【{awaken.name}】升至{awaken.lev}级!";
await _messageService.SendBroadcast(userId, nameof(MessageEnum.BroadcastCode.Promote), msg);
//此处为觉醒成功,返回相关数据
var nextAwaken =
await _equService.GetEquAwakenInfoByLev(equData.EquAwaken[0].atId,
equData.EquAwaken[0].lev + 1);
var nextResult = new CheckTowerNeed()
{
result = false,
Needs = new List<TowerNeed>()
};
if (nextAwaken != null)
{
nextResult = await GameBus.CheckNeed(userId, nextAwaken.need);
}
return PoAction.Ok(new { state = 1, awaken = equData.EquAwaken, result = nextResult }, "觉醒成功!");
}
else
{
return PoAction.Message("觉醒异常,请稍后尝试!");
}
}
else
{
//此处为觉醒成功,返回相关数据
var nextAwaken =
await _equService.GetEquAwakenInfoByLev(equData.EquAwaken[0].atId,
equData.EquAwaken[0].lev + 1);
var nextResult = new CheckTowerNeed()
{
result = false,
Needs = new List<TowerNeed>()
};
if (nextAwaken != null)
{
nextResult = await GameBus.CheckNeed(userId, nextAwaken.need);
}
return PoAction.Ok(new { state = 0, awaken = equData.EquAwaken, result = nextResult }, "觉醒失败!");
}
}
else
{
return PoAction.Message("觉醒异常,请稍后尝试!");
}
return PoAction.Ok(result);
}
/// <summary>
/// 获取强化信息
/// </summary>
/// <param name="ueId"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetEquUpInfo(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("装备已过期!");
}
if (equInfo.isIntensify == 0)
{
return PoAction.Message("装备不可强化!");
}
bool isMax = false;
int upLev = (int)equInfo.intensifyLev + 1;
var needs = await _equService.GetUserEquUpData(upLev);
if (needs == null)
{
isMax = true;
}
CheckTowerNeeds result = new CheckTowerNeeds();
result.result = false;
result.Needs = new List<TowerNeeds>();
if (!isMax)
{
result = await GameBus.CheckNeeds(userId, needs.needData);
}
return PoAction.Ok(new
{
equData = equInfo,
isMax,
result
});
}
/// <summary>
/// 强化装备
/// </summary>
/// <param name="parms"></param>
/// <returns></returns>
[HttpPost]
public async Task<IPoAction> HandleEquUp([FromBody] EquUpParms parms)
{
string ueId = parms.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("装备已过期!");
}
if (equInfo.isIntensify == 0)
{
return PoAction.Message("装备不可强化!");
}
int upLev = (int)equInfo.intensifyLev + 1;
var needs = await _equService.GetUserEquUpData(upLev);
if (needs == null)
{
return PoAction.Message("已达到最大强化等级!");
}
List<TowerNeeds> reqNeeds = JsonConvert.DeserializeObject<List<TowerNeeds>>(parms.needs);
//验证材料
foreach (var item in needs.needData)
{
var onNeed = reqNeeds.Find(it => it.Id == item.Id);
if (item.NeedItem.Any(it => it.code == onNeed.code && it.parameter == onNeed.parameter) == false &&
item.code != onNeed.code && item.parameter != onNeed.parameter)
{
return PoAction.Message("材料错误!");
}
}
var result = await GameBus.CheckNeeds(userId, reqNeeds);
if (result.result == false)
{
return PoAction.Message("材料不足!");
}
if (await GameBus.UpdateBag(userId, 0, reqNeeds, $"强化装备:{ueId}"))
{
CheckTowerNeeds nexResult = new CheckTowerNeeds();
nexResult.result = false;
nexResult.Needs = new List<TowerNeeds>();
bool isMax = false;
int state = 0;
int okNum = (int)needs.okChance;
if (RandomAssist.CheakRandom(okNum))
{
state = 1;
equInfo.intensifyLev = upLev;
equInfo.isDeal = result.isDeal;
equInfo.isGive = result.isGive;
if (await _equService.UpdateUserEquInfo(equInfo, true, "强化", "强化装备") == false)
{
return PoAction.Message("强化异常,请联系客服!");
}
var nextNeeds = await _equService.GetUserEquUpData((int)equInfo.intensifyLev + 1);
if (needs == null)
{
isMax = true;
}
else
{
var nexts = nextNeeds.euId == needs.euId ? reqNeeds : nextNeeds.needData;
nexResult = await GameBus.CheckNeeds(userId, nexts);
}
}
else //执行材料返还
{
List<TowerGet> retProp = new List<TowerGet>();
foreach (var item in reqNeeds)
{
if (item.retCount > 0 && item.isOp == 1)
{
TowerGet temp = new TowerGet()
{
code = item.code,
name = item.name,
parameter = item.parameter,
count = item.count
};
retProp.Add(temp);
}
}
if (retProp.Count > 0)
{
await GameBus.UpdateBag(userId, 1, retProp, "强化失败,返还");
}
nexResult = await GameBus.CheckNeeds(userId, reqNeeds);
}
return PoAction.Ok(new
{
state,
equData = equInfo,
isMax,
result = nexResult
});
}
else
{
return PoAction.Message("强化错误,请稍后尝试!");
}
}
}

View File

@@ -126,4 +126,18 @@ public class BagController : ControllerBase
return PoAction.Ok(new { data = new List<string>(), total = total.Value });
}
}
/// <summary>
/// 验证用户道具
/// </summary>
/// <param name="parms"></param>
/// <returns></returns>
[HttpPost]
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);
}
}

View File

@@ -0,0 +1,7 @@
namespace Application.Web;
public class EquUpParms
{
public string ueId { get; set; }
public string needs { get; set; }
}

View File

@@ -0,0 +1,6 @@
namespace Application.Web;
public class CheckUserPropParms
{
public string needs { get; set; }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -1,5 +1,7 @@
<template>
<img :src="BaseConfig.BaseMediaUrl + url" :class="_class" :alt="_alt">
<span v-if="url != undefined">
<img :src="BaseConfig.BaseMediaUrl + url" :class="_class" :alt="_alt">
</span>
</template>
<script setup>
import { BaseConfig } from "@/config/BaseConfig";
@@ -8,6 +10,6 @@ const props = defineProps({
// 字段名、类型、默认值
url: String,
_class: String,
_alt:String
_alt: String
})
</script>

View File

@@ -0,0 +1,408 @@
<template>
<div class="content" v-if="data.length > 0">
<div class="broad" v-for="item in data">
<span :class="swCodeName(item.code, 1)">
<i :class='swCodeName(item.code, 0)'></i>
<span v-if="item.userId == '0'">海精灵</span>
<span v-else>
<Abar :href='"/user/user?no=" + item.userNo'>
{{ item.nick }}
</Abar>
</span>:
<span v-html="item.msg"></span>
</span>
</div>
</div>
</template>
<script setup lang="ts">
// 1. 定义接收父组件传来的参数 props
const props = defineProps({
data: {
type: Array<any>,
default: () => ([])
}
})
const swCodeName = (code: string, type: number) => {
let result = '';
switch (code) {
case "Gift":
if (type == 0) {
result = "broad-gift";
}
else {
result = "";
}
break;
case "System":
if (type == 0) {
result = "broad-system";
}
else {
result = "masked";
}
break;
case "Award":
if (type == 0) {
result = "broad-award";
}
else {
result = "masked1";
}
break;
case "Remind":
if (type == 0) {
result = "broad-remind";
}
else {
result = "caise6";
}
break;
case "Promote":
if (type == 0) {
result = "broad-promote";
}
else {
result = "caise7";
}
break;
}
return result;
}
</script>
<style >
.broad {
font-size: 15px;
}
.broad-gift {
background-image: url('/images/broad/gift.gif');
background-repeat: no-repeat;
display: inline-block;
width: 18px;
height: 18px;
background-size: 18px; /*设置图片大小*/
margin-right: 2px;
vertical-align: middle;
border: 0;
}
.broad-system {
background-image: url('/images/broad/system.gif');
background-repeat: no-repeat;
display: inline-block;
width: 18px;
height: 18px;
background-size: 18px; /*设置图片大小*/
margin-right: 2px;
vertical-align: middle;
}
.broad-award {
background-image: url('/images/broad/award.gif');
background-repeat: no-repeat;
display: inline-block;
width: 18px;
height: 18px;
background-size: 18px; /*设置图片大小*/
margin-right: 2px;
vertical-align: middle;
}
.broad-remind {
background-image: url('/images/broad/remind.gif');
background-repeat: no-repeat;
display: inline-block;
width: 18px;
height: 18px;
background-size: 18px; /*设置图片大小*/
margin-right: 2px;
vertical-align: middle;
}
.broad-promote {
background-image: url('/images/broad/promote.gif');
background-repeat: no-repeat;
display: inline-block;
width: 18px;
height: 18px;
background-size: 18px; /*设置图片大小*/
margin-right: 2px;
vertical-align: middle;
}
.broad-hot1 {
background-image: url('/images/broad/hot1.gif');
background-repeat: no-repeat;
display: inline-block;
width: 18px;
height: 18px;
background-size: 18px; /*设置图片大小*/
margin-right: 2px;
vertical-align: middle;
}
.masked {
display: inline;
width: 200px;
height: 22px;
/*渐变背景*/
background-image: -webkit-linear-gradient(left, #3498db, #f47920 10%, #d71345 20%, #f7acbc 30%, #ffd400 40%, #3498db 50%, #f47920 60%, #d71345 70%, #f7acbc 80%, #ffd400 90%, #3498db);
color: transparent;
/*文字填充色为透明*/
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
/*背景剪裁为文字,只将文字显示为背景*/
background-size: 200% 100%;
/*背景图片向水平方向扩大一倍这样background-position才有移动与变化的空间*/
/* 动画 */
animation: masked-animation 4s infinite linear;
}
@keyframes masked-animation {
0% {
background-position: 0 0;
/*background-position 属性设置背景图像的起始位置。*/
}
100% {
background-position: -100% 0;
}
}
.masked2 {
display: inline;
width: 200px;
height: 22px;
/*渐变背景*/
background-image: -webkit-linear-gradient(left, #ffa080, #ffa060 10%, #ffa040 20%, #ffa020 30%, #ffa0a0 40%, #ffa080 50%, #ffa060 80%, #ffa040 70%, #ffa020 80%, #ffa000 90%, #ffff00);
color: transparent;
/*文字填充色为透明*/
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
/*背景剪裁为文字,只将文字显示为背景*/
background-size: 200% 100%;
/*背景图片向水平方向扩大一倍这样background-position才有移动与变化的空间*/
/* 动画 */
animation: masked-animation 4s infinite linear;
}
@keyframes masked-animation {
0% {
background-position: 0 0;
/*background-position 属性设置背景图像的起始位置。*/
}
100% {
background-position: -100% 0;
}
}
.masked1 {
display: inline;
width: 200px;
height: 22px;
/*渐变背景*/
background-image: -webkit-linear-gradient(left, #ff0080, #ff0060 10%, #ff0040 20%, #ff0020 30%, #ff00a0 40%, #ff0080 50%, #ff0060 80%, #ff0040 70%, #ff0020 80%, #ff0000 90%, #ffff00);
color: transparent;
/*文字填充色为透明*/
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
/*背景剪裁为文字,只将文字显示为背景*/
background-size: 200% 100%;
/*背景图片向水平方向扩大一倍这样background-position才有移动与变化的空间*/
/* 动画 */
animation: masked-animation 4s infinite linear;
}
@keyframes masked-animation {
0% {
background-position: 0 0;
/*background-position 属性设置背景图像的起始位置。*/
}
100% {
background-position: -100% 0;
}
}
.lmma {
color: #ffff00;
}
.caise_jt {
background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #2f2), color-stop(0.75, #2f2), color-stop(0.9, #ff2), color-stop(1, #f22));
color: transparent;
-webkit-background-clip: text;
-moz-background-clip: text;
-ms-background-clip: text;
-o-background-clip: text
}
.caise3 {
/* 删除 -moz -ms -o 全部废弃前缀 */
background: linear-gradient(180deg, #f2f, #fbd7c6, #fdefac, #bfb5dd, #bed5f5);
/* 兼容webkit内核浏览器Chrome/Edge/移动端) */
background: -webkit-linear-gradient(180deg, #f2f, #fbd7c6, #fdefac, #bfb5dd, #bed5f5);
/* 移除多余 color: #f2f; 会被透明覆盖 */
color: transparent;
-webkit-background-clip: text;
background-clip: text;
/* 滚动动画必备,之前缺失 */
background-size: 200% 200%;
animation: ran 5s linear infinite;
}
@keyframes ran {
from {
backgroud-position: 0 0;
}
to {
background-position: 200px 0;
}
}
.caise4 {
color: aqua;
letter-spacing: 0;
text-shadow: 0px 1px 0px #999, 0px 1px 0px #888, 0px 1px 0px #777, 0px 1px 0px #666, 0px 1px 0px #555, 0px 1px 0px #444, 0px 1px 0px #333, 0px 1px 7px #001135
}
.caise5 {
text-shadow: 1px 1px 6px deeppink;
color: deeppink
}
.caise6 {
background-image: -webkit-linear-gradient(left, blue, #66ffff 10%, #cc00ff 20%, #CC00CC 30%, #CCCCFF 40%, #00FFFF 50%, #CCCCFF 60%, #CC00CC 70%, #CC00FF 80%, #66FFFF 90%, blue 100%);
-webkit-text-fill-color: transparent;
/* 将字体设置成透明色 */
-webkit-background-clip: text;
/* 裁剪背景图,使文字作为裁剪区域向外裁剪 */
-webkit-background-size: 200% 100%;
-webkit-animation: masked-animation 3s linear infinite;
}
@keyframes masked-animation {
0% {
background-position: 0 0;
}
100% {
background-position: -100% 0;
}
}
.caise7 {
--interval: 1s;
text-shadow: 0 0 5px var(--color1), 0 0 5px var(--color2), 0 0 5px var(--color3), 0 0 5px var(--color4);
will-change: filter, color;
filter: saturate(60%);
animation: flicker steps(100) var(--interval) 1s infinite;
}
.caise7:nth-of-type(1) {
color: yellow;
--color1: azure;
--color2: orangered;
--color3: mediumblue;
--color4: dodgerblue;
font-family: Gruppo;
}
.caise7:nth-of-type(2) {
color: lightpink;
--color1: pink;
--color2: mediumblue;
--color3: dodgerblue;
--color4: azure;
font-family: Bad Script;
}
.caise7:nth-of-type(3) {
color: lightyellow;
--color1: yellow;
--color2: dodgerblue;
--color3: green;
--color4: mediumblue;
font-family: Kumar One Outline;
}
.caise7:nth-of-type(4) {
color: lightyellow;
--color1: gold;
--color2: dodgerblue;
--color3: pink;
--color4: azure;
font-family: Londrina Outline;
}
.caise7:nth-of-type(5) {
color: azure;
--color1: azure;
--color2: aqua;
--color3: dodgerblue;
--color4: blue;
font-family: Sriracha;
}
.caise7:nth-of-type(6) {
color: azure;
--color1: green;
--color2: pink;
--color3: dodgerblue;
--color4: green;
font-family: Yellowtail;
}
.caise7:nth-of-type(7) {
color: lightyellow;
--color1: yellow;
--color2: orange;
--color3: pink;
--color4: purple;
font-family: Bad Script;
}
.caise7:nth-of-type(8) {
color: yellow;
--color1: yellow;
--color2: pink;
--color3: azure;
--color4: pink;
font-family: Monoton;
}
.caise7:nth-of-type(9) {
color: lightyellow;
--color1: yellow;
--color2: gold;
--color3: azure;
--color4: pink;
font-family: Sriracha;
}
@keyframes flicker {
50% {
color: white;
filter: saturate(200%) hue-rotate(90deg);
}
}
</style>

View File

@@ -0,0 +1,18 @@
<template>
<div class="common" v-for="item in data">
<div v-if="item.code == 'Goods'">
<Abar :href='"/prop/goods?id=" + item.parameter'>{{ item.name }}</Abar>:({{ item.onCount }}/{{ item.count }})
<span style="color: red;" v-if="item.isAsk == 0">(不满足)</span>
</div>
<div v-else>
{{ item.name }}:({{ item.onCount }}/{{ item.count }})
<span style="color: red;" v-if="item.isAsk == 0">(不满足)</span>
</div>
</div>
</template>
<script lang="ts" setup>
const props = defineProps({
// 字段名、类型、默认值
data: Array<any>
})
</script>

View File

@@ -1,7 +1,8 @@
<template>
<GameBroadcast :data="broadcast"></GameBroadcast>
<div class="item" style="font-size:15px;">
<span>[在线奖励]:3分钟后可领取.</span>
</div>
</div>
<div class="content">
{{ cityInfo.cityName }}·{{ mapInfo.mapName }}
<Abutton @click="Refresh">刷新</Abutton>
@@ -119,6 +120,7 @@ const mapUser = ref<Array<any>>([]);
const business = ref<Array<any>>([]);
const mapRes = ref<Array<any>>([]);
const messageCount = ref(0);
const broadcast = ref<Array<any>>([]);
// 城内地图显示
const showCity = ref(false);
@@ -144,6 +146,7 @@ const BindData = async (map: string): Promise<void> => {
messageCount.value = result.data.noReadMsg;
business.value = result.data.business;
mapRes.value = result.data.mapRes;
broadcast.value = result.data.broadcast;
MapVent(result.data.mapInfo.near);
onMap.value = mapInfo.value.mapId;
}
@@ -289,4 +292,4 @@ const CollectRes = async () => {
}
</script>
</script>

View File

@@ -72,7 +72,9 @@
强化等级:{{ equData.intensifyLev }}<br>
</span>
<span v-if="equAwaken.length > 0">
<Abar href="">装备特性:{{ equAwaken[0].name }}({{ equAwaken[0].lev }})</Abar><br>
<Abar :href='"/user/equ/awaken?ue=" + equData.ueId'>装备特性:{{ equAwaken[0].name }}({{ equAwaken[0].lev
}})
</Abar><br>
</span>
附魔:{{ equMent.name }}<br>
负重:{{ equData.weight }}<br>
@@ -114,28 +116,58 @@
<div v-if="equData.isAppr == 0">
(*该装备需要鉴定)
</div>
<div class="common" v-if="myUserId == equData.userId && equData.isAppr == 1">
<span>
<div class="common" v-if="myUserId == equData.userId">
<span v-if="equData.isAppr == 1">
<Abutton @click="UpOrDownEqu">{{ equData.isOn == 1 ? "卸下装备" : "穿戴装备" }}</Abutton><br>
</span>
<span>
<Abutton>觉醒</Abutton><br>
<span v-if="equData.isAppr == 1 && equData.isIntensify == 1">
<Abar :href='"/user/equ/up?ue=" + equData.ueId'>强化</Abar><br>
</span>
<span>
<span v-if="equData.isAppr == 1">
<Abutton @click="btnOpenAwaken">觉醒</Abutton><br>
</span>
<span v-if="equData.isAppr == 1">
<Abutton>洗练</Abutton><br>
</span>
<span>
<Abutton @click="LockEqu">{{ equData.isLock == 0 ? "绑定" : "解绑" }}</Abutton><br>
</span>
<span>
<Abar href="">寄售</Abar><br>
<span v-if="equData.isOn == 0 && equData.isDeal == 1">
<Abar href="/">寄售</Abar><br>
</span>
<span>
<!-- <span>
<Abutton>个性化</Abutton><br>
</span>
</span> -->
</div>
</div>
</div>
<!--觉醒-->
<GamePopup v-model:show="showAwaken" title="【觉醒装备】" style="width: 60%;min-height: 30%;">
<!-- 自定义内容 -->
<div class="content">
<div v-if="equAwaken.length == 0">
装备暂未觉醒.
</div>
<div v-else>
特性名称{{ equAwaken[0].name }} <br>
觉醒等级{{ equAwaken[0].lev }} <br>
特性效果{{ EquTool.GetEquAttrName(equAwaken[0].awaken, 0) }}<br>
</div>
<div>
<strong>觉醒所需</strong><br>
<GamePropVerify :data="awakenProp.needs"></GamePropVerify>
</div>
</div>
<div class="content" style="max-height: 300px;text-align: center; margin-top: 15px;;" v-if="awakenProp.result">
<van-button type="success" @click="btnEquAwaken(1)">
觉醒装备
</van-button>
<van-button type="danger" @click="btnEquAwaken(0)" v-if="equAwaken.length > 0" style="margin-left: 5px;">
重置觉醒
</van-button>
</div>
</GamePopup>
</template>
<script setup lang="ts">
@@ -165,7 +197,6 @@ onMounted(async () => {
const BindData = async (): Promise<void> => {
let equId = PageExtend.QueryString("id");
let result = await EquService.GetEquInfo(Number(equId), ueId);
if (result.code == 0) {
equData.value = result.data.equData;
@@ -175,7 +206,6 @@ const BindData = async (): Promise<void> => {
equAwaken.value = result.data.equData.equAwaken;
equMent.value = result.data.equData.equMent;
gemMent.value = result.data.equData.gemMent;
console.log(result);
}
else {
MessageExtend.ShowDialog("提示", result.msg);
@@ -209,4 +239,40 @@ const LockEqu = async () => {
MessageExtend.ShowDialog("绑定装备", result.msg);
}
}
/**觉醒装备 */
const showAwaken = ref(false);
const awakenProp = ref<any>({});
const btnOpenAwaken = async () => {
MessageExtend.LoadingToast("觉醒初始化中...");
let result = await EquService.GetEquAwakenInfo(ueId);
MessageExtend.LoadingClose();
if (result.code == 0) {
showAwaken.value = true;
awakenProp.value = result.data;
}
else {
MessageExtend.ShowDialog("装备觉醒", result.msg);
}
}
const btnEquAwaken = async (type: number) => {
MessageExtend.LoadingToast("觉醒中...");
let result = await EquService.HandleEquAwaken(ueId, type);
MessageExtend.LoadingClose();
if (result.code == 0) {
if (result.data.state == 1) {
MessageExtend.ShowToast(result.msg, "success");
}
else {
MessageExtend.ShowToast(result.msg, "fail");
}
equAwaken.value = result.data.awaken;
awakenProp.value = result.data.result;
}
else {
MessageExtend.ShowDialog("装备觉醒", result.msg);
}
}
</script>

View File

@@ -54,7 +54,7 @@
<span v-if="item.isAppr == 0">(未鉴定)</span>
<span v-if="item.useEndTime < onTime" style="color: red;">(过期)</span>
<span v-if="item.durability < 1" style="color: red;">(损坏)</span>
<span v-if="item.isLock == 1" style="color: green;">()</span>
<span v-if="item.isLock == 1" style="color: green;">()</span>
</div>
</div>
<div class="common" v-if="type == '1'">

View File

@@ -0,0 +1,48 @@
<template>
<div class="content">
觉醒属性<br>
名称{{ equData.equName }}<br>
<span v-if="equData.equName != equData.unitEquName">
装备名称{{ equData.unitEquName }}<br>
</span>
部位{{ EquTool.GetEquPlaceName(equData.code) }}<br>
等级{{ equData.lev }}
</div>
<div class="content" v-if="equAwaken.length > 0">
特性名称{{ equAwaken[0].name }} <br>
觉醒等级{{ equAwaken[0].lev }} <br>
特性效果{{ EquTool.GetEquAttrName(equAwaken[0].awaken, 0) }}<br>
</div>
</template>
<script setup lang="ts">
definePageMeta({
layout: layout.default,
middleware: 'page-loading'
})
const equData = ref<any>({});
const equAwaken = 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.GetEquInfo(0, ueId);
if (result.code == 0) {
equData.value = result.data.equData;
equAwaken.value = result.data.equData.equAwaken;
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
};
</script>

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.intensifyLev }}
</div>
<div class="content" v-if="isMax == false">
强化所需:<br>
<div class="common" v-for="item in needs">
<span v-if="item.code == 'Goods'">
<Abar :href='"/prop/goods?id=" + item.parameter'>{{ item.name }}</Abar>:({{ item.onCount }}/{{
item.count }})
<span style="color: red;" v-if="item.isAsk == 0">(不满足)</span>
</span>
<span v-else-if="item.code == 'copper'">
{{ item.name }}:({{ GameTool.FormatCopper(item.onCount) }}/ {{ GameTool.FormatCopper(item.count) }})
<span style="color: red;" v-if="item.isAsk == 0">(不满足)</span>
</span>
<span v-else>
{{ item.name }}:({{ item.onCount }}/{{ item.count }})
<span style="color: red;" v-if="item.isAsk == 0">(不满足)</span>
</span>
<span v-if="item.needItem.length > 0">
<Abutton @click="ChangeProp(item)">更换</Abutton>
</span>
</div>
</div>
<div class="content" v-if="isMax == isMax && verifyData.result == true">
[<Abutton @click="btnHandleEquUp">立即强化</Abutton>]
</div>
<div class="clear"></div>
<div class="content" style="font-size: 16px;;">
强化说明:<br>
1.强化仅在成功后扣除()龙泉水<br>
2.强化等级上限100级<br>
3.强化所需的其他材料可以通过游戏内获得龙泉水可以通过商城/活动获得<br>
4.使用龙泉水装备会不可交易,使用正龙泉水装备自动为可交易状态<br>
</div>
<GamePopup v-model:show="showChange" title="【切换材料】" style="width: 60%;max-height: 30%;">
<!-- 自定义内容 -->
<div class="content" style="max-height: 300px;margin-top: 15px;;">
<div class="item" v-for="(item, index) in changeData" :key="index">
{{ index + 1 }}.<Abutton @click="ChangePropOk(item)">{{ item.name }}×{{ item.count }}</Abutton>
</div>
</div>
</GamePopup>
</template>
<script setup lang="ts">
definePageMeta({
layout: layout.default,
middleware: 'page-loading'
})
const equData = ref<any>({});
const isMax = ref(true);
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.GetEquUpInfo(ueId);
console.log(result);
if (result.code == 0) {
equData.value = result.data.equData;
isMax.value = result.data.isMax;
verifyData.value = result.data.result;
needs.value = verifyData.value.needs;
}
else {
MessageExtend.ShowDialogEvent("强化装备", result.msg, () => {
PageExtend.RedirectTo("/prop/equ?ue=" + ueId);
});
}
};
const changeNum = ref(0);
const changeData = ref<Array<any>>([]);
const showChange = ref(false);
const ChangeProp = (data: any) => {
changeNum.value = data.id;
changeData.value = data.needItem;
showChange.value = true;
}
const ChangePropOk = async (data: any) => {
MessageExtend.LoadingToast("切换中...");
needs.value.forEach(it => {
if (it.id == changeNum.value) {
it.name = data.name;
it.code = data.code;
it.parameter = data.parameter;
it.count = data.count;
}
});
let _needs = JSON.stringify(needs.value);
let result = await BagService.CheckUserProp(_needs);
console.log(result);
MessageExtend.LoadingClose();
if (result.code == 0) {
verifyData.value = result.data;
needs.value = verifyData.value.needs;
showChange.value = false;
}
else {
MessageExtend.ShowDialog("材料切换", result.msg);
}
}
/**强化装备 */
const btnHandleEquUp = async () => {
MessageExtend.LoadingToast("强化中...");
let _needs = JSON.stringify(needs.value);
let result = await EquService.HandleEquUp(ueId, _needs);
MessageExtend.LoadingClose();
if (result.code == 0) {
if (result.data.state == 1) {
MessageExtend.ShowToast("强化成功!", "success");
}
else {
MessageExtend.ShowToast("强化失败!", "fail");
}
equData.value = result.data.equData;
isMax.value = result.data.isMax;
verifyData.value = result.data.result;
needs.value = verifyData.value.needs;
}
else {
MessageExtend.ShowDialog("强化装备", result.msg);
}
}
</script>

View File

@@ -54,4 +54,39 @@ export class EquService {
static async GetUserOnSuitInfo(suitCode: string) {
return await ApiService.Request("get", "/Equ/GetUserOnSuitInfo", { suitCode });
}
/**
* 获取装备觉醒所需
* GET /Equ/GetEquAwakenInfo
*/
static async GetEquAwakenInfo(ue: string) {
return await ApiService.Request("get", "/Equ/GetEquAwakenInfo", { ue });
}
/**
* 觉醒装备
* GET /Equ/HandleEquAwaken
* @param type 0重置1正常觉醒
*/
static async HandleEquAwaken(ue: string, type: number) {
return await ApiService.Request("get", "/Equ/HandleEquAwaken", { ue, type });
}
/**
* 获取强化信息
* GET /Equ/GetEquUpInfo
*/
static async GetEquUpInfo(ueId: string) {
return await ApiService.Request("get", "/Equ/GetEquUpInfo", { ueId });
}
/**
* 强化装备
* POST /Equ/HandleEquUp
* @param ueId body
* @param needs body
*/
static async HandleEquUp(ueId: string, needs: string) {
return await ApiService.Request("post", "/Equ/HandleEquUp", { ueId, needs });
}
}

View File

@@ -8,10 +8,19 @@ export class BagService {
}
/**
* GetUserBagProp
* 获取用户道具数据
* GET /User/Bag/GetUserBagProp
*/
static async GetUserBagProp(type: number, ch: number, query: string, page: number) {
return await ApiService.Request("get", "/User/Bag/GetUserBagProp", { type, ch, query, page });
}
/**
* 验证用户道具
* POST /User/Bag/CheckUserProp
* @param needs body
*/
static async CheckUserProp(needs: string) {
return await ApiService.Request("post", "/User/Bag/CheckUserProp", { needs });
}
}