com.planet_ink.coffee_mud.Libraries
Class CMAbleParms

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

public class CMAbleParms
extends StdLibrary
implements AbilityParameters


Nested Class Summary
protected  class CMAbleParms.AbilityParmEditorImpl
           
protected  class CMAbleParms.AbilityRecipeDataImpl
           
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.AbilityParameters
AbilityParameters.AbilityParmEditor, AbilityParameters.AbilityRecipeData, AbilityParameters.ParmType
 
Field Summary
protected static java.lang.String[] ADJUSTER_TOKENS
           
protected static int[] ALL_BUCKET_MATERIAL_CHOICES
           
protected static int[] ALLOWED_BUCKET_ACODES
           
protected static int[] ALLOWED_BUCKET_QUALITIES
           
protected  java.util.Map<java.lang.String,AbilityParameters.AbilityParmEditor> DEFAULT_EDITORS
           
protected static java.lang.String[] RESISTER_IMMUNER_TOKENS
           
 
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
CMAbleParms()
           
 
Method Summary
protected static void addExtraAbilityMaterial(java.util.Map<java.lang.Integer,int[]> extraMatsM, Item I, Ability A)
           
protected static void addExtraMaterial(java.util.Map<java.lang.Integer,int[]> extraMatsM, Item I, java.lang.Object A, double weight)
           
protected  void calculateRecipeCols(int[] lengths, java.lang.String[] headers, java.util.Vector<DVector> rowsV)
           
protected  java.lang.StringBuffer cleanDataRowEOLs(java.lang.StringBuffer str)
           
 java.lang.String encodeCodedSpells(Affectable I)
          Returns all of the given effect Abilities on the given Affectable as a semicolon delimited string of Ability IDs.
static java.util.Map<java.lang.Integer,int[]> extraMaterial(Item I)
           
protected  boolean fixDataColumn(DVector dataRow, int rowShow)
           
protected  boolean fixDataColumn(DVector dataRow, int rowShow, java.lang.Object classModelI)
           
protected  void fixDataColumns(java.util.Vector<DVector> rowsV)
           
protected static int getAppropriateResourceBucket(Item I, java.lang.Object A)
           
protected static Pair<java.lang.String[],java.lang.String[]> getBuildingCodesNFlags()
           
protected static int getClassFieldIndex(DVector dataRow)
           
 java.util.List<Ability> getCodedSpells(java.lang.String spells)
          Parses the coded effects available from an ability parameter column and generates the Ability objects with any parameters of their own.
 java.util.Map<java.lang.String,AbilityParameters.AbilityParmEditor> getEditors()
          Map of all the Ability Parameter editor objects, keyed by their parameter column ID.
 java.lang.StringBuffer getRecipeList(CraftorAbility iA)
          Given an CraftorAbility object (usually a common skill), this method will load the raw recipe file and return it as a stringbuffer.
protected  java.lang.Object getSampleObject(DVector dataRow)
           
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
protected static boolean isResourceCodeRoomMapped(int resourceCode)
           
 java.lang.String makeRecipeFromItem(ItemCraftor C, Item I)
          Given an ItemCraftor object (usually a common skill), and an item which the ItemCraftor might have crafted, this method will construct a single Recipe text line coded for use by a Recipe object.
 void modifyRecipesList(MOB mob, java.lang.String recipeFilename, java.lang.String recipeFormat)
          Main method for altering a particular recipe list from any of the crafting common skills, from the command line, for the given mob.
protected  java.util.Vector<DVector> parseDataRows(java.lang.StringBuffer recipeData, java.util.Vector<? extends java.lang.Object> columnsV, int numberOfDataColumns)
           
protected  java.lang.String parseLayers(short[] layerAtt, short[] clothingLayers, java.lang.String misctype)
           
 AbilityParameters.AbilityRecipeData parseRecipe(java.lang.String recipeFilename, java.lang.String recipeFormat)
          Mian parser for the crafting common skill recipe parsers.
 java.util.Vector<java.lang.Object> parseRecipeFormatColumns(java.lang.String recipeFormat)
           
 void parseWearLocation(short[] layerAtt, short[] layers, long[] wornLoc, boolean[] logicalAnd, double[] hardBonus, java.lang.String wearLocation)
          Parses a coded wear location, for armor-type items that have particular wear locations, and fills in the given arrays with the information contained therein.
 void resaveRecipeFile(MOB mob, java.lang.String recipeFilename, java.util.List<DVector> rowsV, java.util.List<? extends java.lang.Object> columnsV, boolean saveToVFS)
          Resaves the given recipe file given the editor and data information, already parsed for easy manipulation.
protected  java.lang.String stripData(java.lang.StringBuffer str, java.lang.String div)
           
 void testRecipeParsing(java.lang.StringBuffer recipesString, java.lang.String recipeFormat)
          Test method for the crafting common skill recipe parsers.
 void testRecipeParsing(java.lang.StringBuffer str, java.lang.String recipeFormat, java.lang.String saveRecipeFilename)
           
 void testRecipeParsing(java.lang.String recipeFilename, java.lang.String recipeFormat, boolean save)
          Test method for the crafting common skill recipe parsers.
 
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
 

Field Detail

DEFAULT_EDITORS

protected java.util.Map<java.lang.String,AbilityParameters.AbilityParmEditor> DEFAULT_EDITORS

ALL_BUCKET_MATERIAL_CHOICES

protected static final int[] ALL_BUCKET_MATERIAL_CHOICES

ALLOWED_BUCKET_ACODES

protected static final int[] ALLOWED_BUCKET_ACODES

ALLOWED_BUCKET_QUALITIES

protected static final int[] ALLOWED_BUCKET_QUALITIES

ADJUSTER_TOKENS

protected static final java.lang.String[] ADJUSTER_TOKENS

RESISTER_IMMUNER_TOKENS

protected static final java.lang.String[] RESISTER_IMMUNER_TOKENS
Constructor Detail

CMAbleParms

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

encodeCodedSpells

public java.lang.String encodeCodedSpells(Affectable I)
Description copied from interface: AbilityParameters
Returns all of the given effect Abilities on the given Affectable as a semicolon delimited string of Ability IDs. If any of the abilities contain parameters, they come after the ability and another semicolon. This method can't really capture all permutations and combinations, but, well, it seemed like a good idea at the time.

Specified by:
encodeCodedSpells in interface AbilityParameters
Parameters:
I - the Affectable one to look at the effects of
Returns:
the coded string of those effects
See Also:
Affectable.effects(), AbilityParameters.getCodedSpells(String)

getCodedSpells

public java.util.List<Ability> getCodedSpells(java.lang.String spells)
Description copied from interface: AbilityParameters
Parses the coded effects available from an ability parameter column and generates the Ability objects with any parameters of their own.

Specified by:
getCodedSpells in interface AbilityParameters
Parameters:
spells - the coded ability parameter affectable effects string
Returns:
the list of ability which are the effects
See Also:
Affectable.effects(), AbilityParameters.encodeCodedSpells(Affectable)

parseLayers

protected java.lang.String parseLayers(short[] layerAtt,
                                       short[] clothingLayers,
                                       java.lang.String misctype)

parseWearLocation

public void parseWearLocation(short[] layerAtt,
                              short[] layers,
                              long[] wornLoc,
                              boolean[] logicalAnd,
                              double[] hardBonus,
                              java.lang.String wearLocation)
Description copied from interface: AbilityParameters
Parses a coded wear location, for armor-type items that have particular wear locations, and fills in the given arrays with the information contained therein.

Specified by:
parseWearLocation in interface AbilityParameters
Parameters:
layerAtt - one dimensional array with the layer attributes
layers - one dimensional array with the layer level
wornLoc - one dimensional array with the wear location bitmap
logicalAnd - one dimensional array with the boolean for whether the location bitmap is AND or OR
hardBonus - one dimensional array with the hardness bonus (an armor bonus basically)
wearLocation - The coded wear location string

parseRecipeFormatColumns

public java.util.Vector<java.lang.Object> parseRecipeFormatColumns(java.lang.String recipeFormat)

makeRecipeFromItem

public java.lang.String makeRecipeFromItem(ItemCraftor C,
                                           Item I)
                                    throws CMException
Description copied from interface: AbilityParameters
Given an ItemCraftor object (usually a common skill), and an item which the ItemCraftor might have crafted, this method will construct a single Recipe text line coded for use by a Recipe object.

Specified by:
makeRecipeFromItem in interface AbilityParameters
Parameters:
C - the ItemCraftor skill
I - the Item to return a recipe for
Returns:
the recipe line for that ItemCraftor Item
Throws:
CMException - a recipe syntax error in generating the recipe
See Also:
ItemCraftor, Recipe

getClassFieldIndex

protected static int getClassFieldIndex(DVector dataRow)

getSampleObject

protected java.lang.Object getSampleObject(DVector dataRow)

stripData

protected java.lang.String stripData(java.lang.StringBuffer str,
                                     java.lang.String div)

parseDataRows

protected java.util.Vector<DVector> parseDataRows(java.lang.StringBuffer recipeData,
                                                  java.util.Vector<? extends java.lang.Object> columnsV,
                                                  int numberOfDataColumns)
                                           throws CMException
Throws:
CMException

fixDataColumn

protected boolean fixDataColumn(DVector dataRow,
                                int rowShow)
                         throws CMException
Throws:
CMException

fixDataColumn

protected boolean fixDataColumn(DVector dataRow,
                                int rowShow,
                                java.lang.Object classModelI)
                         throws CMException
Throws:
CMException

fixDataColumns

protected void fixDataColumns(java.util.Vector<DVector> rowsV)
                       throws CMException
Throws:
CMException

cleanDataRowEOLs

protected java.lang.StringBuffer cleanDataRowEOLs(java.lang.StringBuffer str)

testRecipeParsing

public void testRecipeParsing(java.lang.StringBuffer recipesString,
                              java.lang.String recipeFormat)
                       throws CMException
Description copied from interface: AbilityParameters
Test method for the crafting common skill recipe parsers. Basically it takes loaded recipe file data, parses it into the editors, re-generates the recipe file data from the editors, and then either returns, or throws an exception if there were parsing errors

Specified by:
testRecipeParsing in interface AbilityParameters
Parameters:
recipesString - the raw loaded recipe data
recipeFormat - the recipe format coded string from
Throws:
CMException - a parse error, if any
See Also:
CraftorAbility.parametersFile(), CraftorAbility.parametersFormat()

testRecipeParsing

public void testRecipeParsing(java.lang.String recipeFilename,
                              java.lang.String recipeFormat,
                              boolean save)
                       throws CMException
Description copied from interface: AbilityParameters
Test method for the crafting common skill recipe parsers. Basically it loads a recipe file, parses it into the editors, re-generates the recipe file data from the editors, and then optionally re-saves.

Specified by:
testRecipeParsing in interface AbilityParameters
Parameters:
recipeFilename - the unpathed regular filename of the recipe data to start with
recipeFormat - the recipe format coded string from
save - true to re-save the recipes file, false not to
Throws:
CMException - a parse error, if any
See Also:
CraftorAbility.parametersFile(), CraftorAbility.parametersFormat()

testRecipeParsing

public void testRecipeParsing(java.lang.StringBuffer str,
                              java.lang.String recipeFormat,
                              java.lang.String saveRecipeFilename)
                       throws CMException
Throws:
CMException

calculateRecipeCols

protected void calculateRecipeCols(int[] lengths,
                                   java.lang.String[] headers,
                                   java.util.Vector<DVector> rowsV)

parseRecipe

public AbilityParameters.AbilityRecipeData parseRecipe(java.lang.String recipeFilename,
                                                       java.lang.String recipeFormat)
Description copied from interface: AbilityParameters
Mian parser for the crafting common skill recipe parsers. It loads a recipe file, parses it into the editors, and then returns the AbilityRecipeData.

Specified by:
parseRecipe in interface AbilityParameters
Parameters:
recipeFilename - the unpathed regular filename of the recipe data to start with
recipeFormat - the recipe format coded string from
Returns:
the parsed AbilityRecipeData
See Also:
CraftorAbility.parametersFile(), CraftorAbility.parametersFormat(), AbilityParameters.AbilityRecipeData

getRecipeList

public java.lang.StringBuffer getRecipeList(CraftorAbility iA)
Description copied from interface: AbilityParameters
Given an CraftorAbility object (usually a common skill), this method will load the raw recipe file and return it as a stringbuffer.

Specified by:
getRecipeList in interface AbilityParameters
Parameters:
iA - the CraftorAbility skill
Returns:
the recipes for that CraftorAbility, as a stringbuffer
See Also:
CraftorAbility

modifyRecipesList

public void modifyRecipesList(MOB mob,
                              java.lang.String recipeFilename,
                              java.lang.String recipeFormat)
                       throws java.io.IOException
Description copied from interface: AbilityParameters
Main method for altering a particular recipe list from any of the crafting common skills, from the command line, for the given mob.

Specified by:
modifyRecipesList in interface AbilityParameters
Parameters:
mob - the mob who is editing this recipe file
recipeFilename - the unpathed regular filename of the recipe file to edit
recipeFormat - the recipe format from the crafting skill recipe format string
Throws:
java.io.IOException - an i/o error in session communication
See Also:
CraftorAbility.parametersFile(), CraftorAbility.parametersFormat()

resaveRecipeFile

public void resaveRecipeFile(MOB mob,
                             java.lang.String recipeFilename,
                             java.util.List<DVector> rowsV,
                             java.util.List<? extends java.lang.Object> columnsV,
                             boolean saveToVFS)
Description copied from interface: AbilityParameters
Resaves the given recipe file given the editor and data information, already parsed for easy manipulation.

Specified by:
resaveRecipeFile in interface AbilityParameters
Parameters:
mob - the mob doing the save, used only for logging
recipeFilename - the plain unpathed
rowsV - the altered data rows
columnsV - the recipe column information
saveToVFS - true to save to vfs, false for local hard drive
See Also:
See also dev notes below

getAppropriateResourceBucket

protected static int getAppropriateResourceBucket(Item I,
                                                  java.lang.Object A)

isResourceCodeRoomMapped

protected static boolean isResourceCodeRoomMapped(int resourceCode)

addExtraMaterial

protected static void addExtraMaterial(java.util.Map<java.lang.Integer,int[]> extraMatsM,
                                       Item I,
                                       java.lang.Object A,
                                       double weight)

getBuildingCodesNFlags

protected static Pair<java.lang.String[],java.lang.String[]> getBuildingCodesNFlags()

addExtraAbilityMaterial

protected static void addExtraAbilityMaterial(java.util.Map<java.lang.Integer,int[]> extraMatsM,
                                              Item I,
                                              Ability A)

extraMaterial

public static java.util.Map<java.lang.Integer,int[]> extraMaterial(Item I)

getEditors

public java.util.Map<java.lang.String,AbilityParameters.AbilityParmEditor> getEditors()
Description copied from interface: AbilityParameters
Map of all the Ability Parameter editor objects, keyed by their parameter column ID.

Specified by:
getEditors in interface AbilityParameters
Returns:
map of all the Ability Parameter editor objects