com.planet_ink.coffee_mud.Libraries
Class AutoTitles

java.lang.Object
  extended by com.planet_ink.coffee_mud.Libraries.StdLibrary
      extended by com.planet_ink.coffee_mud.Libraries.AutoTitles
All Implemented Interfaces:
CMObject, Tickable, AutoTitlesLibrary, CMLibrary, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class AutoTitles
extends StdLibrary
implements AutoTitlesLibrary


Field Summary
 
Fields inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary
isDebugging, name, serviceClient, tickStatus
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
STATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_BEAMWEAPON, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MISCELLANEOUS, TICKID_MOB, TICKID_PROPERTY_SPECIAL, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
 
Constructor Summary
AutoTitles()
           
 
Method Summary
 void appendAutoTitle(java.lang.String text)
          Appends to the list of titles from the given text and refreshes the cache.
 java.util.Enumeration<java.lang.String> autoTitles()
          Returns an enumerator of the auto-title strings themselves.
 java.lang.String deleteTitleAndResave(java.lang.String title)
          Removes the given title from all affected players, removes the given title from the titles properties file, and refreshes the titles cache.
protected  void dispossesTitle(java.lang.String title)
           
 java.lang.String evaluateAutoTitle(java.lang.String row, boolean addIfPossible)
          Scans an admin-given auto-title definition string to see if it is properly formatted for adding to the list of auto-titles.
 boolean evaluateAutoTitles(MOB mob)
          Scans all existing titles to see if any should be added to the given mob.
 java.lang.String getAutoTitleInstructions()
          Reads the titles.ini file and returns the instructions therein.
 java.lang.String getAutoTitleMask(java.lang.String title)
          Returns the string mask attributed to a particular title string.
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 boolean isExistingAutoTitle(java.lang.String title)
          Returns whether the given string matches one of the defined player titles.
 void reloadAutoTitles()
          Forces this library to re-load its list of titles from the resource file titles.ini.
 
Methods inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary
activate, checkDatabase, compareTo, copyOf, getServiceClient, getTickStatus, initializeClass, L, name, newInstance, propertiesLoaded, setThreadStatus, shutdown, tick
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.CMLibrary
activate, getServiceClient, L, propertiesLoaded, shutdown
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

AutoTitles

public AutoTitles()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, Tech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Overrides:
ID in class StdLibrary
Returns:
the name of this class

evaluateAutoTitle

public java.lang.String evaluateAutoTitle(java.lang.String row,
                                          boolean addIfPossible)
Description copied from interface: AutoTitlesLibrary
Scans an admin-given auto-title definition string to see if it is properly formatted for adding to the list of auto-titles.

Specified by:
evaluateAutoTitle in interface AutoTitlesLibrary
Parameters:
row - the admin-entered command string
addIfPossible - true to add it to the list, false to scan-only
Returns:
true if the title meets the criterium, false if it is rejected

isExistingAutoTitle

public boolean isExistingAutoTitle(java.lang.String title)
Description copied from interface: AutoTitlesLibrary
Returns whether the given string matches one of the defined player titles.

Specified by:
isExistingAutoTitle in interface AutoTitlesLibrary
Parameters:
title - the strong to match
Returns:
true if a title of that string exists, false otherwise

autoTitles

public java.util.Enumeration<java.lang.String> autoTitles()
Description copied from interface: AutoTitlesLibrary
Returns an enumerator of the auto-title strings themselves. The strings will substitute a * character for the players name when building the final title.

Specified by:
autoTitles in interface AutoTitlesLibrary
Returns:
an enumerator of the auto-title strings themselves

getAutoTitleMask

public java.lang.String getAutoTitleMask(java.lang.String title)
Description copied from interface: AutoTitlesLibrary
Returns the string mask attributed to a particular title string. The mask is as described by the masking library.

Specified by:
getAutoTitleMask in interface AutoTitlesLibrary
Parameters:
title - the title itself
Returns:
the zapper mask to determine who should get this title
See Also:
MaskingLibrary

evaluateAutoTitles

public boolean evaluateAutoTitles(MOB mob)
Description copied from interface: AutoTitlesLibrary
Scans all existing titles to see if any should be added to the given mob. If any match, the title is added to the mobs list of choices, after being customized.

Specified by:
evaluateAutoTitles in interface AutoTitlesLibrary
Parameters:
mob - the mob to check for new titles for
Returns:
true if any titles were added, false otherwise

dispossesTitle

protected void dispossesTitle(java.lang.String title)

appendAutoTitle

public void appendAutoTitle(java.lang.String text)
Description copied from interface: AutoTitlesLibrary
Appends to the list of titles from the given text and refreshes the cache. This will also save the file.

Specified by:
appendAutoTitle in interface AutoTitlesLibrary
Parameters:
text - the text of the new title definition

deleteTitleAndResave

public java.lang.String deleteTitleAndResave(java.lang.String title)
Description copied from interface: AutoTitlesLibrary
Removes the given title from all affected players, removes the given title from the titles properties file, and refreshes the titles cache.

Specified by:
deleteTitleAndResave in interface AutoTitlesLibrary
Parameters:
title - the title to remove
Returns:
an error message, or null for success

reloadAutoTitles

public void reloadAutoTitles()
Description copied from interface: AutoTitlesLibrary
Forces this library to re-load its list of titles from the resource file titles.ini.

Specified by:
reloadAutoTitles in interface AutoTitlesLibrary

getAutoTitleInstructions

public java.lang.String getAutoTitleInstructions()
Description copied from interface: AutoTitlesLibrary
Reads the titles.ini file and returns the instructions therein.

Specified by:
getAutoTitleInstructions in interface AutoTitlesLibrary
Returns:
the instructions for entering a title