com.planet_ink.coffee_mud.Libraries.interfaces
Interface AbilityParameters

All Superinterfaces:
java.lang.Cloneable, CMLibrary, CMObject, java.lang.Comparable<CMObject>
All Known Implementing Classes:
CMAbleParms

public interface AbilityParameters
extends CMLibrary

Abilities, like common skills and others, have parameter definition strings that tell the system about any parameters that modify how the ability works. In the case of common skills, these parameters come from files that give them "recipes" for crafting things. Well, this Library provides methods for accessing and using the web and command line editors that are appropriate to a particular ability's parameters. It also provides accessors for common skills recipes and their data.


Nested Class Summary
static interface AbilityParameters.AbilityParmEditor
          The main interface for the individual column editors.
static interface AbilityParameters.AbilityRecipeData
          An AbilityParameters interface for passing around a completely decoded CraftorAbility (Common Skill) recipe list, ready for manipulation by users.
static class AbilityParameters.ParmType
          The column or single parameter types
 
Method Summary
 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.
 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.
 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.
 AbilityParameters.AbilityRecipeData parseRecipe(java.lang.String recipeFilename, java.lang.String recipeFormat)
          Mian parser for the crafting common skill recipe parsers.
 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 saveVFS)
          Resaves the given recipe file given the editor and data information, already parsed for easy manipulation.
 void testRecipeParsing(java.lang.StringBuffer recipesString, java.lang.String recipeFormat)
          Test method for the crafting common skill recipe parsers.
 void testRecipeParsing(java.lang.String recipeFilename, java.lang.String recipeFormat, boolean save)
          Test method for the crafting common skill recipe parsers.
 
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, ID, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

encodeCodedSpells

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. 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.

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

getCodedSpells

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.

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

parseWearLocation

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.

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

modifyRecipesList

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

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

testRecipeParsing

void testRecipeParsing(java.lang.String recipeFilename,
                       java.lang.String recipeFormat,
                       boolean save)
                       throws CMException
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.

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

void testRecipeParsing(java.lang.StringBuffer recipesString,
                       java.lang.String recipeFormat)
                       throws CMException
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

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

parseRecipe

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

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

getEditors

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

Returns:
map of all the Ability Parameter editor objects

resaveRecipeFile

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

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
saveVFS - true to save to vfs, false for local hard drive
See Also:
See also dev notes below

getRecipeList

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.

Parameters:
iA - the CraftorAbility skill
Returns:
the recipes for that CraftorAbility, as a stringbuffer
See Also:
CraftorAbility

makeRecipeFromItem

java.lang.String makeRecipeFromItem(ItemCraftor C,
                                    Item I)
                                    throws CMException
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.

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