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