Handle Dungeons with null config (#2279)

This commit is contained in:
Nazrin 2023-07-31 09:52:42 -07:00 committed by GitHub
parent 4320bc7d29
commit 465582b8da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -6,12 +6,13 @@ import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType;
import emu.grasscutter.game.quest.enums.LogicType; import emu.grasscutter.game.quest.enums.LogicType;
import java.util.List; import java.util.List;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
@ResourceType(name = "DungeonPassExcelConfigData.json") @ResourceType(name = "DungeonPassExcelConfigData.json")
public class DungeonPassConfigData extends GameResource { public class DungeonPassConfigData extends GameResource {
@Getter private int id; @Getter private int id;
@Getter private LogicType logicType; @Getter private LogicType logicType;
@Getter private List<DungeonPassCondition> conds; @Getter @Setter private List<DungeonPassCondition> conds;
public static class DungeonPassCondition { public static class DungeonPassCondition {
@Getter private DungeonPassConditionType condType; @Getter private DungeonPassConditionType condType;

View File

@ -53,8 +53,13 @@ public final class DungeonManager {
public DungeonManager(@NonNull Scene scene, @NonNull DungeonData dungeonData) { public DungeonManager(@NonNull Scene scene, @NonNull DungeonData dungeonData) {
this.scene = scene; this.scene = scene;
this.dungeonData = dungeonData; this.dungeonData = dungeonData;
this.passConfigData = GameData.getDungeonPassConfigDataMap().get(dungeonData.getPassCond()); if(dungeonData.getPassCond() == 0){
this.finishedConditions = new int[passConfigData.getConds().size()]; 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) { public void triggerEvent(DungeonPassConditionType conditionType, int... params) {
@ -76,6 +81,7 @@ public final class DungeonManager {
} }
public boolean isFinishedSuccessfully() { public boolean isFinishedSuccessfully() {
if(passConfigData.getLogicType()==null) return false;
return LogicType.calculate(passConfigData.getLogicType(), finishedConditions); return LogicType.calculate(passConfigData.getLogicType(), finishedConditions);
} }