Mark dungeons as completed and trigger the event

the event & completion were moved to the same location
This commit is contained in:
KingRainbow44
2023-05-01 19:42:12 -04:00
parent 62f7fa639a
commit 1786169782
3 changed files with 37 additions and 20 deletions

View File

@@ -273,17 +273,8 @@ public final class DungeonManager {
public void finishDungeon() {
// Mark the dungeon has completed for the players.
var dungeonId = this.getDungeonData().getId();
this.getScene().getPlayers().forEach(player -> {
var dungeons = player.getPlayerProgress().getCompletedDungeons();
if (!dungeons.contains(dungeonId)) {
dungeons.add(dungeonId);
Grasscutter.getLogger().debug("Dungeon {} has been marked completed for {}.",
dungeonId, player.getUid());
} else {
Grasscutter.getLogger().trace("Player {} already has dungeon {} completed.",
player.getUid(), dungeonId);
}
});
this.getScene().getPlayers().forEach(player -> player
.getPlayerProgress().markDungeonAsComplete(dungeonId));
notifyEndDungeon(true);
endDungeon(BaseDungeonResult.DungeonEndReason.COMPLETED);
@@ -294,13 +285,11 @@ public final class DungeonManager {
.getPlayers()
.forEach(
p -> {
// Quest trigger
p.getQuestManager()
.queueEvent(
successfully
? QuestContent.QUEST_CONTENT_FINISH_DUNGEON
: QuestContent.QUEST_CONTENT_FAIL_DUNGEON,
dungeonData.getId());
// Trigger the fail event if needed.
if (!successfully) {
p.getQuestManager().queueEvent(
QuestContent.QUEST_CONTENT_FAIL_DUNGEON, dungeonData.getId());
}
// Battle pass trigger
if (dungeonData.getType().isCountsToBattlepass() && successfully) {