us.asciiroth.client.items
Class Scroll

java.lang.Object
  extended by us.asciiroth.client.core.AbstractPiece
      extended by us.asciiroth.client.items.AbstractItem
          extended by us.asciiroth.client.items.Scroll
All Implemented Interfaces:
Item, Piece

public class Scroll
extends AbstractItem

A scroll that will display an HTML page in a modal dialog. The url you provide should be relative to the scenario URL (the text must be distributed as part of the scenario). Scrolls have a name in order to distinguish them since their contents differ.

A scroll can be created without an URL to a document to read. In that case, it works more like a marker piece. For example, an NPC could give the player a "Writ of Introduction" that just serves to unlock another part of the game.


Field Summary
static Serializer<Scroll> SERIALIZER
          Type serializer.
 
Constructor Summary
Scroll(java.lang.String name)
          Constructor.
Scroll(java.lang.String name, java.lang.String url)
          Constructor.
 
Method Summary
 java.lang.String getIndefiniteNoun(java.lang.String phrase)
          Produce the phrase with the {0} token replaced with the name of this item using an indefinite article.
 java.lang.String getName()
          The visible name of the piece.
 void onUse(Event event)
          The player has used the item without indicating any particular direction for use.
 
Methods inherited from class us.asciiroth.client.items.AbstractItem
getDefiniteNoun, onDeselect, onDrop, onFire, onHit, onSelect, onSteppedOn, onThrow, onThrowEnd
 
Methods inherited from class us.asciiroth.client.core.AbstractPiece
getColor, getSymbol, is, not
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface us.asciiroth.client.core.Piece
getColor, getSymbol, is, not
 

Field Detail

SERIALIZER

public static final Serializer<Scroll> SERIALIZER
Type serializer.

Constructor Detail

Scroll

public Scroll(java.lang.String name)
Constructor.

Parameters:
name -

Scroll

public Scroll(java.lang.String name,
              java.lang.String url)
Constructor.

Parameters:
name - the name to show as part of the scroll's label
url - the url to load when the scroll is read, which should be relative to the base folder of the scenario.
Method Detail

getIndefiniteNoun

public java.lang.String getIndefiniteNoun(java.lang.String phrase)
Description copied from interface: Item
Produce the phrase with the {0} token replaced with the name of this item using an indefinite article.

Specified by:
getIndefiniteNoun in interface Item
Overrides:
getIndefiniteNoun in class AbstractItem

getName

public java.lang.String getName()
Description copied from interface: Piece
The visible name of the piece.

Specified by:
getName in interface Piece
Overrides:
getName in class AbstractPiece
Returns:
the name of the piece as displayed to the user.

onUse

public void onUse(Event event)
Description copied from interface: Item
The player has used the item without indicating any particular direction for use. Even if the item has no intrinsic use, it's helpful to cancel the event with a message explaining that the item requires a direction to be useful.

Specified by:
onUse in interface Item
Overrides:
onUse in class AbstractItem

0.7

2009 Alx Dark