Java Universal Role Playing Engine Version 0.3.9

jurpe.dungeon
Class DungeonLevels

java.lang.Object
  extended by jurpe.dungeon.DungeonLevels
All Implemented Interfaces:
java.io.Serializable

public class DungeonLevels
extends java.lang.Object
implements java.io.Serializable

Dungeon Levels class. This class handles the persistance of dungeon levels on files. When it is first called it initialize the initial number of levels. With "createDungeons()" it creates the village (openspace) dungeon plus the number of dungeons in numberOfLevels. When created, the dungeon is serialized. Through "getDungeonLevel(int)" this class returns the related RpgMap object deserializing it from the disk.

See Also:
Serialized Form

Constructor Summary
DungeonLevels(Dungeons inDungeon, int levels)
          Constructor
 
Method Summary
 void addItemToLevel(int level, AbstractItem itemToAdd, PlaceholderType phType, boolean unique)
          Add an item to a dungeon level
 void addLevels()
          Add a number of LEVELS_GAP levels to the dungeon.
 void createLevels()
          Create dungeon levels.
 void destroyLevelFiles()
          Delete level files
 Level getDungeonLevel(int level)
          Get the dungeon map associated with that level
 int getNumberOfLevels()
          Get number of levels
static Level restore(int level)
          Get a serialized Level
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DungeonLevels

public DungeonLevels(Dungeons inDungeon,
                     int levels)
Constructor

Parameters:
inDungeon - Handle to dungeon
levels - int Initial Number of dungeons to be created
Method Detail

createLevels

public void createLevels()
                  throws JurpeException
Create dungeon levels. When created, the level is then serialized.

Throws:
JurpeException

addLevels

public void addLevels()
               throws JurpeException
Add a number of LEVELS_GAP levels to the dungeon. The level are created and then serialized.

Throws:
JurpeException

addItemToLevel

public void addItemToLevel(int level,
                           AbstractItem itemToAdd,
                           PlaceholderType phType,
                           boolean unique)
Add an item to a dungeon level

Parameters:
level - Level to add the item to (0=Village, 1=first level...)
itemToAdd - The item to be added
phType - The placeholder type for a representation of this item in the map
unique - If this item has to be the only one in the level

destroyLevelFiles

public void destroyLevelFiles()
Delete level files


getNumberOfLevels

public int getNumberOfLevels()
Get number of levels

Returns:
int Number of Levels

getDungeonLevel

public Level getDungeonLevel(int level)
                      throws JurpeException
Get the dungeon map associated with that level

Parameters:
level - int Level. If zero, returns the Village (open space).
Returns:
RpgMap The map level. If null, new levels have to be generated
Throws:
JurpeException

restore

public static Level restore(int level)
Get a serialized Level

Parameters:
level - int Dungeon map level
Returns:
RpgMap
Throws:
InvalidClassException

Java Universal Role Playing Engine Version 0.3.9

Copyright ? 2010 http://jurpe.sourceforge.net/ All Rights Reserved.