From 12af87620c6624e3a4e28a419111910575a79e77 Mon Sep 17 00:00:00 2001 From: Kaioru Date: Sun, 24 Sep 2023 23:16:15 +0800 Subject: [PATCH] Fix quest manager updating records unnecessarily during update mob kills --- .../Edelstein.Common.Gameplay.Game/Quests/QuestManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/Edelstein.Common.Gameplay.Game/Quests/QuestManager.cs b/src/common/Edelstein.Common.Gameplay.Game/Quests/QuestManager.cs index 3b56dc242..3521a76ad 100644 --- a/src/common/Edelstein.Common.Gameplay.Game/Quests/QuestManager.cs +++ b/src/common/Edelstein.Common.Gameplay.Game/Quests/QuestManager.cs @@ -42,13 +42,17 @@ public async Task UpdateMobKill(IFieldUser user, int mobID, int inc) var checkMob = quest.CheckEnd.CheckMob.FirstOrDefault(m => m.MobID == mobID); if (checkMob == null) continue; - var count = Convert.ToInt32(builder.ToString(3 * checkMob.Order, 3)) + inc; + var count = Convert.ToInt32(builder.ToString(3 * checkMob.Order, 3)); + if (count >= checkMob.Count) continue; + + count += inc; count = Math.Min(count, checkMob.Count); count = Math.Max(count, 0); builder.Remove(3 * checkMob.Order, 3); builder.Insert(3 * checkMob.Order, count.ToString("000")); + record.Value = builder.ToString(); _ = user.Message(new QuestRecordAcceptMessage(questID, record.Value)); }