jurpe.containers
Class MasterShop

java.lang.Object
  extended by jurpe.containers.XMLCollection
      extended by jurpe.containers.MasterShop
All Implemented Interfaces:
java.io.Serializable

public class MasterShop
extends XMLCollection
implements java.io.Serializable

Shop type contains every BasicItems and derived available in the game-world. It is an XMLCollection. A shop contains four ArrayLists of:

Author:
Alessio Saltarin
See Also:
XMLCollection, BasicItem, Serialized Form

Constructor Summary
MasterShop(Skills skills)
          Constructor
 
Method Summary
 void addNewItem(BasicItem sh)
          Add Shield object to Shop collection
 void addRandomItems(RandomNames names, ItemValueType ivt, int number)
          Add some random items to the ones available
 java.util.AbstractList<BasicItem> getItems()
          Get list of items (BasicItems) in this shop.
 java.util.AbstractList<BasicItem> getItems(int n)
          Get a list of the first n items (BasicItems) in this shop.
 java.util.AbstractList<Weapon> getWeapons(Skill skl, boolean rand)
          Get available weapons for a given skill
 void shuffleItems()
          Changes the order of the items.
 
Methods inherited from class jurpe.containers.XMLCollection
size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MasterShop

public MasterShop(Skills skills)
Constructor

Parameters:
skills - Available Skills For this game.
See Also:
Skills
Method Detail

addNewItem

public void addNewItem(BasicItem sh)
Add Shield object to Shop collection

Parameters:
sh - Shield to add to the Shop

addRandomItems

public void addRandomItems(RandomNames names,
                           ItemValueType ivt,
                           int number)
                    throws JurpeException
Add some random items to the ones available

Parameters:
names - Handle to dictionary.xml
ivt - Value for random items to create
number - Number to items to randomly create.
Throws:
JurpeException

shuffleItems

public void shuffleItems()
Changes the order of the items. Useful when there are a lot of random items.


getItems

public java.util.AbstractList<BasicItem> getItems()
Get list of items (BasicItems) in this shop.

Returns:
ArrayList of BasicItem in the shop
See Also:
BasicItem

getItems

public java.util.AbstractList<BasicItem> getItems(int n)
Get a list of the first n items (BasicItems) in this shop. This routine returns first the "static" items (items with isRandom=false), then the "random" items.

Parameters:
n - Total number of shields to be returned (actually the first n ones in the shop.xml)
Returns:
ArrayList of BasicItem in the shop
See Also:
BasicItem

getWeapons

public java.util.AbstractList<Weapon> getWeapons(Skill skl,
                                                 boolean rand)
Get available weapons for a given skill

Parameters:
skl - Skill to search the weapon for
rand - Set to false if you want to search among the weapon from shop.xml, true if you want to search in the randomly created weapons
Returns:
List of weapons (Weapon) in the shop
See Also:
Weapon

Jurpe - Java Universal Role Playing Engine - http://jurpe.sourceforge.net