com.planet_ink.coffee_mud.Libraries
Class CMAbleComps

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

public class CMAbleComps
extends StdLibrary
implements AbilityComponents


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.AbilityComponents
AbilityComponents.AbilityLimits
 
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
CMAbleComps()
           
 
Method Summary
 java.lang.String addAbilityComponent(java.lang.String s, java.util.Map<java.lang.String,java.util.List<AbilityComponent>> H)
          Adds a new coded ability component to the given component map.
 void alterAbilityComponentFile(java.lang.String compID, boolean delete)
          Alters and saved the ability components definition to on the filesystem (components.txt).
 java.util.List<java.lang.Object> componentCheck(MOB mob, java.util.List<AbilityComponent> req, boolean mithrilOK)
          Checks whether the given mob has the given components required to use a skill available to him/her, and if found, returns them as a FoundComponents list.
 java.util.List<Item> componentsSample(java.util.List<AbilityComponent> req, boolean mithrilOK)
          Returns a very dirty approximate of a sample of what components appear to be required.
 AbilityComponent createBlankAbilityComponent()
          Creates a new blank ability component object
 MaterialLibrary.DeadResourceRecord destroyAbilityComponents(java.util.List<java.lang.Object> found)
          If the ability component recipe used to build the list of found components needed to use a skill requires that any of the componenets are destroyed.
 PairList<java.lang.String,java.lang.String> getAbilityComponentCoded(AbilityComponent comp)
          Breaks an ability component decoded objects into a series of key/value pairs, where the first is always the connector, and the keys are as follows: ANDOR, DISPOSITION, FATE, AMOUNT, COMPONENTID, SUBTYPE, MASK.
protected  java.util.List<PairList<java.lang.String,java.lang.String>> getAbilityComponentCodedListLists(java.util.List<AbilityComponent> req)
           
protected  java.util.List<PairList<java.lang.String,java.lang.String>> getAbilityComponentCodedPairsList(java.lang.String AID)
           
 java.lang.String getAbilityComponentCodedString(java.util.List<AbilityComponent> comps)
          Reconstructs the coded ability component definition string (ID=parms) from the given cached decoded structures list.
 java.lang.String getAbilityComponentCodedString(java.lang.String AID)
          Reconstructs the coded ability component definition string (ID=parms) from the internal cached structures, given a particular Ability ID.
protected  java.lang.String getAbilityComponentCodedStringFromCodedList(java.util.List<PairList<java.lang.String,java.lang.String>> comps)
           
 java.lang.String getAbilityComponentDesc(MOB mob, AbilityComponent comp, boolean useConnector)
          Returns a friendly readable description of a specific component in the given decoded ability components definition list.
 java.lang.String getAbilityComponentDesc(MOB mob, java.util.List<AbilityComponent> req)
          Returns a friendly readable form of the component requirements of the given Ability/Skill Component List, or null if it has no requirements.
 java.lang.String getAbilityComponentDesc(MOB mob, java.lang.String AID)
          Returns a friendly readable form of the component requirements of the given Ability/Skill ID(), or null if that ability has no requirements.
 java.util.Map<java.lang.String,java.util.List<AbilityComponent>> getAbilityComponentMap()
          Returns the master ability component map, keyed by the Ability ID.
 java.util.List<AbilityComponent> getAbilityComponents(java.lang.String AID)
          Gets the decoded ability component definition for a given Ability ID().
 AbilityComponents.AbilityLimits getSpecialSkillLimit(MOB studentM)
          Returns the character-class based common skill ability limits object applicable to the given mob, or zeroes if there's a problem.
 AbilityComponents.AbilityLimits getSpecialSkillLimit(MOB studentM, Ability A)
          Returns the character-class based common skill ability limits object applicable to the given mob and the given ability.
 AbilityComponents.AbilityLimits getSpecialSkillRemainder(MOB studentM, Ability A)
          Returns the character-class based common skill ability limits object applicable to the given mob and the given ability, and then subtracts the number of each common skill already learned to derive a remaining number of each type.
 AbilityComponents.AbilityLimits getSpecialSkillRemainders(MOB student)
          Returns the character-class based common skill ability limits object applicable to the given mob, and then subtracts the number of each common skill already learned to derive a remaining number of each type.
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
protected  boolean IsItemComponent(MOB mob, AbilityComponent comp, int[] amt, Item I, java.util.List<java.lang.Object> thisSet, boolean mithrilOK)
           
protected  boolean isRightMaterial(long type, long itemMaterial, boolean mithrilOK)
           
protected  Item makeItemComponent(AbilityComponent comp, boolean mithrilOK)
           
 void setAbilityComponentCodedFromCodedPairs(PairList<java.lang.String,java.lang.String> decodedDV, AbilityComponent comp)
          Copies the key/value pairs from a PairList of specific abilitycomponent fields into the given AbilityComponent object.
 
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

CMAbleComps

public CMAbleComps()
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

isRightMaterial

protected final boolean isRightMaterial(long type,
                                        long itemMaterial,
                                        boolean mithrilOK)

makeItemComponent

protected Item makeItemComponent(AbilityComponent comp,
                                 boolean mithrilOK)

IsItemComponent

protected boolean IsItemComponent(MOB mob,
                                  AbilityComponent comp,
                                  int[] amt,
                                  Item I,
                                  java.util.List<java.lang.Object> thisSet,
                                  boolean mithrilOK)

componentsSample

public java.util.List<Item> componentsSample(java.util.List<AbilityComponent> req,
                                             boolean mithrilOK)
Description copied from interface: AbilityComponents
Returns a very dirty approximate of a sample of what components appear to be required. Named items are not required, but raw material components are created, and most rules are ignored in order to generate as many as possible.

Specified by:
componentsSample in interface AbilityComponents
Parameters:
req - the ability components rules definition
mithrilOK - true to allow mithril as a metal substitute
Returns:
a list of sample items
See Also:
AbilityComponents.getAbilityComponents(String)

componentCheck

public java.util.List<java.lang.Object> componentCheck(MOB mob,
                                                       java.util.List<AbilityComponent> req,
                                                       boolean mithrilOK)
Description copied from interface: AbilityComponents
Checks whether the given mob has the given components required to use a skill available to him/her, and if found, returns them as a FoundComponents list.

Specified by:
componentCheck in interface AbilityComponents
Parameters:
mob - the mob whose inventory or room or both to check
req - the ability components rules definition
mithrilOK - true to allow mithril as a metal substitute
Returns:
null if missing components, or the list of found components
See Also:
AbilityComponents.getAbilityComponents(String)

getAbilityComponents

public java.util.List<AbilityComponent> getAbilityComponents(java.lang.String AID)
Description copied from interface: AbilityComponents
Gets the decoded ability component definition for a given Ability ID(). This is then used by other methods to determine whether a user has the necessary components, or for manipulation of the definition.

Specified by:
getAbilityComponents in interface AbilityComponents
Parameters:
AID - the Ability ID()
Returns:
the decoded ability component definition for a given Ability ID()

getAbilityComponentCodedPairsList

protected java.util.List<PairList<java.lang.String,java.lang.String>> getAbilityComponentCodedPairsList(java.lang.String AID)

getAbilityComponentCoded

public PairList<java.lang.String,java.lang.String> getAbilityComponentCoded(AbilityComponent comp)
Description copied from interface: AbilityComponents
Breaks an ability component decoded objects into a series of key/value pairs, where the first is always the connector, and the keys are as follows: ANDOR, DISPOSITION, FATE, AMOUNT, COMPONENTID, SUBTYPE, MASK. In that order. This is primarily for simplifying editors.

Specified by:
getAbilityComponentCoded in interface AbilityComponents
Parameters:
comp - the decoded ability component to produce fields from
Returns:
the key/value pairs of the ability component values.
See Also:
AbilityComponents.setAbilityComponentCodedFromCodedPairs(PairList, AbilityComponent)

setAbilityComponentCodedFromCodedPairs

public void setAbilityComponentCodedFromCodedPairs(PairList<java.lang.String,java.lang.String> decodedDV,
                                                   AbilityComponent comp)
Description copied from interface: AbilityComponents
Copies the key/value pairs from a PairList of specific abilitycomponent fields into the given AbilityComponent object. The first pairlist entry is always the connector, and the keys are as follows: ANDOR, DISPOSITION, FATE, AMOUNT, COMPONENTID, SUBTYPE, MASK. In that order. This is primarily for simplifying editors.

Specified by:
setAbilityComponentCodedFromCodedPairs in interface AbilityComponents
Parameters:
decodedDV - the key/value pairs of the ability component values.
comp - the decoded ability component to copy field data into
See Also:
AbilityComponents.getAbilityComponentCoded(AbilityComponent)

getAbilityComponentCodedListLists

protected java.util.List<PairList<java.lang.String,java.lang.String>> getAbilityComponentCodedListLists(java.util.List<AbilityComponent> req)

createBlankAbilityComponent

public AbilityComponent createBlankAbilityComponent()
Description copied from interface: AbilityComponents
Creates a new blank ability component object

Specified by:
createBlankAbilityComponent in interface AbilityComponents
Returns:
a new blank ability component object

getAbilityComponentCodedString

public java.lang.String getAbilityComponentCodedString(java.util.List<AbilityComponent> comps)
Description copied from interface: AbilityComponents
Reconstructs the coded ability component definition string (ID=parms) from the given cached decoded structures list.

Specified by:
getAbilityComponentCodedString in interface AbilityComponents
Parameters:
comps - the decoded ability components definition list
Returns:
the coded ability component definition string (ID=parms)
See Also:
AbilityComponents.getAbilityComponentCodedString(String)

getAbilityComponentCodedStringFromCodedList

protected java.lang.String getAbilityComponentCodedStringFromCodedList(java.util.List<PairList<java.lang.String,java.lang.String>> comps)

getAbilityComponentCodedString

public java.lang.String getAbilityComponentCodedString(java.lang.String AID)
Description copied from interface: AbilityComponents
Reconstructs the coded ability component definition string (ID=parms) from the internal cached structures, given a particular Ability ID.

Specified by:
getAbilityComponentCodedString in interface AbilityComponents
Parameters:
AID - the Ability ID()
Returns:
the coded ability component definition string (ID=parms)
See Also:
AbilityComponents.getAbilityComponentCodedString(List)

getAbilityComponentDesc

public java.lang.String getAbilityComponentDesc(MOB mob,
                                                AbilityComponent comp,
                                                boolean useConnector)
Description copied from interface: AbilityComponents
Returns a friendly readable description of a specific component in the given decoded ability components definition list. If the component does not refer to the given mob, "" is returned.

Specified by:
getAbilityComponentDesc in interface AbilityComponents
Parameters:
mob - the mob to check this components applicability to.
comp - the complete ability component decoded
useConnector - true to use a connector AND/OR, false otherwise
Returns:
a friendly readable description of a specific component
See Also:
AbilityComponents.getAbilityComponentDesc(MOB, List), AbilityComponents.getAbilityComponentDesc(MOB, String)

getAbilityComponentDesc

public java.lang.String getAbilityComponentDesc(MOB mob,
                                                java.lang.String AID)
Description copied from interface: AbilityComponents
Returns a friendly readable form of the component requirements of the given Ability/Skill ID(), or null if that ability has no requirements. Since requirements may differ by player mask, the player mob is also required.

Specified by:
getAbilityComponentDesc in interface AbilityComponents
Parameters:
mob - the player mob who wants to know
AID - the Ability ID() of the skill whose components to check
Returns:
a friendly readable form of the component requirements
See Also:
AbilityComponents.getAbilityComponentDesc(MOB, List), AbilityComponents.getAbilityComponentDesc(MOB, AbilityComponent, boolean)

getAbilityComponentDesc

public java.lang.String getAbilityComponentDesc(MOB mob,
                                                java.util.List<AbilityComponent> req)
Description copied from interface: AbilityComponents
Returns a friendly readable form of the component requirements of the given Ability/Skill Component List, or null if it has no requirements. Since requirements may differ by player mask, the player mob is also required.

Specified by:
getAbilityComponentDesc in interface AbilityComponents
Parameters:
mob - the player mob who wants to know
req - the coded requirements list
Returns:
a friendly readable form of the component requirements
See Also:
AbilityComponents.getAbilityComponentDesc(MOB, AbilityComponent, boolean), AbilityComponents.getAbilityComponentDesc(MOB, String)

addAbilityComponent

public java.lang.String addAbilityComponent(java.lang.String s,
                                            java.util.Map<java.lang.String,java.util.List<AbilityComponent>> H)
Description copied from interface: AbilityComponents
Adds a new coded ability component to the given component map. The component is coded as found in components.txt, with ID=parms.

Specified by:
addAbilityComponent in interface AbilityComponents
Parameters:
s - the new coded ability component string
H - the map to add the new component to
Returns:
an error string, or null if everything went well.

getAbilityComponentMap

public java.util.Map<java.lang.String,java.util.List<AbilityComponent>> getAbilityComponentMap()
Description copied from interface: AbilityComponents
Returns the master ability component map, keyed by the Ability ID.

Specified by:
getAbilityComponentMap in interface AbilityComponents
Returns:
the master ability component map, keyed by the Ability ID.

destroyAbilityComponents

public MaterialLibrary.DeadResourceRecord destroyAbilityComponents(java.util.List<java.lang.Object> found)
Description copied from interface: AbilityComponents
If the ability component recipe used to build the list of found components needed to use a skill requires that any of the componenets are destroyed.

Specified by:
destroyAbilityComponents in interface AbilityComponents
Parameters:
found - the components found with componentCheck
Returns:
the record of the components destroyed
See Also:
AbilityComponents.componentCheck(MOB, List, boolean), MaterialLibrary.DeadResourceRecord

alterAbilityComponentFile

public void alterAbilityComponentFile(java.lang.String compID,
                                      boolean delete)
Description copied from interface: AbilityComponents
Alters and saved the ability components definition to on the filesystem (components.txt).

Specified by:
alterAbilityComponentFile in interface AbilityComponents
Parameters:
compID - the ID of the component being altered
delete - true to delete, false to add or modify

getSpecialSkillLimit

public AbilityComponents.AbilityLimits getSpecialSkillLimit(MOB studentM)
Description copied from interface: AbilityComponents
Returns the character-class based common skill ability limits object applicable to the given mob, or zeroes if there's a problem.

Specified by:
getSpecialSkillLimit in interface AbilityComponents
Parameters:
studentM - the mob to find limits for
Returns:
the character-class based common skill ability limits
See Also:
AbilityComponents.getSpecialSkillLimit(MOB, Ability), AbilityComponents.getSpecialSkillRemainder(MOB, Ability), AbilityComponents.getSpecialSkillRemainders(MOB), AbilityComponents.AbilityLimits

getSpecialSkillLimit

public AbilityComponents.AbilityLimits getSpecialSkillLimit(MOB studentM,
                                                            Ability A)
Description copied from interface: AbilityComponents
Returns the character-class based common skill ability limits object applicable to the given mob and the given ability.

Specified by:
getSpecialSkillLimit in interface AbilityComponents
Parameters:
studentM - the mob to find limits for
A - the ability object to find limits for
Returns:
the character-class based common skill ability limits
See Also:
AbilityComponents.getSpecialSkillLimit(MOB), AbilityComponents.getSpecialSkillRemainder(MOB, Ability), AbilityComponents.getSpecialSkillRemainders(MOB), AbilityComponents.AbilityLimits, AbilityComponents.AbilityLimits.specificSkillLimit()

getSpecialSkillRemainder

public AbilityComponents.AbilityLimits getSpecialSkillRemainder(MOB studentM,
                                                                Ability A)
Description copied from interface: AbilityComponents
Returns the character-class based common skill ability limits object applicable to the given mob and the given ability, and then subtracts the number of each common skill already learned to derive a remaining number of each type.

Specified by:
getSpecialSkillRemainder in interface AbilityComponents
Parameters:
studentM - the mob to find limits for
A - the ability object to find limits for
Returns:
the character-class based common skill ability remainders
See Also:
AbilityComponents.getSpecialSkillLimit(MOB, Ability), AbilityComponents.getSpecialSkillLimit(MOB), AbilityComponents.getSpecialSkillRemainders(MOB), AbilityComponents.AbilityLimits, AbilityComponents.AbilityLimits.specificSkillLimit()

getSpecialSkillRemainders

public AbilityComponents.AbilityLimits getSpecialSkillRemainders(MOB student)
Description copied from interface: AbilityComponents
Returns the character-class based common skill ability limits object applicable to the given mob, and then subtracts the number of each common skill already learned to derive a remaining number of each type.

Specified by:
getSpecialSkillRemainders in interface AbilityComponents
Parameters:
student - the mob to find limits for
Returns:
the character-class based common skill ability limits
See Also:
AbilityComponents.getSpecialSkillLimit(MOB, Ability), AbilityComponents.getSpecialSkillLimit(MOB), AbilityComponents.getSpecialSkillRemainder(MOB, Ability), AbilityComponents.AbilityLimits