From 84c5a76e5d3d8757ca7a5ade51197dbeb5ba2df6 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Thu, 20 Apr 2023 00:26:35 -0400 Subject: [PATCH] Fix quests always showing dungeon IDs --- .../emu/grasscutter/game/quest/GameQuest.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/quest/GameQuest.java b/src/main/java/emu/grasscutter/game/quest/GameQuest.java index 6d5545925..c6696452f 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameQuest.java @@ -288,21 +288,19 @@ public class GameQuest { * is the dungeon's scene point. */ public List getDungeonIds() { - var conditions = - this.getQuestData().getFinishCond().stream() - .filter(cond -> cond.getType() == QuestContent.QUEST_CONTENT_ENTER_DUNGEON) - .toList(); + // Check if this quest is active. + if (this.state != QuestState.UNFINISHED) return List.of(); - return conditions.stream() - .map( - condition -> { - var params = condition.getParam(); - // The first parameter is the ID of the dungeon. - // The second parameter is the dungeon entry's scene point. - // ex. [1, 1] = dungeon ID 1, scene point 1 or 'KaeyaDungeon'. - return new IntIntImmutablePair(params[0], params[1]); - }) - .toList(); + return this.getQuestData().getFinishCond().stream() + .filter(cond -> cond.getType() == QuestContent.QUEST_CONTENT_ENTER_DUNGEON) + .map(condition -> { + var params = condition.getParam(); + // The first parameter is the ID of the dungeon. + // The second parameter is the dungeon entry's scene point. + // ex. [1, 1] = dungeon ID 1, scene point 1 or 'KaeyaDungeon'. + return new IntIntImmutablePair(params[0], params[1]); + }) + .toList(); } public void save() {