From 3324d7c7422fcd1a99e0e54e09da92422a5358da Mon Sep 17 00:00:00 2001 From: Putoo <290555932@qq.com> Date: Tue, 14 Jul 2026 15:29:46 +0800 Subject: [PATCH] 1212 --- .../game/user/unit_user_vigour.cs | 6 --- .../Interface/User/IUnitUserAttrService.cs | 3 +- .../Service/User/UnitUserAttrService.cs | 40 +++++------------ .../Services/Service/User/UnitUserService.cs | 1 - .../Controllers/Chat/ChatController.cs | 2 +- .../Controllers/Pub/RecoverController.cs | 43 ++++++------------- Web/src/pages/business/retVigour.vue | 8 ++-- Web/src/pages/map/business.vue | 3 +- Web/src/pages/prop/goods.vue | 4 +- Web/src/pages/user/attr.vue | 2 +- 10 files changed, 35 insertions(+), 77 deletions(-) diff --git a/Service/Application.Domain.Entity/game/user/unit_user_vigour.cs b/Service/Application.Domain.Entity/game/user/unit_user_vigour.cs index 9a1d366..4e985dc 100644 --- a/Service/Application.Domain.Entity/game/user/unit_user_vigour.cs +++ b/Service/Application.Domain.Entity/game/user/unit_user_vigour.cs @@ -18,12 +18,6 @@ namespace Application.Domain.Entity [SugarColumn(IsNullable = true)] public long? vitality { get; set; } - /// - /// 最大活力 - /// - [SugarColumn(IsNullable = true)] - public long? upVitality { get; set; } - /// /// 更新时间 /// diff --git a/Service/Application.Domain/Services/Interface/User/IUnitUserAttrService.cs b/Service/Application.Domain/Services/Interface/User/IUnitUserAttrService.cs index aa666cd..80a82e0 100644 --- a/Service/Application.Domain/Services/Interface/User/IUnitUserAttrService.cs +++ b/Service/Application.Domain/Services/Interface/User/IUnitUserAttrService.cs @@ -37,8 +37,7 @@ public interface IUnitUserAttrService Task GetUserVigourInfo(string userId); Task UpdateUserVigour(string userId, int op, long count, string UpTime = ""); - Task UpdateUserUpVigour(string userId, decimal count); - + Task GetUserMaxVitality(string userId); #endregion #region 在线时间 diff --git a/Service/Application.Domain/Services/Service/User/UnitUserAttrService.cs b/Service/Application.Domain/Services/Service/User/UnitUserAttrService.cs index 87f9110..04f2ed8 100644 --- a/Service/Application.Domain/Services/Service/User/UnitUserAttrService.cs +++ b/Service/Application.Domain/Services/Service/User/UnitUserAttrService.cs @@ -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(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 UpdateUserUpVigour(string userId, decimal count) - { - var db = DbClient.AsTenant().GetConnectionWithAttr(); - bool isok = await db.Updateable().SetColumns(i => i.upVitality == count) - .Where(i => i.userId == userId).ExecuteCommandAsync() > 0; - if (isok) - { - await ClearUserVigourCache(userId); - } - return isok; + + public async Task GetUserMaxVitality(string userId) + { + var OnLev = await GetUserLev(userId); + return GameConfig.GameBaseVigour + (OnLev * 10); } #endregion 活力 diff --git a/Service/Application.Domain/Services/Service/User/UnitUserService.cs b/Service/Application.Domain/Services/Service/User/UnitUserService.cs index 7c70b8a..7113b78 100644 --- a/Service/Application.Domain/Services/Service/User/UnitUserService.cs +++ b/Service/Application.Domain/Services/Service/User/UnitUserService.cs @@ -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(); diff --git a/Service/Application.Web/Controllers/Chat/ChatController.cs b/Service/Application.Web/Controllers/Chat/ChatController.cs index 1baab72..d75b0cc 100644 --- a/Service/Application.Web/Controllers/Chat/ChatController.cs +++ b/Service/Application.Web/Controllers/Chat/ChatController.cs @@ -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; diff --git a/Service/Application.Web/Controllers/Pub/RecoverController.cs b/Service/Application.Web/Controllers/Pub/RecoverController.cs index 29ec57f..71aba23 100644 --- a/Service/Application.Web/Controllers/Pub/RecoverController.cs +++ b/Service/Application.Web/Controllers/Pub/RecoverController.cs @@ -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 }); } /// @@ -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 }); } /// @@ -256,7 +260,7 @@ public class RecoverController : ControllerBase /// /// [HttpGet] - public async Task RecoverEqu(int npcId,string? ueId) + public async Task 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("恢复失败,请稍后尝试!"); - } } } \ No newline at end of file diff --git a/Web/src/pages/business/retVigour.vue b/Web/src/pages/business/retVigour.vue index 538602f..06f49e9 100644 --- a/Web/src/pages/business/retVigour.vue +++ b/Web/src/pages/business/retVigour.vue @@ -3,9 +3,9 @@ 【恢复活力】
- 当前活力:{{ data.vitality }}/{{ data.upVitality }} + 当前活力:{{ data.vitality }}/{{ maxVigour }}
-
+
[立即恢复]
@@ -19,6 +19,7 @@ definePageMeta({ middleware: 'page-loading' }) const data = ref({}); +const maxVigour = ref(0); onMounted(async () => { try { await BindData(); @@ -33,7 +34,8 @@ onMounted(async () => { const BindData = async (): Promise => { 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); diff --git a/Web/src/pages/map/business.vue b/Web/src/pages/map/business.vue index 4d3a590..a93a1d4 100644 --- a/Web/src/pages/map/business.vue +++ b/Web/src/pages/map/business.vue @@ -51,8 +51,7 @@ const BindData = async (): Promise => { 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, () => { diff --git a/Web/src/pages/prop/goods.vue b/Web/src/pages/prop/goods.vue index 048c890..16ad83c 100644 --- a/Web/src/pages/prop/goods.vue +++ b/Web/src/pages/prop/goods.vue @@ -54,8 +54,8 @@ 物品名称:{{ data.goodsName }}
物品数量:{{ count }}
-
- 使用数量:
+
+ 使用数量:
diff --git a/Web/src/pages/user/attr.vue b/Web/src/pages/user/attr.vue index 5963717..2c8dc1f 100644 --- a/Web/src/pages/user/attr.vue +++ b/Web/src/pages/user/attr.vue @@ -3,7 +3,7 @@
幸运:{{ data.luck * 100 }}%   爆率:{{ data.burst * 100 }}%
- 普通经验:0%   副本经验:0%
+ 普通经验:{{unitExp*100}}%   副本经验:{{dupExp*100}}%
铜贝增益:{{ data.addGold * 100 }}%
【基础属性】