1212
This commit is contained in:
@@ -18,12 +18,6 @@ namespace Application.Domain.Entity
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public long? vitality { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大活力
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public long? upVitality { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
|
||||
@@ -37,8 +37,7 @@ public interface IUnitUserAttrService
|
||||
|
||||
Task<unit_user_vigour> GetUserVigourInfo(string userId);
|
||||
Task<bool> UpdateUserVigour(string userId, int op, long count, string UpTime = "");
|
||||
Task<bool> UpdateUserUpVigour(string userId, decimal count);
|
||||
|
||||
Task<long> GetUserMaxVitality(string userId);
|
||||
#endregion
|
||||
|
||||
#region 在线时间
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Application.Domain;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Application.Domain;
|
||||
|
||||
public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) : IUnitUserAttrService, ITransient
|
||||
{
|
||||
@@ -87,29 +89,17 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
||||
{
|
||||
foreach (var item in MyState)
|
||||
{
|
||||
minAtk += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Atk.ToString(), item.attr,
|
||||
temp.minAtk));
|
||||
maxAtk += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Atk.ToString(), item.attr,
|
||||
temp.maxAtk));
|
||||
Defense += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Defense.ToString(),
|
||||
item.attr, temp.defense));
|
||||
Agility += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Agility.ToString(),
|
||||
item.attr, temp.agility));
|
||||
upBlood += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Blood.ToString(), item.attr,
|
||||
temp.upBlood));
|
||||
upMorale += Convert.ToInt32(GameAttrTool.GetAttrItemValue(GameEnum.AttrCode.Morale.ToString(),
|
||||
item.attr, temp.upMorale));
|
||||
ExtendAttrData.AddRange(item.attr);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 加层处理
|
||||
|
||||
var otTemp = GameAttrTool.GetRoleAttrTemp(temp, ExtendAttrData);
|
||||
|
||||
result = GameAttrTool.GetRoleAttrTempMerge(result, otTemp); //加层其他
|
||||
result = GameAttrTool.GetRoleAttrTempMerge(result, temp); //加层其他
|
||||
|
||||
result.minAtk += minAtk;
|
||||
result.maxAtk += maxAtk;
|
||||
result.defense += Defense;
|
||||
@@ -313,9 +303,6 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
||||
var data = GameTool.GetAttrData(OnLev);
|
||||
result = await db.Updateable<unit_user_attr>(data).Where(i => i.userId == userId)
|
||||
.ExecuteCommandAsync() > 0;
|
||||
int upVigour = GameConfig.GameBaseVigour + (OnLev * 10);
|
||||
await UpdateUserUpVigour(userId, upVigour);
|
||||
|
||||
IsUpUserAttr = result;
|
||||
}
|
||||
}
|
||||
@@ -439,7 +426,7 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
||||
if (op == 1)
|
||||
{
|
||||
var userVigour = await GetUserVigourInfo(userId);
|
||||
long endVigour = (long)userVigour.upVitality - (long)userVigour.vitality;
|
||||
long endVigour = await GetUserMaxVitality(userId) - (long)userVigour.vitality;
|
||||
count = endVigour > count ? count : endVigour;
|
||||
}
|
||||
|
||||
@@ -470,17 +457,12 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateUserUpVigour(string userId, decimal count)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_vigour>();
|
||||
bool isok = await db.Updateable<unit_user_vigour>().SetColumns(i => i.upVitality == count)
|
||||
.Where(i => i.userId == userId).ExecuteCommandAsync() > 0;
|
||||
if (isok)
|
||||
{
|
||||
await ClearUserVigourCache(userId);
|
||||
}
|
||||
|
||||
return isok;
|
||||
|
||||
public async Task<long> GetUserMaxVitality(string userId)
|
||||
{
|
||||
var OnLev = await GetUserLev(userId);
|
||||
return GameConfig.GameBaseVigour + (OnLev * 10);
|
||||
}
|
||||
|
||||
#endregion 活力
|
||||
|
||||
@@ -244,7 +244,6 @@ public class UnitUserService(ISqlSugarClient DbClient, IRedisCache redis) : IUni
|
||||
unit_user_vigour vitality = new unit_user_vigour();
|
||||
vitality.userId = userId;
|
||||
vitality.vitality = GameConfig.GameBaseVigour;
|
||||
vitality.upVitality = GameConfig.GameBaseVigour;
|
||||
vitality.upTime = TimeAssist.GetDateTimeYMDString(-1);
|
||||
db.Insertable(vitality).AddQueue();
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public class ChatController : ControllerBase
|
||||
isSend = par != "0";
|
||||
break;
|
||||
case 2:
|
||||
isSend = true;
|
||||
isSend = false;
|
||||
code = nameof(GameChatEnum.Code.Group);
|
||||
par = "";
|
||||
break;
|
||||
|
||||
@@ -15,7 +15,8 @@ public class RecoverController : ControllerBase
|
||||
private readonly IUnitUserAccService _accService;
|
||||
private readonly IGameEquService _equService;
|
||||
|
||||
public RecoverController(IUnitUserAttrService attrService, IGameMapService mapService,IUnitUserAccService accService,IGameEquService equService)
|
||||
public RecoverController(IUnitUserAttrService attrService, IGameMapService mapService,
|
||||
IUnitUserAccService accService, IGameEquService equService)
|
||||
{
|
||||
_attrService = attrService;
|
||||
_mapService = mapService;
|
||||
@@ -144,7 +145,8 @@ public class RecoverController : ControllerBase
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
var data = await _attrService.GetUserVigourInfo(userId);
|
||||
return PoAction.Ok(data);
|
||||
long maxVigour = await _attrService.GetUserMaxVitality(userId);
|
||||
return PoAction.Ok(new { data, maxVigour });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -189,12 +191,14 @@ public class RecoverController : ControllerBase
|
||||
{
|
||||
return PoAction.Message("今天已恢复过活力啦!");
|
||||
}
|
||||
if (data.vitality >= data.upVitality)
|
||||
|
||||
long maxVitality = await _attrService.GetUserMaxVitality(userId);
|
||||
if (data.vitality >= maxVitality)
|
||||
{
|
||||
return PoAction.Message("活力满满,无需恢复!");
|
||||
}
|
||||
|
||||
bool result = await _attrService.UpdateUserVigour(userId, 2, (long)data.upVitality,time);
|
||||
bool result = await _attrService.UpdateUserVigour(userId, 2, maxVitality, time);
|
||||
if (result)
|
||||
{
|
||||
return PoAction.Ok(true);
|
||||
@@ -245,8 +249,8 @@ public class RecoverController : ControllerBase
|
||||
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 });
|
||||
need = needData.Sum(it => (int)it.maxdurability - (int)it.durability);
|
||||
return PoAction.Ok(new { data, need });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -256,7 +260,7 @@ public class RecoverController : ControllerBase
|
||||
/// <param name="ueId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> RecoverEqu(int npcId,string? ueId)
|
||||
public async Task<IPoAction> RecoverEqu(int npcId, string? ueId)
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
|
||||
@@ -296,7 +300,7 @@ public class RecoverController : ControllerBase
|
||||
{
|
||||
return PoAction.Message("耐久已满,无需恢复!");
|
||||
}
|
||||
|
||||
|
||||
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
||||
if (need > myAcc)
|
||||
{
|
||||
@@ -310,6 +314,7 @@ public class RecoverController : ControllerBase
|
||||
item.durability = item.maxdurability;
|
||||
await _equService.UpdateUserEquInfo(item);
|
||||
}
|
||||
|
||||
return PoAction.Ok(true, $"恢复成功,花费{need}铜贝!");
|
||||
}
|
||||
else
|
||||
@@ -369,27 +374,5 @@ public class RecoverController : ControllerBase
|
||||
return PoAction.Message("恢复失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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("恢复失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@
|
||||
【恢复活力】
|
||||
</div>
|
||||
<div class="content">
|
||||
当前活力:{{ data.vitality }}/{{ data.upVitality }}
|
||||
当前活力:{{ data.vitality }}/{{ maxVigour }}
|
||||
</div>
|
||||
<div class="content" v-if="data.vitality < data.upVitality">
|
||||
<div class="content" v-if="data.vitality < maxVigour">
|
||||
[<Abutton @click="Recover">立即恢复</Abutton>]
|
||||
</div>
|
||||
<div class="content" v-else>
|
||||
@@ -19,6 +19,7 @@ definePageMeta({
|
||||
middleware: 'page-loading'
|
||||
})
|
||||
const data = ref<any>({});
|
||||
const maxVigour = ref(0);
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
@@ -33,7 +34,8 @@ onMounted(async () => {
|
||||
const BindData = async (): Promise<void> => {
|
||||
let result = await RecoverService.GetUserVigour()
|
||||
if (result.code == 0) {
|
||||
data.value = result.data;
|
||||
data.value = result.data.data;
|
||||
maxVigour.value = result.data.maxVigour;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("提示", result.msg);
|
||||
|
||||
@@ -51,8 +51,7 @@ const BindData = async (): Promise<void> => {
|
||||
data.value = result.data.data;
|
||||
verifyData.value = result.data.result;
|
||||
needs.value = verifyData.value.needs;
|
||||
content.value = JSON.parse(data.value.busContent);
|
||||
console.log(result.data);
|
||||
content.value = JSON.parse(data.value.busContent);
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialogEvent("提示", result.msg, () => {
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
物品名称:{{ data.goodsName }}<br>
|
||||
物品数量:{{ count }}<br>
|
||||
</div>
|
||||
<div class="common" style="text-align: center;">
|
||||
使用数量:<input type="number" class="search-ipt" v-model="useCount"><br>
|
||||
<div class="common" style="text-align: center;">
|
||||
<span style="font-size: 16px;">使用数量:</span><input type="number" class="search-ipt" v-model="useCount"><br>
|
||||
<button class="ipt-btn" name="serch" @click="UseGoods" style="margin-top: 15px;">确认</button>
|
||||
</div>
|
||||
</GamePopup>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="module-content">
|
||||
<span>幸运:{{ data.luck * 100 }}%</span> <span>爆率:{{ data.burst * 100 }}%</span><br>
|
||||
<!-- <span>升空:0米</span> <span>下潜:0米</span> -->
|
||||
<span>普通经验:0%</span> <span>副本经验:0%</span><br>
|
||||
<span>普通经验:{{unitExp*100}}%</span> <span>副本经验:{{dupExp*100}}%</span><br>
|
||||
<span>铜贝增益:{{ data.addGold * 100 }}%</span>
|
||||
</div>
|
||||
<div class="module-title">【基础属性】</div>
|
||||
|
||||
Reference in New Issue
Block a user