com.planet_ink.coffee_mud.Libraries.interfaces
Interface CatalogLibrary.CataData

All Known Implementing Classes:
CMCatalog.CataDataImpl
Enclosing interface:
CatalogLibrary

public static interface CatalogLibrary.CataData

CataData is the metadata about each entry in the catalog. It stores information for features like the random drop, for instances of the cataloged items in the world, and how many times the mob has been killed or item picked up.


Method Summary
 void addReference(Physical P)
          Adds the given object as a world instance of this cataloged object
 void build(java.lang.String catadata)
          Builds this metadata from an xml doc
 void bumpDeathPickup()
          Bumps the number of times this mob has died, if the cataloged object is a mob, or the number of times this item has been picked up, if it's an item.
 java.lang.String category()
          Returns the user-defined catagory to which this cataloged object belongs.
 void cleanHouse()
          Goes through all the world instances of this cataloged item and removes any that are destroyed.
 java.lang.String data(java.lang.String name)
          Returns this metadata as an xml doc
 void delReference(Physical P)
          Removes the given item from the list of registered world instances of this cataloged object.
 java.util.Enumeration<Physical> enumeration()
          Creates and returns an enumeration of all the instances of this cataloged item in the world.
 int getDeathsPicksups()
          Returns the number of times this mob has died, if the cataloged object is a mob, or the number of times this item has been picked up, if it's an item.
 Physical getLiveReference()
          Returns the first world instance of this cataloged item or mob.
 java.lang.String getMaskStr()
          A zapper mask string that is applied to mobs to determine if this particular item is potentially a random drop.
 MaskingLibrary.CompiledZMask getMaskV()
          A compiled zapper mask that is applied to mobs to determine if this particular item is potentially a random drop.
 double getRate()
          If this item is a random drop, then this is the pct chance that this item is a potential selection for a random drop.
 boolean getWhenLive()
          If this item is a random drop, this flag will return true if it is random equipment for a live mob, and false if it is random drop for a corpse.
 boolean isReference(Physical P)
          Returns whether the given item is a registered world instance of this cataloged object.
 java.lang.String mostPopularArea()
          Determines and returns the name of the most popular area in which instances of this catalog object can be found.
 int numReferences()
          Returns the number of world items that are instances of this cataloged object.
 java.lang.String randomRoom()
          Returns one of the rooms in which an instance of this cataloged item was registered.
 void setCategory(java.lang.String cat)
          Sets the user-defined catagory to which this cataloged object belongs.
 void setMaskStr(java.lang.String s)
          A zapper mask string that is applied to mobs to determine if this particular item is potentially a random drop.
 void setRate(double r)
          If this item is a random drop, then this is the pct chance that this item is a potential selection for a random drop.
 void setWhenLive(boolean l)
          If this item is a random drop, this flag will be true if it is random equipment for a live mob, and false if it is random drop for a corpse.
 

Method Detail

getMaskV

MaskingLibrary.CompiledZMask getMaskV()
A compiled zapper mask that is applied to mobs to determine if this particular item is potentially a random drop. The mask is only applied if it is non-null, so null means it is NOT a random drop.

Returns:
a compiled zapper mask for dead mobs
See Also:
getMaskStr(), getWhenLive(), getRate()

getMaskStr

java.lang.String getMaskStr()
A zapper mask string that is applied to mobs to determine if this particular item is potentially a random drop. The mask is only applied if it is non-empty, so empty means it is NOT a random drop.

Returns:
a zapper mask string for dead mobs
See Also:
getMaskV(), getRate(), setMaskStr(String)

getWhenLive

boolean getWhenLive()
If this item is a random drop, this flag will return true if it is random equipment for a live mob, and false if it is random drop for a corpse.

Returns:
true for equipment, false for live mob
See Also:
getMaskV(), getRate(), setWhenLive(boolean)

getRate

double getRate()
If this item is a random drop, then this is the pct chance that this item is a potential selection for a random drop. It is a number from 0.0 - 1, where 0.0 means it is not a random drop at all.

Returns:
pct chance that the item is a potential selection
See Also:
getMaskV(), setRate(double), getWhenLive()

setMaskStr

void setMaskStr(java.lang.String s)
A zapper mask string that is applied to mobs to determine if this particular item is potentially a random drop. The mask is only applied if it is non-empty, so empty means it is NOT a random drop.

Parameters:
s - a zapper mask string for dead mobs
See Also:
getMaskV(), getRate(), getMaskStr()

setWhenLive

void setWhenLive(boolean l)
If this item is a random drop, this flag will be true if it is random equipment for a live mob, and false if it is random drop for a corpse.

Parameters:
l - true for equipment, false for live mob
See Also:
getMaskV(), getRate(), getWhenLive()

setRate

void setRate(double r)
If this item is a random drop, then this is the pct chance that this item is a potential selection for a random drop. It is a number from 0.0 - 1, where 0.0 means it is not a random drop at all.

Parameters:
r - pct chance that the item is a potential selection
See Also:
getMaskV(), setRate(double), getWhenLive()

enumeration

java.util.Enumeration<Physical> enumeration()
Creates and returns an enumeration of all the instances of this cataloged item in the world.

Returns:
an enumeration of all the instances
See Also:
addReference(Physical), isReference(Physical), delReference(Physical), numReferences()

addReference

void addReference(Physical P)
Adds the given object as a world instance of this cataloged object

Parameters:
P - the mob or item in the world
See Also:
enumeration(), isReference(Physical), delReference(Physical), numReferences()

isReference

boolean isReference(Physical P)
Returns whether the given item is a registered world instance of this cataloged object.

Parameters:
P - the item or mob in the world
Returns:
true if its registered, false otherwise
See Also:
enumeration(), addReference(Physical), delReference(Physical), numReferences()

delReference

void delReference(Physical P)
Removes the given item from the list of registered world instances of this cataloged object.

Parameters:
P - the item or mob in the world
See Also:
enumeration(), addReference(Physical), isReference(Physical), numReferences()

numReferences

int numReferences()
Returns the number of world items that are instances of this cataloged object.

Returns:
the number of world items
See Also:
enumeration(), addReference(Physical), isReference(Physical), delReference(Physical)

mostPopularArea

java.lang.String mostPopularArea()
Determines and returns the name of the most popular area in which instances of this catalog object can be found.

Returns:
the name of the area

randomRoom

java.lang.String randomRoom()
Returns one of the rooms in which an instance of this cataloged item was registered.

Returns:
a room with an instance

cleanHouse

void cleanHouse()
Goes through all the world instances of this cataloged item and removes any that are destroyed. Hopefully this method never does anything.


getLiveReference

Physical getLiveReference()
Returns the first world instance of this cataloged item or mob.

Returns:
the first world instance

getDeathsPicksups

int getDeathsPicksups()
Returns the number of times this mob has died, if the cataloged object is a mob, or the number of times this item has been picked up, if it's an item.

Returns:
the number of times
See Also:
bumpDeathPickup()

bumpDeathPickup

void bumpDeathPickup()
Bumps the number of times this mob has died, if the cataloged object is a mob, or the number of times this item has been picked up, if it's an item.

See Also:
bumpDeathPickup()

category

java.lang.String category()
Returns the user-defined catagory to which this cataloged object belongs. null is uncatagorized

Returns:
the catagory name
See Also:
setCategory(String)

setCategory

void setCategory(java.lang.String cat)
Sets the user-defined catagory to which this cataloged object belongs. null is uncatagorized

Parameters:
cat - the catagory name
See Also:
category()

data

java.lang.String data(java.lang.String name)
Returns this metadata as an xml doc

Parameters:
name - null, or an optional item/mob name
Returns:
this metadata as an xml doc
See Also:
build(String)

build

void build(java.lang.String catadata)
Builds this metadata from an xml doc

Parameters:
catadata - this metadata as an xml doc
See Also:
data(String)