From 53d8b03630bd0756881e0863e59d02b18feab09e Mon Sep 17 00:00:00 2001 From: AnikiKun Date: Fri, 12 Jun 2026 02:31:47 +0800 Subject: [PATCH 1/2] fix: dungeon_clear condition never satisfied after dungeon completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two fixes: 1. ConditionUtil.cs — add dungeon_clear to quest_clear group in CheckCode() (reuse Integers.Contains logic, matching dungeon room ID against condition codes) 2. DungeonFieldManager.cs — call ConditionUpdate on Clear state change (use DungeonId as codeLong, matching quest condition Codes.Integers) This allows quests with ConditionType.dungeon_clear (194) to complete after defeating a dungeon boss. First verified instance: quest 50001601 (dungeon room 25004001 -> map 2000331). --- .../Manager/Field/FieldManager/DungeonFieldManager.cs | 2 ++ Maple2.Server.Game/Util/ConditionUtil.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/Maple2.Server.Game/Manager/Field/FieldManager/DungeonFieldManager.cs b/Maple2.Server.Game/Manager/Field/FieldManager/DungeonFieldManager.cs index 5b3d92441..0a2120530 100644 --- a/Maple2.Server.Game/Manager/Field/FieldManager/DungeonFieldManager.cs +++ b/Maple2.Server.Game/Manager/Field/FieldManager/DungeonFieldManager.cs @@ -64,6 +64,8 @@ public void ChangeState(DungeonState state) { } player.Session.Dungeon.CompleteDungeon(clearTimestamp); + player.Session.ConditionUpdate(ConditionType.dungeon_clear, + codeLong: DungeonId); } } diff --git a/Maple2.Server.Game/Util/ConditionUtil.cs b/Maple2.Server.Game/Util/ConditionUtil.cs index 580cde349..dfe5e813e 100644 --- a/Maple2.Server.Game/Util/ConditionUtil.cs +++ b/Maple2.Server.Game/Util/ConditionUtil.cs @@ -86,6 +86,7 @@ private static bool CheckCode(this ConditionMetadata.Parameters code, GameSessio case ConditionType.quest_accept: case ConditionType.quest_clear_by_chapter: case ConditionType.quest_clear: + case ConditionType.dungeon_clear: case ConditionType.buff: case ConditionType.enchant_result: case ConditionType.dialogue: From 29e8ffcf77c7953388cb904344ed9b7a2a267363 Mon Sep 17 00:00:00 2001 From: AnikiKun Date: Fri, 12 Jun 2026 02:32:41 +0800 Subject: [PATCH 2/2] fix(trigger): QuestUserDetected State1 incorrectly matching completable quests The quest_user_detected condition only checked questStates[0] and State 1 (Started) did not exclude CanComplete quests, causing a chain of failures: 1. DarkWindMovie.Ready (state=1) matched a completable quest, forcing the movie to replay and sending the player back to map 52000067 2. jordy.Ready (state=2) never triggered, so Joddy (NPC 11003220) never spawned in Dark Wind HQ (map 52000055) 3. Players could not accept follow-up quest 60100240, creating an infinite loop between maps 52000067 and 52000055 Fixes: - Iterate all questStates instead of only checking questStates[0] - State 1 now requires !CanComplete, strictly distinguishing it from State 2 Affects: Lv20 quest chain 60100235 -> 60100240 -> 60100245 --- .../Trigger/TriggerContext.Player.cs | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/Maple2.Server.Game/Trigger/TriggerContext.Player.cs b/Maple2.Server.Game/Trigger/TriggerContext.Player.cs index 557c99d4a..186c2844b 100644 --- a/Maple2.Server.Game/Trigger/TriggerContext.Player.cs +++ b/Maple2.Server.Game/Trigger/TriggerContext.Player.cs @@ -247,22 +247,24 @@ public bool QuestUserDetected(int[] boxIds, int[] questIds, int[] questStates, i continue; } - switch (questStates[0]) { - case 1: // Started - if (quest.State == QuestState.Started) { - return !negate; - } - break; - case 2: // Started and Can Complete - if (quest.State == QuestState.Started && player.Session.Quest.CanComplete(quest)) { - return !negate; - } - break; - case 3: // Completed - if (quest.State == QuestState.Completed) { - return !negate; - } - break; + foreach (int questState in questStates) { + switch (questState) { + case 1: // Started (but NOT ready to complete) + if (quest.State == QuestState.Started && !player.Session.Quest.CanComplete(quest)) { + return !negate; + } + break; + case 2: // Started and Can Complete + if (quest.State == QuestState.Started && player.Session.Quest.CanComplete(quest)) { + return !negate; + } + break; + case 3: // Completed + if (quest.State == QuestState.Completed) { + return !negate; + } + break; + } } } }