Fix Wanderlust from breaking other quests

This commit is contained in:
Chris H
2025-02-08 22:25:58 -05:00
parent 8f3f83051b
commit 9445093d68

View File

@@ -146,17 +146,16 @@ public class AdventureQuestController implements Serializable {
} }
private Map<String, Long> nextQuestDate = new HashMap<>(); private Map<String, Long> nextQuestDate = new HashMap<>();
private int maximumSideQuests = 5; //todo: move to configuration file private int maximumSideQuests = 5; //todo: move to configuration file
private transient boolean inDialog = false; private transient MapDialog activeDialog = null;
private transient Array<AdventureQuestData> allQuests = new Array<>(); private transient Array<AdventureQuestData> allQuests = new Array<>();
private transient Array<AdventureQuestData> allSideQuests = new Array<>(); private final transient Array<AdventureQuestData> allSideQuests = new Array<>();
private Queue<DialogData> dialogQueue = new LinkedList<>(); private Queue<DialogData> dialogQueue = new LinkedList<>();
private Map<String,Date> questAvailability = new HashMap<>(); private Map<String,Date> questAvailability = new HashMap<>();
public PointOfInterest mostRecentPOI; public PointOfInterest mostRecentPOI;
private List<EnemySprite> enemySpriteList= new ArrayList<>(); private final List<EnemySprite> enemySpriteList= new ArrayList<>();
private int nextQuestID = 0; private int nextQuestID = 0;
public void showQuestDialogs(GameStage stage) { public void showQuestDialogs(GameStage stage) {
List<AdventureQuestData> finishedQuests = new ArrayList<>(); List<AdventureQuestData> finishedQuests = new ArrayList<>();
for (AdventureQuestData quest : Current.player().getQuests()) { for (AdventureQuestData quest : Current.player().getQuests()) {
DialogData prologue = quest.getPrologue(); DialogData prologue = quest.getPrologue();
if (prologue != null){ if (prologue != null){
@@ -198,12 +197,12 @@ public class AdventureQuestController implements Serializable {
finishedQuests.add(quest); finishedQuests.add(quest);
updateQuestComplete(quest); updateQuestComplete(quest);
} }
if (!inDialog){
inDialog = true; if (activeDialog == null && !dialogQueue.isEmpty()){
displayNextDialog((MapStage) stage); displayNextDialog((MapStage) stage);
} }
for (AdventureQuestData toRemove : finishedQuests) {
for (AdventureQuestData toRemove : finishedQuests) {
if (!toRemove.failed && locationHasMoreQuests()){ if (!toRemove.failed && locationHasMoreQuests()){
nextQuestDate.remove(toRemove.sourceID); nextQuestDate.remove(toRemove.sourceID);
} }
@@ -219,32 +218,32 @@ public class AdventureQuestController implements Serializable {
return new Random().nextFloat() <= 0.85f; return new Random().nextFloat() <= 0.85f;
} }
public void displayNextDialog(MapStage stage){ public void displayNextDialog(MapStage stage){
if (dialogQueue.peek() == null) if (dialogQueue.peek() == null) {
{ activeDialog = null;
inDialog = false;
return; return;
} }
DialogData data = dialogQueue.remove(); DialogData data = dialogQueue.remove();
MapDialog dialog = new MapDialog(data, stage, -1, null); activeDialog = new MapDialog(data, stage, -1, null);
if (data.options == null || data.options.length == 0) { if (data.options == null || data.options.length == 0) {
dialog.setEffects(data.action); activeDialog.setEffects(data.action);
displayNextDialog(stage); displayNextDialog(stage);
return; return;
} }
stage.showDialog(); stage.showDialog();
dialog.activate(); activeDialog.activate();
ChangeListener listen = new ChangeListener() { ChangeListener listen = new ChangeListener() {
@Override @Override
public void changed(ChangeEvent changeEvent, Actor actor) { public void changed(ChangeEvent changeEvent, Actor actor) {
activeDialog = null;
displayNextDialog(stage); displayNextDialog(stage);
} }
}; };
dialog.addDialogCompleteListener(listen); activeDialog.addDialogCompleteListener(listen);
if (data.options == null || data.options.length == 0) // Seems weird that data would be null here, but not null up there. Are we changingi these values inside activate?
{ if (data.options == null || data.options.length == 0) {
displayNextDialog(stage); displayNextDialog(stage);
} }
} }