More preparations for quest worlds.

This commit is contained in:
RumbleBBU
2012-11-23 11:27:15 +00:00
parent 814b15cd79
commit 46f94e796d
3 changed files with 25 additions and 2 deletions

View File

@@ -1 +1 @@
Index:1|Name:Shandalar|Dir:shandalar|Sets:2ED, ARN, ATQ, 3ED, LEG, DRK, FEM, 4ED, ICE, CHR, HML, ALL|Banned:Chaos Orb; Falling Star Index:1|Name:Shandalar|Dir:shandalar|Sets:2ED, ARN, ATQ, 3ED, LEG, DRK, 4ED|Banned:Chaos Orb; Falling Star

View File

@@ -364,6 +364,15 @@ public enum FModel {
return this.formats; return this.formats;
} }
/**
* Gets the game worlds.
*
* @return the worlds
*/
public final IStorageView<QuestWorld> getWorlds() {
return this.worlds;
}
/** /**
* Finalizer, generally should be avoided, but here closes the log file * Finalizer, generally should be avoided, but here closes the log file
* stream and resets the system output streams. * stream and resets the system output streams.

View File

@@ -17,6 +17,7 @@
*/ */
package forge.quest.data; package forge.quest.data;
import forge.Singletons;
import forge.game.GameFormat; import forge.game.GameFormat;
import forge.quest.QuestMode; import forge.quest.QuestMode;
import forge.quest.io.QuestDataIO; import forge.quest.io.QuestDataIO;
@@ -51,7 +52,8 @@ public final class QuestData {
/** The mode. */ /** The mode. */
private QuestMode mode; private QuestMode mode;
// Quest world ID, if any
private String worldId;
// gadgets // gadgets
private final QuestAssets assets; private final QuestAssets assets;
@@ -81,6 +83,7 @@ public final class QuestData {
this.mode = mode2; this.mode = mode2;
this.achievements = new QuestAchievements(diff); this.achievements = new QuestAchievements(diff);
this.assets = new QuestAssets(format); this.assets = new QuestAssets(format);
this.worldId = null; // Default to "no world", i.e. regular opponents and challenges
} }
@@ -102,6 +105,17 @@ public final class QuestData {
return this.format; return this.format;
} }
/**
* Gets the QuestWorld, if any.
*
* @return QuestWorld or null, if using regular duels and challenges.
*/
public QuestWorld getWorld() {
if (this.worldId == null) {
return null;
}
return Singletons.getModel().getWorlds().get(worldId);
}
// SERIALIZATION - related things // SERIALIZATION - related things
// This must be called by XML-serializer via reflection // This must be called by XML-serializer via reflection