mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 07:37:43 +00:00
Handle Dungeons with null config (#2279)
This commit is contained in:
parent
4320bc7d29
commit
465582b8da
@ -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<DungeonPassCondition> conds;
|
||||
@Getter @Setter private List<DungeonPassCondition> conds;
|
||||
|
||||
public static class DungeonPassCondition {
|
||||
@Getter private DungeonPassConditionType condType;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user