From 465582b8da75dd4fb5792af783915556c4320480 Mon Sep 17 00:00:00 2001 From: Nazrin Date: Mon, 31 Jul 2023 09:52:42 -0700 Subject: [PATCH] Handle Dungeons with null config (#2279) --- .../data/excels/dungeon/DungeonPassConfigData.java | 3 ++- .../emu/grasscutter/game/dungeons/DungeonManager.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonPassConfigData.java b/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonPassConfigData.java index a5f965a23..bf5b245b9 100644 --- a/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonPassConfigData.java +++ b/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonPassConfigData.java @@ -6,12 +6,13 @@ import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType; import emu.grasscutter.game.quest.enums.LogicType; import java.util.List; import lombok.Getter; +import lombok.Setter; @ResourceType(name = "DungeonPassExcelConfigData.json") public class DungeonPassConfigData extends GameResource { @Getter private int id; @Getter private LogicType logicType; - @Getter private List conds; + @Getter @Setter private List conds; public static class DungeonPassCondition { @Getter private DungeonPassConditionType condType; diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java index b4890abc1..fd45ee3e9 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java @@ -53,8 +53,13 @@ public final class DungeonManager { public DungeonManager(@NonNull Scene scene, @NonNull DungeonData dungeonData) { this.scene = scene; this.dungeonData = dungeonData; - this.passConfigData = GameData.getDungeonPassConfigDataMap().get(dungeonData.getPassCond()); - this.finishedConditions = new int[passConfigData.getConds().size()]; + if(dungeonData.getPassCond() == 0){ + this.passConfigData = new DungeonPassConfigData(); + this.passConfigData.setConds(new ArrayList<>()); + }else { + this.passConfigData = GameData.getDungeonPassConfigDataMap().get(dungeonData.getPassCond()); + } + this.finishedConditions = new int[this.passConfigData.getConds().size()]; } public void triggerEvent(DungeonPassConditionType conditionType, int... params) { @@ -76,6 +81,7 @@ public final class DungeonManager { } public boolean isFinishedSuccessfully() { + if(passConfigData.getLogicType()==null) return false; return LogicType.calculate(passConfigData.getLogicType(), finishedConditions); }