<NME> CMAbleParms.java <BEF> package com.planet_ink.coffee_mud.Libraries; import com.planet_ink.coffee_web.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.AbilityMapper.AbilityMapping; import com.planet_ink.coffee_mud.Libraries.interfaces.AbilityParameters.AbilityParmEditor; import com.planet_ink.coffee_mud.core.exceptions.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.RawMaterial.Material; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.net.Socket; import java.util.*; /* Copyright 2008-2022 Bo Zimmerman Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ public class CMAbleParms extends StdLibrary implements AbilityParameters { @Override public String ID() { return "CMAbleParms"; } protected Map<String,AbilityParmEditor> DEFAULT_EDITORS = null; protected final static int[] ALL_BUCKET_MATERIAL_CHOICES = new int[]{RawMaterial.MATERIAL_CLOTH, RawMaterial.MATERIAL_METAL, RawMaterial.MATERIAL_LEATHER, RawMaterial.MATERIAL_LIQUID, RawMaterial.MATERIAL_WOODEN, RawMaterial.MATERIAL_PRECIOUS,RawMaterial.MATERIAL_VEGETATION, RawMaterial.MATERIAL_ROCK }; protected final static int[] ALLOWED_BUCKET_ACODES = new int[]{Ability.ACODE_CHANT,Ability.ACODE_SPELL,Ability.ACODE_PRAYER,Ability.ACODE_SONG,Ability.ACODE_SKILL, Ability.ACODE_THIEF_SKILL}; protected final static int[] ALLOWED_BUCKET_QUALITIES = new int[]{Ability.QUALITY_BENEFICIAL_OTHERS,Ability.QUALITY_BENEFICIAL_SELF,Ability.QUALITY_INDIFFERENT, Ability.QUALITY_OK_OTHERS,Ability.QUALITY_OK_SELF}; protected final static String[] ADJUSTER_TOKENS = new String[]{"+","-","="}; protected final static String[] RESISTER_IMMUNER_TOKENS = new String[]{"%",";"}; public CMAbleParms() { super(); } protected String parseLayers(final short[] layerAtt, final short[] clothingLayers, String misctype) { final int colon=misctype.indexOf(':'); if(colon>=0) { String layers=misctype.substring(0,colon).toUpperCase().trim(); misctype=misctype.substring(colon+1).trim(); if((layers.startsWith("MS"))||(layers.startsWith("SM"))) { layers=layers.substring(2); layerAtt[0]=Armor.LAYERMASK_MULTIWEAR|Armor.LAYERMASK_SEETHROUGH; } else if(layers.startsWith("M")) { layers=layers.substring(1); layerAtt[0]=Armor.LAYERMASK_MULTIWEAR; } else if(layers.startsWith("S")) { layers=layers.substring(1); layerAtt[0]=Armor.LAYERMASK_SEETHROUGH; } clothingLayers[0]=CMath.s_short(layers); } return misctype; } @Override public void parseWearLocation(final short[] layerAtt, final short[] layers, final long[] wornLoc, final boolean[] logicalAnd, final double[] hardBonus, String wearLocation) { if(layers != null) { layerAtt[0] = 0; layers[0] = 0; wearLocation=parseLayers(layerAtt,layers,wearLocation); } final double hardnessMultiplier = hardBonus[0]; wornLoc[0] = 0; hardBonus[0]=0.0; final Wearable.CODES codes = Wearable.CODES.instance(); for(int wo=1;wo<codes.total();wo++) { final String WO=codes.name(wo).toUpperCase(); if(wearLocation.equalsIgnoreCase(WO)) { hardBonus[0]+=codes.location_strength_points()[wo]; wornLoc[0]=CMath.pow(2,wo-1); logicalAnd[0]=false; } else if((wearLocation.toUpperCase().indexOf(WO+"||")>=0) ||(wearLocation.toUpperCase().endsWith("||"+WO))) { if(hardBonus[0]==0.0) hardBonus[0]+=codes.location_strength_points()[wo]; wornLoc[0]=wornLoc[0]|CMath.pow(2,wo-1); logicalAnd[0]=false; } else if((wearLocation.toUpperCase().indexOf(WO+"&&")>=0) ||(wearLocation.toUpperCase().endsWith("&&"+WO))) { hardBonus[0]+=codes.location_strength_points()[wo]; wornLoc[0]=wornLoc[0]|CMath.pow(2,wo-1); logicalAnd[0]=true; } } hardBonus[0]=(int)Math.round(hardBonus[0] * hardnessMultiplier); } public Vector<Object> parseRecipeFormatColumns(final String recipeFormat) { char C = '\0'; final StringBuffer currentColumn = new StringBuffer(""); Vector<String> currentColumns = null; final char[] recipeFmtC = recipeFormat.toCharArray(); final Vector<Object> columnsV = new Vector<Object>(); for(int c=0;c<=recipeFmtC.length;c++) { if(c==recipeFmtC.length) { break; } C = recipeFmtC[c]; if((C=='|') &&(c<(recipeFmtC.length-1)) &&(recipeFmtC[c+1]=='|') &&(currentColumn.length()>0)) { if(currentColumn.length()>0) { if(currentColumns == null) { currentColumns = new Vector<String>(); columnsV.addElement(currentColumns); } currentColumns.addElement(currentColumn.toString()); currentColumn.setLength(0); } c++; } else if(Character.isLetter(C)||Character.isDigit(C)||(C=='_')) currentColumn.append(C); else { if(currentColumn.length()>0) { if(currentColumns == null) { currentColumns = new Vector<String>(); columnsV.addElement(currentColumns); } currentColumns.addElement(currentColumn.toString()); currentColumn.setLength(0); } currentColumns = null; if((C=='.') &&(c<(recipeFmtC.length-2)) &&(recipeFmtC[c+1]=='.') &&(recipeFmtC[c+2]=='.')) { c+=2; columnsV.addElement("..."); } else if(columnsV.lastElement() instanceof String) columnsV.setElementAt(((String)columnsV.lastElement())+C,columnsV.size()-1); else columnsV.addElement(""+C); } } if(currentColumn.length()>0) { if(currentColumns == null) { currentColumns = new Vector<String>(); columnsV.addElement(currentColumns); } currentColumns.addElement(currentColumn.toString()); } if((currentColumns != null) && (currentColumns.size()==0)) columnsV.remove(currentColumns); return columnsV; } @Override public String makeRecipeFromItem(final ItemCraftor C, final Item I) throws CMException { final Vector<Object> columns = parseRecipeFormatColumns(C.getRecipeFormat()); final Map<String,AbilityParmEditor> editors = this.getEditors(); final StringBuilder recipe = new StringBuilder(""); for(int d=0;d<columns.size();d++) { if(columns.get(d) instanceof String) { final String name = (String)columns.get( d ); AbilityParmEditor A = editors.get(columns.get(d)); if((A==null)||(name.length()<3)) { recipe.append("\t"); continue; } if(A.appliesToClass(I)<0) A = editors.get("N_A"); if(A!=null) columns.set(d,A.ID()); } else if(columns.get(d) instanceof List) { AbilityParmEditor applicableA = null; final List<?> colV=(List<?>)columns.get(d); for(int c=0;c<colV.size();c++) { final Object o = colV.get(c); if (o instanceof List) continue; final String ID = (o instanceof String) ? (String)o : ((AbilityParmEditor)o).ID(); final AbilityParmEditor A = editors.get(ID); if(A==null) throw new CMException("Column name "+ID+" is not found."); if((applicableA==null) ||(A.appliesToClass(I) > applicableA.appliesToClass(I))) applicableA = A; } if((applicableA == null)||(applicableA.appliesToClass(I)<0)) applicableA = editors.get("N_A"); columns.set(d,applicableA.ID()); } else throw new CMException("Col name "+(columns.get(d))+" is not a String or List."); final AbilityParmEditor A = editors.get(columns.get(d)); if(A==null) throw new CMException("Editor name "+(columns.get(d))+" is not defined."); recipe.append(A.convertFromItem(C, I)); } return recipe.toString(); } @SuppressWarnings("unchecked") protected static int getClassFieldIndex(final DVector dataRow) { for(int d=0;d<dataRow.size();d++) { if(dataRow.elementAt(d,1) instanceof List) { final List<String> V=(List<String>)dataRow.elementAt(d,1); if(V.contains("ITEM_CLASS_ID") ||V.contains("FOOD_DRINK") ||V.contains("COLOR_TERM") ||V.contains("ITEM_CMARE") ||V.contains("BUILDING_CODE")) return d; } else if(dataRow.elementAt(d,1) instanceof String) { final String s=(String)dataRow.elementAt(d,1); if(s.equalsIgnoreCase("ITEM_CLASS_ID") ||s.equalsIgnoreCase("FOOD_DRINK") ||s.equalsIgnoreCase("ITEM_CMARE") ||s.equalsIgnoreCase("COLOR_TERM") ||s.equalsIgnoreCase("BUILDING_CODE")) return d; } } return -1; } @SuppressWarnings("unchecked") protected Object getSampleObject(final DVector dataRow) { boolean classIDRequired = false; String classID = null; final int fieldIndex = getClassFieldIndex(dataRow); for(int d=0;d<dataRow.size();d++) { if((dataRow.elementAt(d,1) instanceof List) &&(!classIDRequired) &&(((List<String>)dataRow.elementAt(d,1)).size()>1)) classIDRequired=true; } if(fieldIndex >=0) classID=(String)dataRow.elementAt(fieldIndex,2); if((classID!=null)&&(classID.length()>0)) { final String uClassID=classID.toUpperCase(); if(uClassID.equalsIgnoreCase("FOOD")) return CMClass.getItemPrototype("GenFood"); else if(uClassID.equalsIgnoreCase("SOAP")) return CMClass.getItemPrototype("GenItem"); else if(uClassID.equalsIgnoreCase("DRINK")) return CMClass.getItemPrototype("GenDrink"); else if(uClassID.startsWith("<ITEM>") ||uClassID.startsWith("<MOB>") ||uClassID.startsWith("<AREA>") ||uClassID.startsWith("<ROOM>")) { final List<XMLLibrary.XMLTag> pieces=CMLib.xml().parseAllXML(classID); if(pieces.size()>0) { final XMLLibrary.XMLTag tag = CMLib.xml().getPieceFromPieces(pieces, "ITEM"); if(tag != null) { final String realClassID=CMLib.xml().getValFromPieces(tag.contents(), "CLASSID"); if((realClassID!=null) &&(realClassID.length()>0)) { if(uClassID.startsWith("<ITEM>")) return CMClass.getItemPrototype(realClassID); if(uClassID.startsWith("<MOB>")) return CMClass.getMOBPrototype(realClassID); if(uClassID.startsWith("<AREA>")) return CMClass.getAreaType(realClassID); if(uClassID.startsWith("<ROOM>")) return CMClass.getLocalePrototype(realClassID); } } } return CMClass.getItemPrototype("GenDrink"); } else { final PhysicalAgent I=CMClass.getItemPrototype(classID); if(I==null) { final Pair<String[],String[]> codeFlags = getBuildingCodesNFlags(); if(CMParms.containsIgnoreCase(codeFlags.first, classID)) return classID.toUpperCase().trim(); } return I; } } if(classIDRequired) return null; return CMClass.getItemPrototype("StdItem"); } protected String stripData(final StringBuffer str, final String div) { final StringBuffer data = new StringBuffer(""); while(str.length()>0) { if(str.length() < div.length()) return null; for(int d=0;d<=div.length();d++) { if(d==div.length()) { str.delete(0,div.length()); return data.toString(); } else if(str.charAt(d)!=div.charAt(d)) break; } if(str.charAt(0)=='\n') { if(data.length()>0) return data.toString(); return null; } data.append(str.charAt(0)); str.delete(0,1); } if((div.charAt(0)=='\n') && (data.length()>0)) return data.toString(); return null; } @SuppressWarnings("unchecked") protected Vector<DVector> parseDataRows(final StringBuffer recipeData, final Vector<? extends Object> columnsV, final int numberOfDataColumns) throws CMException { StringBuffer str = new StringBuffer(recipeData.toString()); DVector dataRow = new DVector(2); List<String> currCol = null; String lastDiv = null; // detect item xml, and to special line parse { int openTagDex=str.indexOf("<"); if((openTagDex>=0) &&(str.substring(0,openTagDex).trim().length()==0) &&(columnsV.size()==1)) &&(str.substring(0,openTagDex).trim().length()==0) &&(columnsV.size()==1)) { String xml = str.toString().trim(); String uxml = xml.toUpperCase(); if(uxml.startsWith("<ITEMS>")&&(uxml.endsWith("</ITEMS>"))) str.setLength(0); xml = xml.substring(7,xml.length()-8).trim(); uxml = uxml.substring(7,uxml.length()-8).trim(); while(uxml.startsWith("<ITEM>")) { int closeTagDex=uxml.indexOf("</ITEM>"); String itemRow = xml.substring(0,closeTagDex+7); uxml=uxml.substring(closeTagDex+7).trim(); xml=xml.substring(closeTagDex+7).trim(); dataRow.addElement(currCol,itemRow); xml=xml.substring(closeTagDex+7).trim(); dataRow.addElement(currCol,itemRow); rowsV.addElement(dataRow); dataRow = new DVector(2); } str.setLength(0); str.append(xml); } } } int lastLen = str.length(); while(str.length() > 0) { if(str.charAt(0)=='#') { final int x=str.indexOf("\n"); if(x>0) { str.delete(0, x+1); while((str.length()>0) &&((str.charAt(0)=='\r')||(str.charAt(0)=='\n'))) str.delete(0, 1); continue; } } lastLen = str.length(); for(int c = 0; c < columnsV.size(); c++) { String div = "\n"; currCol = null; if(columnsV.elementAt(c) instanceof String) stripData(str,(String)columnsV.elementAt(c)); else if(columnsV.elementAt(c) instanceof List) { currCol = (List<String>)columnsV.elementAt(c); if(c<columnsV.size()-1) { div = (String)columnsV.elementAt(c+1); c++; } } if((str.length()==0)&&(c<columnsV.size()-1)) break; if(!div.equals("...")) { lastDiv = div; String data = null; data = stripData(str,lastDiv); if(data == null) data = ""; dataRow.addElement(currCol,data); currCol = null; } else { final String data = stripData(str,lastDiv); if(data == null) break; dataRow.addElement(currCol,data); } } if(dataRow.size() != numberOfDataColumns) throw new CMException("Row "+(rowsV.size()+1)+" has "+dataRow.size()+"/"+numberOfDataColumns); rowsV.addElement(dataRow); dataRow = new DVector(2); if(str.length()==lastLen) throw new CMException("UNCHANGED: Row "+(rowsV.size()+1)+" has "+dataRow.size()+"/"+numberOfDataColumns); } if(str.length()<2) str.setLength(0); return rowsV; } protected boolean fixDataColumn(final DVector dataRow, final int rowShow) throws CMException { final Object classModelI = getSampleObject(dataRow); return fixDataColumn(dataRow,rowShow,classModelI); } @SuppressWarnings("unchecked") protected boolean fixDataColumn(final DVector dataRow, final int rowShow, final Object classModelI) throws CMException { final Map<String,AbilityParmEditor> editors = getEditors(); for(int d=0;d<dataRow.size();d++) { if(!(dataRow.elementAt(d, 1) instanceof List)) throw new CMException(L("Data row @x1 discarded due to non-List at @x2",""+rowShow,""+d)); final List<String> colV=(List<String>)dataRow.elementAt(d,1); if(colV.size()==1) { AbilityParmEditor A = editors.get(colV.get(0)); if((A == null)||(A.appliesToClass(classModelI)<0)) A = editors.get("N_A"); dataRow.setElementAt(d,1,A.ID()); } else { if(classModelI == null) { //Log.errOut("CMAbleParms","Data row "+rowShow+" discarded due to null/empty classID"); throw new CMException(L("Data row @x1 discarded due to null/empty classID",""+rowShow)); } AbilityParmEditor applicableA = null; for(int c=0;c<colV.size();c++) { final AbilityParmEditor A = editors.get(colV.get(c)); if(A==null) throw new CMException(L("Col name @x1 is not defined.",""+(colV.get(c)))); if((applicableA==null) ||(A.appliesToClass(classModelI) > applicableA.appliesToClass(classModelI))) applicableA = A; } if((applicableA == null)||(applicableA.appliesToClass(classModelI)<0)) applicableA = editors.get("N_A"); dataRow.setElementAt(d,1,applicableA.ID()); } final AbilityParmEditor A = editors.get(dataRow.elementAt(d,1)); if(A==null) { if(classModelI instanceof CMObject) throw new CMException(L("Item id @x1 has no editor for @x2",((CMObject)classModelI).ID(),((String)dataRow.elementAt(d,1)))); else throw new CMException(L("Item id @x1 has no editor for @x2",classModelI+"",((String)dataRow.elementAt(d,1)))); //Log.errOut("CMAbleParms","Item id "+classModelI.ID()+" has no editor for "+((String)dataRow.elementAt(d,1))); //return false; } else if((rowShow>=0) &&(!A.confirmValue((String)dataRow.elementAt(d,2)))) { final String data = ((String)dataRow.elementAt(d,2)).replace('@', ' '); if(classModelI instanceof CMObject) throw new CMException(L("Item id @x1 has bad data '@x2' for column @x3 at row @x4",((CMObject)classModelI).ID(),data,((String)dataRow.elementAt(d,1)),""+rowShow)); else throw new CMException(L("Item id @x1 has bad data '@x2' for column @x3 at row @x4",""+classModelI,data,((String)dataRow.elementAt(d,1)),""+rowShow)); //Log.errOut("CMAbleParms","Item id "+classModelI.ID()+" has bad data '"+((String)dataRow.elementAt(d,2))+"' for column "+((String)dataRow.elementAt(d,1))+" at row "+rowShow); } } return true; } protected void fixDataColumns(final Vector<DVector> rowsV) throws CMException { DVector dataRow = new DVector(2); for(int r=0;r<rowsV.size();r++) { dataRow=rowsV.elementAt(r); if(!fixDataColumn(dataRow,r)) throw new CMException(L("Unknown error in row @x1",""+r)); /* catch(CMException e) { rowsV.removeElementAt(r); r--; } */ } } protected StringBuffer cleanDataRowEOLs(final StringBuffer str) { if(str.indexOf("\n")<0) return new StringBuffer(str.toString().replace('\r','\n')); for(int i=str.length()-1;i>=0;i--) { if(str.charAt(i)=='\r') str.delete(i,i+1); } return str; } @Override public void testRecipeParsing(final StringBuffer recipesString, final String recipeFormat) throws CMException { testRecipeParsing(recipesString,recipeFormat,null); } @Override public void testRecipeParsing(final String recipeFilename, final String recipeFormat, final boolean save) throws CMException { final StringBuffer str=new CMFile(Resources.buildResourcePath("skills")+recipeFilename,null,CMFile.FLAG_LOGERRORS).text(); testRecipeParsing(str,recipeFormat,save?recipeFilename:null); } @SuppressWarnings("unchecked") public void testRecipeParsing(final StringBuffer str, final String recipeFormat, final String saveRecipeFilename) throws CMException { final Vector<? extends Object> columnsV = parseRecipeFormatColumns(recipeFormat); int numberOfDataColumns = 0; for(int c = 0; c < columnsV.size(); c++) { if(columnsV.elementAt(c) instanceof List) numberOfDataColumns++; } final Vector<DVector> rowsV = parseDataRows(str,columnsV,numberOfDataColumns); final Vector<String> convertedColumnsV=(Vector<String>)columnsV; fixDataColumns(rowsV); final Map<String,AbilityParmEditor> editors = getEditors(); DVector editRow = null; final int[] showNumber = {0}; final int showFlag =-999; final MOB mob=CMClass.getFactoryMOB(); final Session fakeSession = (Session)CMClass.getCommon("FakeSession"); mob.setSession(fakeSession); fakeSession.setMob(mob); for(int r=0;r<rowsV.size();r++) { editRow = rowsV.elementAt(r); for(int a=0;a<editRow.size();a++) { final AbilityParmEditor A = editors.get(editRow.elementAt(a,1)); try { final String oldVal = (String)editRow.elementAt(a,2); fakeSession.getPreviousCMD().clear(); fakeSession.getPreviousCMD().addAll(new XVector<String>(A.fakeUserInput(oldVal))); final String newVal = A.commandLinePrompt(mob,oldVal,showNumber,showFlag); editRow.setElementAt(a,2,newVal); } catch (final Exception e) { } } } fakeSession.setMob(null); mob.destroy(); if(saveRecipeFilename!=null) resaveRecipeFile(mob,saveRecipeFilename,rowsV,convertedColumnsV,false); } protected void calculateRecipeCols(final int[] lengths, final String[] headers, final Vector<DVector> rowsV) { final Map<String,AbilityParmEditor> editors = getEditors(); DVector dataRow = null; final int numRows[]=new int[headers.length]; for(int r=0;r<rowsV.size();r++) { dataRow=rowsV.elementAt(r); for(int c=0;c<dataRow.size();c++) { final AbilityParmEditor A = editors.get(dataRow.elementAt(c,1)); try { int dataLen=((String)dataRow.elementAt(c, 2)).length(); if(dataLen > A.maxColWidth()) dataLen = A.maxColWidth(); if(dataLen < A.minColWidth()) dataLen = A.minColWidth(); lengths[c]+=dataLen; numRows[c]++; } catch(final Exception e) { } if(A==null) Log.errOut("CMAbleParms","Inexplicable lack of a column: "+((String)dataRow.elementAt(c,1))); else if(headers[c] == null) { headers[c] = A.colHeader(); } else if((!headers[c].startsWith("#"))&&(!headers[c].equalsIgnoreCase(A.colHeader()))) { headers[c]="#"+c; } } } for(int i=0;i<headers.length;i++) { if(numRows[i]>0) { lengths[i] /= numRows[i]; if(lengths[i]+headers.length>50) lengths[i]=50-headers.length; } if(headers[i]==null) headers[i]="*Add*"; } int currLenTotal = 0; for (final int length : lengths) currLenTotal+=length; int curCol = 0; while((currLenTotal+lengths.length)>72) { if(lengths[curCol]>1) { lengths[curCol]--; currLenTotal--; } curCol++; if(curCol >= lengths.length) curCol = 0; } while((currLenTotal+lengths.length)<72) { lengths[curCol]++; currLenTotal++; curCol++; if(curCol >= lengths.length) curCol = 0; } } @Override public AbilityRecipeData parseRecipe(final String recipeFilename, final String recipeFormat) { final AbilityRecipeDataImpl recipe = new AbilityRecipeDataImpl(recipeFilename, recipeFormat); return recipe; } @Override public StringBuffer getRecipeList(final RecipeDriven iA) { final AbilityRecipeData recipe = parseRecipe(iA.getRecipeFilename(),iA.getRecipeFormat()); if(recipe.parseError() != null) return new StringBuffer("File: "+iA.getRecipeFilename()+": "+recipe.parseError()); return getRecipeList(recipe); } private StringBuffer getRecipeList(final AbilityRecipeData recipe) { final Map<String,AbilityParmEditor> editors = getEditors(); final StringBuffer list=new StringBuffer(""); DVector dataRow = null; list.append("### "); for(int l=0;l<recipe.columnLengths().length;l++) list.append(CMStrings.padRight(recipe.columnHeaders()[l],recipe.columnLengths()[l])+" "); list.append("\n\r"); for(int r=0;r<recipe.dataRows().size();r++) { dataRow=recipe.dataRows().get(r); list.append(CMStrings.padRight(""+(r+1),3)+" "); for(int c=0;c<dataRow.size();c++) { final Object fieldType = dataRow.elementAt(c, 1); final AbilityParmEditor A = editors.get(fieldType); String value=(String)dataRow.elementAt(c,2); if(A!=null) value=A.commandLineValue(value); final String colVal = CMStrings.limit(value,recipe.columnLengths()[c]); list.append(CMStrings.padRight(colVal,recipe.columnLengths()[c])+" "); } list.append("\n\r"); } return list; } @Override @SuppressWarnings("unchecked") public void modifyRecipesList(final MOB mob, final String recipeFilename, final String recipeFormat) throws java.io.IOException { final Map<String,AbilityParmEditor> editors = getEditors(); final AbilityRecipeData recipe = parseRecipe(recipeFilename, recipeFormat); if(recipe.parseError() != null) { Log.errOut("CMAbleParms","File: "+recipeFilename+": "+recipe.parseError()); return; } while((mob.session()!=null)&&(!mob.session().isStopped())) { final StringBuffer list=getRecipeList(recipe); mob.tell(list.toString()); final String lineNum = mob.session().prompt(L("\n\rEnter a line to edit, A to add, or ENTER to exit: "),""); if(lineNum.trim().length()==0) break; DVector editRow = null; if(lineNum.equalsIgnoreCase("A")) { editRow = recipe.blankRow(); final int keyIndex = getClassFieldIndex(editRow); String classFieldData = null; if(keyIndex>=0) { final AbilityParmEditor A = editors.get(((List<String>)editRow.elementAt(keyIndex,1)).get(0)); if(A!=null) { classFieldData = A.commandLinePrompt(mob,(String)editRow.elementAt(keyIndex,2),new int[]{0},-999); if(!A.confirmValue(classFieldData)) { mob.tell(L("Invalid value. Aborted.")); continue; } } } editRow=recipe.newRow(classFieldData); if(editRow==null) continue; recipe.dataRows().add(editRow); } else if(CMath.isInteger(lineNum)) { final int line = CMath.s_int(lineNum); if((line<1)||(line>recipe.dataRows().size())) continue; editRow = recipe.dataRows().get(line-1); } else break; if(editRow != null) { int showFlag=-1; if(CMProps.getIntVar(CMProps.Int.EDITORTYPE)>0) showFlag=-999; boolean ok=false; while(!ok) { final int[] showNumber = {0}; final int keyIndex = getClassFieldIndex(editRow); for(int a=0;a<editRow.size();a++) { final Object editorName = editRow.elementAt(a,1); if((a!=keyIndex) ||(editors.containsKey(editorName))) { final AbilityParmEditor A = editors.get(editorName); final String newVal = A.commandLinePrompt(mob,(String)editRow.elementAt(a,2),showNumber,showFlag); editRow.setElementAt(a,2,newVal); } } if(showFlag<-900) { ok=true; break; } if(showFlag>0) { showFlag=-1; continue; } showFlag=CMath.s_int(mob.session().prompt(L("Edit which? "),"")); if(showFlag<=0) { showFlag=-1; ok=true; } } } } if((mob.session()!=null)&&(!mob.session().isStopped())) { final String prompt="Save to V)FS, F)ilesystem, or C)ancel (" + (recipe.wasVFS()?"V/f/c":"v/F/c")+"): "; final String choice=mob.session().choose(prompt,L("VFC"),recipe.wasVFS()?L("V"):L("F")); if(choice.equalsIgnoreCase("C")) mob.tell(L("Cancelled.")); else { final boolean saveToVFS = choice.equalsIgnoreCase("V"); resaveRecipeFile(mob, recipeFilename,recipe.dataRows(),recipe.columns(),saveToVFS); } } } @Override public void resaveRecipeFile(final MOB mob, final String recipeFilename, final List<DVector> rowsV, final List<? extends Object> columnsV, final boolean saveToVFS) { final StringBuffer saveBuf = new StringBuffer(""); for(int r=0;r<rowsV.size();r++) { final DVector dataRow = rowsV.get(r); int dataDex = 0; for(int c=0;c<columnsV.size();c++) { final String newRowVal; if(columnsV.get(c) instanceof String) newRowVal = (String)columnsV.get(c); else newRowVal = dataRow.elementAt(dataDex++,2).toString(); saveBuf.append(newRowVal); } saveBuf.append("\n"); } if((saveBuf.length()>10) &&(saveBuf.substring(0,8).trim().toUpperCase().startsWith("<ITEM>"))) { saveBuf.insert(0, "<ITEMS>"); saveBuf.append("</ITEMS>"); } CMFile file = new CMFile((saveToVFS?"::":"//")+Resources.buildResourcePath("skills")+recipeFilename,null,CMFile.FLAG_LOGERRORS); if(!file.canWrite()) Log.errOut("CMAbleParms","File: "+recipeFilename+" can not be written"); else if((!file.exists())||(!file.text().equals(saveBuf))) { file.saveText(saveBuf); if(!saveToVFS) { file = new CMFile("::"+Resources.buildResourcePath("skills")+recipeFilename,null,CMFile.FLAG_LOGERRORS); if((file.exists())&&(file.canWrite())) { file.saveText(saveBuf); } } if(mob != null) Log.sysOut("CMAbleParms","User: "+mob.Name()+" modified "+(saveToVFS?"VFS":"Local")+" file "+recipeFilename); Resources.removeResource("PARSED_RECIPE: "+recipeFilename); Resources.removeMultiLists(recipeFilename); } } protected static int getAppropriateResourceBucket(final Item I, final Object A) { final int myMaterial = ((I.material() & RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_MITHRIL) ? RawMaterial.MATERIAL_METAL : (I.material() & RawMaterial.MATERIAL_MASK); if(A instanceof Behavior) return CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_LEATHER, RawMaterial.MATERIAL_VEGETATION}, myMaterial ); if(A instanceof Ability) { switch(((Ability)A).abilityCode() & Ability.ALL_ACODES) { case Ability.ACODE_CHANT: return CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_VEGETATION, RawMaterial.MATERIAL_ROCK}, myMaterial ); case Ability.ACODE_SPELL: return CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_WOODEN, RawMaterial.MATERIAL_PRECIOUS}, myMaterial ); case Ability.ACODE_PRAYER: return CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_METAL, RawMaterial.MATERIAL_ROCK}, myMaterial ); case Ability.ACODE_SONG: return CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_LIQUID, RawMaterial.MATERIAL_WOODEN}, myMaterial ); case Ability.ACODE_THIEF_SKILL: case Ability.ACODE_SKILL: return CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_CLOTH, RawMaterial.MATERIAL_METAL}, myMaterial ); case Ability.ACODE_PROPERTY: if(A instanceof TriggeredAffect) return CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_PRECIOUS, RawMaterial.MATERIAL_METAL}, myMaterial ); break; default: break; } } return CMLib.dice().pick( ALL_BUCKET_MATERIAL_CHOICES, myMaterial ); } protected static void addExtraMaterial(final Map<Integer,int[]> extraMatsM, final Item I, final Object A, double weight) { int times = 1; if(weight >= 1.0) { times = (int)Math.round(weight / 1.0); weight=.99; } final MaterialLibrary mats=CMLib.materials(); final int myBucket = getAppropriateResourceBucket(I,A); if(myBucket != RawMaterial.RESOURCE_NOTHING) { final PairList<Integer,Double> bucket = RawMaterial.CODES.instance().getValueSortedResources(myBucket); Integer resourceCode = (bucket.size()==0) ? Integer.valueOf(CMLib.dice().pick( RawMaterial.CODES.ALL(), I.material() )) : bucket.get( (weight>=.99) ? bucket.size()-1 : 0 ).first; for (final Pair<Integer, Double> p : bucket) { if((weight <= p.second.doubleValue())&&(mats.isResourceCodeRoomMapped(p.first.intValue()))) { resourceCode = p.first; break; } } int tries=100; while((--tries>0)&&(!mats.isResourceCodeRoomMapped(resourceCode.intValue()))) resourceCode=bucket.get(CMLib.dice().roll(1, bucket.size(), -1)).first; resourceCode = Integer.valueOf( resourceCode.intValue() ); for(int x=0;x<times;x++) { final int[] amt = extraMatsM.get( resourceCode ); if(amt == null) extraMatsM.put( resourceCode, new int[]{1} ); else amt[0]++; } } } @SuppressWarnings("unchecked") protected static Pair<String[],String[]> getBuildingCodesNFlags() { Pair<String[],String[]> codesFlags = (Pair<String[],String[]>)Resources.getResource("BUILDING_SKILL_CODES_FLAGS"); if(codesFlags == null) { RecipeDriven A=(RecipeDriven)CMClass.getAbility("Masonry"); if(A==null) A=(RecipeDriven)CMClass.getAbility("Construction"); if(A==null) A=(RecipeDriven)CMClass.getAbility("Excavation"); if(A!=null) A.getRecipeFormat(); codesFlags = (Pair<String[],String[]>)Resources.getResource("BUILDING_SKILL_CODES_FLAGS"); } return codesFlags; } protected static void addExtraAbilityMaterial(final Map<Integer,int[]> extraMatsM, final Item I, final Ability A) { double level = CMLib.ableMapper().lowestQualifyingLevel( A.ID() ); if( level <= 0.0 ) { level = I.basePhyStats().level(); if( level <= 0.0 ) level = 1.0; addExtraMaterial(extraMatsM, I, A, CMath.div( level, CMProps.getIntVar( CMProps.Int.LASTPLAYERLEVEL ) )); } else { final double levelCap = CMLib.ableMapper().getCalculatedMedianLowestQualifyingLevel(); addExtraMaterial(extraMatsM, I, A, CMath.div(level , ( levelCap * 2.0))); } } public static Map<Integer,int[]> extraMaterial(final Item I) { final Map<Integer,int[]> extraMatsM=new TreeMap<Integer,int[]>(); /* * behaviors/properties of the item */ for(final Enumeration<Ability> a=I.effects(); a.hasMoreElements();) { final Ability A=a.nextElement(); if(A.isSavable()) { if((A.abilityCode() & Ability.ALL_ACODES) == Ability.ACODE_PROPERTY) { if(A instanceof AbilityContainer) { for(final Enumeration<Ability> a1=((AbilityContainer)A).allAbilities(); a1.hasMoreElements(); ) { addExtraAbilityMaterial(extraMatsM,I,a1.nextElement()); } } if(A instanceof TriggeredAffect) { if((A.flags() & Ability.FLAG_ADJUSTER) != 0) { int count = CMStrings.countSubstrings( new String[]{A.text()}, ADJUSTER_TOKENS ); if(count == 0) count = 1; for(int i=0;i<count;i++) addExtraAbilityMaterial(extraMatsM,I,A); } else if((A.flags() & (Ability.FLAG_RESISTER | Ability.FLAG_IMMUNER)) != 0) { int count = CMStrings.countSubstrings( new String[]{A.text()}, RESISTER_IMMUNER_TOKENS ); if(count == 0) count = 1; for(int i=0;i<count;i++) addExtraAbilityMaterial(extraMatsM,I,A); } } } else if((CMParms.indexOf(ALLOWED_BUCKET_ACODES, A.abilityCode() & Ability.ALL_ACODES ) >=0) &&(CMParms.indexOf( ALLOWED_BUCKET_QUALITIES, A.abstractQuality()) >=0 )) { addExtraAbilityMaterial(extraMatsM,I,A); } } } for(final Enumeration<Behavior> b=I.behaviors(); b.hasMoreElements();) { final Behavior B=b.nextElement(); if(B.isSavable()) { addExtraMaterial(extraMatsM, I, B, CMath.div( CMProps.getIntVar( CMProps.Int.LASTPLAYERLEVEL ), I.basePhyStats().level() )); } } return extraMatsM; } @Override public synchronized Map<String,AbilityParmEditor> getEditors() { if(DEFAULT_EDITORS != null) return DEFAULT_EDITORS; final Vector<AbilityParmEditorImpl> V=new XVector<AbilityParmEditorImpl>(new AbilityParmEditorImpl[] { new AbilityParmEditorImpl("SPELL_ID","The Spell ID",ParmType.CHOICES) { @Override public void createChoices() { createChoices(CMClass.abilities()); } @Override public String defaultValue() { return "Spell_ID"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { if(I instanceof Potion) return ((Potion)I).getSpellList(); else if((I instanceof Scroll) &&(I instanceof MiscMagic)) return ((Scroll)I).getSpellList(); return ""; } }, new AbilityParmEditorImpl("RESOURCE_NAME","Resource",ParmType.CHOICES) { @Override public void createChoices() { createChoices(RawMaterial.CODES.NAMES()); } @Override public String defaultValue() { return "IRON"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return RawMaterial.CODES.NAME(I.material()); } }, new AbilityParmEditorImpl("ITEM_NAME","Item Final Name",ParmType.STRING) { @Override public void createChoices() { } @Override public String defaultValue() { return "Item Name"; } @Override public int minColWidth() { return 10; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { final String oldName=CMStrings.removeColors(I.Name()); if(I.material()==RawMaterial.RESOURCE_GLASS) return CMLib.english().removeArticleLead(oldName); String newName=oldName; final List<String> V=CMParms.parseSpaces(oldName,true); for(int i=0;i<V.size();i++) { final String s=V.get(i); final int code=RawMaterial.CODES.FIND_IgnoreCase(s); if((code>0)&&(code==I.material())) { V.set(i, "%"); if((i>0)&&(CMLib.english().isAnArticle(V.get(i-1)))) V.remove(i-1); newName=CMParms.combine(V); break; } } if(oldName.equals(newName)) { for(int i=0;i<V.size();i++) { final String s=V.get(i); final int code=RawMaterial.CODES.FIND_IgnoreCase(s); if(code>0) { V.set(i, "%"); if((i>0)&&(CMLib.english().isAnArticle(V.get(i-1)))) V.remove(i-1); newName=CMParms.combine(V); break; } } } if(newName.indexOf( '%' )<0) { for(int i=0;i<V.size()-1;i++) { if(CMLib.english().isAnArticle( V.get( i ) )) { if(i==0) V.set( i, "%" ); else V.add(i+1, "%"); break; } } newName=CMParms.combine( V ); } if(newName.indexOf( '%' )<0) { newName="% "+newName; } return newName; } }, new AbilityParmEditorImpl("COLOR_TERM","Color term",ParmType.STRING) { @Override public void createChoices() { } @Override public String defaultValue() { return "color name"; } @Override public boolean confirmValue(final String oldVal) { return true; } @Override public int minColWidth() { return 5; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } }, new AbilityParmEditorImpl("ACTIVE_VERB","Active Verb",ParmType.STRING) { @Override public void createChoices() { } @Override public String defaultValue() { return "verbing"; } @Override public boolean confirmValue(final String oldVal) { return true; } @Override public int minColWidth() { return 3; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } }, new AbilityParmEditorImpl("DISPLAY_MASK","Display Mask",ParmType.STRING) { @Override public void createChoices() { } @Override public String defaultValue() { return "@x1 is here"; } @Override public boolean confirmValue(final String oldVal) { return true; } @Override public int minColWidth() { return 3; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return CMStrings.replaceAll(I.displayText(), I.Name(), "@x1"); } }, new AbilityParmEditorImpl("COLOR_MASK","Color mask",ParmType.STRING) { @Override public void createChoices() { } @Override public String defaultValue() { return ""; } @Override public boolean confirmValue(final String oldVal) { if(oldVal.length()>0) { for(int i=0;i<oldVal.length();i++) if("0123cCwWeEFm-*|".indexOf(oldVal.charAt(i))<0) return false; } return true; } @Override public int minColWidth() { return 5; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } }, new AbilityParmEditorImpl("EXPERTISENUM","Expertise#",ParmType.NUMBERORNULL) { @Override public void createChoices() { } @Override public String defaultValue() { return ""; } @Override public boolean confirmValue(final String oldVal) { return true; } @Override public int minColWidth() { return 5; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } }, new AbilityParmEditorImpl("STAIRS_DESC","Exit Desc",ParmType.STRING) { @Override public void createChoices() { } @Override public int appliesToClass(final Object o) { if(o instanceof String) { final String chk=((String)o).toUpperCase(); if(chk.equals("STAIRS")) return 1; } return -1; } @Override public String defaultValue() { return "@x1stairs to the @x2 floor"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } }, new AbilityParmEditorImpl("BUILDING_NOUN","Building noun",ParmType.STRING) { @Override public void createChoices() { } @Override public String defaultValue() { return "thing"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } }, new AbilityParmEditorImpl("BUILDER_MASK","Builder Mask",ParmType.STRINGORNULL) { @Override public void createChoices() { } @Override public String defaultValue() { return ""; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } }, new AbilityParmEditorImpl("BUILDER_DESC","Info Description",ParmType.STRING) { @Override public void createChoices() { } @Override public String defaultValue() { return ""; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public int maxColWidth() { return 20; } }, new AbilityParmEditorImpl("RES_SUBTYPE","Sub-Type",ParmType.STRINGORNULL) { @Override public void createChoices() { } @Override public String defaultValue() { return ""; } @Override public int appliesToClass(final Object o) { if(o instanceof RawMaterial) return 5; return -1; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { if(I instanceof RawMaterial) return ((RawMaterial)I).getSubType(); return ""; } @Override public String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { return super.commandLinePrompt(mob, oldVal, showNumber, showFlag).toUpperCase().trim(); } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { return super.webValue(httpReq,parms,oldVal,fieldName).toUpperCase().trim(); } }, new AbilityParmEditorImpl("ITEM_LEVEL","Lvl",ParmType.NUMBER) { @Override public void createChoices() { } @Override public String defaultValue() { return "1"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { if((I instanceof Weapon)||(I instanceof Armor)) { final int timsLevel = CMLib.itemBuilder().timsLevelCalculator(I); if((timsLevel > I.basePhyStats().level() ) && (timsLevel < CMProps.getIntVar(CMProps.Int.LASTPLAYERLEVEL))) return ""+timsLevel; } return ""+I.basePhyStats().level(); } }, new AbilityParmEditorImpl("BUILDING_GRID_SIZE","Grid Size",ParmType.NUMBER) { @Override public void createChoices() { } @Override public int appliesToClass(final Object o) { if(o instanceof String) { final String chk=((String)o).toUpperCase(); if(chk.equals("ROOM")) return 1; } return -1; } @Override public String defaultValue() { return "1"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return "1"; } }, new AbilityParmEditorImpl("BUILD_TIME_TICKS","Time",ParmType.NUMBER) { @Override public void createChoices() { } @Override public String defaultValue() { return "20"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""+(10 + (I.basePhyStats().level()/2)); } }, new AbilityParmEditorImpl("XLEVEL","Expertise Level",ParmType.NUMBER) { @Override public void createChoices() { } @Override public String defaultValue() { return "0"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return "0"; } }, new AbilityParmEditorImpl("FUTURE_USE","Future Use",ParmType.STRINGORNULL) { @Override public void createChoices() { } @Override public String defaultValue() { return "1"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return "1"; } }, new AbilityParmEditorImpl("AMOUNT_MATERIAL_REQUIRED","Amt",ParmType.NUMBER) { @Override public void createChoices() { } @Override public boolean confirmValue(final String oldVal) { return true; } @Override public String defaultValue() { return "10"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""+Math.round(CMath.mul(I.basePhyStats().weight(),(A!=null)?A.getItemWeightMultiplier(false):1.0)); } }, new AbilityParmEditorImpl("MATERIALS_REQUIRED","Amount/Cmp",ParmType.SPECIAL) { @Override public void createChoices() { } @Override public boolean confirmValue(final String oldVal) { return true; } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { if(httpReq.isUrlParameter(fieldName+"_WHICH")) { final String which=httpReq.getUrlParameter(fieldName+"_WHICH"); if((which.trim().length()==0)||(which.trim().equalsIgnoreCase("AMOUNT"))) return httpReq.getUrlParameter(fieldName+"_AMOUNT"); if(which.trim().equalsIgnoreCase("COMPONENT")) return httpReq.getUrlParameter(fieldName+"_COMPONENT"); int x=1; final List<AbilityComponent> comps=new Vector<AbilityComponent>(); while(httpReq.isUrlParameter(fieldName+"_CUST_TYPE_"+x)) { String connector=httpReq.getUrlParameter(fieldName+"_CUST_CONN_"+x); final String amt=httpReq.getUrlParameter(fieldName+"_CUST_AMT_"+x); final String strVal=httpReq.getUrlParameter(fieldName+"_CUST_STR_"+x); final String loc=httpReq.getUrlParameter(fieldName+"_CUST_LOC_"+x); final String def=httpReq.getUrlParameter(fieldName+"_CUST_DEF_"+x); final String typ=httpReq.getUrlParameter(fieldName+"_CUST_TYPE_"+x); final String styp=httpReq.getUrlParameter(fieldName+"_CUST_STYPE_"+x); final String con=httpReq.getUrlParameter(fieldName+"_CUST_CON_"+x); if(connector==null) connector="AND"; if(connector.equalsIgnoreCase("DEL")||(connector.length()==0)) { x++; continue; } try { final AbilityComponent able=CMLib.ableComponents().createBlankAbilityComponent(""); able.setConnector(AbilityComponent.CompConnector.valueOf(connector)); able.setAmount(CMath.s_int(amt)); able.setMask((def==null)?"":def); able.setTriggererDef(""); able.setConsumed((con!=null) && con.equalsIgnoreCase("on")); able.setLocation(AbilityComponent.CompLocation.valueOf(loc)); if(CMath.s_valueOf(AbilityComponent.CompType.class, typ)!=null) able.setType(AbilityComponent.CompType.valueOf(typ), strVal, styp); comps.add(able); } catch(final Exception e) { } x++; } if(comps.size()>0) return CMLib.ableComponents().getAbilityComponentCodedString(comps); } return oldVal; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { int amt=(int)Math.round(CMath.mul(I.basePhyStats().weight()-1,(A!=null)?A.getItemWeightMultiplier(false):1.0)); if(amt<1) amt=1; final Map<Integer,int[]> extraMatsM = CMAbleParms.extraMaterial( I ); if((extraMatsM == null) || (extraMatsM.size()==0)) { return ""+amt; } final String subType = (I instanceof RawMaterial)?((RawMaterial)I).getSubType():""; final List<AbilityComponent> comps=new Vector<AbilityComponent>(); AbilityComponent able=CMLib.ableComponents().createBlankAbilityComponent(""); able.setConnector(AbilityComponent.CompConnector.AND); able.setAmount(amt); able.setMask(""); able.setTriggererDef(""); able.setConsumed(true); able.setLocation(AbilityComponent.CompLocation.ONGROUND); able.setType(AbilityComponent.CompType.MATERIAL, Integer.valueOf(I.material() & RawMaterial.MATERIAL_MASK), subType); comps.add(able); for(final Integer resourceCode : extraMatsM.keySet()) { able=CMLib.ableComponents().createBlankAbilityComponent(""); able.setConnector(AbilityComponent.CompConnector.AND); able.setAmount(extraMatsM.get(resourceCode)[0]); able.setMask(""); able.setTriggererDef(""); able.setConsumed(true); able.setLocation(AbilityComponent.CompLocation.ONGROUND); able.setType(AbilityComponent.CompType.RESOURCE, resourceCode, ""); comps.add(able); } return CMLib.ableComponents().getAbilityComponentCodedString(comps); } @Override public String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { String value=webValue(httpReq,parms,oldVal,fieldName); if(value.endsWith("$")) value = value.substring(0,oldVal.length()-1); value = value.trim(); final String curWhich=httpReq.getUrlParameter(fieldName+"_WHICH"); int type=0; if("COMPONENT".equalsIgnoreCase(curWhich)) type=1; else if("EMBEDDED".equalsIgnoreCase(curWhich)) type=2; else if("AMOUNT".equalsIgnoreCase(curWhich)) type=0; else if(CMLib.ableComponents().getAbilityComponentMap().containsKey(value.toUpperCase().trim())) type=1; else if(value.startsWith("(")) type=2; else type=0; List<AbilityComponent> comps=null; if(type==2) { final Hashtable<String,List<AbilityComponent>> H=new Hashtable<String,List<AbilityComponent>>(); final String s="ID="+value; CMLib.ableComponents().addAbilityComponent(s, H); comps=H.get("ID"); } if(comps==null) comps=new ArrayList<AbilityComponent>(1); final StringBuffer str = new StringBuffer("<FONT SIZE=-1>"); str.append("<INPUT TYPE=RADIO NAME="+fieldName+"_WHICH "+(type==0?"CHECKED ":"")+"VALUE=\"AMOUNT\">"); str.append("\n\rAmount: <INPUT TYPE=TEXT SIZE=3 NAME="+fieldName+"_AMOUNT VALUE=\""+(type!=0?"":value)+"\" ONKEYDOWN=\"document.RESOURCES."+fieldName+"_WHICH[0].checked=true;\">"); str.append("\n\r<BR>"); str.append("<INPUT TYPE=RADIO NAME="+fieldName+"_WHICH "+(type==1?"CHECKED ":"")+"VALUE=\"COMPONENT\">"); str.append(L("\n\rSkill Components:")); str.append("\n\r<SELECT NAME="+fieldName+"_COMPONENT ONCHANGE=\"document.RESOURCES."+fieldName+"_WHICH[1].checked=true;\">"); str.append("<OPTION VALUE=\"0\""); if((type!=1)||(value.length()==0)||(value.equalsIgnoreCase("0"))) str.append(" SELECTED"); str.append(">&nbsp;"); for(final String S : CMLib.ableComponents().getAbilityComponentMap().keySet()) { str.append("<OPTION VALUE=\""+S+"\""); if((type==1)&&(value.equalsIgnoreCase(S))) str.append(" SELECTED"); str.append(">"+S); } str.append("</SELECT>"); str.append("\n\r<BR>"); str.append("<INPUT TYPE=RADIO NAME="+fieldName+"_WHICH "+(type==2?"CHECKED ":"")+"VALUE=\"EMBEDDED\">"); str.append("\n\rCustom:"); str.append("\n\r<BR>"); AbilityComponent comp; for(int i=0;i<=comps.size();i++) { comp=(i<comps.size())?comps.get(i):null; if(i>0) { str.append("\n\r<SELECT NAME="+fieldName+"_CUST_CONN_"+(i+1)+" ONCHANGE=\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\">"); if(comp!=null) str.append("<OPTION VALUE=\"DEL\">DEL"); else if(type==2) str.append("<OPTION VALUE=\"\" SELECTED>"); for(final AbilityComponent.CompConnector conector : AbilityComponent.CompConnector.values()) { str.append("<OPTION VALUE=\""+conector.toString()+"\" "); if((type==2)&&(comp!=null)&&(conector==comp.getConnector())) str.append("SELECTED "); str.append(">"+CMStrings.capitalizeAndLower(conector.toString())); } str.append("</SELECT>"); } str.append("\n\rAmt: <INPUT TYPE=TEXT SIZE=2 NAME="+fieldName+"_CUST_AMT_"+(i+1)+" VALUE=\""+(((type!=2)||(comp==null))?"":Integer.toString(comp.getAmount()))+"\" ONKEYDOWN=\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\">"); str.append("\n\r<SELECT NAME="+fieldName+"_CUST_TYPE_"+(i+1)+" ONCHANGE=\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true; ReShow();\">"); final AbilityComponent.CompType compType=(comp!=null)?comp.getType():AbilityComponent.CompType.STRING; final String subType=(comp != null)?comp.getSubType():""; for(final AbilityComponent.CompType conn : AbilityComponent.CompType.values()) { str.append("<OPTION VALUE=\""+conn.toString()+"\" "); if(conn==compType) str.append("SELECTED "); str.append(">"+CMStrings.capitalizeAndLower(conn.toString())); } str.append("</SELECT>"); if(compType==AbilityComponent.CompType.STRING) str.append("\n\r<INPUT TYPE=TEXT SIZE=10 NAME="+fieldName+"_CUST_STR_"+(i+1)+" VALUE=\""+(((type!=2)||(comp==null))?"":comp.getStringType())+"\" ONKEYDOWN=\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\">"); else { str.append("\n\r<SELECT NAME="+fieldName+"_CUST_STR_"+(i+1)+" ONCHANGE=\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\">"); if(compType==AbilityComponent.CompType.MATERIAL) { final RawMaterial.Material[] M=RawMaterial.Material.values(); Arrays.sort(M,new Comparator<RawMaterial.Material>() { @Override public int compare(final Material o1, final Material o2) { return o1.name().compareToIgnoreCase(o2.name()); } }); for(final RawMaterial.Material m : M) { str.append("<OPTION VALUE="+m.mask()); if((type==2)&&(comp!=null)&&(m.mask()==comp.getLongType())) str.append(" SELECTED"); str.append(">"+m.noun()); } } else if(compType==AbilityComponent.CompType.RESOURCE) { final List<Pair<String,Integer>> L=new Vector<Pair<String,Integer>>(); for(int x=0;x<RawMaterial.CODES.TOTAL();x++) L.add(new Pair<String,Integer>(RawMaterial.CODES.NAME(x),Integer.valueOf(RawMaterial.CODES.GET(x)))); Collections.sort(L,new Comparator<Pair<String,Integer>>() { @Override public int compare(final Pair<String, Integer> o1, final Pair<String, Integer> o2) { return o1.first.compareToIgnoreCase(o2.first); } }); for(final Pair<String,Integer> p : L) { str.append("<OPTION VALUE="+p.second); if((type==2)&&(comp!=null)&&(p.second.longValue()==comp.getLongType())) str.append(" SELECTED"); str.append(">"+p.first); } } str.append("</SELECT>"); str.append(" <INPUT TYPE=TEXT SIZE=2 NAME="+fieldName+"_CUST_STYPE_"+(i+1)+" VALUE=\""+subType+"\">"); } str.append("\n\r<SELECT NAME="+fieldName+"_CUST_LOC_"+(i+1)+" ONCHANGE=\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\">"); for(final AbilityComponent.CompLocation conn : AbilityComponent.CompLocation.values()) { str.append("<OPTION VALUE=\""+conn.toString()+"\" "); if((type==2)&&(comp!=null)&&(conn==comp.getLocation())) str.append("SELECTED "); str.append(">"+CMStrings.capitalizeAndLower(conn.toString())); } str.append("</SELECT>"); str.append("\n\rConsumed:<INPUT TYPE=CHECKBOX NAME="+fieldName+"_CUST_CON_"+(i+1)+" "+((type!=2)||(comp==null)||(!comp.isConsumed())?"":"CHECKED")+" ONCLICK=\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\">"); if(i<comps.size()) str.append("\n\r<BR>\n\r"); else str.append("\n\r<a href=\"javascript:ReShow();\">&lt;*&gt;</a>\n\r"); } str.append("<BR>"); str.append("</FONT>"); return str.toString(); } @Override public String[] fakeUserInput(final String oldVal) { return new String[] { oldVal }; } @Override public String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { ++showNumber[0]; String str = oldVal; while(!mob.session().isStopped()) { final String help="<AMOUNT>" +"\n\rSkill Component: "+CMParms.toListString(CMLib.ableComponents().getAbilityComponentMap().keySet()) +"\n\rCustom Component: ([DISPOSITION]:[FATE]:[AMOUNT]:[COMPONENT ID]:[MASK]) && ..."; str=CMLib.genEd().prompt(mob,oldVal,showNumber[0],showFlag,prompt(),true,help).trim(); if(str.equals(oldVal)) return oldVal; if(CMath.isInteger(str)) return Integer.toString(CMath.s_int(str)); if(CMLib.ableComponents().getAbilityComponentMap().containsKey(str.toUpperCase().trim())) return str.toUpperCase().trim(); String error=null; if(str.trim().startsWith("(")) { error=CMLib.ableComponents().addAbilityComponent("ID="+str, new Hashtable<String,List<AbilityComponent>>()); if(error==null) return str; } mob.session().println(L("'@x1' is not an amount of material, a component key, or custom component list@x2. Please use ? for help.",str,(error==null?"":"("+error+")"))); } return str; } @Override public String defaultValue() { return "1"; } }, new AbilityParmEditorImpl("OPTIONAL_AMOUNT_REQUIRED","Amt",ParmType.NUMBER) { @Override public void createChoices() { } @Override public boolean confirmValue(final String oldVal) { return true; } @Override public String defaultValue() { return ""; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } }, new AbilityParmEditorImpl("ITEM_BASE_VALUE","Value",ParmType.NUMBER) { @Override public void createChoices() { } @Override public String defaultValue() { return "5"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""+I.baseGoldValue(); } }, new AbilityParmEditorImpl("ROOM_CLASS_ID","Class ID",ParmType.CHOICES) { @Override public int appliesToClass(final Object o) { if(o instanceof String) { final String chk=((String)o).toUpperCase(); if(chk.equalsIgnoreCase("ROOM") ||chk.equalsIgnoreCase("EXCAVATE")) return 1; } return -1; } @Override public void createChoices() { final Vector<Environmental> V = new Vector<Environmental>(); V.addAll(new XVector<Room>(CMClass.locales())); createChoices(V); } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public String defaultValue() { return "Plains"; } }, new AbilityParmEditorImpl("ALLITEM_CLASS_ID","Class ID",ParmType.CHOICES) { @Override public int appliesToClass(final Object o) { if(o instanceof String) { final String chk=((String)o).toUpperCase(); if(chk.equalsIgnoreCase("ITEM")) return 1; } return -1; } @Override public void createChoices() { final XVector<Environmental> V = new XVector<Environmental>(); V.addAll(CMClass.basicItems()); V.addAll(CMClass.weapons()); V.addAll(CMClass.tech()); V.addAll(CMClass.armor()); V.addAll(CMClass.miscMagic()); V.addAll(CMClass.clanItems()); for(int i=V.size()-1;i<=0;i--) { if(V.get(i) instanceof CMObjectWrapper) V.remove(i); } createChoices(V); } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public String defaultValue() { return "StdItem"; } }, new AbilityParmEditorImpl("ROOM_CLASS_ID_OR_NONE","Class ID",ParmType.CHOICES) { @Override public int appliesToClass(final Object o) { if(o instanceof String) { final String chk=((String)o).toUpperCase(); if(chk.equalsIgnoreCase("DEMOLISH") ||chk.equalsIgnoreCase("STAIRS")) return 1; } return -1; } @Override public void createChoices() { final Vector<Object> V = new Vector<Object>(); V.add(""); V.addAll(new XVector<Room>(CMClass.locales())); createChoices(V); } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public String defaultValue() { return ""; } }, new AbilityParmEditorImpl("EXIT_CLASS_ID","Class ID",ParmType.CHOICES) { @Override public int appliesToClass(final Object o) { if(o instanceof String) { final String chk=((String)o).toUpperCase(); if(chk.equalsIgnoreCase("DOOR")) return 1; } return -1; } @Override public void createChoices() { final Vector<Environmental> V = new Vector<Environmental>(); V.addAll(new XVector<Exit>(CMClass.exits())); final Vector<CMObject> V2=new Vector<CMObject>(); Environmental I; for(final Enumeration<Environmental> e=V.elements();e.hasMoreElements();) { I=e.nextElement(); if(I.isGeneric()) V2.addElement(I); } createChoices(V2); } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public String defaultValue() { return "GenExit"; } }, new AbilityParmEditorImpl("ITEM_CLASS_ID","Class ID",ParmType.CHOICES) { @Override public void createChoices() { final List<Item> V = new ArrayList<Item>(); V.addAll(new XVector<ClanItem>(CMClass.clanItems())); V.addAll(new XVector<Armor>(CMClass.armor())); V.addAll(new XVector<Item>(CMClass.basicItems())); V.addAll(new XVector<MiscMagic>(CMClass.miscMagic())); V.addAll(new XVector<Technical>(CMClass.tech())); V.addAll(new XVector<Weapon>(CMClass.weapons())); final List<Item> V2=new ArrayList<Item>(); Item I; for(final Iterator<Item> e=V.iterator();e.hasNext();) { I=e.next(); if(I.isGeneric() || I.ID().equalsIgnoreCase("StdDeckOfCards")) V2.add(I); } for(int i=V.size()-1;i<=0;i--) { if(V.get(i) instanceof CMObjectWrapper) V.remove(i); } createChoices(V2); } @Override public String convertFromItem(final ItemCraftor A, final Item I) { if(I.isGeneric()) return I.ID(); if(I instanceof Weapon) return "GenWeapon"; if(I instanceof Armor) return "GenArmor"; if(I instanceof Rideable) return "GenRideable"; return "GenItem"; } @Override public String defaultValue() { return "GenItem"; } }, new AbilityParmEditorImpl("CODED_WEAR_LOCATION","Wear Locs",ParmType.SPECIAL) { @Override public int appliesToClass(final Object o) { if(o instanceof FalseLimb) return -1; return ((o instanceof Armor) || (o instanceof MusicalInstrument)) ? 2 : -1; } @Override public void createChoices() { } @Override public boolean confirmValue(final String oldVal) { return oldVal.trim().length() > 0; } @Override public String defaultValue() { return "NECK"; } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final short[] layerAtt = new short[1]; final short[] layers = new short[1]; final long[] wornLoc = new long[1]; final boolean[] logicalAnd = new boolean[1]; final double[] hardBonus=new double[1]; CMLib.ableParms().parseWearLocation(layerAtt,layers,wornLoc,logicalAnd,hardBonus,oldVal); if(httpReq.isUrlParameter(fieldName+"_WORNDATA")) { wornLoc[0]=CMath.s_long(httpReq.getUrlParameter(fieldName+"_WORNDATA")); for(int i=1;;i++) if(httpReq.isUrlParameter(fieldName+"_WORNDATA"+(Integer.toString(i)))) wornLoc[0]=wornLoc[0]|CMath.s_long(httpReq.getUrlParameter(fieldName+"_WORNDATA"+(Integer.toString(i)))); else break; logicalAnd[0] = httpReq.getUrlParameter(fieldName+"_ISTWOHANDED").equalsIgnoreCase("on"); layers[0] = CMath.s_short(httpReq.getUrlParameter(fieldName+"_LAYER")); layerAtt[0] = 0; if((httpReq.isUrlParameter(fieldName+"_SEETHRU")) &&(httpReq.getUrlParameter(fieldName+"_SEETHRU").equalsIgnoreCase("on"))) layerAtt[0] |= Armor.LAYERMASK_SEETHROUGH; if((httpReq.isUrlParameter(fieldName+"_MULTIWEAR")) &&(httpReq.getUrlParameter(fieldName+"_MULTIWEAR").equalsIgnoreCase("on"))) layerAtt[0] |= Armor.LAYERMASK_MULTIWEAR; } return reconvert(layerAtt,layers,wornLoc,logicalAnd,hardBonus); } @Override public String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final String value = webValue(httpReq,parms,oldVal,fieldName); final short[] layerAtt = new short[1]; final short[] layers = new short[1]; final long[] wornLoc = new long[1]; final boolean[] logicalAnd = new boolean[1]; final double[] hardBonus=new double[1]; CMLib.ableParms().parseWearLocation(layerAtt,layers,wornLoc,logicalAnd,hardBonus,value); final StringBuffer str = new StringBuffer(""); str.append("\n\r<SELECT NAME="+fieldName+"_WORNDATA MULTIPLE>"); final Wearable.CODES codes = Wearable.CODES.instance(); for(int i=1;i<codes.total();i++) { final String climstr=codes.name(i); final int mask=(int)CMath.pow(2,i-1); str.append("<OPTION VALUE="+mask); if((wornLoc[0]&mask)>0) str.append(" SELECTED"); str.append(">"+climstr); } str.append("</SELECT>"); str.append("<BR>\n\r<INPUT TYPE=RADIO NAME="+fieldName+"_ISTWOHANDED value=\"on\" "+(logicalAnd[0]?"CHECKED":"")+">Is worn on All above Locations."); str.append("<BR>\n\r<INPUT TYPE=RADIO NAME="+fieldName+"_ISTWOHANDED value=\"\" "+(logicalAnd[0]?"":"CHECKED")+">Is worn on ANY of the above Locations."); str.append("<BR>\n\rLayer: <INPUT TYPE=TEXT NAME="+fieldName+"_LAYER SIZE=5 VALUE=\""+layers[0]+"\">"); final boolean seeThru = CMath.bset(layerAtt[0],Armor.LAYERMASK_SEETHROUGH); final boolean multiWear = CMath.bset(layerAtt[0],Armor.LAYERMASK_MULTIWEAR); str.append("&nbsp;&nbsp;\n\r<INPUT TYPE=CHECKBOX NAME="+fieldName+"_SEETHRU value=\"on\" "+(seeThru?"CHECKED":"")+">Is see-through."); str.append("&nbsp;&nbsp;\n\r<INPUT TYPE=CHECKBOX NAME="+fieldName+"_MULTIWEAR value=\"on\" "+(multiWear?"CHECKED":"")+">Is multi-wear."); return str.toString(); } public String reconvert(final short[] layerAtt, final short[] layers, final long[] wornLoc, final boolean[] logicalAnd, final double[] hardBonus) { final StringBuffer newVal = new StringBuffer(""); if((layerAtt[0]!=0)||(layers[0]!=0)) { if(CMath.bset(layerAtt[0],Armor.LAYERMASK_MULTIWEAR)) newVal.append('M'); if(CMath.bset(layerAtt[0],Armor.LAYERMASK_SEETHROUGH)) newVal.append('S'); newVal.append(layers[0]); newVal.append(':'); } boolean needLink=false; final Wearable.CODES codes = Wearable.CODES.instance(); for(int wo=1;wo<codes.total();wo++) { if(CMath.bset(wornLoc[0],CMath.pow(2,wo-1))) { if(needLink) newVal.append(logicalAnd[0]?"&&":"||"); needLink = true; newVal.append(codes.name(wo).toUpperCase()); } } return newVal.toString(); } @Override public String convertFromItem(final ItemCraftor C, final Item I) { if(!(I instanceof Armor)) return "HELD"; final Armor A=(Armor)I; final boolean[] logicalAnd=new boolean[]{I.rawLogicalAnd()}; final long[] wornLoc=new long[]{I.rawProperLocationBitmap()}; final double[] hardBonus=new double[]{0.0}; final short[] layerAtt=new short[]{A.getLayerAttributes()}; final short[] layers=new short[]{A.getClothingLayer()}; return reconvert(layerAtt,layers,wornLoc,logicalAnd,hardBonus); } @Override public String[] fakeUserInput(final String oldVal) { final ArrayList<String> V = new ArrayList<String>(); final short[] layerAtt = new short[1]; final short[] layers = new short[1]; final long[] wornLoc = new long[1]; final boolean[] logicalAnd = new boolean[1]; final double[] hardBonus=new double[1]; CMLib.ableParms().parseWearLocation(layerAtt,layers,wornLoc,logicalAnd,hardBonus,oldVal); V.add(""+layers[0]); if(CMath.bset(layerAtt[0],Armor.LAYERMASK_SEETHROUGH)) V.add("Y"); else V.add("N"); if(CMath.bset(layerAtt[0],Armor.LAYERMASK_MULTIWEAR)) V.add("Y"); else V.add("N"); V.add("1"); V.add("1"); final Wearable.CODES codes = Wearable.CODES.instance(); for(int i=0;i<codes.total();i++) { if(CMath.bset(wornLoc[0],codes.get(i))) { V.add(""+(i+2)); V.add(""+(i+2)); } } V.add("0"); return CMParms.toStringArray(V); } @Override public String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { final short[] layerAtt = new short[1]; final short[] layers = new short[1]; final long[] wornLoc = new long[1]; final boolean[] logicalAnd = new boolean[1]; final double[] hardBonus=new double[1]; CMLib.ableParms().parseWearLocation(layerAtt,layers,wornLoc,logicalAnd,hardBonus,oldVal); CMLib.genEd().wornLayer(mob,layerAtt,layers,++showNumber[0],showFlag); CMLib.genEd().wornLocation(mob,wornLoc,logicalAnd,++showNumber[0],showFlag); return reconvert(layerAtt,layers,wornLoc,logicalAnd,hardBonus); } }, new AbilityParmEditorImpl("PAGES_CHARS","Max Pgs/Chrs.",ParmType.SPECIAL) { @Override public int appliesToClass(final Object o) { return (o instanceof Book) ? 1 : -1; } @Override public void createChoices() { } @Override public String defaultValue() { return "1/0"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { if(I instanceof Book) return ""+((Book)I).getMaxPages()+"/"+((Book)I).getMaxCharsPerPage(); return "1/0"; } @Override public boolean confirmValue(final String oldVal) { return oldVal.trim().length() > 0; } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { int maxPages=1; int maxCharsPage=0; if(oldVal.length()>0) { final int x=oldVal.indexOf('/'); if(x>0) { maxPages=CMath.s_int(oldVal.substring(0,x)); maxCharsPage=CMath.s_int(oldVal.substring(x+1)); } } if(httpReq.isUrlParameter(fieldName+"_MAXPAGES")) maxPages = CMath.s_int(httpReq.getUrlParameter(fieldName+"_MAXPAGES")); if(httpReq.isUrlParameter(fieldName+"_MAXCHARSPAGE")) maxCharsPage = CMath.s_int(httpReq.getUrlParameter(fieldName+"_MAXCHARSPAGE")); return ""+maxPages+"/"+maxCharsPage; } @Override public String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final String value = webValue(httpReq, parms, oldVal, fieldName); final StringBuffer str = new StringBuffer(""); str.append("<TABLE WIDTH=100% BORDER=\"1\" CELLSPACING=0 CELLPADDING=0><TR>"); final String[] vals = this.fakeUserInput(value); str.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Max Pages")+"</FONT></TD>"); str.append("<TD WIDTH=25%><INPUT TYPE=TEXT SIZE=5 NAME="+fieldName+"_MAXPAGES VALUE=\""+vals[0]+"\">"); str.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Max Chars Page")+"</FONT></TD>"); str.append("<TD WIDTH=25%><INPUT TYPE=TEXT SIZE=5 NAME="+fieldName+"_MAXCHARSPAGE VALUE=\""+vals[1]+"\">"); str.append("</TD>"); str.append("</TR></TABLE>"); return str.toString(); } @Override public String[] fakeUserInput(final String oldVal) { final ArrayList<String> V = new ArrayList<String>(); int maxPages=1; int maxCharsPage=0; if(oldVal.length()>0) { final int x=oldVal.indexOf('/'); if(x>0) { maxPages=CMath.s_int(oldVal.substring(0,x)); maxCharsPage=CMath.s_int(oldVal.substring(x+1)); } } V.add(""+maxPages); V.add(""+maxCharsPage); return CMParms.toStringArray(V); } @Override public String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { final String[] input=this.fakeUserInput(oldVal); int maxPages=CMath.s_int(input[0]); int maxCharsPage=CMath.s_int(input[1]); maxPages = CMLib.genEd().prompt(mob, maxPages, ++showNumber[0], showFlag, L("Max Pages"), null); maxCharsPage = CMLib.genEd().prompt(mob, maxCharsPage, ++showNumber[0], showFlag, L("Max Chars/Page"), null); return maxPages+"/"+maxCharsPage; } }, new AbilityParmEditorImpl("RIDE_OVERRIDE_STRS","Ride Strings",ParmType.SPECIAL) { @Override public int appliesToClass(final Object o) { return (o instanceof Rideable) ? 1 : -1; } @Override public void createChoices() { } @Override public String defaultValue() { return ""; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { if(I instanceof Rideable) { final Rideable R=(Rideable)I; final StringBuilder str=new StringBuilder(""); //STATESTR,STATESUBJSTR,RIDERSTR,MOUNTSTR,DISMOUNTSTR,PUTSTR str.append(R.getStateString().replace(';', ',')).append(';'); str.append(R.getStateStringSubject().replace(';', ',')).append(';'); str.append(R.getRideString().replace(';', ',')).append(';'); str.append(R.getMountString().replace(';', ',')).append(';'); str.append(R.getDismountString().replace(';', ',')).append(';'); str.append(R.getPutString().replace(';', ',')); if(str.length()==5) return ""; return str.toString(); } return ""; } @Override public boolean confirmValue(final String oldVal) { return true; } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final String[] finput = this.fakeUserInput(oldVal); String stateStr=finput[0]; String stateSubjectStr=finput[1]; String riderStr=finput[2]; String mountStr=finput[3]; String dismountStr=finput[4]; String putStr=finput[5]; if(httpReq.isUrlParameter(fieldName+"_RSTATESTR")) stateStr = httpReq.getUrlParameter(fieldName+"_RSTATESTR"); if(httpReq.isUrlParameter(fieldName+"_RSTATESUBJSTR")) stateSubjectStr = httpReq.getUrlParameter(fieldName+"_RSTATESUBJSTR"); if(httpReq.isUrlParameter(fieldName+"_RRIDERSTR")) riderStr = httpReq.getUrlParameter(fieldName+"_RRIDERSTR"); if(httpReq.isUrlParameter(fieldName+"_RMOUNTSTR")) mountStr = httpReq.getUrlParameter(fieldName+"_RMOUNTSTR"); if(httpReq.isUrlParameter(fieldName+"_RDISMOUNTSTR")) dismountStr = httpReq.getUrlParameter(fieldName+"_RDISMOUNTSTR"); if(httpReq.isUrlParameter(fieldName+"_RPUTSTR")) putStr = httpReq.getUrlParameter(fieldName+"_RPUTSTR"); final StringBuilder str=new StringBuilder(""); str.append(stateStr.replace(';', ',')).append(';'); str.append(stateSubjectStr.replace(';', ',')).append(';'); str.append(riderStr.replace(';', ',')).append(';'); str.append(mountStr.replace(';', ',')).append(';'); str.append(dismountStr.replace(';', ',')).append(';'); str.append(putStr.replace(';', ',')); if(str.length()==5) return ""; return str.toString(); } @Override public String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final String value = webValue(httpReq, parms, oldVal, fieldName); final StringBuffer str = new StringBuffer(""); str.append("<TABLE WIDTH=100% BORDER=\"1\" CELLSPACING=0 CELLPADDING=0>"); final String[] vals = this.fakeUserInput(value); str.append("<TR>"); str.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("State")+"</FONT></TD>"); str.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RSTATESTR VALUE=\""+vals[0]+"\">"); str.append("</TR>"); str.append("<TR>"); str.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("State Subj.")+"</FONT></TD>"); str.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RSTATESUBJSTR VALUE=\""+vals[1]+"\">"); str.append("</TR>"); str.append("<TR>"); str.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Rider")+"</FONT></TD>"); str.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RRIDERSTR VALUE=\""+vals[2]+"\">"); str.append("</TR>"); str.append("<TR>"); str.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Mount")+"</FONT></TD>"); str.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RMOUNTSTR VALUE=\""+vals[3]+"\">"); str.append("</TR>"); str.append("<TR>"); str.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Dismount")+"</FONT></TD>"); str.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RDISMOUNTSTR VALUE=\""+vals[4]+"\">"); str.append("</TR>"); str.append("<TR>"); str.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Put")+"</FONT></TD>"); str.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RPUTSTR VALUE=\""+vals[5]+"\">"); str.append("</TR>"); str.append("</TABLE>"); return str.toString(); } @Override public String[] fakeUserInput(final String oldVal) { final ArrayList<String> V = new ArrayList<String>(); String stateStr=""; String stateSubjectStr=""; String riderStr=""; String mountStr=""; String dismountStr=""; String putStr=""; if(oldVal.length()>0) { final List<String> lst=CMParms.parseSemicolons(oldVal.trim(),false); if(lst.size()>0) stateStr=lst.get(0).replace(';',','); if(lst.size()>1) stateSubjectStr=lst.get(1).replace(';',','); if(lst.size()>2) riderStr=lst.get(2).replace(';',','); if(lst.size()>3) mountStr=lst.get(3).replace(';',','); if(lst.size()>4) dismountStr=lst.get(4).replace(';',','); if(lst.size()>5) putStr=lst.get(5).replace(';',','); } V.add(stateStr); V.add(stateSubjectStr); V.add(riderStr); V.add(mountStr); V.add(dismountStr); V.add(putStr); return CMParms.toStringArray(V); } @Override public String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { final String[] finput = this.fakeUserInput(oldVal); String stateStr=finput[0]; String stateSubjectStr=finput[1]; String riderStr=finput[2]; String mountStr=finput[3]; String dismountStr=finput[4]; String putStr=finput[5]; stateStr = CMLib.genEd().prompt(mob, stateStr, ++showNumber[0], showFlag, L("State Str"), true); stateSubjectStr = CMLib.genEd().prompt(mob, stateSubjectStr, ++showNumber[0], showFlag, L("State Subject"), true); riderStr = CMLib.genEd().prompt(mob, riderStr, ++showNumber[0], showFlag, L("Ride Str"), true); mountStr = CMLib.genEd().prompt(mob, mountStr, ++showNumber[0], showFlag, L("Mount Str"), true); dismountStr = CMLib.genEd().prompt(mob, dismountStr, ++showNumber[0], showFlag, L("Dismount Str"), true); putStr = CMLib.genEd().prompt(mob, putStr, ++showNumber[0], showFlag, L("Put Str"), true); final StringBuilder str=new StringBuilder(""); str.append(stateStr.replace(';', ',')).append(';'); str.append(stateSubjectStr.replace(';', ',')).append(';'); str.append(riderStr.replace(';', ',')).append(';'); str.append(mountStr.replace(';', ',')).append(';'); str.append(dismountStr.replace(';', ',')).append(';'); str.append(putStr.replace(';', ',')); if(str.length()==5) return ""; return str.toString(); } }, new AbilityParmEditorImpl("CONTAINER_CAPACITY","Cap.",ParmType.NUMBER) { @Override public int appliesToClass(final Object o) { return (o instanceof Container) ? 1 : -1; } @Override public void createChoices() { } @Override public String defaultValue() { return "20"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { if(I instanceof Container) return ""+((Container)I).capacity(); return "0"; } }, new AbilityParmEditorImpl("BASE_ARMOR_AMOUNT","Arm.",ParmType.NUMBER) { @Override public int appliesToClass(final Object o) { return (o instanceof Armor) ? 2 : -1; } @Override public void createChoices() { } @Override public String defaultValue() { return "1"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""+I.basePhyStats().armor(); } }, new AbilityParmEditorImpl("BOARDABLE_POP","Pop.",ParmType.NUMBER) { @Override public int appliesToClass(final Object o) { return (o instanceof Boardable) ? 2 : -1; } @Override public void createChoices() { } @Override public String defaultValue() { return "100"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { if(I instanceof Boardable) return ""+((Boardable)I).getArea().numberOfProperIDedRooms()*10; return "100"; } }, new AbilityParmEditorImpl("CONTAINER_TYPE","Con.",ParmType.MULTICHOICES) { @Override public void createChoices() { createBinaryChoices(Container.CONTAIN_DESCS); } @Override public int appliesToClass(final Object o) { return (o instanceof Container) ? 1 : -1; } @Override public String defaultValue() { return "0"; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { if(!(I instanceof Container)) return ""; final Container C=(Container)I; final StringBuilder str=new StringBuilder(""); for(int i=1;i<Container.CONTAIN_DESCS.length;i++) { if(CMath.isSet(C.containTypes(), i-1)) { if(str.length()>0) str.append("|"); str.append(Container.CONTAIN_DESCS[i]); } } return str.toString(); } }, new AbilityParmEditorImpl("CONTAINER_TYPE_OR_LIDLOCK","Con.",ParmType.SPECIAL) { @Override public void createChoices() { super.choices = new PairVector<String,String>(); for(final String s : Container.CONTAIN_DESCS) choices().add(s.toUpperCase().trim(),s); choices().add("LID","Lid"); choices().add("LOCK","Lock"); } @Override public int appliesToClass(final Object o) { return (o instanceof Container) ? 1 : -1; } @Override public String defaultValue() { return ""; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { final StringBuilder str=new StringBuilder(""); if(I instanceof Container) { final Container C=(Container)I; if(C.hasALock()) str.append("LOCK"); if(str.length()>0) str.append("|"); if(C.hasADoor()) str.append("LID"); if(str.length()>0) str.append("|"); for(int i=1;i<Container.CONTAIN_DESCS.length;i++) { if(CMath.isSet(C.containTypes(), i-1)) { if(str.length()>0) str.append("|"); str.append(Container.CONTAIN_DESCS[i]); } } } return str.toString(); } @Override public String[] fakeUserInput(final String oldVal) { if(oldVal.trim().length()==0) return new String[]{"NULL"}; return CMParms.parseAny(oldVal,'|',true).toArray(new String[0]); } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final String webValue = httpReq.getUrlParameter(fieldName); if(webValue == null) return oldVal; String id=""; int index=0; final StringBuilder str=new StringBuilder(""); for(;httpReq.isUrlParameter(fieldName+id);id=""+(++index)) { final String newVal = httpReq.getUrlParameter(fieldName+id); if((newVal!=null)&&(newVal.length()>0)&&(choices().containsFirst(newVal))) str.append(newVal).append("|"); } return str.toString(); } @Override public String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { return CMLib.genEd().promptMultiSelectList(mob,oldVal,"|",++showNumber[0],showFlag,prompt(),choices(),false); } @Override public boolean confirmValue(final String oldVal) { final List<String> webVals=CMParms.parseAny(oldVal.toUpperCase().trim(), "|", true); for(final String s : webVals) { if(!choices().containsFirst(s)) return false; } return true; } @Override public String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final String webValue = webValue(httpReq,parms,oldVal,fieldName); final List<String> webVals=CMParms.parseAny(webValue.toUpperCase().trim(), "|", true); String onChange = null; onChange = " MULTIPLE "; if(!parms.containsKey("NOSELECT")) onChange+= "ONCHANGE=\"MultiSelect(this);\""; final StringBuilder str=new StringBuilder(""); str.append("\n\r<SELECT NAME="+fieldName+onChange+">"); for(int i=0;i<choices().size();i++) { final String option = (choices().get(i).first); str.append("<OPTION VALUE=\""+option+"\" "); if(webVals.contains(option)) str.append("SELECTED"); str.append(">"+(choices().get(i).second)); } return str.toString()+"</SELECT>"; } }, new AbilityParmEditorImpl("CODED_SPELL_LIST","Spell Affects",ParmType.SPECIAL) { @Override public void createChoices() { } @Override public int maxColWidth() { return 20; } @Override public boolean confirmValue(String oldVal) { if(oldVal.length()==0) return true; if(oldVal.charAt(0)=='*') oldVal = oldVal.substring(1); final int x=oldVal.indexOf('('); int y=oldVal.indexOf(';'); if((x<y)&&(x>0)) y=x; if(y<0) return CMClass.getAbility(oldVal)!=null; return CMClass.getAbility(oldVal.substring(0,y))!=null; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return CMLib.coffeeMaker().getCodedSpellsOrBehaviors(I); } @Override public String defaultValue() { return ""; } public String rebuild(final List<CMObject> spells) throws CMException { final StringBuffer newVal = new StringBuffer(""); if(spells.size()==1) { newVal.append("*" + spells.get(0).ID() + ";"); if(spells.get(0) instanceof Ability) newVal.append(((Ability)spells.get(0)).text()); else if(spells.get(0) instanceof Behavior) newVal.append(((Behavior)spells.get(0)).getParms()); } else { if(spells.size()>1) { for(int s=0;s<spells.size();s++) { final String txt; if(spells.get(s) instanceof Ability) txt=((Ability)spells.get(s)).text(); else if(spells.get(s) instanceof Behavior) txt=((Behavior)spells.get(s)).getParms(); else txt=""; if(txt.length()>0) { if((txt.indexOf(';')>=0) ||(CMClass.getAbility(txt.trim())!=null) ||(CMClass.getBehavior(txt.trim())!=null)) throw new CMException("You may not have more than one spell when one of the spells parameters is a spell id or a ; character."); } newVal.append(spells.get(s).ID()); if(txt.length()>0) newVal.append(";" + txt); if(s<(spells.size()-1)) newVal.append(";"); } } } return newVal.toString(); } @Override public String[] fakeUserInput(final String oldVal) { final Vector<String> V = new Vector<String>(); final Vector<String> V2 = new Vector<String>(); final List<CMObject> spells=CMLib.coffeeMaker().getCodedSpellsOrBehaviors(oldVal); for(int s=0;s<spells.size();s++) { final CMObject O = spells.get(s); V.addElement(O.ID()); V2.addElement(O.ID()); if(O instanceof Ability) V2.addElement(((Ability)O).text()); else if(O instanceof Behavior) V2.addElement(((Behavior)O).getParms()); else V2.add(""); } V.addAll(V2); V.addElement(""); return CMParms.toStringArray(V); } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { List<CMObject> spells=null; if(httpReq.isUrlParameter(fieldName+"_AFFECT1")) { spells = new Vector<CMObject>(); int num=1; String behav=httpReq.getUrlParameter(fieldName+"_AFFECT"+num); String theparm=httpReq.getUrlParameter(fieldName+"_ADATA"+num); while((behav!=null)&&(theparm!=null)) { if(behav.length()>0) { final Ability A=CMClass.getAbility(behav); if(A!=null) { if(theparm.trim().length()>0) A.setMiscText(theparm); spells.add(A); } else { final Behavior B=CMClass.getBehavior(behav); if(B!=null) { if(theparm.trim().length()>0) B.setParms(theparm); spells.add(B); } } } num++; behav=httpReq.getUrlParameter(fieldName+"_AFFECT"+num); theparm=httpReq.getUrlParameter(fieldName+"_ADATA"+num); } } else spells = CMLib.coffeeMaker().getCodedSpellsOrBehaviors(oldVal); try { return rebuild(spells); } catch(final Exception e) { return oldVal; } } @Override public String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final List<CMObject> spells=CMLib.coffeeMaker().getCodedSpellsOrBehaviors(webValue(httpReq,parms,oldVal,fieldName)); final StringBuffer str = new StringBuffer(""); str.append("<TABLE WIDTH=100% BORDER=\"1\" CELLSPACING=0 CELLPADDING=0>"); for(int i=0;i<spells.size();i++) { final CMObject A=spells.get(i); str.append("<TR><TD WIDTH=50%>"); str.append("\n\r<SELECT ONCHANGE=\"EditAffect(this);\" NAME="+fieldName+"_AFFECT"+(i+1)+">"); str.append("<OPTION VALUE=\"\">Delete!"); str.append("<OPTION VALUE=\""+A.ID()+"\" SELECTED>"+A.ID()); str.append("</SELECT>"); str.append("</TD><TD WIDTH=50%>"); final String parmstr=(A instanceof Ability)?((Ability)A).text():((Behavior)A).getParms(); final String theparm=CMStrings.replaceAll(parmstr,"\"","&quot;"); str.append("\n\r<INPUT TYPE=TEXT SIZE=30 NAME="+fieldName+"_ADATA"+(i+1)+" VALUE=\""+theparm+"\">"); str.append("</TD></TR>"); } str.append("<TR><TD WIDTH=50%>"); str.append("\n\r<SELECT ONCHANGE=\"AddAffect(this);\" NAME="+fieldName+"_AFFECT"+(spells.size()+1)+">"); str.append("<OPTION SELECTED VALUE=\"\">Select an Effect/Behav"); for(final Enumeration<Ability> a=CMClass.abilities();a.hasMoreElements();) { final Ability A=a.nextElement(); if((A.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_ARCHON) continue; final String cnam=A.ID(); str.append("<OPTION VALUE=\""+cnam+"\">"+cnam); } for(final Enumeration<Behavior> b=CMClass.behaviors();b.hasMoreElements();) { final Behavior B=b.nextElement(); final String cnam=B.ID(); str.append("<OPTION VALUE=\""+cnam+"\">"+cnam); } str.append("</SELECT>"); str.append("</TD><TD WIDTH=50%>"); str.append("\n\r<INPUT TYPE=TEXT SIZE=30 NAME="+fieldName+"_ADATA"+(spells.size()+1)+" VALUE=\"\">"); str.append("</TD></TR>"); str.append("</TABLE>"); return str.toString(); } @Override public String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { final List<CMObject> spells=CMLib.coffeeMaker().getCodedSpellsOrBehaviors(oldVal); final StringBuffer rawCheck = new StringBuffer(""); for(int s=0;s<spells.size();s++) { rawCheck.append(spells.get(s).ID()).append(";"); if(spells.get(s) instanceof Ability) rawCheck.append(((Ability)spells.get(s)).text()).append(";"); else if(spells.get(s) instanceof Behavior) rawCheck.append(((Behavior)spells.get(s)).getParms()).append(";"); } boolean okToProceed = true; ++showNumber[0]; String newVal = null; while(okToProceed) { okToProceed = false; CMLib.genEd().spellsOrBehavs(mob,spells,showNumber[0],showFlag,true); final StringBuffer sameCheck = new StringBuffer(""); for(int s=0;s<spells.size();s++) { sameCheck.append(spells.get(s).ID()).append(';'); if(spells.get(s) instanceof Ability) sameCheck.append(((Ability)spells.get(s)).text()).append(";"); else if(spells.get(s) instanceof Behavior) sameCheck.append(((Behavior)spells.get(s)).getParms()).append(";"); } if(sameCheck.toString().equals(rawCheck.toString())) return oldVal; try { newVal = rebuild(spells); } catch(final CMException e) { mob.tell(e.getMessage()); okToProceed = true; break; } } return (newVal==null)?oldVal:newVal.toString(); } }, new AbilityParmEditorImpl("BUILDING_FLAGS","Flags",ParmType.SPECIAL) { @Override public void createChoices() { } @Override public boolean confirmValue(final String oldVal) { if(oldVal.trim().length()==0) return true; final Pair<String[],String[]> codesFlags = CMAbleParms.getBuildingCodesNFlags(); final String[] names = CMParms.parseSpaces(oldVal, true).toArray(new String[0]); for(final String name : names) { if(!CMParms.containsIgnoreCase(codesFlags.second, name)) return false; } return true; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public String defaultValue() { return ""; } @Override public String[] fakeUserInput(final String oldVal) { return CMParms.parseSpaces(oldVal, true).toArray(new String[0]); } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final String webValue = httpReq.getUrlParameter(fieldName); if(webValue == null) return oldVal; final StringBuilder s=new StringBuilder(""); String id=""; int index=0; final Pair<String[],String[]> codesFlags = CMAbleParms.getBuildingCodesNFlags(); for(;httpReq.isUrlParameter(fieldName+id);id=""+(++index)) { final String newVal = httpReq.getUrlParameter(fieldName+id); if(CMParms.containsIgnoreCase(codesFlags.second, newVal.toUpperCase().trim())) s.append(" ").append(newVal.toUpperCase().trim()); } return s.toString().trim(); } @Override public String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final StringBuffer str = new StringBuffer(""); final String webValue = webValue(httpReq,parms,oldVal,fieldName); String onChange = null; onChange = " MULTIPLE "; if(!parms.containsKey("NOSELECT")) onChange+= "ONCHANGE=\"MultiSelect(this);\""; final Pair<String[],String[]> codesFlags = CMAbleParms.getBuildingCodesNFlags(); final String[] fakeValues = this.fakeUserInput(webValue); str.append("\n\r<SELECT NAME="+fieldName+onChange+">"); for(int i=0;i<codesFlags.second.length;i++) { final String option = (codesFlags.second[i]); str.append("<OPTION VALUE=\""+option+"\" "); if(CMParms.containsIgnoreCase(fakeValues, option)) str.append("SELECTED"); str.append(">"+option); } return str.toString()+"</SELECT>"; } @Override public String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { final Pair<String[],String[]> codesFlags = CMAbleParms.getBuildingCodesNFlags(); final String help=CMParms.combineWith(Arrays.asList(codesFlags.second), ','); final String newVal = CMLib.genEd().prompt(mob, oldVal, ++showNumber[0], showFlag, L("Flags"), true, help); String[] newVals; if(newVal.indexOf(',')>0) newVals = CMParms.parseCommas(newVal.toUpperCase().trim(), true).toArray(new String[0]); else if(newVal.indexOf(';')>0) newVals = CMParms.parseSemicolons(newVal.toUpperCase().trim(), true).toArray(new String[0]); else newVals = CMParms.parse(newVal.toUpperCase().trim()).toArray(new String[0]); final StringBuilder finalVal = new StringBuilder(""); for(int i=0;i<newVals.length;i++) { if(CMParms.containsIgnoreCase(codesFlags.second, newVals[i])) finalVal.append(" ").append(newVals[i]); } return finalVal.toString().toUpperCase().trim(); } }, new AbilityParmEditorImpl("EXIT_NAMES","Exit Words",ParmType.SPECIAL) { @Override public void createChoices() { } @Override public int appliesToClass(final Object o) { if(o instanceof String) { final String chk=((String)o).toUpperCase(); if(chk.equalsIgnoreCase("DOOR")) return 1; } return -1; } @Override public boolean confirmValue(final String oldVal) { if(oldVal.trim().length()==0) return true; final String[] names = CMParms.parseAny(oldVal.trim(), '|', true).toArray(new String[0]); if(names.length > 6) return false; return true; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public String defaultValue() { return "door|open|close|A closed door.|An open doorway.|"; } @Override public String[] fakeUserInput(final String oldVal) { final Vector<String> V = new Vector<String>(); V.addAll(CMParms.parseAny(oldVal.trim(), '|', true)); while(V.size()<6) V.add(""); return CMParms.toStringArray(V); } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { if(httpReq.isUrlParameter(fieldName+"_W1")) { final StringBuilder str=new StringBuilder(""); str.append(httpReq.getUrlParameter(fieldName+"_W1")).append("|"); str.append(httpReq.getUrlParameter(fieldName+"_W2")).append("|"); str.append(httpReq.getUrlParameter(fieldName+"_W3")).append("|"); str.append(httpReq.getUrlParameter(fieldName+"_W4")).append("|"); str.append(httpReq.getUrlParameter(fieldName+"_W5")).append("|"); str.append(httpReq.getUrlParameter(fieldName+"_W6")); String s=str.toString(); while(s.endsWith("|")) s=s.substring(0,s.length()-1); return s; } else { return oldVal; } } @Override public String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final StringBuffer str = new StringBuffer(""); str.append("<TABLE WIDTH=100% BORDER=\"1\" CELLSPACING=0 CELLPADDING=0>"); final String[] vals = this.fakeUserInput(oldVal); final String[] keys = new String[]{"Noun","Open","Close","Closed Display","Open Display","Description"}; for(int i=0;i<keys.length;i++) { str.append("<TR><TD WIDTH=30%><FONT COLOR=WHITE>"+L(keys[i])+"</FONT></TD>"); str.append("<TD><INPUT TYPE=TEXT SIZE=30 NAME="+fieldName+"_W"+(i+1)+" VALUE=\""+vals[i]+"\">"); str.append("</TD></TR>"); } str.append("</TABLE>"); return str.toString(); } @Override public String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { final String[] vals = this.fakeUserInput(oldVal); final StringBuilder newVal = new StringBuilder(""); newVal.append(CMLib.genEd().prompt(mob, vals[0], ++showNumber[0], showFlag, L("Exit Noun"), true)).append("|"); newVal.append(CMLib.genEd().prompt(mob, vals[1], ++showNumber[0], showFlag, L("Open Verb"), true)).append("|"); newVal.append(CMLib.genEd().prompt(mob, vals[2], ++showNumber[0], showFlag, L("Close Verb"), true)).append("|"); newVal.append(CMLib.genEd().prompt(mob, vals[3], ++showNumber[0], showFlag, L("Opened Text"), true)).append("|"); newVal.append(CMLib.genEd().prompt(mob, vals[4], ++showNumber[0], showFlag, L("Closed Text"), true)).append("|"); newVal.append(CMLib.genEd().prompt(mob, vals[5], ++showNumber[0], showFlag, L("Description"), true)); String s=newVal.toString(); while(s.endsWith("|")) s=s.substring(0,s.length()-1); return s; } }, new AbilityParmEditorImpl("PCODED_SPELL_LIST","Spell Affects",ParmType.SPECIAL) { @Override public void createChoices() { } @Override public int maxColWidth() { return 20; } @Override public int appliesToClass(final Object o) { if(o instanceof String) { final String chk=((String)o).toUpperCase(); if(chk.equalsIgnoreCase("WALL") ||chk.equalsIgnoreCase("DEMOLISH") ||chk.equalsIgnoreCase("TITLE") ||chk.equalsIgnoreCase("DESC")) return -1; final Pair<String[],String[]> codeFlags = CMAbleParms.getBuildingCodesNFlags(); if(CMParms.contains(codeFlags.first, chk)) return 1; } return -1; } @Override public boolean confirmValue(final String oldVal) { if(oldVal.trim().length()==0) return true; final String[] spells = CMParms.parseAny(oldVal.trim(), ')', true).toArray(new String[0]); for(String spell : spells) { final int x=spell.indexOf('('); if(x>0) spell=spell.substring(0,x); if(spell.trim().length()==0) continue; if((CMClass.getAbility(spell)==null)&&(CMClass.getBehavior(spell)==null)) return false; } return true; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public String defaultValue() { return ""; } public String rebuild(final List<CMObject> spells) throws CMException { final StringBuffer newVal = new StringBuffer(""); for(int s=0;s<spells.size();s++) { final String txt; if(spells.get(s) instanceof Ability) txt = ((Ability)spells.get(s)).text().trim(); else if(spells.get(s) instanceof Behavior) txt = ((Behavior)spells.get(s)).getParms().trim(); else continue; newVal.append(spells.get(s).ID()).append("(").append(txt).append(")"); } return newVal.toString(); } @Override public String[] fakeUserInput(final String oldVal) { final Vector<String> V = new Vector<String>(); final String[] spells = CMParms.parseAny(oldVal.trim(), ')', true).toArray(new String[0]); for(String spell : spells) { final int x=spell.indexOf('('); String parms=""; if(x>0) { parms=spell.substring(x+1).trim(); spell=spell.substring(0,x); } if(spell.trim().length()==0) continue; if((CMClass.getAbility(spell)!=null) ||(CMClass.getBehavior(spell)!=null)) { V.add(spell); V.add(parms); } } return CMParms.toStringArray(V); } public List<CMObject> getCodedSpells(final String oldVal) { final String[] spellStrs = this.fakeUserInput(oldVal); final List<CMObject> spells=new ArrayList<CMObject>(spellStrs.length/2); for(int s=0;s<spellStrs.length;s+=2) { final Ability A=CMClass.getAbility(spellStrs[s]); if(A!=null) { if(spellStrs[s+1].length()>0) A.setMiscText(spellStrs[s+1]); spells.add(A); } else { final Behavior B=CMClass.getBehavior(spellStrs[s]); if(spellStrs[s+1].length()>0) B.setParms(spellStrs[s+1]); spells.add(B); } } return spells; } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { List<CMObject> spells=null; if(httpReq.isUrlParameter(fieldName+"_AFFECT1")) { spells = new Vector<CMObject>(); int num=1; String behav=httpReq.getUrlParameter(fieldName+"_AFFECT"+num); String theparm=httpReq.getUrlParameter(fieldName+"_ADATA"+num); while((behav!=null)&&(theparm!=null)) { if(behav.length()>0) { final Ability A=CMClass.getAbility(behav); if(A!=null) { if(theparm.trim().length()>0) A.setMiscText(theparm); spells.add(A); } else { final Behavior B=CMClass.getBehavior(behav); if(theparm.trim().length()>0) B.setParms(theparm); spells.add(B); } } num++; behav=httpReq.getUrlParameter(fieldName+"_AFFECT"+num); theparm=httpReq.getUrlParameter(fieldName+"_ADATA"+num); } } else { spells = getCodedSpells(oldVal); } try { return rebuild(spells); } catch(final Exception e) { return oldVal; } } @Override public String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final List<CMObject> spells=getCodedSpells(webValue(httpReq,parms,oldVal,fieldName)); final StringBuffer str = new StringBuffer(""); str.append("<TABLE WIDTH=100% BORDER=\"1\" CELLSPACING=0 CELLPADDING=0>"); for(int i=0;i<spells.size();i++) { final CMObject A=spells.get(i); str.append("<TR><TD WIDTH=50%>"); str.append("\n\r<SELECT ONCHANGE=\"EditAffect(this);\" NAME="+fieldName+"_AFFECT"+(i+1)+">"); str.append("<OPTION VALUE=\"\">Delete!"); str.append("<OPTION VALUE=\""+A.ID()+"\" SELECTED>"+A.ID()); str.append("</SELECT>"); str.append("</TD><TD WIDTH=50%>"); final String theparm; if(A instanceof Ability) theparm=CMStrings.replaceAll(((Ability)A).text(),"\"","&quot;"); else if(A instanceof Behavior) theparm=CMStrings.replaceAll(((Behavior)A).getParms(),"\"","&quot;"); else continue; str.append("\n\r<INPUT TYPE=TEXT SIZE=30 NAME="+fieldName+"_ADATA"+(i+1)+" VALUE=\""+theparm+"\">"); str.append("</TD></TR>"); } str.append("<TR><TD WIDTH=50%>"); str.append("\n\r<SELECT ONCHANGE=\"AddAffect(this);\" NAME="+fieldName+"_AFFECT"+(spells.size()+1)+">"); str.append("<OPTION SELECTED VALUE=\"\">Select Effect/Behavior"); for(final Enumeration<Ability> a=CMClass.abilities();a.hasMoreElements();) { final Ability A=a.nextElement(); if((A.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_ARCHON) continue; final String cnam=A.ID(); str.append("<OPTION VALUE=\""+cnam+"\">"+cnam); } for(final Enumeration<Behavior> a=CMClass.behaviors();a.hasMoreElements();) { final Behavior A=a.nextElement(); final String cnam=A.ID(); str.append("<OPTION VALUE=\""+cnam+"\">"+cnam); } str.append("</SELECT>"); str.append("</TD><TD WIDTH=50%>"); str.append("\n\r<INPUT TYPE=TEXT SIZE=30 NAME="+fieldName+"_ADATA"+(spells.size()+1)+" VALUE=\"\">"); str.append("</TD></TR>"); str.append("</TABLE>"); return str.toString(); } @Override public String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { final List<CMObject> spells=getCodedSpells(oldVal); final StringBuffer rawCheck = new StringBuffer(""); for(int s=0;s<spells.size();s++) { rawCheck.append(spells.get(s).ID()).append(";"); if(spells.get(s) instanceof Ability) rawCheck.append(((Ability)spells.get(s)).text()).append(";"); else if(spells.get(s) instanceof Behavior) rawCheck.append(((Behavior)spells.get(s)).getParms()).append(";"); else rawCheck.append(";"); } boolean okToProceed = true; ++showNumber[0]; String newVal = null; while(okToProceed) { okToProceed = false; CMLib.genEd().spellsOrBehaviors(mob,spells,showNumber[0],showFlag,true); final StringBuffer sameCheck = new StringBuffer(""); for(int s=0;s<spells.size();s++) { if(spells.get(s) instanceof Ability) rawCheck.append(((Ability)spells.get(s)).text()).append(";"); else if(spells.get(s) instanceof Behavior) rawCheck.append(((Behavior)spells.get(s)).getParms()).append(";"); else rawCheck.append(";"); } if(sameCheck.toString().equals(rawCheck.toString())) return oldVal; try { newVal = rebuild(spells); } catch(final CMException e) { mob.tell(e.getMessage()); okToProceed = true; break; } } return (newVal==null)?oldVal:newVal.toString(); } }, new AbilityParmEditorImpl("ABILITY_ID","Ability ID",ParmType.SPECIAL) { @Override public void createChoices() { } @Override public int maxColWidth() { return 20; } @Override public int appliesToClass(final Object o) { return 1; } @Override public boolean confirmValue(final String oldVal) { if(oldVal.trim().length()==0) return false; final Ability A=CMClass.getAbility(oldVal); return (A instanceof Trap); } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public String defaultValue() { return ""; } @Override public String[] fakeUserInput(final String oldVal) { if(confirmValue(oldVal)) return new String[] {oldVal}; return new String[] {defaultValue()}; } @Override public String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { if(confirmValue(httpReq.getUrlParameter(fieldName))) return httpReq.getUrlParameter(fieldName); return oldVal; } @Override public String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName) { final StringBuffer str = new StringBuffer(""); final String val = webValue(httpReq,parms,oldVal,fieldName); str.append("\n\r<SELECT NAME="+fieldName+">"); str.append("<OPTION SELECTED VALUE=\"\">Select Effect/Behavior"); for(final Enumeration<Ability> a=CMClass.abilities();a.hasMoreElements();) { final Ability A=a.nextElement(); if(((A.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_TRAP) &&(A instanceof Trap) &&(((Trap)A).maySetTrap(null, Integer.MAX_VALUE))) { str.append("<OPTION VALUE=\""+A.ID()+"\""); if(A.ID().equalsIgnoreCase(val)) str.append(" SELECTED"); str.append(">"+A.ID()); } } str.append("</SELECT>"); return str.toString(); } @Override public String commandLinePrompt(final MOB mob, String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException { ++showNumber[0]; if((showFlag>0)&&(showFlag!=showNumber[0])) return oldVal; String behave="NO"; while((mob.session()!=null)&&(!mob.session().isStopped())&&(behave.length()>0)) { mob.tell(L("@x1. Trap ID: '@x2'.",""+showNumber,oldVal)); if((showFlag!=showNumber[0])&&(showFlag>-999)) return oldVal; behave=mob.session().prompt(L("Enter trap ability ID (?):"),""); if(behave.length()>0) { if(behave.equalsIgnoreCase("?")) { mob.tell(CMLib.lister().build3ColTable(mob,CMClass.abilities(new Filterer<Ability>() { @Override public boolean passesFilter(final Ability obj) { if(((obj.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_TRAP) &&(obj instanceof Trap) &&(((Trap)obj).maySetTrap(null, Integer.MAX_VALUE))) return true; return false; } })).toString()); } else { Ability chosenOne=CMClass.getAbility(behave); if((chosenOne instanceof Ability) &&((chosenOne.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_ARCHON) &&(!CMSecurity.isASysOp(mob))) chosenOne=null; if((chosenOne!=null) &&((chosenOne.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_TRAP) &&(chosenOne instanceof Trap)) { oldVal = chosenOne.ID(); behave=""; } else mob.tell(L("'@x1' is not a recognized trap. Try '?'.",behave)); } } else mob.tell(L("(no change)")); } return oldVal; } }, new AbilityParmEditorImpl("TRIGGER_MSG","Trigger Msg",ParmType.STRINGORNULL) { @Override public String defaultValue() { return ""; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public void createChoices() { } }, new AbilityParmEditorImpl("DAMAGE_MSG","Damage Msg",ParmType.STRINGORNULL) { @Override public String defaultValue() { return ""; } @Override public String convertFromItem(final ItemCraftor A, final Item I) { return ""; } @Override public void createChoices() { } }, new AbilityParmEditorImpl("AVOID_MSG","Avoid Msg",ParmType.STRINGORNULL) { @Override public String
{'commit': 'diff --git a/com/planet_ink/coffee_mud/Abilities/Common/Cooking.java b/com/planet_ink/coffee_mud/Abilities/Common/Cooking.java\nindex 4c03128626..6f8f28cd7a 100644\n--- a/com/planet_ink/coffee_mud/Abilities/Common/Cooking.java\n+++ b/com/planet_ink/coffee_mud/Abilities/Common/Cooking.java\n@@ -1055,7 +1055,7 @@ public class Cooking extends EnhancedCraftingSkill implements ItemCraftor\n \t\t\t\tbuildingI.basePhyStats().setLevel(CMath.s_int(finalRecipe.get(RCP_LEVEL)));\r\n \t\t\t\tbuildingI.phyStats().setLevel(buildingI.basePhyStats().level());\r\n \t\t\t}\r\n-\t\t\tint duration=getDuration(mob, 1);\r\n+\t\t\tfinal int duration=getDuration(mob, 1);\r\n \t\t\tcrafted.add(new CraftedItem(buildingI,null,duration));\r\n \t\t\treturn true;\r\n \t\t}\r\ndiff --git a/com/planet_ink/coffee_mud/Libraries/CMAbleParms.java b/com/planet_ink/coffee_mud/Libraries/CMAbleParms.java\nindex 8f2a682fe7..b3c29c627a 100644\n--- a/com/planet_ink/coffee_mud/Libraries/CMAbleParms.java\n+++ b/com/planet_ink/coffee_mud/Libraries/CMAbleParms.java\n@@ -408,10 +408,10 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\tDVector dataRow = new DVector(2);\r\n \t\tList<String> currCol = null;\r\n \t\tString lastDiv = null;\r\n-\t\t\r\n+\r\n \t\t// detect item xml, and to special line parse\r\n \t\t{\r\n-\t\t\tint openTagDex=str.indexOf("<");\r\n+\t\t\tfinal int openTagDex=str.indexOf("<");\r\n \t\t\tif((openTagDex>=0)\r\n \t\t\t&&(str.substring(0,openTagDex).trim().length()==0)\r\n \t\t\t&&(columnsV.size()==1))\r\n@@ -424,11 +424,11 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\tstr.setLength(0);\r\n \t\t\t\t\txml = xml.substring(7,xml.length()-8).trim();\r\n \t\t\t\t\tuxml = uxml.substring(7,uxml.length()-8).trim();\r\n-\t\t\t\t\t\r\n+\r\n \t\t\t\t\twhile(uxml.startsWith("<ITEM>"))\r\n \t\t\t\t\t{\r\n-\t\t\t\t\t\tint closeTagDex=uxml.indexOf("</ITEM>");\r\n-\t\t\t\t\t\tString itemRow = xml.substring(0,closeTagDex+7);\r\n+\t\t\t\t\t\tfinal int closeTagDex=uxml.indexOf("</ITEM>");\r\n+\t\t\t\t\t\tfinal String itemRow = xml.substring(0,closeTagDex+7);\r\n \t\t\t\t\t\tuxml=uxml.substring(closeTagDex+7).trim();\r\n \t\t\t\t\t\txml=xml.substring(closeTagDex+7).trim();\r\n \t\t\t\t\t\tdataRow.addElement(currCol,itemRow);\r\n@@ -4060,7 +4060,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t@Override\r\n \t\t\t\tpublic void createChoices()\r\n \t\t\t\t{\r\n-\t\t\t\t\tcreateChoices(new String[] { "", "FOOD", "DRINK", "SOAP", "GenPerfume" });\r\n+\t\t\t\t\tcreateChoices(new String[] { "", "FOOD", "DRINK", "SOAP", "GenPerfume","GenPowder","GenCigar","GenFoodResource"});\r\n \t\t\t\t}\r\n \r\n \t\t\t\t@Override\r\n@@ -4076,9 +4076,17 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\tif(str.startsWith("SOAP ") || str.endsWith(" SOAP") || (str.indexOf("SOAP")>0))\r\n \t\t\t\t\t\treturn "SOAP";\r\n \t\t\t\t\tif(I instanceof Perfume)\r\n-\t\t\t\t\t\treturn "PERFUME";\r\n+\t\t\t\t\t\treturn "GenPerfume";\r\n+\t\t\t\t\tif(I instanceof MagicDust)\r\n+\t\t\t\t\t\treturn "GenPowder";\r\n+\t\t\t\t\tif((I instanceof Container)&&(I instanceof Light))\r\n+\t\t\t\t\t\treturn "GenCigar";\r\n+\t\t\t\t\tif((I instanceof Food)&&(I instanceof RawMaterial))\r\n+\t\t\t\t\t\treturn "GenFoodResource";\r\n \t\t\t\t\tif(I instanceof Food)\r\n \t\t\t\t\t\treturn "FOOD";\r\n+\t\t\t\t\tif((I instanceof Drink)&&(I instanceof RawMaterial))\r\n+\t\t\t\t\t\treturn "GenLiquidResource";\r\n \t\t\t\t\tif(I instanceof Drink)\r\n \t\t\t\t\t\treturn "DRINK";\r\n \t\t\t\t\treturn "";\r\n@@ -5258,7 +5266,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\t}\r\n \t\t\t\t\treturn oldVal;\r\n \t\t\t\t}\r\n-\t\t\t\t\r\n+\r\n \t\t\t\t@Override\r\n \t\t\t\tpublic String defaultValue()\r\n \t\t\t\t{\r\n@@ -5272,13 +5280,13 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\t\treturn defaultValue();\r\n \t\t\t\t\treturn CMLib.coffeeMaker().getItemXML(I);\r\n \t\t\t\t}\r\n-\t\t\t\t\r\n+\r\n \t\t\t\t@Override\r\n \t\t\t\tpublic String prompt()\r\n \t\t\t\t{\r\n \t\t\t\t\treturn "Item";\r\n \t\t\t\t}\r\n-\t\t\t\t\r\n+\r\n \t\t\t\t@Override\r\n \t\t\t\tpublic boolean confirmValue(final String oldVal)\r\n \t\t\t\t{\r\n@@ -5289,8 +5297,8 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t@Override\r\n \t\t\t\tpublic String webTableField(final HTTPRequest httpReq, final java.util.Map<String, String> parms, final String oldVal)\r\n \t\t\t\t{\r\n-\t\t\t\t\tString val=oldVal;\r\n-\t\t\t\t\t\r\n+\t\t\t\t\tfinal String val=oldVal;\r\n+\r\n \t\t\t\t\tif((val != null)\r\n \t\t\t\t\t&&(val.length()>0)\r\n \t\t\t\t\t&&(val.trim().startsWith("<")))\r\n@@ -5348,7 +5356,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\t\t\t\treturn CMLib.coffeeMaker().getItemXML(I);\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t\tString rowNum=fieldName.substring(5);\r\n-\t\t\t\t\t\tint x=rowNum.indexOf(\'_\');\r\n+\t\t\t\t\t\tfinal int x=rowNum.indexOf(\'_\');\r\n \t\t\t\t\t\tif(x>0)\r\n \t\t\t\t\t\t\trowNum=rowNum.substring(0,x);\r\n \t\t\t\t\t\tItem I=null;\r\n@@ -5379,7 +5387,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\t\t\treturn data.toString();\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t}\r\n-\t\t\t\t\t\r\n+\r\n \t\t\t\t\tLog.debugOut("AbilityEditor:ITEM_CMARE:webValue: "+fieldName+": "+oldVal);\r\n \t\t\t\t\treturn oldVal;\r\n \t\t\t\t}\r\n@@ -5439,7 +5447,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\t\tI=CMClass.getItem(oldVal);\r\n \t\t\t\t\twhile(!mob.session().isStopped())\r\n \t\t\t\t\t{\r\n-\t\t\t\t\t\tString showVal = (I==null)?"None?!":(I.Name()+" ("+I.ID()+")");\r\n+\t\t\t\t\t\tfinal String showVal = (I==null)?"None?!":(I.Name()+" ("+I.ID()+")");\r\n \t\t\t\t\t\tstr=CMLib.genEd().prompt(mob,showVal,showNumber[0],showFlag,prompt(),true,"").trim();\r\n \t\t\t\t\t\tif(str.equals(oldVal)||(str.equals(showVal))||(str.trim().length()==0))\r\n \t\t\t\t\t\t\treturn oldVal;\r\n@@ -5660,7 +5668,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t{\r\n \t\t\treturn prompt;\r\n \t\t}\r\n-\t\t\r\n+\r\n \t\t@Override\r\n \t\tpublic String colHeader()\r\n \t\t{\r\n@@ -5910,7 +5918,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t{\r\n \t\t\treturn oldVal;\r\n \t\t}\r\n-\t\t\r\n+\r\n \t\t@Override\r\n \t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\r\n \t\t{\r\n', 'commit_subject': 'Cooking derivatives support more things now.', 'repo_name': 'bozimmerman/CoffeeMud', 'committer': {'name': 'bozimmerman', 'email': 'dc45fe023482b3b890b5e574e53c1d051f45b1ef@zimmers.net', 'time_sec': '1657069225', 'tz_offset': '0', 'date': {'seconds': '1657069225'}}, 'commit_tree': '39a8d07a22b7f7cfac93d4b674bf3210d1f2e71c', 'commit_message': 'Cooking derivatives support more things now.\n\ngit-svn-id: 0cdf8356e41b2d8ccbb41bb76c82068fe80b2514@21531 0d6f1817-ed0e-0410-87c9-987e46238f29\n', 'language_name': 'HTML', 'license': 'apache-2.0', 'hunks': '@@ -408,10 +408,10 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\tDVector dataRow = new DVector(2);\r\n \t\tList<String> currCol = null;\r\n \t\tString lastDiv = null;\r\n-\t\t\r\n+\r\n \t\t// detect item xml, and to special line parse\r\n \t\t{\r\n-\t\t\tint openTagDex=str.indexOf("<");\r\n+\t\t\tfinal int openTagDex=str.indexOf("<");\r\n \t\t\tif((openTagDex>=0)\r\n \t\t\t&&(str.substring(0,openTagDex).trim().length()==0)\r\n \t\t\t&&(columnsV.size()==1))\r\n@@ -424,11 +424,11 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\tstr.setLength(0);\r\n \t\t\t\t\txml = xml.substring(7,xml.length()-8).trim();\r\n \t\t\t\t\tuxml = uxml.substring(7,uxml.length()-8).trim();\r\n-\t\t\t\t\t\r\n+\r\n \t\t\t\t\twhile(uxml.startsWith("<ITEM>"))\r\n \t\t\t\t\t{\r\n-\t\t\t\t\t\tint closeTagDex=uxml.indexOf("</ITEM>");\r\n-\t\t\t\t\t\tString itemRow = xml.substring(0,closeTagDex+7);\r\n+\t\t\t\t\t\tfinal int closeTagDex=uxml.indexOf("</ITEM>");\r\n+\t\t\t\t\t\tfinal String itemRow = xml.substring(0,closeTagDex+7);\r\n \t\t\t\t\t\tuxml=uxml.substring(closeTagDex+7).trim();\r\n \t\t\t\t\t\txml=xml.substring(closeTagDex+7).trim();\r\n \t\t\t\t\t\tdataRow.addElement(currCol,itemRow);\r\n@@ -4060,7 +4060,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t@Override\r\n \t\t\t\tpublic void createChoices()\r\n \t\t\t\t{\r\n-\t\t\t\t\tcreateChoices(new String[] { "", "FOOD", "DRINK", "SOAP", "GenPerfume" });\r\n+\t\t\t\t\tcreateChoices(new String[] { "", "FOOD", "DRINK", "SOAP", "GenPerfume","GenPowder","GenCigar","GenFoodResource"});\r\n \t\t\t\t}\r\n \r\n \t\t\t\t@Override\r\n@@ -4076,9 +4076,17 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\tif(str.startsWith("SOAP ") || str.endsWith(" SOAP") || (str.indexOf("SOAP")>0))\r\n \t\t\t\t\t\treturn "SOAP";\r\n \t\t\t\t\tif(I instanceof Perfume)\r\n-\t\t\t\t\t\treturn "PERFUME";\r\n+\t\t\t\t\t\treturn "GenPerfume";\r\n+\t\t\t\t\tif(I instanceof MagicDust)\r\n+\t\t\t\t\t\treturn "GenPowder";\r\n+\t\t\t\t\tif((I instanceof Container)&&(I instanceof Light))\r\n+\t\t\t\t\t\treturn "GenCigar";\r\n+\t\t\t\t\tif((I instanceof Food)&&(I instanceof RawMaterial))\r\n+\t\t\t\t\t\treturn "GenFoodResource";\r\n \t\t\t\t\tif(I instanceof Food)\r\n \t\t\t\t\t\treturn "FOOD";\r\n+\t\t\t\t\tif((I instanceof Drink)&&(I instanceof RawMaterial))\r\n+\t\t\t\t\t\treturn "GenLiquidResource";\r\n \t\t\t\t\tif(I instanceof Drink)\r\n \t\t\t\t\t\treturn "DRINK";\r\n \t\t\t\t\treturn "";\r\n@@ -5258,7 +5266,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\t}\r\n \t\t\t\t\treturn oldVal;\r\n \t\t\t\t}\r\n-\t\t\t\t\r\n+\r\n \t\t\t\t@Override\r\n \t\t\t\tpublic String defaultValue()\r\n \t\t\t\t{\r\n@@ -5272,13 +5280,13 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\t\treturn defaultValue();\r\n \t\t\t\t\treturn CMLib.coffeeMaker().getItemXML(I);\r\n \t\t\t\t}\r\n-\t\t\t\t\r\n+\r\n \t\t\t\t@Override\r\n \t\t\t\tpublic String prompt()\r\n \t\t\t\t{\r\n \t\t\t\t\treturn "Item";\r\n \t\t\t\t}\r\n-\t\t\t\t\r\n+\r\n \t\t\t\t@Override\r\n \t\t\t\tpublic boolean confirmValue(final String oldVal)\r\n \t\t\t\t{\r\n@@ -5289,8 +5297,8 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t@Override\r\n \t\t\t\tpublic String webTableField(final HTTPRequest httpReq, final java.util.Map<String, String> parms, final String oldVal)\r\n \t\t\t\t{\r\n-\t\t\t\t\tString val=oldVal;\r\n-\t\t\t\t\t\r\n+\t\t\t\t\tfinal String val=oldVal;\r\n+\r\n \t\t\t\t\tif((val != null)\r\n \t\t\t\t\t&&(val.length()>0)\r\n \t\t\t\t\t&&(val.trim().startsWith("<")))\r\n@@ -5348,7 +5356,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\t\t\t\treturn CMLib.coffeeMaker().getItemXML(I);\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t\tString rowNum=fieldName.substring(5);\r\n-\t\t\t\t\t\tint x=rowNum.indexOf(\'_\');\r\n+\t\t\t\t\t\tfinal int x=rowNum.indexOf(\'_\');\r\n \t\t\t\t\t\tif(x>0)\r\n \t\t\t\t\t\t\trowNum=rowNum.substring(0,x);\r\n \t\t\t\t\t\tItem I=null;\r\n@@ -5379,7 +5387,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\t\t\treturn data.toString();\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t}\r\n-\t\t\t\t\t\r\n+\r\n \t\t\t\t\tLog.debugOut("AbilityEditor:ITEM_CMARE:webValue: "+fieldName+": "+oldVal);\r\n \t\t\t\t\treturn oldVal;\r\n \t\t\t\t}\r\n@@ -5439,7 +5447,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t\t\t\t\tI=CMClass.getItem(oldVal);\r\n \t\t\t\t\twhile(!mob.session().isStopped())\r\n \t\t\t\t\t{\r\n-\t\t\t\t\t\tString showVal = (I==null)?"None?!":(I.Name()+" ("+I.ID()+")");\r\n+\t\t\t\t\t\tfinal String showVal = (I==null)?"None?!":(I.Name()+" ("+I.ID()+")");\r\n \t\t\t\t\t\tstr=CMLib.genEd().prompt(mob,showVal,showNumber[0],showFlag,prompt(),true,"").trim();\r\n \t\t\t\t\t\tif(str.equals(oldVal)||(str.equals(showVal))||(str.trim().length()==0))\r\n \t\t\t\t\t\t\treturn oldVal;\r\n@@ -5660,7 +5668,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t{\r\n \t\t\treturn prompt;\r\n \t\t}\r\n-\t\t\r\n+\r\n \t\t@Override\r\n \t\tpublic String colHeader()\r\n \t\t{\r\n@@ -5910,7 +5918,7 @@ public class CMAbleParms extends StdLibrary implements AbilityParameters\n \t\t{\r\n \t\t\treturn oldVal;\r\n \t\t}\r\n-\t\t\r\n+\r\n \t\t@Override\r\n \t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\r\n \t\t{\r\n', 'addition_count': 25, 'deletion_count': 17, 'src_file': 'a/com/planet_ink/coffee_mud/Libraries/CMAbleParms.java', 'tgt_file': 'b/com/planet_ink/coffee_mud/Libraries/CMAbleParms.java', 'file_extension': '.java', 'before_file': 'package com.planet_ink.coffee_mud.Libraries;\n\nimport com.planet_ink.coffee_web.interfaces.*;\nimport com.planet_ink.coffee_mud.Libraries.interfaces.*;\nimport com.planet_ink.coffee_mud.Libraries.interfaces.AbilityMapper.AbilityMapping;\nimport com.planet_ink.coffee_mud.Libraries.interfaces.AbilityParameters.AbilityParmEditor;\nimport com.planet_ink.coffee_mud.core.exceptions.*;\nimport com.planet_ink.coffee_mud.core.*;\nimport com.planet_ink.coffee_mud.core.collections.*;\nimport com.planet_ink.coffee_mud.core.interfaces.*;\nimport com.planet_ink.coffee_mud.Abilities.interfaces.*;\nimport com.planet_ink.coffee_mud.Areas.interfaces.*;\nimport com.planet_ink.coffee_mud.Behaviors.interfaces.*;\nimport com.planet_ink.coffee_mud.CharClasses.interfaces.*;\nimport com.planet_ink.coffee_mud.Commands.interfaces.*;\nimport com.planet_ink.coffee_mud.Common.interfaces.*;\nimport com.planet_ink.coffee_mud.Exits.interfaces.*;\nimport com.planet_ink.coffee_mud.Items.interfaces.*;\nimport com.planet_ink.coffee_mud.Items.interfaces.RawMaterial.Material;\nimport com.planet_ink.coffee_mud.Locales.interfaces.*;\nimport com.planet_ink.coffee_mud.MOBS.interfaces.*;\nimport com.planet_ink.coffee_mud.Races.interfaces.*;\n\nimport java.net.Socket;\nimport java.util.*;\n\n/*\n   Copyright 2008-2022 Bo Zimmerman\n\n   Licensed under the Apache License, Version 2.0 (the "License");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n\t   http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an "AS IS" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n */\npublic class CMAbleParms extends StdLibrary implements AbilityParameters\n{\n\t@Override\n\tpublic String ID()\n\t{\n\t\treturn "CMAbleParms";\n\t}\n\n\tprotected Map<String,AbilityParmEditor> DEFAULT_EDITORS = null;\n\n\tprotected final static int[] ALL_BUCKET_MATERIAL_CHOICES = new int[]{RawMaterial.MATERIAL_CLOTH, RawMaterial.MATERIAL_METAL, RawMaterial.MATERIAL_LEATHER,\n\t\t\tRawMaterial.MATERIAL_LIQUID, RawMaterial.MATERIAL_WOODEN, RawMaterial.MATERIAL_PRECIOUS,RawMaterial.MATERIAL_VEGETATION, RawMaterial.MATERIAL_ROCK };\n\tprotected final static int[] ALLOWED_BUCKET_ACODES = new int[]{Ability.ACODE_CHANT,Ability.ACODE_SPELL,Ability.ACODE_PRAYER,Ability.ACODE_SONG,Ability.ACODE_SKILL,\n\t\t\tAbility.ACODE_THIEF_SKILL};\n\tprotected final static int[] ALLOWED_BUCKET_QUALITIES = new int[]{Ability.QUALITY_BENEFICIAL_OTHERS,Ability.QUALITY_BENEFICIAL_SELF,Ability.QUALITY_INDIFFERENT,\n\t\t\tAbility.QUALITY_OK_OTHERS,Ability.QUALITY_OK_SELF};\n\tprotected final static String[] ADJUSTER_TOKENS = new String[]{"+","-","="};\n\tprotected final static String[] RESISTER_IMMUNER_TOKENS = new String[]{"%",";"};\n\n\tpublic CMAbleParms()\n\t{\n\t\tsuper();\n\t}\n\n\tprotected String parseLayers(final short[] layerAtt, final short[] clothingLayers, String misctype)\n\t{\n\t\tfinal int colon=misctype.indexOf(\':\');\n\t\tif(colon>=0)\n\t\t{\n\t\t\tString layers=misctype.substring(0,colon).toUpperCase().trim();\n\t\t\tmisctype=misctype.substring(colon+1).trim();\n\t\t\tif((layers.startsWith("MS"))||(layers.startsWith("SM")))\n\t\t\t{\n\t\t\t\tlayers=layers.substring(2);\n\t\t\t\tlayerAtt[0]=Armor.LAYERMASK_MULTIWEAR|Armor.LAYERMASK_SEETHROUGH;\n\t\t\t}\n\t\t\telse\n\t\t\tif(layers.startsWith("M"))\n\t\t\t{\n\t\t\t\tlayers=layers.substring(1);\n\t\t\t\tlayerAtt[0]=Armor.LAYERMASK_MULTIWEAR;\n\t\t\t}\n\t\t\telse\n\t\t\tif(layers.startsWith("S"))\n\t\t\t{\n\t\t\t\tlayers=layers.substring(1);\n\t\t\t\tlayerAtt[0]=Armor.LAYERMASK_SEETHROUGH;\n\t\t\t}\n\t\t\tclothingLayers[0]=CMath.s_short(layers);\n\t\t}\n\t\treturn misctype;\n\t}\n\n\t@Override\n\tpublic void parseWearLocation(final short[] layerAtt, final short[] layers, final long[] wornLoc, final boolean[] logicalAnd, final double[] hardBonus, String wearLocation)\n\t{\n\t\tif(layers != null)\n\t\t{\n\t\t\tlayerAtt[0] = 0;\n\t\t\tlayers[0] = 0;\n\t\t\twearLocation=parseLayers(layerAtt,layers,wearLocation);\n\t\t}\n\n\t\tfinal double hardnessMultiplier = hardBonus[0];\n\t\twornLoc[0] = 0;\n\t\thardBonus[0]=0.0;\n\t\tfinal Wearable.CODES codes = Wearable.CODES.instance();\n\t\tfor(int wo=1;wo<codes.total();wo++)\n\t\t{\n\t\t\tfinal String WO=codes.name(wo).toUpperCase();\n\t\t\tif(wearLocation.equalsIgnoreCase(WO))\n\t\t\t{\n\t\t\t\thardBonus[0]+=codes.location_strength_points()[wo];\n\t\t\t\twornLoc[0]=CMath.pow(2,wo-1);\n\t\t\t\tlogicalAnd[0]=false;\n\t\t\t}\n\t\t\telse\n\t\t\tif((wearLocation.toUpperCase().indexOf(WO+"||")>=0)\n\t\t\t||(wearLocation.toUpperCase().endsWith("||"+WO)))\n\t\t\t{\n\t\t\t\tif(hardBonus[0]==0.0)\n\t\t\t\t\thardBonus[0]+=codes.location_strength_points()[wo];\n\t\t\t\twornLoc[0]=wornLoc[0]|CMath.pow(2,wo-1);\n\t\t\t\tlogicalAnd[0]=false;\n\t\t\t}\n\t\t\telse\n\t\t\tif((wearLocation.toUpperCase().indexOf(WO+"&&")>=0)\n\t\t\t||(wearLocation.toUpperCase().endsWith("&&"+WO)))\n\t\t\t{\n\t\t\t\thardBonus[0]+=codes.location_strength_points()[wo];\n\t\t\t\twornLoc[0]=wornLoc[0]|CMath.pow(2,wo-1);\n\t\t\t\tlogicalAnd[0]=true;\n\t\t\t}\n\t\t}\n\t\thardBonus[0]=(int)Math.round(hardBonus[0] * hardnessMultiplier);\n\t}\n\n\tpublic Vector<Object> parseRecipeFormatColumns(final String recipeFormat)\n\t{\n\t\tchar C = \'\\0\';\n\t\tfinal StringBuffer currentColumn = new StringBuffer("");\n\t\tVector<String> currentColumns = null;\n\t\tfinal char[] recipeFmtC = recipeFormat.toCharArray();\n\t\tfinal Vector<Object> columnsV = new Vector<Object>();\n\t\tfor(int c=0;c<=recipeFmtC.length;c++)\n\t\t{\n\t\t\tif(c==recipeFmtC.length)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tC = recipeFmtC[c];\n\t\t\tif((C==\'|\')\n\t\t\t&&(c<(recipeFmtC.length-1))\n\t\t\t&&(recipeFmtC[c+1]==\'|\')\n\t\t\t&&(currentColumn.length()>0))\n\t\t\t{\n\t\t\t\tif(currentColumn.length()>0)\n\t\t\t\t{\n\t\t\t\t\tif(currentColumns == null)\n\t\t\t\t\t{\n\t\t\t\t\t\tcurrentColumns = new Vector<String>();\n\t\t\t\t\t\tcolumnsV.addElement(currentColumns);\n\t\t\t\t\t}\n\t\t\t\t\tcurrentColumns.addElement(currentColumn.toString());\n\t\t\t\t\tcurrentColumn.setLength(0);\n\t\t\t\t}\n\t\t\t\tc++;\n\t\t\t}\n\t\t\telse\n\t\t\tif(Character.isLetter(C)||Character.isDigit(C)||(C==\'_\'))\n\t\t\t\tcurrentColumn.append(C);\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(currentColumn.length()>0)\n\t\t\t\t{\n\t\t\t\t\tif(currentColumns == null)\n\t\t\t\t\t{\n\t\t\t\t\t\tcurrentColumns = new Vector<String>();\n\t\t\t\t\t\tcolumnsV.addElement(currentColumns);\n\t\t\t\t\t}\n\t\t\t\t\tcurrentColumns.addElement(currentColumn.toString());\n\t\t\t\t\tcurrentColumn.setLength(0);\n\t\t\t\t}\n\t\t\t\tcurrentColumns = null;\n\t\t\t\tif((C==\'.\')\n\t\t\t\t&&(c<(recipeFmtC.length-2))\n\t\t\t\t&&(recipeFmtC[c+1]==\'.\')\n\t\t\t\t&&(recipeFmtC[c+2]==\'.\'))\n\t\t\t\t{\n\t\t\t\t\tc+=2;\n\t\t\t\t\tcolumnsV.addElement("...");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(columnsV.lastElement() instanceof String)\n\t\t\t\t\tcolumnsV.setElementAt(((String)columnsV.lastElement())+C,columnsV.size()-1);\n\t\t\t\telse\n\t\t\t\t\tcolumnsV.addElement(""+C);\n\t\t\t}\n\t\t}\n\t\tif(currentColumn.length()>0)\n\t\t{\n\t\t\tif(currentColumns == null)\n\t\t\t{\n\t\t\t\tcurrentColumns = new Vector<String>();\n\t\t\t\tcolumnsV.addElement(currentColumns);\n\t\t\t}\n\t\t\tcurrentColumns.addElement(currentColumn.toString());\n\t\t}\n\t\tif((currentColumns != null) && (currentColumns.size()==0))\n\t\t\tcolumnsV.remove(currentColumns);\n\t\treturn columnsV;\n\t}\n\n\t@Override\n\tpublic String makeRecipeFromItem(final ItemCraftor C, final Item I) throws CMException\n\t{\n\t\tfinal Vector<Object> columns = parseRecipeFormatColumns(C.getRecipeFormat());\n\t\tfinal Map<String,AbilityParmEditor> editors = this.getEditors();\n\t\tfinal StringBuilder recipe = new StringBuilder("");\n\t\tfor(int d=0;d<columns.size();d++)\n\t\t{\n\t\t\tif(columns.get(d) instanceof String)\n\t\t\t{\n\t\t\t\tfinal String name = (String)columns.get( d );\n\t\t\t\tAbilityParmEditor A = editors.get(columns.get(d));\n\t\t\t\tif((A==null)||(name.length()<3))\n\t\t\t\t{\n\t\t\t\t\trecipe.append("\\t");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif(A.appliesToClass(I)<0)\n\t\t\t\t\tA = editors.get("N_A");\n\t\t\t\tif(A!=null)\n\t\t\t\t\tcolumns.set(d,A.ID());\n\t\t\t}\n\t\t\telse\n\t\t\tif(columns.get(d) instanceof List)\n\t\t\t{\n\t\t\t\tAbilityParmEditor applicableA = null;\n\t\t\t\tfinal List<?> colV=(List<?>)columns.get(d);\n\t\t\t\tfor(int c=0;c<colV.size();c++)\n\t\t\t\t{\n\t\t\t\t\tfinal Object o = colV.get(c);\n\t\t\t\t\tif (o instanceof List)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tfinal String ID = (o instanceof String) ? (String)o : ((AbilityParmEditor)o).ID();\n\t\t\t\t\tfinal AbilityParmEditor A = editors.get(ID);\n\t\t\t\t\tif(A==null)\n\t\t\t\t\t\tthrow new CMException("Column name "+ID+" is not found.");\n\t\t\t\t\tif((applicableA==null)\n\t\t\t\t\t||(A.appliesToClass(I) > applicableA.appliesToClass(I)))\n\t\t\t\t\t\tapplicableA = A;\n\t\t\t\t}\n\t\t\t\tif((applicableA == null)||(applicableA.appliesToClass(I)<0))\n\t\t\t\t\tapplicableA = editors.get("N_A");\n\t\t\t\tcolumns.set(d,applicableA.ID());\n\t\t\t}\n\t\t\telse\n\t\t\t\tthrow new CMException("Col name "+(columns.get(d))+" is not a String or List.");\n\t\t\tfinal AbilityParmEditor A = editors.get(columns.get(d));\n\t\t\tif(A==null)\n\t\t\t\tthrow new CMException("Editor name "+(columns.get(d))+" is not defined.");\n\t\t\trecipe.append(A.convertFromItem(C, I));\n\t\t}\n\t\treturn recipe.toString();\n\t}\n\n\t@SuppressWarnings("unchecked")\n\tprotected static int getClassFieldIndex(final DVector dataRow)\n\t{\n\t\tfor(int d=0;d<dataRow.size();d++)\n\t\t{\n\t\t\tif(dataRow.elementAt(d,1) instanceof List)\n\t\t\t{\n\t\t\t\tfinal List<String> V=(List<String>)dataRow.elementAt(d,1);\n\t\t\t\tif(V.contains("ITEM_CLASS_ID")\n\t\t\t\t||V.contains("FOOD_DRINK")\n\t\t\t\t||V.contains("COLOR_TERM")\n\t\t\t\t||V.contains("ITEM_CMARE")\n\t\t\t\t||V.contains("BUILDING_CODE"))\n\t\t\t\t\treturn d;\n\t\t\t}\n\t\t\telse\n\t\t\tif(dataRow.elementAt(d,1) instanceof String)\n\t\t\t{\n\t\t\t\tfinal String s=(String)dataRow.elementAt(d,1);\n\t\t\t\tif(s.equalsIgnoreCase("ITEM_CLASS_ID")\n\t\t\t\t||s.equalsIgnoreCase("FOOD_DRINK")\n\t\t\t\t||s.equalsIgnoreCase("ITEM_CMARE")\n\t\t\t\t||s.equalsIgnoreCase("COLOR_TERM")\n\t\t\t\t||s.equalsIgnoreCase("BUILDING_CODE"))\n\t\t\t\t\treturn d;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\n\t@SuppressWarnings("unchecked")\n\tprotected Object getSampleObject(final DVector dataRow)\n\t{\n\t\tboolean classIDRequired = false;\n\t\tString classID = null;\n\t\tfinal int fieldIndex = getClassFieldIndex(dataRow);\n\t\tfor(int d=0;d<dataRow.size();d++)\n\t\t{\n\t\t\tif((dataRow.elementAt(d,1) instanceof List)\n\t\t\t&&(!classIDRequired)\n\t\t\t&&(((List<String>)dataRow.elementAt(d,1)).size()>1))\n\t\t\t\tclassIDRequired=true;\n\t\t}\n\t\tif(fieldIndex >=0)\n\t\t\tclassID=(String)dataRow.elementAt(fieldIndex,2);\n\t\tif((classID!=null)&&(classID.length()>0))\n\t\t{\n\t\t\tfinal String uClassID=classID.toUpperCase();\n\t\t\tif(uClassID.equalsIgnoreCase("FOOD"))\n\t\t\t\treturn CMClass.getItemPrototype("GenFood");\n\t\t\telse\n\t\t\tif(uClassID.equalsIgnoreCase("SOAP"))\n\t\t\t\treturn CMClass.getItemPrototype("GenItem");\n\t\t\telse\n\t\t\tif(uClassID.equalsIgnoreCase("DRINK"))\n\t\t\t\treturn CMClass.getItemPrototype("GenDrink");\n\t\t\telse\n\t\t\tif(uClassID.startsWith("<ITEM>")\n\t\t\t||uClassID.startsWith("<MOB>")\n\t\t\t||uClassID.startsWith("<AREA>")\n\t\t\t||uClassID.startsWith("<ROOM>"))\n\t\t\t{\n\t\t\t\tfinal List<XMLLibrary.XMLTag> pieces=CMLib.xml().parseAllXML(classID);\n\t\t\t\tif(pieces.size()>0)\n\t\t\t\t{\n\t\t\t\t\tfinal XMLLibrary.XMLTag tag = CMLib.xml().getPieceFromPieces(pieces, "ITEM");\n\t\t\t\t\tif(tag != null)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String realClassID=CMLib.xml().getValFromPieces(tag.contents(), "CLASSID");\n\t\t\t\t\t\tif((realClassID!=null)\n\t\t\t\t\t\t&&(realClassID.length()>0))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(uClassID.startsWith("<ITEM>"))\n\t\t\t\t\t\t\t\treturn CMClass.getItemPrototype(realClassID);\n\t\t\t\t\t\t\tif(uClassID.startsWith("<MOB>"))\n\t\t\t\t\t\t\t\treturn CMClass.getMOBPrototype(realClassID);\n\t\t\t\t\t\t\tif(uClassID.startsWith("<AREA>"))\n\t\t\t\t\t\t\t\treturn CMClass.getAreaType(realClassID);\n\t\t\t\t\t\t\tif(uClassID.startsWith("<ROOM>"))\n\t\t\t\t\t\t\t\treturn CMClass.getLocalePrototype(realClassID);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn CMClass.getItemPrototype("GenDrink");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfinal PhysicalAgent I=CMClass.getItemPrototype(classID);\n\t\t\t\tif(I==null)\n\t\t\t\t{\n\t\t\t\t\tfinal Pair<String[],String[]> codeFlags = getBuildingCodesNFlags();\n\t\t\t\t\tif(CMParms.containsIgnoreCase(codeFlags.first, classID))\n\t\t\t\t\t\treturn classID.toUpperCase().trim();\n\t\t\t\t}\n\t\t\t\treturn I;\n\t\t\t}\n\t\t}\n\t\tif(classIDRequired)\n\t\t\treturn null;\n\t\treturn CMClass.getItemPrototype("StdItem");\n\t}\n\n\tprotected String stripData(final StringBuffer str, final String div)\n\t{\n\t\tfinal StringBuffer data = new StringBuffer("");\n\t\twhile(str.length()>0)\n\t\t{\n\t\t\tif(str.length() < div.length())\n\t\t\t\treturn null;\n\t\t\tfor(int d=0;d<=div.length();d++)\n\t\t\t{\n\t\t\t\tif(d==div.length())\n\t\t\t\t{\n\t\t\t\t\tstr.delete(0,div.length());\n\t\t\t\t\treturn data.toString();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tif(str.charAt(d)!=div.charAt(d))\n\t\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(str.charAt(0)==\'\\n\')\n\t\t\t{\n\t\t\t\tif(data.length()>0)\n\t\t\t\t\treturn data.toString();\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tdata.append(str.charAt(0));\n\t\t\tstr.delete(0,1);\n\t\t}\n\t\tif((div.charAt(0)==\'\\n\') && (data.length()>0))\n\t\t\treturn data.toString();\n\t\treturn null;\n\t}\n\n\t@SuppressWarnings("unchecked")\n\tprotected Vector<DVector> parseDataRows(final StringBuffer recipeData, final Vector<? extends Object> columnsV, final int numberOfDataColumns)\n\t\tthrows CMException\n\t{\n\t\tStringBuffer str = new StringBuffer(recipeData.toString());\n\t\tDVector dataRow = new DVector(2);\r\n\t\tList<String> currCol = null;\r\n\t\tString lastDiv = null;\r\n\t\t\r\n\t\t// detect item xml, and to special line parse\r\n\t\t{\r\n\t\t\tint openTagDex=str.indexOf("<");\r\n\t\t\tif((openTagDex>=0)\r\n\t\t\t&&(str.substring(0,openTagDex).trim().length()==0)\r\n\t\t\t&&(columnsV.size()==1))\r\n\t\t\t&&(str.substring(0,openTagDex).trim().length()==0)\n\t\t\t&&(columnsV.size()==1))\n\t\t\t{\n\t\t\t\tString xml = str.toString().trim();\n\t\t\t\tString uxml = xml.toUpperCase();\n\t\t\t\tif(uxml.startsWith("<ITEMS>")&&(uxml.endsWith("</ITEMS>")))\n\t\t\t\t\tstr.setLength(0);\r\n\t\t\t\t\txml = xml.substring(7,xml.length()-8).trim();\r\n\t\t\t\t\tuxml = uxml.substring(7,uxml.length()-8).trim();\r\n\t\t\t\t\t\r\n\t\t\t\t\twhile(uxml.startsWith("<ITEM>"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tint closeTagDex=uxml.indexOf("</ITEM>");\r\n\t\t\t\t\t\tString itemRow = xml.substring(0,closeTagDex+7);\r\n\t\t\t\t\t\tuxml=uxml.substring(closeTagDex+7).trim();\r\n\t\t\t\t\t\txml=xml.substring(closeTagDex+7).trim();\r\n\t\t\t\t\t\tdataRow.addElement(currCol,itemRow);\r\n\t\t\t\t\t\txml=xml.substring(closeTagDex+7).trim();\n\t\t\t\t\t\tdataRow.addElement(currCol,itemRow);\n\t\t\t\t\t\trowsV.addElement(dataRow);\n\t\t\t\t\t\tdataRow = new DVector(2);\n\t\t\t\t\t}\n\t\t\t\t\tstr.setLength(0);\n\t\t\t\t\tstr.append(xml);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tint lastLen = str.length();\n\t\twhile(str.length() > 0)\n\t\t{\n\t\t\tif(str.charAt(0)==\'#\')\n\t\t\t{\n\t\t\t\tfinal int x=str.indexOf("\\n");\n\t\t\t\tif(x>0)\n\t\t\t\t{\n\t\t\t\t\tstr.delete(0, x+1);\n\t\t\t\t\twhile((str.length()>0)\n\t\t\t\t\t&&((str.charAt(0)==\'\\r\')||(str.charAt(0)==\'\\n\')))\n\t\t\t\t\t\tstr.delete(0, 1);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlastLen = str.length();\n\t\t\tfor(int c = 0; c < columnsV.size(); c++)\n\t\t\t{\n\t\t\t\tString div = "\\n";\n\t\t\t\tcurrCol = null;\n\t\t\t\tif(columnsV.elementAt(c) instanceof String)\n\t\t\t\t\tstripData(str,(String)columnsV.elementAt(c));\n\t\t\t\telse\n\t\t\t\tif(columnsV.elementAt(c) instanceof List)\n\t\t\t\t{\n\t\t\t\t\tcurrCol = (List<String>)columnsV.elementAt(c);\n\t\t\t\t\tif(c<columnsV.size()-1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdiv = (String)columnsV.elementAt(c+1);\n\t\t\t\t\t\tc++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif((str.length()==0)&&(c<columnsV.size()-1))\n\t\t\t\t\tbreak;\n\t\t\t\tif(!div.equals("..."))\n\t\t\t\t{\n\t\t\t\t\tlastDiv = div;\n\t\t\t\t\tString data = null;\n\t\t\t\t\tdata = stripData(str,lastDiv);\n\t\t\t\t\tif(data == null)\n\t\t\t\t\t\tdata = "";\n\t\t\t\t\tdataRow.addElement(currCol,data);\n\t\t\t\t\tcurrCol = null;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tfinal String data = stripData(str,lastDiv);\n\t\t\t\t\tif(data == null)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdataRow.addElement(currCol,data);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(dataRow.size() != numberOfDataColumns)\n\t\t\t\tthrow new CMException("Row "+(rowsV.size()+1)+" has "+dataRow.size()+"/"+numberOfDataColumns);\n\t\t\trowsV.addElement(dataRow);\n\t\t\tdataRow = new DVector(2);\n\t\t\tif(str.length()==lastLen)\n\t\t\t\tthrow new CMException("UNCHANGED: Row "+(rowsV.size()+1)+" has "+dataRow.size()+"/"+numberOfDataColumns);\n\t\t}\n\t\tif(str.length()<2)\n\t\t\tstr.setLength(0);\n\t\treturn rowsV;\n\t}\n\n\tprotected boolean fixDataColumn(final DVector dataRow, final int rowShow) throws CMException\n\t{\n\t\tfinal Object classModelI = getSampleObject(dataRow);\n\t\treturn fixDataColumn(dataRow,rowShow,classModelI);\n\t}\n\n\t@SuppressWarnings("unchecked")\n\tprotected boolean fixDataColumn(final DVector dataRow, final int rowShow, final Object classModelI) throws CMException\n\t{\n\t\tfinal Map<String,AbilityParmEditor> editors = getEditors();\n\t\tfor(int d=0;d<dataRow.size();d++)\n\t\t{\n\t\t\tif(!(dataRow.elementAt(d, 1) instanceof List))\n\t\t\t\tthrow new CMException(L("Data row @x1 discarded due to non-List at @x2",""+rowShow,""+d));\n\n\t\t\tfinal List<String> colV=(List<String>)dataRow.elementAt(d,1);\n\t\t\tif(colV.size()==1)\n\t\t\t{\n\t\t\t\tAbilityParmEditor A = editors.get(colV.get(0));\n\t\t\t\tif((A == null)||(A.appliesToClass(classModelI)<0))\n\t\t\t\t\tA = editors.get("N_A");\n\t\t\t\tdataRow.setElementAt(d,1,A.ID());\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(classModelI == null)\n\t\t\t\t{\n\t\t\t\t\t//Log.errOut("CMAbleParms","Data row "+rowShow+" discarded due to null/empty classID");\n\t\t\t\t\tthrow new CMException(L("Data row @x1 discarded due to null/empty classID",""+rowShow));\n\t\t\t\t}\n\t\t\t\tAbilityParmEditor applicableA = null;\n\t\t\t\tfor(int c=0;c<colV.size();c++)\n\t\t\t\t{\n\t\t\t\t\tfinal AbilityParmEditor A = editors.get(colV.get(c));\n\t\t\t\t\tif(A==null)\n\t\t\t\t\t\tthrow new CMException(L("Col name @x1 is not defined.",""+(colV.get(c))));\n\t\t\t\t\tif((applicableA==null)\n\t\t\t\t\t||(A.appliesToClass(classModelI) > applicableA.appliesToClass(classModelI)))\n\t\t\t\t\t\tapplicableA = A;\n\t\t\t\t}\n\t\t\t\tif((applicableA == null)||(applicableA.appliesToClass(classModelI)<0))\n\t\t\t\t\tapplicableA = editors.get("N_A");\n\t\t\t\tdataRow.setElementAt(d,1,applicableA.ID());\n\t\t\t}\n\t\t\tfinal AbilityParmEditor A = editors.get(dataRow.elementAt(d,1));\n\t\t\tif(A==null)\n\t\t\t{\n\t\t\t\tif(classModelI instanceof CMObject)\n\t\t\t\t\tthrow new CMException(L("Item id @x1 has no editor for @x2",((CMObject)classModelI).ID(),((String)dataRow.elementAt(d,1))));\n\t\t\t\telse\n\t\t\t\t\tthrow new CMException(L("Item id @x1 has no editor for @x2",classModelI+"",((String)dataRow.elementAt(d,1))));\n\t\t\t\t//Log.errOut("CMAbleParms","Item id "+classModelI.ID()+" has no editor for "+((String)dataRow.elementAt(d,1)));\n\t\t\t\t//return false;\n\t\t\t}\n\t\t\telse\n\t\t\tif((rowShow>=0)\n\t\t\t&&(!A.confirmValue((String)dataRow.elementAt(d,2))))\n\t\t\t{\n\t\t\t\tfinal String data = ((String)dataRow.elementAt(d,2)).replace(\'@\', \' \');\n\t\t\t\tif(classModelI instanceof CMObject)\n\t\t\t\t\tthrow new CMException(L("Item id @x1 has bad data \'@x2\' for column @x3 at row @x4",((CMObject)classModelI).ID(),data,((String)dataRow.elementAt(d,1)),""+rowShow));\n\t\t\t\telse\n\t\t\t\t\tthrow new CMException(L("Item id @x1 has bad data \'@x2\' for column @x3 at row @x4",""+classModelI,data,((String)dataRow.elementAt(d,1)),""+rowShow));\n\t\t\t\t//Log.errOut("CMAbleParms","Item id "+classModelI.ID()+" has bad data \'"+((String)dataRow.elementAt(d,2))+"\' for column "+((String)dataRow.elementAt(d,1))+" at row "+rowShow);\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprotected void fixDataColumns(final Vector<DVector> rowsV) throws CMException\n\t{\n\t\tDVector dataRow = new DVector(2);\n\t\tfor(int r=0;r<rowsV.size();r++)\n\t\t{\n\t\t\tdataRow=rowsV.elementAt(r);\n\t\t\tif(!fixDataColumn(dataRow,r))\n\t\t\t\tthrow new CMException(L("Unknown error in row @x1",""+r));\n\t\t\t/*\n\t\t\tcatch(CMException e)\n\t\t\t{\n\t\t\t\trowsV.removeElementAt(r);\n\t\t\t\tr--;\n\t\t\t}\n\t\t\t*/\n\t\t}\n\t}\n\n\tprotected StringBuffer cleanDataRowEOLs(final StringBuffer str)\n\t{\n\t\tif(str.indexOf("\\n")<0)\n\t\t\treturn new StringBuffer(str.toString().replace(\'\\r\',\'\\n\'));\n\t\tfor(int i=str.length()-1;i>=0;i--)\n\t\t{\n\t\t\tif(str.charAt(i)==\'\\r\')\n\t\t\t\tstr.delete(i,i+1);\n\t\t}\n\t\treturn str;\n\t}\n\n\t@Override\n\tpublic void testRecipeParsing(final StringBuffer recipesString, final String recipeFormat) throws CMException\n\t{\n\t\ttestRecipeParsing(recipesString,recipeFormat,null);\n\t}\n\n\t@Override\n\tpublic void testRecipeParsing(final String recipeFilename, final String recipeFormat, final boolean save) throws CMException\n\t{\n\t\tfinal StringBuffer str=new CMFile(Resources.buildResourcePath("skills")+recipeFilename,null,CMFile.FLAG_LOGERRORS).text();\n\t\ttestRecipeParsing(str,recipeFormat,save?recipeFilename:null);\n\t}\n\n\t@SuppressWarnings("unchecked")\n\tpublic void testRecipeParsing(final StringBuffer str, final String recipeFormat, final String saveRecipeFilename) throws CMException\n\t{\n\t\tfinal Vector<? extends Object> columnsV = parseRecipeFormatColumns(recipeFormat);\n\t\tint numberOfDataColumns = 0;\n\t\tfor(int c = 0; c < columnsV.size(); c++)\n\t\t{\n\t\t\tif(columnsV.elementAt(c) instanceof List)\n\t\t\t\tnumberOfDataColumns++;\n\t\t}\n\t\tfinal Vector<DVector> rowsV = parseDataRows(str,columnsV,numberOfDataColumns);\n\t\tfinal Vector<String> convertedColumnsV=(Vector<String>)columnsV;\n\t\tfixDataColumns(rowsV);\n\t\tfinal Map<String,AbilityParmEditor> editors = getEditors();\n\t\tDVector editRow = null;\n\t\tfinal int[] showNumber = {0};\n\t\tfinal int showFlag =-999;\n\t\tfinal MOB mob=CMClass.getFactoryMOB();\n\t\tfinal Session fakeSession = (Session)CMClass.getCommon("FakeSession");\n\t\tmob.setSession(fakeSession);\n\t\tfakeSession.setMob(mob);\n\t\tfor(int r=0;r<rowsV.size();r++)\n\t\t{\n\t\t\teditRow = rowsV.elementAt(r);\n\t\t\tfor(int a=0;a<editRow.size();a++)\n\t\t\t{\n\t\t\t\tfinal AbilityParmEditor A = editors.get(editRow.elementAt(a,1));\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tfinal String oldVal = (String)editRow.elementAt(a,2);\n\t\t\t\t\tfakeSession.getPreviousCMD().clear();\n\t\t\t\t\tfakeSession.getPreviousCMD().addAll(new XVector<String>(A.fakeUserInput(oldVal)));\n\t\t\t\t\tfinal String newVal = A.commandLinePrompt(mob,oldVal,showNumber,showFlag);\n\t\t\t\t\teditRow.setElementAt(a,2,newVal);\n\t\t\t\t}\n\t\t\t\tcatch (final Exception e)\n\t\t\t\t{\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfakeSession.setMob(null);\n\t\tmob.destroy();\n\t\tif(saveRecipeFilename!=null)\n\t\t\tresaveRecipeFile(mob,saveRecipeFilename,rowsV,convertedColumnsV,false);\n\t}\n\n\tprotected void calculateRecipeCols(final int[] lengths, final String[] headers, final Vector<DVector> rowsV)\n\t{\n\t\tfinal Map<String,AbilityParmEditor> editors = getEditors();\n\t\tDVector dataRow = null;\n\t\tfinal int numRows[]=new int[headers.length];\n\t\tfor(int r=0;r<rowsV.size();r++)\n\t\t{\n\t\t\tdataRow=rowsV.elementAt(r);\n\t\t\tfor(int c=0;c<dataRow.size();c++)\n\t\t\t{\n\t\t\t\tfinal AbilityParmEditor A = editors.get(dataRow.elementAt(c,1));\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tint dataLen=((String)dataRow.elementAt(c, 2)).length();\n\t\t\t\t\tif(dataLen > A.maxColWidth())\n\t\t\t\t\t\tdataLen = A.maxColWidth();\n\t\t\t\t\tif(dataLen < A.minColWidth())\n\t\t\t\t\t\tdataLen = A.minColWidth();\n\t\t\t\t\tlengths[c]+=dataLen;\n\t\t\t\t\tnumRows[c]++;\n\t\t\t\t}\n\t\t\t\tcatch(final Exception e)\n\t\t\t\t{\n\t\t\t\t}\n\t\t\t\tif(A==null)\n\t\t\t\t\tLog.errOut("CMAbleParms","Inexplicable lack of a column: "+((String)dataRow.elementAt(c,1)));\n\t\t\t\telse\n\t\t\t\tif(headers[c] == null)\n\t\t\t\t{\n\t\t\t\t\theaders[c] = A.colHeader();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif((!headers[c].startsWith("#"))&&(!headers[c].equalsIgnoreCase(A.colHeader())))\n\t\t\t\t{\n\t\t\t\t\theaders[c]="#"+c;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<headers.length;i++)\n\t\t{\n\t\t\tif(numRows[i]>0)\n\t\t\t{\n\t\t\t\tlengths[i] /= numRows[i];\n\t\t\t\tif(lengths[i]+headers.length>50)\n\t\t\t\t\tlengths[i]=50-headers.length;\n\t\t\t}\n\t\t\tif(headers[i]==null)\n\t\t\t\theaders[i]="*Add*";\n\t\t}\n\t\tint currLenTotal = 0;\n\t\tfor (final int length : lengths)\n\t\t\tcurrLenTotal+=length;\n\t\tint curCol = 0;\n\t\twhile((currLenTotal+lengths.length)>72)\n\t\t{\n\t\t\tif(lengths[curCol]>1)\n\t\t\t{\n\t\t\t\tlengths[curCol]--;\n\t\t\t\tcurrLenTotal--;\n\t\t\t}\n\t\t\tcurCol++;\n\t\t\tif(curCol >= lengths.length)\n\t\t\t\tcurCol = 0;\n\t\t}\n\t\twhile((currLenTotal+lengths.length)<72)\n\t\t{\n\t\t\tlengths[curCol]++;\n\t\t\tcurrLenTotal++;\n\t\t\tcurCol++;\n\t\t\tif(curCol >= lengths.length)\n\t\t\t\tcurCol = 0;\n\t\t}\n\t}\n\n\t@Override\n\tpublic AbilityRecipeData parseRecipe(final String recipeFilename, final String recipeFormat)\n\t{\n\t\tfinal AbilityRecipeDataImpl recipe = new AbilityRecipeDataImpl(recipeFilename, recipeFormat);\n\t\treturn recipe;\n\t}\n\n\t@Override\n\tpublic StringBuffer getRecipeList(final RecipeDriven iA)\n\t{\n\t\tfinal AbilityRecipeData recipe = parseRecipe(iA.getRecipeFilename(),iA.getRecipeFormat());\n\t\tif(recipe.parseError() != null)\n\t\t\treturn new StringBuffer("File: "+iA.getRecipeFilename()+": "+recipe.parseError());\n\t\treturn getRecipeList(recipe);\n\t}\n\n\tprivate StringBuffer getRecipeList(final AbilityRecipeData recipe)\n\t{\n\t\tfinal Map<String,AbilityParmEditor> editors = getEditors();\n\t\tfinal StringBuffer list=new StringBuffer("");\n\t\tDVector dataRow = null;\n\t\tlist.append("### ");\n\t\tfor(int l=0;l<recipe.columnLengths().length;l++)\n\t\t\tlist.append(CMStrings.padRight(recipe.columnHeaders()[l],recipe.columnLengths()[l])+" ");\n\t\tlist.append("\\n\\r");\n\t\tfor(int r=0;r<recipe.dataRows().size();r++)\n\t\t{\n\t\t\tdataRow=recipe.dataRows().get(r);\n\t\t\tlist.append(CMStrings.padRight(""+(r+1),3)+" ");\n\t\t\tfor(int c=0;c<dataRow.size();c++)\n\t\t\t{\n\t\t\t\tfinal Object fieldType = dataRow.elementAt(c, 1);\n\t\t\t\tfinal AbilityParmEditor A = editors.get(fieldType);\n\t\t\t\tString value=(String)dataRow.elementAt(c,2);\n\t\t\t\tif(A!=null)\n\t\t\t\t\tvalue=A.commandLineValue(value);\n\t\t\t\tfinal String colVal = CMStrings.limit(value,recipe.columnLengths()[c]);\n\t\t\t\tlist.append(CMStrings.padRight(colVal,recipe.columnLengths()[c])+" ");\n\t\t\t}\n\t\t\tlist.append("\\n\\r");\n\t\t}\n\t\treturn list;\n\t}\n\n\t@Override\n\t@SuppressWarnings("unchecked")\n\tpublic void modifyRecipesList(final MOB mob, final String recipeFilename, final String recipeFormat) throws java.io.IOException\n\t{\n\t\tfinal Map<String,AbilityParmEditor> editors = getEditors();\n\t\tfinal AbilityRecipeData recipe = parseRecipe(recipeFilename, recipeFormat);\n\t\tif(recipe.parseError() != null)\n\t\t{\n\t\t\tLog.errOut("CMAbleParms","File: "+recipeFilename+": "+recipe.parseError());\n\t\t\treturn;\n\t\t}\n\t\twhile((mob.session()!=null)&&(!mob.session().isStopped()))\n\t\t{\n\t\t\tfinal StringBuffer list=getRecipeList(recipe);\n\t\t\tmob.tell(list.toString());\n\t\t\tfinal String lineNum = mob.session().prompt(L("\\n\\rEnter a line to edit, A to add, or ENTER to exit: "),"");\n\t\t\tif(lineNum.trim().length()==0)\n\t\t\t\tbreak;\n\t\t\tDVector editRow = null;\n\t\t\tif(lineNum.equalsIgnoreCase("A"))\n\t\t\t{\n\t\t\t\teditRow = recipe.blankRow();\n\t\t\t\tfinal int keyIndex = getClassFieldIndex(editRow);\n\t\t\t\tString classFieldData = null;\n\t\t\t\tif(keyIndex>=0)\n\t\t\t\t{\n\t\t\t\t\tfinal AbilityParmEditor A = editors.get(((List<String>)editRow.elementAt(keyIndex,1)).get(0));\n\t\t\t\t\tif(A!=null)\n\t\t\t\t\t{\n\t\t\t\t\t\tclassFieldData = A.commandLinePrompt(mob,(String)editRow.elementAt(keyIndex,2),new int[]{0},-999);\n\t\t\t\t\t\tif(!A.confirmValue(classFieldData))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmob.tell(L("Invalid value.  Aborted."));\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\teditRow=recipe.newRow(classFieldData);\n\t\t\t\tif(editRow==null)\n\t\t\t\t\tcontinue;\n\t\t\t\trecipe.dataRows().add(editRow);\n\t\t\t}\n\t\t\telse\n\t\t\tif(CMath.isInteger(lineNum))\n\t\t\t{\n\t\t\t\tfinal int line = CMath.s_int(lineNum);\n\t\t\t\tif((line<1)||(line>recipe.dataRows().size()))\n\t\t\t\t\tcontinue;\n\t\t\t\teditRow = recipe.dataRows().get(line-1);\n\t\t\t}\n\t\t\telse\n\t\t\t\tbreak;\n\t\t\tif(editRow != null)\n\t\t\t{\n\t\t\t\tint showFlag=-1;\n\t\t\t\tif(CMProps.getIntVar(CMProps.Int.EDITORTYPE)>0)\n\t\t\t\t\tshowFlag=-999;\n\t\t\t\tboolean ok=false;\n\t\t\t\twhile(!ok)\n\t\t\t\t{\n\t\t\t\t\tfinal int[] showNumber = {0};\n\t\t\t\t\tfinal int keyIndex = getClassFieldIndex(editRow);\n\t\t\t\t\tfor(int a=0;a<editRow.size();a++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Object editorName = editRow.elementAt(a,1);\n\t\t\t\t\t\tif((a!=keyIndex)\n\t\t\t\t\t\t||(editors.containsKey(editorName)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal AbilityParmEditor A = editors.get(editorName);\n\t\t\t\t\t\t\tfinal String newVal = A.commandLinePrompt(mob,(String)editRow.elementAt(a,2),showNumber,showFlag);\n\t\t\t\t\t\t\teditRow.setElementAt(a,2,newVal);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(showFlag<-900)\n\t\t\t\t\t{\n\t\t\t\t\t\tok=true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif(showFlag>0)\n\t\t\t\t\t{\n\t\t\t\t\t\tshowFlag=-1;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tshowFlag=CMath.s_int(mob.session().prompt(L("Edit which? "),""));\n\t\t\t\t\tif(showFlag<=0)\n\t\t\t\t\t{\n\t\t\t\t\t\tshowFlag=-1;\n\t\t\t\t\t\tok=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif((mob.session()!=null)&&(!mob.session().isStopped()))\n\t\t{\n\t\t\tfinal String prompt="Save to V)FS, F)ilesystem, or C)ancel (" + (recipe.wasVFS()?"V/f/c":"v/F/c")+"): ";\n\t\t\tfinal String choice=mob.session().choose(prompt,L("VFC"),recipe.wasVFS()?L("V"):L("F"));\n\t\t\tif(choice.equalsIgnoreCase("C"))\n\t\t\t\tmob.tell(L("Cancelled."));\n\t\t\telse\n\t\t\t{\n\t\t\t\tfinal boolean saveToVFS = choice.equalsIgnoreCase("V");\n\t\t\t\tresaveRecipeFile(mob, recipeFilename,recipe.dataRows(),recipe.columns(),saveToVFS);\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic void resaveRecipeFile(final MOB mob, final String recipeFilename, final List<DVector> rowsV, final List<? extends Object> columnsV, final boolean saveToVFS)\n\t{\n\t\tfinal StringBuffer saveBuf = new StringBuffer("");\n\t\tfor(int r=0;r<rowsV.size();r++)\n\t\t{\n\t\t\tfinal DVector dataRow = rowsV.get(r);\n\t\t\tint dataDex = 0;\n\t\t\tfor(int c=0;c<columnsV.size();c++)\n\t\t\t{\n\t\t\t\tfinal String newRowVal;\n\t\t\t\tif(columnsV.get(c) instanceof String)\n\t\t\t\t\tnewRowVal = (String)columnsV.get(c);\n\t\t\t\telse\n\t\t\t\t\tnewRowVal = dataRow.elementAt(dataDex++,2).toString();\n\t\t\t\tsaveBuf.append(newRowVal);\n\t\t\t}\n\t\t\tsaveBuf.append("\\n");\n\t\t}\n\t\tif((saveBuf.length()>10)\n\t\t&&(saveBuf.substring(0,8).trim().toUpperCase().startsWith("<ITEM>")))\n\t\t{\n\t\t\tsaveBuf.insert(0, "<ITEMS>");\n\t\t\tsaveBuf.append("</ITEMS>");\n\t\t}\n\t\tCMFile file = new CMFile((saveToVFS?"::":"//")+Resources.buildResourcePath("skills")+recipeFilename,null,CMFile.FLAG_LOGERRORS);\n\t\tif(!file.canWrite())\n\t\t\tLog.errOut("CMAbleParms","File: "+recipeFilename+" can not be written");\n\t\telse\n\t\tif((!file.exists())||(!file.text().equals(saveBuf)))\n\t\t{\n\t\t\tfile.saveText(saveBuf);\n\t\t\tif(!saveToVFS)\n\t\t\t{\n\t\t\t\tfile = new CMFile("::"+Resources.buildResourcePath("skills")+recipeFilename,null,CMFile.FLAG_LOGERRORS);\n\t\t\t\tif((file.exists())&&(file.canWrite()))\n\t\t\t\t{\n\t\t\t\t\tfile.saveText(saveBuf);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mob != null)\n\t\t\t\tLog.sysOut("CMAbleParms","User: "+mob.Name()+" modified "+(saveToVFS?"VFS":"Local")+" file "+recipeFilename);\n\t\t\tResources.removeResource("PARSED_RECIPE: "+recipeFilename);\n\t\t\tResources.removeMultiLists(recipeFilename);\n\t\t}\n\t}\n\n\tprotected static int getAppropriateResourceBucket(final Item I, final Object A)\n\t{\n\t\tfinal int myMaterial = ((I.material() & RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_MITHRIL) ? RawMaterial.MATERIAL_METAL : (I.material() & RawMaterial.MATERIAL_MASK);\n\t\tif(A instanceof Behavior)\n\t\t\treturn CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_LEATHER, RawMaterial.MATERIAL_VEGETATION}, myMaterial );\n\t\tif(A instanceof Ability)\n\t\t{\n\t\t\tswitch(((Ability)A).abilityCode() & Ability.ALL_ACODES)\n\t\t\t{\n\t\t\t\tcase Ability.ACODE_CHANT:\n\t\t\t\t\treturn CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_VEGETATION, RawMaterial.MATERIAL_ROCK}, myMaterial );\n\t\t\t\tcase Ability.ACODE_SPELL:\n\t\t\t\t\treturn CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_WOODEN, RawMaterial.MATERIAL_PRECIOUS}, myMaterial );\n\t\t\t\tcase Ability.ACODE_PRAYER:\n\t\t\t\t\treturn CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_METAL, RawMaterial.MATERIAL_ROCK}, myMaterial );\n\t\t\t\tcase Ability.ACODE_SONG:\n\t\t\t\t\treturn CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_LIQUID, RawMaterial.MATERIAL_WOODEN}, myMaterial );\n\t\t\t\tcase Ability.ACODE_THIEF_SKILL:\n\t\t\t\tcase Ability.ACODE_SKILL:\n\t\t\t\t\treturn CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_CLOTH, RawMaterial.MATERIAL_METAL}, myMaterial );\n\t\t\t\tcase Ability.ACODE_PROPERTY:\n\t\t\t\t\tif(A instanceof TriggeredAffect)\n\t\t\t\t\t\treturn CMLib.dice().pick( new int[]{RawMaterial.MATERIAL_PRECIOUS, RawMaterial.MATERIAL_METAL}, myMaterial );\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn CMLib.dice().pick( ALL_BUCKET_MATERIAL_CHOICES, myMaterial );\n\t}\n\n\tprotected static void addExtraMaterial(final Map<Integer,int[]> extraMatsM, final Item I, final Object A, double weight)\n\t{\n\t\tint times = 1;\n\t\tif(weight >= 1.0)\n\t\t{\n\t\t\ttimes = (int)Math.round(weight / 1.0);\n\t\t\tweight=.99;\n\t\t}\n\t\tfinal MaterialLibrary mats=CMLib.materials();\n\t\tfinal int myBucket = getAppropriateResourceBucket(I,A);\n\t\tif(myBucket != RawMaterial.RESOURCE_NOTHING)\n\t\t{\n\t\t\tfinal PairList<Integer,Double> bucket = RawMaterial.CODES.instance().getValueSortedResources(myBucket);\n\t\t\tInteger resourceCode = (bucket.size()==0)\n\t\t\t\t\t? Integer.valueOf(CMLib.dice().pick( RawMaterial.CODES.ALL(), I.material() ))\n\t\t\t\t\t: bucket.get( (weight>=.99) ? bucket.size()-1 : 0 ).first;\n\t\t\tfor (final Pair<Integer, Double> p : bucket)\n\t\t\t{\n\t\t\t\tif((weight <= p.second.doubleValue())&&(mats.isResourceCodeRoomMapped(p.first.intValue())))\n\t\t\t\t{\n\t\t\t\t\tresourceCode = p.first;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint tries=100;\n\t\t\twhile((--tries>0)&&(!mats.isResourceCodeRoomMapped(resourceCode.intValue())))\n\t\t\t\tresourceCode=bucket.get(CMLib.dice().roll(1, bucket.size(), -1)).first;\n\t\t\tresourceCode = Integer.valueOf( resourceCode.intValue() );\n\t\t\tfor(int x=0;x<times;x++)\n\t\t\t{\n\t\t\t\tfinal int[] amt = extraMatsM.get( resourceCode );\n\t\t\t\tif(amt == null)\n\t\t\t\t\textraMatsM.put( resourceCode, new int[]{1} );\n\t\t\t\telse\n\t\t\t\t\tamt[0]++;\n\t\t\t}\n\t\t}\n\t}\n\n\t@SuppressWarnings("unchecked")\n\tprotected static Pair<String[],String[]> getBuildingCodesNFlags()\n\t{\n\t\tPair<String[],String[]> codesFlags = (Pair<String[],String[]>)Resources.getResource("BUILDING_SKILL_CODES_FLAGS");\n\t\tif(codesFlags == null)\n\t\t{\n\t\t\tRecipeDriven A=(RecipeDriven)CMClass.getAbility("Masonry");\n\t\t\tif(A==null)\n\t\t\t\tA=(RecipeDriven)CMClass.getAbility("Construction");\n\t\t\tif(A==null)\n\t\t\t\tA=(RecipeDriven)CMClass.getAbility("Excavation");\n\t\t\tif(A!=null)\n\t\t\t\tA.getRecipeFormat();\n\t\t\tcodesFlags = (Pair<String[],String[]>)Resources.getResource("BUILDING_SKILL_CODES_FLAGS");\n\t\t}\n\t\treturn codesFlags;\n\t}\n\n\tprotected static void addExtraAbilityMaterial(final Map<Integer,int[]> extraMatsM, final Item I, final Ability A)\n\t{\n\t\tdouble level = CMLib.ableMapper().lowestQualifyingLevel( A.ID() );\n\t\tif( level <= 0.0 )\n\t\t{\n\t\t\tlevel = I.basePhyStats().level();\n\t\t\tif( level <= 0.0 )\n\t\t\t\tlevel = 1.0;\n\t\t\taddExtraMaterial(extraMatsM, I, A, CMath.div( level, CMProps.getIntVar( CMProps.Int.LASTPLAYERLEVEL ) ));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfinal double levelCap = CMLib.ableMapper().getCalculatedMedianLowestQualifyingLevel();\n\t\t\taddExtraMaterial(extraMatsM, I, A, CMath.div(level , ( levelCap * 2.0)));\n\t\t}\n\t}\n\n\tpublic static Map<Integer,int[]> extraMaterial(final Item I)\n\t{\n\t\tfinal Map<Integer,int[]> extraMatsM=new TreeMap<Integer,int[]>();\n\t\t/*\n\t\t * behaviors/properties of the item\n\t\t */\n\t\tfor(final Enumeration<Ability> a=I.effects(); a.hasMoreElements();)\n\t\t{\n\t\t\tfinal Ability A=a.nextElement();\n\t\t\tif(A.isSavable())\n\t\t\t{\n\t\t\t\tif((A.abilityCode() & Ability.ALL_ACODES) == Ability.ACODE_PROPERTY)\n\t\t\t\t{\n\t\t\t\t\tif(A instanceof AbilityContainer)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor(final Enumeration<Ability> a1=((AbilityContainer)A).allAbilities(); a1.hasMoreElements(); )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\taddExtraAbilityMaterial(extraMatsM,I,a1.nextElement());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(A instanceof TriggeredAffect)\n\t\t\t\t\t{\n\t\t\t\t\t\tif((A.flags() & Ability.FLAG_ADJUSTER) != 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tint count = CMStrings.countSubstrings( new String[]{A.text()}, ADJUSTER_TOKENS );\n\t\t\t\t\t\t\tif(count == 0)\n\t\t\t\t\t\t\t\tcount = 1;\n\t\t\t\t\t\t\tfor(int i=0;i<count;i++)\n\t\t\t\t\t\t\t\taddExtraAbilityMaterial(extraMatsM,I,A);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\tif((A.flags() & (Ability.FLAG_RESISTER | Ability.FLAG_IMMUNER)) != 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tint count = CMStrings.countSubstrings( new String[]{A.text()}, RESISTER_IMMUNER_TOKENS );\n\t\t\t\t\t\t\tif(count == 0)\n\t\t\t\t\t\t\t\tcount = 1;\n\t\t\t\t\t\t\tfor(int i=0;i<count;i++)\n\t\t\t\t\t\t\t\taddExtraAbilityMaterial(extraMatsM,I,A);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif((CMParms.indexOf(ALLOWED_BUCKET_ACODES, A.abilityCode() & Ability.ALL_ACODES ) >=0)\n\t\t\t\t&&(CMParms.indexOf( ALLOWED_BUCKET_QUALITIES, A.abstractQuality()) >=0 ))\n\t\t\t\t{\n\t\t\t\t\taddExtraAbilityMaterial(extraMatsM,I,A);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(final Enumeration<Behavior> b=I.behaviors(); b.hasMoreElements();)\n\t\t{\n\t\t\tfinal Behavior B=b.nextElement();\n\t\t\tif(B.isSavable())\n\t\t\t{\n\t\t\t\taddExtraMaterial(extraMatsM, I, B, CMath.div( CMProps.getIntVar( CMProps.Int.LASTPLAYERLEVEL ), I.basePhyStats().level() ));\n\t\t\t}\n\t\t}\n\t\treturn extraMatsM;\n\t}\n\n\t@Override\n\tpublic synchronized Map<String,AbilityParmEditor> getEditors()\n\t{\n\t\tif(DEFAULT_EDITORS != null)\n\t\t\treturn DEFAULT_EDITORS;\n\n\t\tfinal Vector<AbilityParmEditorImpl> V=new XVector<AbilityParmEditorImpl>(new AbilityParmEditorImpl[]\n\t\t{\n\t\t\tnew AbilityParmEditorImpl("SPELL_ID","The Spell ID",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(CMClass.abilities());\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "Spell_ID";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Potion)\n\t\t\t\t\t\treturn ((Potion)I).getSpellList();\n\t\t\t\t\telse\n\t\t\t\t\tif((I instanceof Scroll)\n\t\t\t\t\t&&(I instanceof MiscMagic))\n\t\t\t\t\t\treturn ((Scroll)I).getSpellList();\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("RESOURCE_NAME","Resource",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(RawMaterial.CODES.NAMES());\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "IRON";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn RawMaterial.CODES.NAME(I.material());\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ITEM_NAME","Item Final Name",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "Item Name";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int minColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 10;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tfinal String oldName=CMStrings.removeColors(I.Name());\n\t\t\t\t\tif(I.material()==RawMaterial.RESOURCE_GLASS)\n\t\t\t\t\t\treturn CMLib.english().removeArticleLead(oldName);\n\n\t\t\t\t\tString newName=oldName;\n\t\t\t\t\tfinal List<String> V=CMParms.parseSpaces(oldName,true);\n\t\t\t\t\tfor(int i=0;i<V.size();i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String s=V.get(i);\n\t\t\t\t\t\tfinal int code=RawMaterial.CODES.FIND_IgnoreCase(s);\n\t\t\t\t\t\tif((code>0)&&(code==I.material()))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tV.set(i, "%");\n\t\t\t\t\t\t\tif((i>0)&&(CMLib.english().isAnArticle(V.get(i-1))))\n\t\t\t\t\t\t\t\tV.remove(i-1);\n\t\t\t\t\t\t\tnewName=CMParms.combine(V);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(oldName.equals(newName))\n\t\t\t\t\t{\n\t\t\t\t\t\tfor(int i=0;i<V.size();i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal String s=V.get(i);\n\t\t\t\t\t\t\tfinal int code=RawMaterial.CODES.FIND_IgnoreCase(s);\n\t\t\t\t\t\t\tif(code>0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tV.set(i, "%");\n\t\t\t\t\t\t\t\tif((i>0)&&(CMLib.english().isAnArticle(V.get(i-1))))\n\t\t\t\t\t\t\t\t\tV.remove(i-1);\n\t\t\t\t\t\t\t\tnewName=CMParms.combine(V);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(newName.indexOf( \'%\' )<0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor(int i=0;i<V.size()-1;i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(CMLib.english().isAnArticle( V.get( i ) ))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(i==0)\n\t\t\t\t\t\t\t\t\tV.set( i, "%" );\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tV.add(i+1, "%");\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnewName=CMParms.combine( V );\n\t\t\t\t\t}\n\t\t\t\t\tif(newName.indexOf( \'%\' )<0)\n\t\t\t\t\t{\n\t\t\t\t\t\tnewName="% "+newName;\n\t\t\t\t\t}\n\t\t\t\t\treturn newName;\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("COLOR_TERM","Color term",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "color name";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int minColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 5;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ACTIVE_VERB","Active Verb",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "verbing";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int minColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 3;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("DISPLAY_MASK","Display Mask",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "@x1 is here";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int minColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 3;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn CMStrings.replaceAll(I.displayText(), I.Name(), "@x1");\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("COLOR_MASK","Color mask",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.length()>0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor(int i=0;i<oldVal.length();i++)\n\t\t\t\t\t\t\tif("0123cCwWeEFm-*|".indexOf(oldVal.charAt(i))<0)\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int minColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 5;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("EXPERTISENUM","Expertise#",ParmType.NUMBERORNULL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int minColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 5;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("STAIRS_DESC","Exit Desc",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof String)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String chk=((String)o).toUpperCase();\n\t\t\t\t\t\tif(chk.equals("STAIRS"))\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "@x1stairs to the @x2 floor";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("BUILDING_NOUN","Building noun",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "thing";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("BUILDER_MASK","Builder Mask",ParmType.STRINGORNULL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("BUILDER_DESC","Info Description",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int maxColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 20;\n\t\t\t\t}\n\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("RES_SUBTYPE","Sub-Type",ParmType.STRINGORNULL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof RawMaterial)\n\t\t\t\t\t\treturn 5;\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof RawMaterial)\n\t\t\t\t\t\treturn ((RawMaterial)I).getSubType();\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag)\n\t\t\t\tthrows java.io.IOException\n\t\t\t\t{\n\t\t\t\t\treturn super.commandLinePrompt(mob, oldVal, showNumber, showFlag).toUpperCase().trim();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\treturn super.webValue(httpReq,parms,oldVal,fieldName).toUpperCase().trim();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ITEM_LEVEL","Lvl",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif((I instanceof Weapon)||(I instanceof Armor))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int timsLevel = CMLib.itemBuilder().timsLevelCalculator(I);\n\t\t\t\t\t\tif((timsLevel > I.basePhyStats().level() ) && (timsLevel < CMProps.getIntVar(CMProps.Int.LASTPLAYERLEVEL)))\n\t\t\t\t\t\t\treturn ""+timsLevel;\n\t\t\t\t\t}\n\t\t\t\t\treturn ""+I.basePhyStats().level();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("BUILDING_GRID_SIZE","Grid Size",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof String)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String chk=((String)o).toUpperCase();\n\t\t\t\t\t\tif(chk.equals("ROOM"))\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("BUILD_TIME_TICKS","Time",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "20";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn ""+(10 + (I.basePhyStats().level()/2));\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("XLEVEL","Expertise Level",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "0";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "0";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("FUTURE_USE","Future Use",ParmType.STRINGORNULL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("AMOUNT_MATERIAL_REQUIRED","Amt",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "10";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn ""+Math.round(CMath.mul(I.basePhyStats().weight(),(A!=null)?A.getItemWeightMultiplier(false):1.0));\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("MATERIALS_REQUIRED","Amount/Cmp",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_WHICH"))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String which=httpReq.getUrlParameter(fieldName+"_WHICH");\n\t\t\t\t\t\tif((which.trim().length()==0)||(which.trim().equalsIgnoreCase("AMOUNT")))\n\t\t\t\t\t\t\treturn httpReq.getUrlParameter(fieldName+"_AMOUNT");\n\t\t\t\t\t\tif(which.trim().equalsIgnoreCase("COMPONENT"))\n\t\t\t\t\t\t\treturn httpReq.getUrlParameter(fieldName+"_COMPONENT");\n\t\t\t\t\t\tint x=1;\n\t\t\t\t\t\tfinal List<AbilityComponent> comps=new Vector<AbilityComponent>();\n\t\t\t\t\t\twhile(httpReq.isUrlParameter(fieldName+"_CUST_TYPE_"+x))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tString connector=httpReq.getUrlParameter(fieldName+"_CUST_CONN_"+x);\n\t\t\t\t\t\t\tfinal String amt=httpReq.getUrlParameter(fieldName+"_CUST_AMT_"+x);\n\t\t\t\t\t\t\tfinal String strVal=httpReq.getUrlParameter(fieldName+"_CUST_STR_"+x);\n\t\t\t\t\t\t\tfinal String loc=httpReq.getUrlParameter(fieldName+"_CUST_LOC_"+x);\n\t\t\t\t\t\t\tfinal String def=httpReq.getUrlParameter(fieldName+"_CUST_DEF_"+x);\n\t\t\t\t\t\t\tfinal String typ=httpReq.getUrlParameter(fieldName+"_CUST_TYPE_"+x);\n\t\t\t\t\t\t\tfinal String styp=httpReq.getUrlParameter(fieldName+"_CUST_STYPE_"+x);\n\t\t\t\t\t\t\tfinal String con=httpReq.getUrlParameter(fieldName+"_CUST_CON_"+x);\n\t\t\t\t\t\t\tif(connector==null)\n\t\t\t\t\t\t\t\tconnector="AND";\n\t\t\t\t\t\t\tif(connector.equalsIgnoreCase("DEL")||(connector.length()==0))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tx++;\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttry\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfinal AbilityComponent able=CMLib.ableComponents().createBlankAbilityComponent("");\n\t\t\t\t\t\t\t\table.setConnector(AbilityComponent.CompConnector.valueOf(connector));\n\t\t\t\t\t\t\t\table.setAmount(CMath.s_int(amt));\n\t\t\t\t\t\t\t\table.setMask((def==null)?"":def);\n\t\t\t\t\t\t\t\table.setTriggererDef("");\n\t\t\t\t\t\t\t\table.setConsumed((con!=null) && con.equalsIgnoreCase("on"));\n\t\t\t\t\t\t\t\table.setLocation(AbilityComponent.CompLocation.valueOf(loc));\n\t\t\t\t\t\t\t\tif(CMath.s_valueOf(AbilityComponent.CompType.class, typ)!=null)\n\t\t\t\t\t\t\t\t\table.setType(AbilityComponent.CompType.valueOf(typ), strVal, styp);\n\t\t\t\t\t\t\t\tcomps.add(able);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch(final Exception e)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tx++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(comps.size()>0)\n\t\t\t\t\t\t\treturn CMLib.ableComponents().getAbilityComponentCodedString(comps);\n\t\t\t\t\t}\n\t\t\t\t\treturn oldVal;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tint amt=(int)Math.round(CMath.mul(I.basePhyStats().weight()-1,(A!=null)?A.getItemWeightMultiplier(false):1.0));\n\t\t\t\t\tif(amt<1)\n\t\t\t\t\t\tamt=1;\n\t\t\t\t\tfinal Map<Integer,int[]> extraMatsM = CMAbleParms.extraMaterial( I );\n\t\t\t\t\tif((extraMatsM == null) || (extraMatsM.size()==0))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn ""+amt;\n\t\t\t\t\t}\n\t\t\t\t\tfinal String subType = (I instanceof RawMaterial)?((RawMaterial)I).getSubType():"";\n\t\t\t\t\tfinal List<AbilityComponent> comps=new Vector<AbilityComponent>();\n\t\t\t\t\tAbilityComponent able=CMLib.ableComponents().createBlankAbilityComponent("");\n\t\t\t\t\table.setConnector(AbilityComponent.CompConnector.AND);\n\t\t\t\t\table.setAmount(amt);\n\t\t\t\t\table.setMask("");\n\t\t\t\t\table.setTriggererDef("");\n\t\t\t\t\table.setConsumed(true);\n\t\t\t\t\table.setLocation(AbilityComponent.CompLocation.ONGROUND);\n\t\t\t\t\table.setType(AbilityComponent.CompType.MATERIAL, Integer.valueOf(I.material() & RawMaterial.MATERIAL_MASK), subType);\n\t\t\t\t\tcomps.add(able);\n\t\t\t\t\tfor(final Integer resourceCode : extraMatsM.keySet())\n\t\t\t\t\t{\n\t\t\t\t\t\table=CMLib.ableComponents().createBlankAbilityComponent("");\n\t\t\t\t\t\table.setConnector(AbilityComponent.CompConnector.AND);\n\t\t\t\t\t\table.setAmount(extraMatsM.get(resourceCode)[0]);\n\t\t\t\t\t\table.setMask("");\n\t\t\t\t\t\table.setTriggererDef("");\n\t\t\t\t\t\table.setConsumed(true);\n\t\t\t\t\t\table.setLocation(AbilityComponent.CompLocation.ONGROUND);\n\t\t\t\t\t\table.setType(AbilityComponent.CompType.RESOURCE, resourceCode, "");\n\t\t\t\t\t\tcomps.add(able);\n\t\t\t\t\t}\n\t\t\t\t\treturn CMLib.ableComponents().getAbilityComponentCodedString(comps);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tString value=webValue(httpReq,parms,oldVal,fieldName);\n\t\t\t\t\tif(value.endsWith("$"))\n\t\t\t\t\t\tvalue = value.substring(0,oldVal.length()-1);\n\t\t\t\t\tvalue = value.trim();\n\t\t\t\t\tfinal String curWhich=httpReq.getUrlParameter(fieldName+"_WHICH");\n\t\t\t\t\tint type=0;\n\t\t\t\t\tif("COMPONENT".equalsIgnoreCase(curWhich))\n\t\t\t\t\t\ttype=1;\n\t\t\t\t\telse\n\t\t\t\t\tif("EMBEDDED".equalsIgnoreCase(curWhich))\n\t\t\t\t\t\ttype=2;\n\t\t\t\t\telse\n\t\t\t\t\tif("AMOUNT".equalsIgnoreCase(curWhich))\n\t\t\t\t\t\ttype=0;\n\t\t\t\t\telse\n\t\t\t\t\tif(CMLib.ableComponents().getAbilityComponentMap().containsKey(value.toUpperCase().trim()))\n\t\t\t\t\t\ttype=1;\n\t\t\t\t\telse\n\t\t\t\t\tif(value.startsWith("("))\n\t\t\t\t\t\ttype=2;\n\t\t\t\t\telse\n\t\t\t\t\t\ttype=0;\n\n\t\t\t\t\tList<AbilityComponent> comps=null;\n\t\t\t\t\tif(type==2)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Hashtable<String,List<AbilityComponent>> H=new Hashtable<String,List<AbilityComponent>>();\n\t\t\t\t\t\tfinal String s="ID="+value;\n\t\t\t\t\t\tCMLib.ableComponents().addAbilityComponent(s, H);\n\t\t\t\t\t\tcomps=H.get("ID");\n\t\t\t\t\t}\n\t\t\t\t\tif(comps==null)\n\t\t\t\t\t\tcomps=new ArrayList<AbilityComponent>(1);\n\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("<FONT SIZE=-1>");\n\t\t\t\t\tstr.append("<INPUT TYPE=RADIO NAME="+fieldName+"_WHICH "+(type==0?"CHECKED ":"")+"VALUE=\\"AMOUNT\\">");\n\t\t\t\t\tstr.append("\\n\\rAmount: <INPUT TYPE=TEXT SIZE=3 NAME="+fieldName+"_AMOUNT VALUE=\\""+(type!=0?"":value)+"\\"  ONKEYDOWN=\\"document.RESOURCES."+fieldName+"_WHICH[0].checked=true;\\">");\n\t\t\t\t\tstr.append("\\n\\r<BR>");\n\t\t\t\t\tstr.append("<INPUT TYPE=RADIO NAME="+fieldName+"_WHICH "+(type==1?"CHECKED ":"")+"VALUE=\\"COMPONENT\\">");\n\t\t\t\t\tstr.append(L("\\n\\rSkill Components:"));\n\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+"_COMPONENT ONCHANGE=\\"document.RESOURCES."+fieldName+"_WHICH[1].checked=true;\\">");\n\t\t\t\t\tstr.append("<OPTION VALUE=\\"0\\"");\n\t\t\t\t\tif((type!=1)||(value.length()==0)||(value.equalsIgnoreCase("0")))\n\t\t\t\t\t\tstr.append(" SELECTED");\n\t\t\t\t\tstr.append(">&nbsp;");\n\t\t\t\t\tfor(final String S : CMLib.ableComponents().getAbilityComponentMap().keySet())\n\t\t\t\t\t{\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+S+"\\"");\n\t\t\t\t\t\tif((type==1)&&(value.equalsIgnoreCase(S)))\n\t\t\t\t\t\t\tstr.append(" SELECTED");\n\t\t\t\t\t\tstr.append(">"+S);\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\tstr.append("\\n\\r<BR>");\n\t\t\t\t\tstr.append("<INPUT TYPE=RADIO NAME="+fieldName+"_WHICH "+(type==2?"CHECKED ":"")+"VALUE=\\"EMBEDDED\\">");\n\t\t\t\t\tstr.append("\\n\\rCustom:");\n\t\t\t\t\tstr.append("\\n\\r<BR>");\n\t\t\t\t\tAbilityComponent comp;\n\t\t\t\t\tfor(int i=0;i<=comps.size();i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcomp=(i<comps.size())?comps.get(i):null;\n\t\t\t\t\t\tif(i>0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+"_CUST_CONN_"+(i+1)+" ONCHANGE=\\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\\">");\n\t\t\t\t\t\t\tif(comp!=null)\n\t\t\t\t\t\t\t\tstr.append("<OPTION VALUE=\\"DEL\\">DEL");\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif(type==2)\n\t\t\t\t\t\t\t\tstr.append("<OPTION VALUE=\\"\\" SELECTED>");\n\t\t\t\t\t\t\tfor(final AbilityComponent.CompConnector conector : AbilityComponent.CompConnector.values())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+conector.toString()+"\\" ");\n\t\t\t\t\t\t\t\tif((type==2)&&(comp!=null)&&(conector==comp.getConnector()))\n\t\t\t\t\t\t\t\t\tstr.append("SELECTED ");\n\t\t\t\t\t\t\t\tstr.append(">"+CMStrings.capitalizeAndLower(conector.toString()));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr.append("\\n\\rAmt: <INPUT TYPE=TEXT SIZE=2 NAME="+fieldName+"_CUST_AMT_"+(i+1)+" VALUE=\\""+(((type!=2)||(comp==null))?"":Integer.toString(comp.getAmount()))+"\\"  ONKEYDOWN=\\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\\">");\n\t\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+"_CUST_TYPE_"+(i+1)+" ONCHANGE=\\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true; ReShow();\\">");\n\t\t\t\t\t\tfinal AbilityComponent.CompType compType=(comp!=null)?comp.getType():AbilityComponent.CompType.STRING;\n\t\t\t\t\t\tfinal String subType=(comp != null)?comp.getSubType():"";\n\t\t\t\t\t\tfor(final AbilityComponent.CompType conn : AbilityComponent.CompType.values())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+conn.toString()+"\\" ");\n\t\t\t\t\t\t\tif(conn==compType)\n\t\t\t\t\t\t\t\tstr.append("SELECTED ");\n\t\t\t\t\t\t\tstr.append(">"+CMStrings.capitalizeAndLower(conn.toString()));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\t\tif(compType==AbilityComponent.CompType.STRING)\n\t\t\t\t\t\t\tstr.append("\\n\\r<INPUT TYPE=TEXT SIZE=10 NAME="+fieldName+"_CUST_STR_"+(i+1)+" VALUE=\\""+(((type!=2)||(comp==null))?"":comp.getStringType())+"\\"  ONKEYDOWN=\\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\\">");\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+"_CUST_STR_"+(i+1)+" ONCHANGE=\\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\\">");\n\t\t\t\t\t\t\tif(compType==AbilityComponent.CompType.MATERIAL)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfinal RawMaterial.Material[] M=RawMaterial.Material.values();\n\t\t\t\t\t\t\t\tArrays.sort(M,new Comparator<RawMaterial.Material>()\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\tpublic int compare(final Material o1, final Material o2)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\treturn o1.name().compareToIgnoreCase(o2.name());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tfor(final RawMaterial.Material m : M)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tstr.append("<OPTION VALUE="+m.mask());\n\t\t\t\t\t\t\t\t\tif((type==2)&&(comp!=null)&&(m.mask()==comp.getLongType()))\n\t\t\t\t\t\t\t\t\t\tstr.append(" SELECTED");\n\t\t\t\t\t\t\t\t\tstr.append(">"+m.noun());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif(compType==AbilityComponent.CompType.RESOURCE)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfinal List<Pair<String,Integer>> L=new Vector<Pair<String,Integer>>();\n\t\t\t\t\t\t\t\tfor(int x=0;x<RawMaterial.CODES.TOTAL();x++)\n\t\t\t\t\t\t\t\t\tL.add(new Pair<String,Integer>(RawMaterial.CODES.NAME(x),Integer.valueOf(RawMaterial.CODES.GET(x))));\n\t\t\t\t\t\t\t\tCollections.sort(L,new Comparator<Pair<String,Integer>>()\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\tpublic int compare(final Pair<String, Integer> o1, final Pair<String, Integer> o2)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\treturn o1.first.compareToIgnoreCase(o2.first);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tfor(final Pair<String,Integer> p : L)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tstr.append("<OPTION VALUE="+p.second);\n\t\t\t\t\t\t\t\t\tif((type==2)&&(comp!=null)&&(p.second.longValue()==comp.getLongType()))\n\t\t\t\t\t\t\t\t\t\tstr.append(" SELECTED");\n\t\t\t\t\t\t\t\t\tstr.append(">"+p.first);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\t\t\tstr.append(" <INPUT TYPE=TEXT SIZE=2 NAME="+fieldName+"_CUST_STYPE_"+(i+1)+" VALUE=\\""+subType+"\\">");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+"_CUST_LOC_"+(i+1)+" ONCHANGE=\\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\\">");\n\t\t\t\t\t\tfor(final AbilityComponent.CompLocation conn : AbilityComponent.CompLocation.values())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+conn.toString()+"\\" ");\n\t\t\t\t\t\t\tif((type==2)&&(comp!=null)&&(conn==comp.getLocation()))\n\t\t\t\t\t\t\t\tstr.append("SELECTED ");\n\t\t\t\t\t\t\tstr.append(">"+CMStrings.capitalizeAndLower(conn.toString()));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\t\tstr.append("\\n\\rConsumed:<INPUT TYPE=CHECKBOX NAME="+fieldName+"_CUST_CON_"+(i+1)+" "+((type!=2)||(comp==null)||(!comp.isConsumed())?"":"CHECKED")+"  ONCLICK=\\"document.RESOURCES."+fieldName+"_WHICH[2].checked=true;\\">");\n\t\t\t\t\t\tif(i<comps.size())\n\t\t\t\t\t\t\tstr.append("\\n\\r<BR>\\n\\r");\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstr.append("\\n\\r<a href=\\"javascript:ReShow();\\">&lt;*&gt;</a>\\n\\r");\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("<BR>");\n\t\t\t\t\tstr.append("</FONT>");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn new String[] { oldVal };\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\t++showNumber[0];\n\t\t\t\t\tString str = oldVal;\n\t\t\t\t\twhile(!mob.session().isStopped())\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String help="<AMOUNT>"\n\t\t\t\t\t\t\t+"\\n\\rSkill Component: "+CMParms.toListString(CMLib.ableComponents().getAbilityComponentMap().keySet())\n\t\t\t\t\t\t\t+"\\n\\rCustom Component: ([DISPOSITION]:[FATE]:[AMOUNT]:[COMPONENT ID]:[MASK]) && ...";\n\t\t\t\t\t\tstr=CMLib.genEd().prompt(mob,oldVal,showNumber[0],showFlag,prompt(),true,help).trim();\n\t\t\t\t\t\tif(str.equals(oldVal))\n\t\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t\tif(CMath.isInteger(str))\n\t\t\t\t\t\t\treturn Integer.toString(CMath.s_int(str));\n\t\t\t\t\t\tif(CMLib.ableComponents().getAbilityComponentMap().containsKey(str.toUpperCase().trim()))\n\t\t\t\t\t\t\treturn str.toUpperCase().trim();\n\t\t\t\t\t\tString error=null;\n\t\t\t\t\t\tif(str.trim().startsWith("("))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\terror=CMLib.ableComponents().addAbilityComponent("ID="+str, new Hashtable<String,List<AbilityComponent>>());\n\t\t\t\t\t\t\tif(error==null)\n\t\t\t\t\t\t\t\treturn str;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmob.session().println(L("\'@x1\' is not an amount of material, a component key, or custom component list@x2.  Please use ? for help.",str,(error==null?"":"("+error+")")));\n\t\t\t\t\t}\n\t\t\t\t\treturn str;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("OPTIONAL_AMOUNT_REQUIRED","Amt",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ITEM_BASE_VALUE","Value",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "5";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn ""+I.baseGoldValue();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ROOM_CLASS_ID","Class ID",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof String)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String chk=((String)o).toUpperCase();\n\t\t\t\t\t\tif(chk.equalsIgnoreCase("ROOM")\n\t\t\t\t\t\t||chk.equalsIgnoreCase("EXCAVATE"))\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tfinal Vector<Environmental> V  = new Vector<Environmental>();\n\t\t\t\t\tV.addAll(new XVector<Room>(CMClass.locales()));\n\t\t\t\t\tcreateChoices(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "Plains";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ALLITEM_CLASS_ID","Class ID",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof String)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String chk=((String)o).toUpperCase();\n\t\t\t\t\t\tif(chk.equalsIgnoreCase("ITEM"))\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tfinal XVector<Environmental> V  = new XVector<Environmental>();\n\t\t\t\t\tV.addAll(CMClass.basicItems());\n\t\t\t\t\tV.addAll(CMClass.weapons());\n\t\t\t\t\tV.addAll(CMClass.tech());\n\t\t\t\t\tV.addAll(CMClass.armor());\n\t\t\t\t\tV.addAll(CMClass.miscMagic());\n\t\t\t\t\tV.addAll(CMClass.clanItems());\n\t\t\t\t\tfor(int i=V.size()-1;i<=0;i--)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(V.get(i) instanceof CMObjectWrapper)\n\t\t\t\t\t\t\tV.remove(i);\n\t\t\t\t\t}\n\t\t\t\t\tcreateChoices(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "StdItem";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ROOM_CLASS_ID_OR_NONE","Class ID",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof String)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String chk=((String)o).toUpperCase();\n\t\t\t\t\t\tif(chk.equalsIgnoreCase("DEMOLISH")\n\t\t\t\t\t\t||chk.equalsIgnoreCase("STAIRS"))\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tfinal Vector<Object> V  = new Vector<Object>();\n\t\t\t\t\tV.add("");\n\t\t\t\t\tV.addAll(new XVector<Room>(CMClass.locales()));\n\t\t\t\t\tcreateChoices(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("EXIT_CLASS_ID","Class ID",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof String)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String chk=((String)o).toUpperCase();\n\t\t\t\t\t\tif(chk.equalsIgnoreCase("DOOR"))\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tfinal Vector<Environmental> V  = new Vector<Environmental>();\n\t\t\t\t\tV.addAll(new XVector<Exit>(CMClass.exits()));\n\t\t\t\t\tfinal Vector<CMObject> V2=new Vector<CMObject>();\n\t\t\t\t\tEnvironmental I;\n\t\t\t\t\tfor(final Enumeration<Environmental> e=V.elements();e.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tI=e.nextElement();\n\t\t\t\t\t\tif(I.isGeneric())\n\t\t\t\t\t\t\tV2.addElement(I);\n\t\t\t\t\t}\n\t\t\t\t\tcreateChoices(V2);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "GenExit";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ITEM_CLASS_ID","Class ID",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tfinal List<Item> V  = new ArrayList<Item>();\n\t\t\t\t\tV.addAll(new XVector<ClanItem>(CMClass.clanItems()));\n\t\t\t\t\tV.addAll(new XVector<Armor>(CMClass.armor()));\n\t\t\t\t\tV.addAll(new XVector<Item>(CMClass.basicItems()));\n\t\t\t\t\tV.addAll(new XVector<MiscMagic>(CMClass.miscMagic()));\n\t\t\t\t\tV.addAll(new XVector<Technical>(CMClass.tech()));\n\t\t\t\t\tV.addAll(new XVector<Weapon>(CMClass.weapons()));\n\t\t\t\t\tfinal List<Item> V2=new ArrayList<Item>();\n\t\t\t\t\tItem I;\n\t\t\t\t\tfor(final Iterator<Item> e=V.iterator();e.hasNext();)\n\t\t\t\t\t{\n\t\t\t\t\t\tI=e.next();\n\t\t\t\t\t\tif(I.isGeneric() || I.ID().equalsIgnoreCase("StdDeckOfCards"))\n\t\t\t\t\t\t\tV2.add(I);\n\t\t\t\t\t}\n\t\t\t\t\tfor(int i=V.size()-1;i<=0;i--)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(V.get(i) instanceof CMObjectWrapper)\n\t\t\t\t\t\t\tV.remove(i);\n\t\t\t\t\t}\n\t\t\t\t\tcreateChoices(V2);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I.isGeneric())\n\t\t\t\t\t\treturn I.ID();\n\t\t\t\t\tif(I instanceof Weapon)\n\t\t\t\t\t\treturn "GenWeapon";\n\t\t\t\t\tif(I instanceof Armor)\n\t\t\t\t\t\treturn "GenArmor";\n\t\t\t\t\tif(I instanceof Rideable)\n\t\t\t\t\t\treturn "GenRideable";\n\t\t\t\t\treturn "GenItem";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "GenItem";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("CODED_WEAR_LOCATION","Wear Locs",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof FalseLimb)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\treturn ((o instanceof Armor) || (o instanceof MusicalInstrument)) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn oldVal.trim().length() > 0;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "NECK";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal short[] layerAtt = new short[1];\n\t\t\t\t\tfinal short[] layers = new short[1];\n\t\t\t\t\tfinal long[] wornLoc = new long[1];\n\t\t\t\t\tfinal boolean[] logicalAnd = new boolean[1];\n\t\t\t\t\tfinal double[] hardBonus=new double[1];\n\t\t\t\t\tCMLib.ableParms().parseWearLocation(layerAtt,layers,wornLoc,logicalAnd,hardBonus,oldVal);\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_WORNDATA"))\n\t\t\t\t\t{\n\t\t\t\t\t\twornLoc[0]=CMath.s_long(httpReq.getUrlParameter(fieldName+"_WORNDATA"));\n\t\t\t\t\t\tfor(int i=1;;i++)\n\t\t\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_WORNDATA"+(Integer.toString(i))))\n\t\t\t\t\t\t\t\twornLoc[0]=wornLoc[0]|CMath.s_long(httpReq.getUrlParameter(fieldName+"_WORNDATA"+(Integer.toString(i))));\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tlogicalAnd[0] = httpReq.getUrlParameter(fieldName+"_ISTWOHANDED").equalsIgnoreCase("on");\n\t\t\t\t\t\tlayers[0] = CMath.s_short(httpReq.getUrlParameter(fieldName+"_LAYER"));\n\t\t\t\t\t\tlayerAtt[0] = 0;\n\t\t\t\t\t\tif((httpReq.isUrlParameter(fieldName+"_SEETHRU"))\n\t\t\t\t\t\t&&(httpReq.getUrlParameter(fieldName+"_SEETHRU").equalsIgnoreCase("on")))\n\t\t\t\t\t\t\tlayerAtt[0] |= Armor.LAYERMASK_SEETHROUGH;\n\t\t\t\t\t\tif((httpReq.isUrlParameter(fieldName+"_MULTIWEAR"))\n\t\t\t\t\t\t&&(httpReq.getUrlParameter(fieldName+"_MULTIWEAR").equalsIgnoreCase("on")))\n\t\t\t\t\t\t\tlayerAtt[0] |= Armor.LAYERMASK_MULTIWEAR;\n\t\t\t\t\t}\n\t\t\t\t\treturn reconvert(layerAtt,layers,wornLoc,logicalAnd,hardBonus);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal String value = webValue(httpReq,parms,oldVal,fieldName);\n\t\t\t\t\tfinal short[] layerAtt = new short[1];\n\t\t\t\t\tfinal short[] layers = new short[1];\n\t\t\t\t\tfinal long[] wornLoc = new long[1];\n\t\t\t\t\tfinal boolean[] logicalAnd = new boolean[1];\n\t\t\t\t\tfinal double[] hardBonus=new double[1];\n\t\t\t\t\tCMLib.ableParms().parseWearLocation(layerAtt,layers,wornLoc,logicalAnd,hardBonus,value);\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("");\n\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+"_WORNDATA MULTIPLE>");\n\t\t\t\t\tfinal Wearable.CODES codes = Wearable.CODES.instance();\n\t\t\t\t\tfor(int i=1;i<codes.total();i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String climstr=codes.name(i);\n\t\t\t\t\t\tfinal int mask=(int)CMath.pow(2,i-1);\n\t\t\t\t\t\tstr.append("<OPTION VALUE="+mask);\n\t\t\t\t\t\tif((wornLoc[0]&mask)>0)\n\t\t\t\t\t\t\tstr.append(" SELECTED");\n\t\t\t\t\t\tstr.append(">"+climstr);\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\tstr.append("<BR>\\n\\r<INPUT TYPE=RADIO NAME="+fieldName+"_ISTWOHANDED value=\\"on\\" "+(logicalAnd[0]?"CHECKED":"")+">Is worn on All above Locations.");\n\t\t\t\t\tstr.append("<BR>\\n\\r<INPUT TYPE=RADIO NAME="+fieldName+"_ISTWOHANDED value=\\"\\" "+(logicalAnd[0]?"":"CHECKED")+">Is worn on ANY of the above Locations.");\n\t\t\t\t\tstr.append("<BR>\\n\\rLayer: <INPUT TYPE=TEXT NAME="+fieldName+"_LAYER SIZE=5 VALUE=\\""+layers[0]+"\\">");\n\t\t\t\t\tfinal boolean seeThru = CMath.bset(layerAtt[0],Armor.LAYERMASK_SEETHROUGH);\n\t\t\t\t\tfinal boolean multiWear = CMath.bset(layerAtt[0],Armor.LAYERMASK_MULTIWEAR);\n\t\t\t\t\tstr.append("&nbsp;&nbsp;\\n\\r<INPUT TYPE=CHECKBOX NAME="+fieldName+"_SEETHRU value=\\"on\\" "+(seeThru?"CHECKED":"")+">Is see-through.");\n\t\t\t\t\tstr.append("&nbsp;&nbsp;\\n\\r<INPUT TYPE=CHECKBOX NAME="+fieldName+"_MULTIWEAR value=\\"on\\" "+(multiWear?"CHECKED":"")+">Is multi-wear.");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\tpublic String reconvert(final short[] layerAtt, final short[] layers, final long[] wornLoc, final boolean[] logicalAnd, final double[] hardBonus)\n\t\t\t\t{\n\t\t\t\t\tfinal StringBuffer newVal = new StringBuffer("");\n\t\t\t\t\tif((layerAtt[0]!=0)||(layers[0]!=0))\n\t\t\t\t\t{\n\t\t\t\t\t\tif(CMath.bset(layerAtt[0],Armor.LAYERMASK_MULTIWEAR))\n\t\t\t\t\t\t\tnewVal.append(\'M\');\n\t\t\t\t\t\tif(CMath.bset(layerAtt[0],Armor.LAYERMASK_SEETHROUGH))\n\t\t\t\t\t\t\tnewVal.append(\'S\');\n\t\t\t\t\t\tnewVal.append(layers[0]);\n\t\t\t\t\t\tnewVal.append(\':\');\n\t\t\t\t\t}\n\t\t\t\t\tboolean needLink=false;\n\t\t\t\t\tfinal Wearable.CODES codes = Wearable.CODES.instance();\n\t\t\t\t\tfor(int wo=1;wo<codes.total();wo++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(CMath.bset(wornLoc[0],CMath.pow(2,wo-1)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(needLink)\n\t\t\t\t\t\t\t\tnewVal.append(logicalAnd[0]?"&&":"||");\n\t\t\t\t\t\t\tneedLink = true;\n\t\t\t\t\t\t\tnewVal.append(codes.name(wo).toUpperCase());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn newVal.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor C, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(!(I instanceof Armor))\n\t\t\t\t\t\treturn "HELD";\n\t\t\t\t\tfinal Armor A=(Armor)I;\n\t\t\t\t\tfinal boolean[] logicalAnd=new boolean[]{I.rawLogicalAnd()};\n\t\t\t\t\tfinal long[] wornLoc=new long[]{I.rawProperLocationBitmap()};\n\t\t\t\t\tfinal double[] hardBonus=new double[]{0.0};\n\t\t\t\t\tfinal short[] layerAtt=new short[]{A.getLayerAttributes()};\n\t\t\t\t\tfinal short[] layers=new short[]{A.getClothingLayer()};\n\t\t\t\t\treturn reconvert(layerAtt,layers,wornLoc,logicalAnd,hardBonus);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tfinal ArrayList<String> V = new ArrayList<String>();\n\t\t\t\t\tfinal short[] layerAtt = new short[1];\n\t\t\t\t\tfinal short[] layers = new short[1];\n\t\t\t\t\tfinal long[] wornLoc = new long[1];\n\t\t\t\t\tfinal boolean[] logicalAnd = new boolean[1];\n\t\t\t\t\tfinal double[] hardBonus=new double[1];\n\t\t\t\t\tCMLib.ableParms().parseWearLocation(layerAtt,layers,wornLoc,logicalAnd,hardBonus,oldVal);\n\t\t\t\t\tV.add(""+layers[0]);\n\t\t\t\t\tif(CMath.bset(layerAtt[0],Armor.LAYERMASK_SEETHROUGH))\n\t\t\t\t\t\tV.add("Y");\n\t\t\t\t\telse\n\t\t\t\t\t\tV.add("N");\n\t\t\t\t\tif(CMath.bset(layerAtt[0],Armor.LAYERMASK_MULTIWEAR))\n\t\t\t\t\t\tV.add("Y");\n\t\t\t\t\telse\n\t\t\t\t\t\tV.add("N");\n\t\t\t\t\tV.add("1");\n\t\t\t\t\tV.add("1");\n\t\t\t\t\tfinal Wearable.CODES codes = Wearable.CODES.instance();\n\t\t\t\t\tfor(int i=0;i<codes.total();i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(CMath.bset(wornLoc[0],codes.get(i)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tV.add(""+(i+2));\n\t\t\t\t\t\t\tV.add(""+(i+2));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tV.add("0");\n\t\t\t\t\treturn CMParms.toStringArray(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\tfinal short[] layerAtt = new short[1];\n\t\t\t\t\tfinal short[] layers = new short[1];\n\t\t\t\t\tfinal long[] wornLoc = new long[1];\n\t\t\t\t\tfinal boolean[] logicalAnd = new boolean[1];\n\t\t\t\t\tfinal double[] hardBonus=new double[1];\n\t\t\t\t\tCMLib.ableParms().parseWearLocation(layerAtt,layers,wornLoc,logicalAnd,hardBonus,oldVal);\n\t\t\t\t\tCMLib.genEd().wornLayer(mob,layerAtt,layers,++showNumber[0],showFlag);\n\t\t\t\t\tCMLib.genEd().wornLocation(mob,wornLoc,logicalAnd,++showNumber[0],showFlag);\n\t\t\t\t\treturn reconvert(layerAtt,layers,wornLoc,logicalAnd,hardBonus);\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("PAGES_CHARS","Max Pgs/Chrs.",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Book) ? 1 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "1/0";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Book)\n\t\t\t\t\t\treturn ""+((Book)I).getMaxPages()+"/"+((Book)I).getMaxCharsPerPage();\n\t\t\t\t\treturn "1/0";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn oldVal.trim().length() > 0;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tint maxPages=1;\n\t\t\t\t\tint maxCharsPage=0;\n\t\t\t\t\tif(oldVal.length()>0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int x=oldVal.indexOf(\'/\');\n\t\t\t\t\t\tif(x>0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmaxPages=CMath.s_int(oldVal.substring(0,x));\n\t\t\t\t\t\t\tmaxCharsPage=CMath.s_int(oldVal.substring(x+1));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_MAXPAGES"))\n\t\t\t\t\t\tmaxPages = CMath.s_int(httpReq.getUrlParameter(fieldName+"_MAXPAGES"));\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_MAXCHARSPAGE"))\n\t\t\t\t\t\tmaxCharsPage = CMath.s_int(httpReq.getUrlParameter(fieldName+"_MAXCHARSPAGE"));\n\t\t\t\t\treturn ""+maxPages+"/"+maxCharsPage;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal String value = webValue(httpReq, parms, oldVal, fieldName);\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("");\n\t\t\t\t\tstr.append("<TABLE WIDTH=100% BORDER=\\"1\\" CELLSPACING=0 CELLPADDING=0><TR>");\n\t\t\t\t\tfinal String[] vals = this.fakeUserInput(value);\n\t\t\t\t\tstr.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Max Pages")+"</FONT></TD>");\n\t\t\t\t\tstr.append("<TD WIDTH=25%><INPUT TYPE=TEXT SIZE=5 NAME="+fieldName+"_MAXPAGES VALUE=\\""+vals[0]+"\\">");\n\t\t\t\t\tstr.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Max Chars Page")+"</FONT></TD>");\n\t\t\t\t\tstr.append("<TD WIDTH=25%><INPUT TYPE=TEXT SIZE=5 NAME="+fieldName+"_MAXCHARSPAGE VALUE=\\""+vals[1]+"\\">");\n\t\t\t\t\tstr.append("</TD>");\n\t\t\t\t\tstr.append("</TR></TABLE>");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tfinal ArrayList<String> V = new ArrayList<String>();\n\t\t\t\t\tint maxPages=1;\n\t\t\t\t\tint maxCharsPage=0;\n\t\t\t\t\tif(oldVal.length()>0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int x=oldVal.indexOf(\'/\');\n\t\t\t\t\t\tif(x>0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmaxPages=CMath.s_int(oldVal.substring(0,x));\n\t\t\t\t\t\t\tmaxCharsPage=CMath.s_int(oldVal.substring(x+1));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tV.add(""+maxPages);\n\t\t\t\t\tV.add(""+maxCharsPage);\n\t\t\t\t\treturn CMParms.toStringArray(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\tfinal String[] input=this.fakeUserInput(oldVal);\n\t\t\t\t\tint maxPages=CMath.s_int(input[0]);\n\t\t\t\t\tint maxCharsPage=CMath.s_int(input[1]);\n\t\t\t\t\tmaxPages = CMLib.genEd().prompt(mob, maxPages, ++showNumber[0], showFlag, L("Max Pages"), null);\n\t\t\t\t\tmaxCharsPage = CMLib.genEd().prompt(mob, maxCharsPage, ++showNumber[0], showFlag, L("Max Chars/Page"), null);\n\t\t\t\t\treturn maxPages+"/"+maxCharsPage;\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("RIDE_OVERRIDE_STRS","Ride Strings",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Rideable) ? 1 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Rideable)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Rideable R=(Rideable)I;\n\t\t\t\t\t\tfinal StringBuilder str=new StringBuilder("");\n\t\t\t\t\t\t//STATESTR,STATESUBJSTR,RIDERSTR,MOUNTSTR,DISMOUNTSTR,PUTSTR\n\t\t\t\t\t\tstr.append(R.getStateString().replace(\';\', \',\')).append(\';\');\n\t\t\t\t\t\tstr.append(R.getStateStringSubject().replace(\';\', \',\')).append(\';\');\n\t\t\t\t\t\tstr.append(R.getRideString().replace(\';\', \',\')).append(\';\');\n\t\t\t\t\t\tstr.append(R.getMountString().replace(\';\', \',\')).append(\';\');\n\t\t\t\t\t\tstr.append(R.getDismountString().replace(\';\', \',\')).append(\';\');\n\t\t\t\t\t\tstr.append(R.getPutString().replace(\';\', \',\'));\n\t\t\t\t\t\tif(str.length()==5)\n\t\t\t\t\t\t\treturn "";\n\t\t\t\t\t\treturn str.toString();\n\t\t\t\t\t}\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal String[] finput = this.fakeUserInput(oldVal);\n\t\t\t\t\tString stateStr=finput[0];\n\t\t\t\t\tString stateSubjectStr=finput[1];\n\t\t\t\t\tString riderStr=finput[2];\n\t\t\t\t\tString mountStr=finput[3];\n\t\t\t\t\tString dismountStr=finput[4];\n\t\t\t\t\tString putStr=finput[5];\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_RSTATESTR"))\n\t\t\t\t\t\tstateStr = httpReq.getUrlParameter(fieldName+"_RSTATESTR");\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_RSTATESUBJSTR"))\n\t\t\t\t\t\tstateSubjectStr = httpReq.getUrlParameter(fieldName+"_RSTATESUBJSTR");\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_RRIDERSTR"))\n\t\t\t\t\t\triderStr = httpReq.getUrlParameter(fieldName+"_RRIDERSTR");\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_RMOUNTSTR"))\n\t\t\t\t\t\tmountStr = httpReq.getUrlParameter(fieldName+"_RMOUNTSTR");\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_RDISMOUNTSTR"))\n\t\t\t\t\t\tdismountStr = httpReq.getUrlParameter(fieldName+"_RDISMOUNTSTR");\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_RPUTSTR"))\n\t\t\t\t\t\tputStr = httpReq.getUrlParameter(fieldName+"_RPUTSTR");\n\t\t\t\t\tfinal StringBuilder str=new StringBuilder("");\n\t\t\t\t\tstr.append(stateStr.replace(\';\', \',\')).append(\';\');\n\t\t\t\t\tstr.append(stateSubjectStr.replace(\';\', \',\')).append(\';\');\n\t\t\t\t\tstr.append(riderStr.replace(\';\', \',\')).append(\';\');\n\t\t\t\t\tstr.append(mountStr.replace(\';\', \',\')).append(\';\');\n\t\t\t\t\tstr.append(dismountStr.replace(\';\', \',\')).append(\';\');\n\t\t\t\t\tstr.append(putStr.replace(\';\', \',\'));\n\t\t\t\t\tif(str.length()==5)\n\t\t\t\t\t\treturn "";\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal String value = webValue(httpReq, parms, oldVal, fieldName);\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("");\n\t\t\t\t\tstr.append("<TABLE WIDTH=100% BORDER=\\"1\\" CELLSPACING=0 CELLPADDING=0>");\n\t\t\t\t\tfinal String[] vals = this.fakeUserInput(value);\n\t\t\t\t\tstr.append("<TR>");\n\t\t\t\t\tstr.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("State")+"</FONT></TD>");\n\t\t\t\t\tstr.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RSTATESTR VALUE=\\""+vals[0]+"\\">");\n\t\t\t\t\tstr.append("</TR>");\n\t\t\t\t\tstr.append("<TR>");\n\t\t\t\t\tstr.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("State Subj.")+"</FONT></TD>");\n\t\t\t\t\tstr.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RSTATESUBJSTR VALUE=\\""+vals[1]+"\\">");\n\t\t\t\t\tstr.append("</TR>");\n\t\t\t\t\tstr.append("<TR>");\n\t\t\t\t\tstr.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Rider")+"</FONT></TD>");\n\t\t\t\t\tstr.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RRIDERSTR VALUE=\\""+vals[2]+"\\">");\n\t\t\t\t\tstr.append("</TR>");\n\t\t\t\t\tstr.append("<TR>");\n\t\t\t\t\tstr.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Mount")+"</FONT></TD>");\n\t\t\t\t\tstr.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RMOUNTSTR VALUE=\\""+vals[3]+"\\">");\n\t\t\t\t\tstr.append("</TR>");\n\t\t\t\t\tstr.append("<TR>");\n\t\t\t\t\tstr.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Dismount")+"</FONT></TD>");\n\t\t\t\t\tstr.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RDISMOUNTSTR VALUE=\\""+vals[4]+"\\">");\n\t\t\t\t\tstr.append("</TR>");\n\t\t\t\t\tstr.append("<TR>");\n\t\t\t\t\tstr.append("<TD WIDTH=25%><FONT COLOR=WHITE>"+L("Put")+"</FONT></TD>");\n\t\t\t\t\tstr.append("<TD><INPUT TYPE=TEXT SIZE=50 NAME="+fieldName+"_RPUTSTR VALUE=\\""+vals[5]+"\\">");\n\t\t\t\t\tstr.append("</TR>");\n\t\t\t\t\tstr.append("</TABLE>");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tfinal ArrayList<String> V = new ArrayList<String>();\n\t\t\t\t\tString stateStr="";\n\t\t\t\t\tString stateSubjectStr="";\n\t\t\t\t\tString riderStr="";\n\t\t\t\t\tString mountStr="";\n\t\t\t\t\tString dismountStr="";\n\t\t\t\t\tString putStr="";\n\t\t\t\t\tif(oldVal.length()>0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal List<String> lst=CMParms.parseSemicolons(oldVal.trim(),false);\n\t\t\t\t\t\tif(lst.size()>0)\n\t\t\t\t\t\t\tstateStr=lst.get(0).replace(\';\',\',\');\n\t\t\t\t\t\tif(lst.size()>1)\n\t\t\t\t\t\t\tstateSubjectStr=lst.get(1).replace(\';\',\',\');\n\t\t\t\t\t\tif(lst.size()>2)\n\t\t\t\t\t\t\triderStr=lst.get(2).replace(\';\',\',\');\n\t\t\t\t\t\tif(lst.size()>3)\n\t\t\t\t\t\t\tmountStr=lst.get(3).replace(\';\',\',\');\n\t\t\t\t\t\tif(lst.size()>4)\n\t\t\t\t\t\t\tdismountStr=lst.get(4).replace(\';\',\',\');\n\t\t\t\t\t\tif(lst.size()>5)\n\t\t\t\t\t\t\tputStr=lst.get(5).replace(\';\',\',\');\n\t\t\t\t\t}\n\t\t\t\t\tV.add(stateStr);\n\t\t\t\t\tV.add(stateSubjectStr);\n\t\t\t\t\tV.add(riderStr);\n\t\t\t\t\tV.add(mountStr);\n\t\t\t\t\tV.add(dismountStr);\n\t\t\t\t\tV.add(putStr);\n\t\t\t\t\treturn CMParms.toStringArray(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\tfinal String[] finput = this.fakeUserInput(oldVal);\n\t\t\t\t\tString stateStr=finput[0];\n\t\t\t\t\tString stateSubjectStr=finput[1];\n\t\t\t\t\tString riderStr=finput[2];\n\t\t\t\t\tString mountStr=finput[3];\n\t\t\t\t\tString dismountStr=finput[4];\n\t\t\t\t\tString putStr=finput[5];\n\t\t\t\t\tstateStr = CMLib.genEd().prompt(mob, stateStr, ++showNumber[0], showFlag, L("State Str"), true);\n\t\t\t\t\tstateSubjectStr = CMLib.genEd().prompt(mob, stateSubjectStr, ++showNumber[0], showFlag, L("State Subject"), true);\n\t\t\t\t\triderStr = CMLib.genEd().prompt(mob, riderStr, ++showNumber[0], showFlag, L("Ride Str"), true);\n\t\t\t\t\tmountStr = CMLib.genEd().prompt(mob, mountStr, ++showNumber[0], showFlag, L("Mount Str"), true);\n\t\t\t\t\tdismountStr = CMLib.genEd().prompt(mob, dismountStr, ++showNumber[0], showFlag, L("Dismount Str"), true);\n\t\t\t\t\tputStr = CMLib.genEd().prompt(mob, putStr, ++showNumber[0], showFlag, L("Put Str"), true);\n\t\t\t\t\tfinal StringBuilder str=new StringBuilder("");\n\t\t\t\t\tstr.append(stateStr.replace(\';\', \',\')).append(\';\');\n\t\t\t\t\tstr.append(stateSubjectStr.replace(\';\', \',\')).append(\';\');\n\t\t\t\t\tstr.append(riderStr.replace(\';\', \',\')).append(\';\');\n\t\t\t\t\tstr.append(mountStr.replace(\';\', \',\')).append(\';\');\n\t\t\t\t\tstr.append(dismountStr.replace(\';\', \',\')).append(\';\');\n\t\t\t\t\tstr.append(putStr.replace(\';\', \',\'));\n\t\t\t\t\tif(str.length()==5)\n\t\t\t\t\t\treturn "";\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("CONTAINER_CAPACITY","Cap.",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Container) ? 1 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "20";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Container)\n\t\t\t\t\t\treturn ""+((Container)I).capacity();\n\t\t\t\t\treturn "0";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("BASE_ARMOR_AMOUNT","Arm.",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Armor) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn ""+I.basePhyStats().armor();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("BOARDABLE_POP","Pop.",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Boardable) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "100";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Boardable)\n\t\t\t\t\t\treturn ""+((Boardable)I).getArea().numberOfProperIDedRooms()*10;\n\t\t\t\t\treturn "100";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("CONTAINER_TYPE","Con.",ParmType.MULTICHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateBinaryChoices(Container.CONTAIN_DESCS);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Container) ? 1 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "0";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(!(I instanceof Container))\n\t\t\t\t\t\treturn "";\n\t\t\t\t\tfinal Container C=(Container)I;\n\t\t\t\t\tfinal StringBuilder str=new StringBuilder("");\n\t\t\t\t\tfor(int i=1;i<Container.CONTAIN_DESCS.length;i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(CMath.isSet(C.containTypes(), i-1))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(str.length()>0)\n\t\t\t\t\t\t\t\tstr.append("|");\n\t\t\t\t\t\t\tstr.append(Container.CONTAIN_DESCS[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("CONTAINER_TYPE_OR_LIDLOCK","Con.",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tsuper.choices = new PairVector<String,String>();\n\t\t\t\t\tfor(final String s : Container.CONTAIN_DESCS)\n\t\t\t\t\t\tchoices().add(s.toUpperCase().trim(),s);\n\t\t\t\t\tchoices().add("LID","Lid");\n\t\t\t\t\tchoices().add("LOCK","Lock");\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Container) ? 1 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tfinal StringBuilder str=new StringBuilder("");\n\t\t\t\t\tif(I instanceof Container)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Container C=(Container)I;\n\t\t\t\t\t\tif(C.hasALock())\n\t\t\t\t\t\t\tstr.append("LOCK");\n\t\t\t\t\t\tif(str.length()>0)\n\t\t\t\t\t\t\tstr.append("|");\n\t\t\t\t\t\tif(C.hasADoor())\n\t\t\t\t\t\t\tstr.append("LID");\n\t\t\t\t\t\tif(str.length()>0)\n\t\t\t\t\t\t\tstr.append("|");\n\t\t\t\t\t\tfor(int i=1;i<Container.CONTAIN_DESCS.length;i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(CMath.isSet(C.containTypes(), i-1))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(str.length()>0)\n\t\t\t\t\t\t\t\t\tstr.append("|");\n\t\t\t\t\t\t\t\tstr.append(Container.CONTAIN_DESCS[i]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn new String[]{"NULL"};\n\t\t\t\t\treturn CMParms.parseAny(oldVal,\'|\',true).toArray(new String[0]);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal String webValue = httpReq.getUrlParameter(fieldName);\n\t\t\t\t\tif(webValue == null)\n\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\tString id="";\n\t\t\t\t\tint index=0;\n\t\t\t\t\tfinal StringBuilder str=new StringBuilder("");\n\t\t\t\t\tfor(;httpReq.isUrlParameter(fieldName+id);id=""+(++index))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String newVal = httpReq.getUrlParameter(fieldName+id);\n\t\t\t\t\t\tif((newVal!=null)&&(newVal.length()>0)&&(choices().containsFirst(newVal)))\n\t\t\t\t\t\t\tstr.append(newVal).append("|");\n\t\t\t\t\t}\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag)\n\t\t\t\tthrows java.io.IOException\n\t\t\t\t{\n\t\t\t\t\treturn CMLib.genEd().promptMultiSelectList(mob,oldVal,"|",++showNumber[0],showFlag,prompt(),choices(),false);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tfinal List<String> webVals=CMParms.parseAny(oldVal.toUpperCase().trim(), "|", true);\n\t\t\t\t\tfor(final String s : webVals)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(!choices().containsFirst(s))\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal String webValue = webValue(httpReq,parms,oldVal,fieldName);\n\t\t\t\t\tfinal List<String> webVals=CMParms.parseAny(webValue.toUpperCase().trim(), "|", true);\n\t\t\t\t\tString onChange = null;\n\t\t\t\t\tonChange = " MULTIPLE ";\n\t\t\t\t\tif(!parms.containsKey("NOSELECT"))\n\t\t\t\t\t\tonChange+= "ONCHANGE=\\"MultiSelect(this);\\"";\n\t\t\t\t\tfinal StringBuilder str=new StringBuilder("");\n\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+onChange+">");\n\t\t\t\t\tfor(int i=0;i<choices().size();i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String option = (choices().get(i).first);\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+option+"\\" ");\n\t\t\t\t\t\tif(webVals.contains(option))\n\t\t\t\t\t\t\tstr.append("SELECTED");\n\t\t\t\t\t\tstr.append(">"+(choices().get(i).second));\n\t\t\t\t\t}\n\t\t\t\t\treturn str.toString()+"</SELECT>";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("CODED_SPELL_LIST","Spell Affects",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int maxColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 20;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.length()==0)\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tif(oldVal.charAt(0)==\'*\')\n\t\t\t\t\t\toldVal = oldVal.substring(1);\n\t\t\t\t\tfinal int x=oldVal.indexOf(\'(\');\n\t\t\t\t\tint y=oldVal.indexOf(\';\');\n\t\t\t\t\tif((x<y)&&(x>0))\n\t\t\t\t\t\ty=x;\n\t\t\t\t\tif(y<0)\n\t\t\t\t\t\treturn CMClass.getAbility(oldVal)!=null;\n\t\t\t\t\treturn CMClass.getAbility(oldVal.substring(0,y))!=null;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn CMLib.coffeeMaker().getCodedSpellsOrBehaviors(I);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\tpublic String rebuild(final List<CMObject> spells) throws CMException\n\t\t\t\t{\n\t\t\t\t\tfinal StringBuffer newVal = new StringBuffer("");\n\t\t\t\t\tif(spells.size()==1)\n\t\t\t\t\t{\n\t\t\t\t\t\tnewVal.append("*" + spells.get(0).ID() + ";");\n\t\t\t\t\t\tif(spells.get(0) instanceof Ability)\n\t\t\t\t\t\t\tnewVal.append(((Ability)spells.get(0)).text());\n\t\t\t\t\t\telse\n\t\t\t\t\t\tif(spells.get(0) instanceof Behavior)\n\t\t\t\t\t\t\tnewVal.append(((Behavior)spells.get(0)).getParms());\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif(spells.size()>1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(int s=0;s<spells.size();s++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfinal String txt;\n\t\t\t\t\t\t\t\tif(spells.get(s) instanceof Ability)\n\t\t\t\t\t\t\t\t\ttxt=((Ability)spells.get(s)).text();\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif(spells.get(s) instanceof Behavior)\n\t\t\t\t\t\t\t\t\ttxt=((Behavior)spells.get(s)).getParms();\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\ttxt="";\n\t\t\t\t\t\t\t\tif(txt.length()>0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif((txt.indexOf(\';\')>=0)\n\t\t\t\t\t\t\t\t\t||(CMClass.getAbility(txt.trim())!=null)\n\t\t\t\t\t\t\t\t\t||(CMClass.getBehavior(txt.trim())!=null))\n\t\t\t\t\t\t\t\t\t\tthrow new CMException("You may not have more than one spell when one of the spells parameters is a spell id or a ; character.");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnewVal.append(spells.get(s).ID());\n\t\t\t\t\t\t\t\tif(txt.length()>0)\n\t\t\t\t\t\t\t\t\tnewVal.append(";" + txt);\n\t\t\t\t\t\t\t\tif(s<(spells.size()-1))\n\t\t\t\t\t\t\t\t\tnewVal.append(";");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn newVal.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tfinal Vector<String> V = new Vector<String>();\n\t\t\t\t\tfinal Vector<String> V2 = new Vector<String>();\n\t\t\t\t\tfinal List<CMObject> spells=CMLib.coffeeMaker().getCodedSpellsOrBehaviors(oldVal);\n\t\t\t\t\tfor(int s=0;s<spells.size();s++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal CMObject O = spells.get(s);\n\t\t\t\t\t\tV.addElement(O.ID());\n\t\t\t\t\t\tV2.addElement(O.ID());\n\t\t\t\t\t\tif(O instanceof Ability)\n\t\t\t\t\t\t\tV2.addElement(((Ability)O).text());\n\t\t\t\t\t\telse\n\t\t\t\t\t\tif(O instanceof Behavior)\n\t\t\t\t\t\t\tV2.addElement(((Behavior)O).getParms());\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tV2.add("");\n\t\t\t\t\t}\n\t\t\t\t\tV.addAll(V2);\n\t\t\t\t\tV.addElement("");\n\t\t\t\t\treturn CMParms.toStringArray(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tList<CMObject> spells=null;\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_AFFECT1"))\n\t\t\t\t\t{\n\t\t\t\t\t\tspells = new Vector<CMObject>();\n\t\t\t\t\t\tint num=1;\n\t\t\t\t\t\tString behav=httpReq.getUrlParameter(fieldName+"_AFFECT"+num);\n\t\t\t\t\t\tString theparm=httpReq.getUrlParameter(fieldName+"_ADATA"+num);\n\t\t\t\t\t\twhile((behav!=null)&&(theparm!=null))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(behav.length()>0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfinal Ability A=CMClass.getAbility(behav);\n\t\t\t\t\t\t\t\tif(A!=null)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(theparm.trim().length()>0)\n\t\t\t\t\t\t\t\t\t\tA.setMiscText(theparm);\n\t\t\t\t\t\t\t\t\tspells.add(A);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfinal Behavior B=CMClass.getBehavior(behav);\n\t\t\t\t\t\t\t\t\tif(B!=null)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(theparm.trim().length()>0)\n\t\t\t\t\t\t\t\t\t\t\tB.setParms(theparm);\n\t\t\t\t\t\t\t\t\t\tspells.add(B);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnum++;\n\t\t\t\t\t\t\tbehav=httpReq.getUrlParameter(fieldName+"_AFFECT"+num);\n\t\t\t\t\t\t\ttheparm=httpReq.getUrlParameter(fieldName+"_ADATA"+num);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tspells = CMLib.coffeeMaker().getCodedSpellsOrBehaviors(oldVal);\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\t\t\t\t\t\treturn rebuild(spells);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(final Exception e)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal List<CMObject> spells=CMLib.coffeeMaker().getCodedSpellsOrBehaviors(webValue(httpReq,parms,oldVal,fieldName));\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("");\n\t\t\t\t\tstr.append("<TABLE WIDTH=100% BORDER=\\"1\\" CELLSPACING=0 CELLPADDING=0>");\n\t\t\t\t\tfor(int i=0;i<spells.size();i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal CMObject A=spells.get(i);\n\t\t\t\t\t\tstr.append("<TR><TD WIDTH=50%>");\n\t\t\t\t\t\tstr.append("\\n\\r<SELECT ONCHANGE=\\"EditAffect(this);\\" NAME="+fieldName+"_AFFECT"+(i+1)+">");\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\"\\">Delete!");\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+A.ID()+"\\" SELECTED>"+A.ID());\n\t\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\t\tstr.append("</TD><TD WIDTH=50%>");\n\t\t\t\t\t\tfinal String parmstr=(A instanceof Ability)?((Ability)A).text():((Behavior)A).getParms();\n\t\t\t\t\t\tfinal String theparm=CMStrings.replaceAll(parmstr,"\\"","&quot;");\n\t\t\t\t\t\tstr.append("\\n\\r<INPUT TYPE=TEXT SIZE=30 NAME="+fieldName+"_ADATA"+(i+1)+" VALUE=\\""+theparm+"\\">");\n\t\t\t\t\t\tstr.append("</TD></TR>");\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("<TR><TD WIDTH=50%>");\n\t\t\t\t\tstr.append("\\n\\r<SELECT ONCHANGE=\\"AddAffect(this);\\" NAME="+fieldName+"_AFFECT"+(spells.size()+1)+">");\n\t\t\t\t\tstr.append("<OPTION SELECTED VALUE=\\"\\">Select an Effect/Behav");\n\t\t\t\t\tfor(final Enumeration<Ability> a=CMClass.abilities();a.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Ability A=a.nextElement();\n\t\t\t\t\t\tif((A.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_ARCHON)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tfinal String cnam=A.ID();\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+cnam+"\\">"+cnam);\n\t\t\t\t\t}\n\t\t\t\t\tfor(final Enumeration<Behavior> b=CMClass.behaviors();b.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Behavior B=b.nextElement();\n\t\t\t\t\t\tfinal String cnam=B.ID();\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+cnam+"\\">"+cnam);\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\tstr.append("</TD><TD WIDTH=50%>");\n\t\t\t\t\tstr.append("\\n\\r<INPUT TYPE=TEXT SIZE=30 NAME="+fieldName+"_ADATA"+(spells.size()+1)+" VALUE=\\"\\">");\n\t\t\t\t\tstr.append("</TD></TR>");\n\t\t\t\t\tstr.append("</TABLE>");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\tfinal List<CMObject> spells=CMLib.coffeeMaker().getCodedSpellsOrBehaviors(oldVal);\n\t\t\t\t\tfinal StringBuffer rawCheck = new StringBuffer("");\n\t\t\t\t\tfor(int s=0;s<spells.size();s++)\n\t\t\t\t\t{\n\t\t\t\t\t\trawCheck.append(spells.get(s).ID()).append(";");\n\t\t\t\t\t\tif(spells.get(s) instanceof Ability)\n\t\t\t\t\t\t\trawCheck.append(((Ability)spells.get(s)).text()).append(";");\n\t\t\t\t\t\telse\n\t\t\t\t\t\tif(spells.get(s) instanceof Behavior)\n\t\t\t\t\t\t\trawCheck.append(((Behavior)spells.get(s)).getParms()).append(";");\n\t\t\t\t\t}\n\t\t\t\t\tboolean okToProceed = true;\n\t\t\t\t\t++showNumber[0];\n\t\t\t\t\tString newVal = null;\n\t\t\t\t\twhile(okToProceed)\n\t\t\t\t\t{\n\t\t\t\t\t\tokToProceed = false;\n\t\t\t\t\t\tCMLib.genEd().spellsOrBehavs(mob,spells,showNumber[0],showFlag,true);\n\t\t\t\t\t\tfinal StringBuffer sameCheck = new StringBuffer("");\n\t\t\t\t\t\tfor(int s=0;s<spells.size();s++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsameCheck.append(spells.get(s).ID()).append(\';\');\n\t\t\t\t\t\t\tif(spells.get(s) instanceof Ability)\n\t\t\t\t\t\t\t\tsameCheck.append(((Ability)spells.get(s)).text()).append(";");\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif(spells.get(s) instanceof Behavior)\n\t\t\t\t\t\t\t\tsameCheck.append(((Behavior)spells.get(s)).getParms()).append(";");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(sameCheck.toString().equals(rawCheck.toString()))\n\t\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnewVal = rebuild(spells);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch(final CMException e)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmob.tell(e.getMessage());\n\t\t\t\t\t\t\tokToProceed = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn (newVal==null)?oldVal:newVal.toString();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("BUILDING_FLAGS","Flags",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tfinal Pair<String[],String[]> codesFlags = CMAbleParms.getBuildingCodesNFlags();\n\t\t\t\t\tfinal String[] names = CMParms.parseSpaces(oldVal, true).toArray(new String[0]);\n\t\t\t\t\tfor(final String name : names)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(!CMParms.containsIgnoreCase(codesFlags.second, name))\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn CMParms.parseSpaces(oldVal, true).toArray(new String[0]);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal String webValue = httpReq.getUrlParameter(fieldName);\n\t\t\t\t\tif(webValue == null)\n\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\tfinal StringBuilder s=new StringBuilder("");\n\t\t\t\t\tString id="";\n\t\t\t\t\tint index=0;\n\t\t\t\t\tfinal Pair<String[],String[]> codesFlags = CMAbleParms.getBuildingCodesNFlags();\n\t\t\t\t\tfor(;httpReq.isUrlParameter(fieldName+id);id=""+(++index))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String newVal = httpReq.getUrlParameter(fieldName+id);\n\t\t\t\t\t\tif(CMParms.containsIgnoreCase(codesFlags.second, newVal.toUpperCase().trim()))\n\t\t\t\t\t\t\ts.append(" ").append(newVal.toUpperCase().trim());\n\t\t\t\t\t}\n\t\t\t\t\treturn s.toString().trim();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("");\n\t\t\t\t\tfinal String webValue = webValue(httpReq,parms,oldVal,fieldName);\n\t\t\t\t\tString onChange = null;\n\t\t\t\t\tonChange = " MULTIPLE ";\n\t\t\t\t\tif(!parms.containsKey("NOSELECT"))\n\t\t\t\t\t\tonChange+= "ONCHANGE=\\"MultiSelect(this);\\"";\n\t\t\t\t\tfinal Pair<String[],String[]> codesFlags = CMAbleParms.getBuildingCodesNFlags();\n\t\t\t\t\tfinal String[] fakeValues = this.fakeUserInput(webValue);\n\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+onChange+">");\n\t\t\t\t\tfor(int i=0;i<codesFlags.second.length;i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String option = (codesFlags.second[i]);\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+option+"\\" ");\n\t\t\t\t\t\tif(CMParms.containsIgnoreCase(fakeValues, option))\n\t\t\t\t\t\t\tstr.append("SELECTED");\n\t\t\t\t\t\tstr.append(">"+option);\n\t\t\t\t\t}\n\t\t\t\t\treturn str.toString()+"</SELECT>";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\tfinal Pair<String[],String[]> codesFlags = CMAbleParms.getBuildingCodesNFlags();\n\t\t\t\t\tfinal String help=CMParms.combineWith(Arrays.asList(codesFlags.second), \',\');\n\t\t\t\t\tfinal String newVal = CMLib.genEd().prompt(mob, oldVal, ++showNumber[0], showFlag, L("Flags"), true, help);\n\t\t\t\t\tString[] newVals;\n\t\t\t\t\tif(newVal.indexOf(\',\')>0)\n\t\t\t\t\t\tnewVals = CMParms.parseCommas(newVal.toUpperCase().trim(), true).toArray(new String[0]);\n\t\t\t\t\telse\n\t\t\t\t\tif(newVal.indexOf(\';\')>0)\n\t\t\t\t\t\tnewVals = CMParms.parseSemicolons(newVal.toUpperCase().trim(), true).toArray(new String[0]);\n\t\t\t\t\telse\n\t\t\t\t\t\tnewVals = CMParms.parse(newVal.toUpperCase().trim()).toArray(new String[0]);\n\t\t\t\t\tfinal StringBuilder finalVal = new StringBuilder("");\n\t\t\t\t\tfor(int i=0;i<newVals.length;i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(CMParms.containsIgnoreCase(codesFlags.second, newVals[i]))\n\t\t\t\t\t\t\tfinalVal.append(" ").append(newVals[i]);\n\t\t\t\t\t}\n\t\t\t\t\treturn finalVal.toString().toUpperCase().trim();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("EXIT_NAMES","Exit Words",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof String)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String chk=((String)o).toUpperCase();\n\t\t\t\t\t\tif(chk.equalsIgnoreCase("DOOR"))\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tfinal String[] names = CMParms.parseAny(oldVal.trim(), \'|\', true).toArray(new String[0]);\n\t\t\t\t\tif(names.length > 6)\n\t\t\t\t\t\treturn false;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "door|open|close|A closed door.|An open doorway.|";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\n\t\t\t\t\tfinal Vector<String> V = new Vector<String>();\n\t\t\t\t\tV.addAll(CMParms.parseAny(oldVal.trim(), \'|\', true));\n\t\t\t\t\twhile(V.size()<6)\n\t\t\t\t\t\tV.add("");\n\t\t\t\t\treturn CMParms.toStringArray(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_W1"))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal StringBuilder str=new StringBuilder("");\n\t\t\t\t\t\tstr.append(httpReq.getUrlParameter(fieldName+"_W1")).append("|");\n\t\t\t\t\t\tstr.append(httpReq.getUrlParameter(fieldName+"_W2")).append("|");\n\t\t\t\t\t\tstr.append(httpReq.getUrlParameter(fieldName+"_W3")).append("|");\n\t\t\t\t\t\tstr.append(httpReq.getUrlParameter(fieldName+"_W4")).append("|");\n\t\t\t\t\t\tstr.append(httpReq.getUrlParameter(fieldName+"_W5")).append("|");\n\t\t\t\t\t\tstr.append(httpReq.getUrlParameter(fieldName+"_W6"));\n\t\t\t\t\t\tString s=str.toString();\n\t\t\t\t\t\twhile(s.endsWith("|"))\n\t\t\t\t\t\t\ts=s.substring(0,s.length()-1);\n\t\t\t\t\t\treturn s;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("");\n\t\t\t\t\tstr.append("<TABLE WIDTH=100% BORDER=\\"1\\" CELLSPACING=0 CELLPADDING=0>");\n\t\t\t\t\tfinal String[] vals = this.fakeUserInput(oldVal);\n\t\t\t\t\tfinal String[] keys = new String[]{"Noun","Open","Close","Closed Display","Open Display","Description"};\n\t\t\t\t\tfor(int i=0;i<keys.length;i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tstr.append("<TR><TD WIDTH=30%><FONT COLOR=WHITE>"+L(keys[i])+"</FONT></TD>");\n\t\t\t\t\t\tstr.append("<TD><INPUT TYPE=TEXT SIZE=30 NAME="+fieldName+"_W"+(i+1)+" VALUE=\\""+vals[i]+"\\">");\n\t\t\t\t\t\tstr.append("</TD></TR>");\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("</TABLE>");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\tfinal String[] vals = this.fakeUserInput(oldVal);\n\t\t\t\t\tfinal StringBuilder newVal = new StringBuilder("");\n\t\t\t\t\tnewVal.append(CMLib.genEd().prompt(mob, vals[0], ++showNumber[0], showFlag, L("Exit Noun"), true)).append("|");\n\t\t\t\t\tnewVal.append(CMLib.genEd().prompt(mob, vals[1], ++showNumber[0], showFlag, L("Open Verb"), true)).append("|");\n\t\t\t\t\tnewVal.append(CMLib.genEd().prompt(mob, vals[2], ++showNumber[0], showFlag, L("Close Verb"), true)).append("|");\n\t\t\t\t\tnewVal.append(CMLib.genEd().prompt(mob, vals[3], ++showNumber[0], showFlag, L("Opened Text"), true)).append("|");\n\t\t\t\t\tnewVal.append(CMLib.genEd().prompt(mob, vals[4], ++showNumber[0], showFlag, L("Closed Text"), true)).append("|");\n\t\t\t\t\tnewVal.append(CMLib.genEd().prompt(mob, vals[5], ++showNumber[0], showFlag, L("Description"), true));\n\t\t\t\t\tString s=newVal.toString();\n\t\t\t\t\twhile(s.endsWith("|"))\n\t\t\t\t\t\ts=s.substring(0,s.length()-1);\n\t\t\t\t\treturn s;\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("PCODED_SPELL_LIST","Spell Affects",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int maxColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 20;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof String)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String chk=((String)o).toUpperCase();\n\t\t\t\t\t\tif(chk.equalsIgnoreCase("WALL")\n\t\t\t\t\t\t||chk.equalsIgnoreCase("DEMOLISH")\n\t\t\t\t\t\t||chk.equalsIgnoreCase("TITLE")\n\t\t\t\t\t\t||chk.equalsIgnoreCase("DESC"))\n\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\tfinal Pair<String[],String[]> codeFlags = CMAbleParms.getBuildingCodesNFlags();\n\t\t\t\t\t\tif(CMParms.contains(codeFlags.first, chk))\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tfinal String[] spells = CMParms.parseAny(oldVal.trim(), \')\', true).toArray(new String[0]);\n\t\t\t\t\tfor(String spell : spells)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int x=spell.indexOf(\'(\');\n\t\t\t\t\t\tif(x>0)\n\t\t\t\t\t\t\tspell=spell.substring(0,x);\n\t\t\t\t\t\tif(spell.trim().length()==0)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tif((CMClass.getAbility(spell)==null)&&(CMClass.getBehavior(spell)==null))\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\tpublic String rebuild(final List<CMObject> spells) throws CMException\n\t\t\t\t{\n\t\t\t\t\tfinal StringBuffer newVal = new StringBuffer("");\n\t\t\t\t\tfor(int s=0;s<spells.size();s++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String txt;\n\t\t\t\t\t\tif(spells.get(s) instanceof Ability)\n\t\t\t\t\t\t\ttxt = ((Ability)spells.get(s)).text().trim();\n\t\t\t\t\t\telse\n\t\t\t\t\t\tif(spells.get(s) instanceof Behavior)\n\t\t\t\t\t\t\ttxt = ((Behavior)spells.get(s)).getParms().trim();\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tnewVal.append(spells.get(s).ID()).append("(").append(txt).append(")");\n\t\t\t\t\t}\n\t\t\t\t\treturn newVal.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tfinal Vector<String> V = new Vector<String>();\n\t\t\t\t\tfinal String[] spells = CMParms.parseAny(oldVal.trim(), \')\', true).toArray(new String[0]);\n\t\t\t\t\tfor(String spell : spells)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int x=spell.indexOf(\'(\');\n\t\t\t\t\t\tString parms="";\n\t\t\t\t\t\tif(x>0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tparms=spell.substring(x+1).trim();\n\t\t\t\t\t\t\tspell=spell.substring(0,x);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(spell.trim().length()==0)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tif((CMClass.getAbility(spell)!=null)\n\t\t\t\t\t\t||(CMClass.getBehavior(spell)!=null))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tV.add(spell);\n\t\t\t\t\t\t\tV.add(parms);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn CMParms.toStringArray(V);\n\t\t\t\t}\n\n\t\t\t\tpublic List<CMObject> getCodedSpells(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tfinal String[] spellStrs = this.fakeUserInput(oldVal);\n\t\t\t\t\tfinal List<CMObject> spells=new ArrayList<CMObject>(spellStrs.length/2);\n\t\t\t\t\tfor(int s=0;s<spellStrs.length;s+=2)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Ability A=CMClass.getAbility(spellStrs[s]);\n\t\t\t\t\t\tif(A!=null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(spellStrs[s+1].length()>0)\n\t\t\t\t\t\t\t\tA.setMiscText(spellStrs[s+1]);\n\t\t\t\t\t\t\tspells.add(A);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal Behavior B=CMClass.getBehavior(spellStrs[s]);\n\t\t\t\t\t\t\tif(spellStrs[s+1].length()>0)\n\t\t\t\t\t\t\t\tB.setParms(spellStrs[s+1]);\n\t\t\t\t\t\t\tspells.add(B);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn spells;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tList<CMObject> spells=null;\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_AFFECT1"))\n\t\t\t\t\t{\n\t\t\t\t\t\tspells = new Vector<CMObject>();\n\t\t\t\t\t\tint num=1;\n\t\t\t\t\t\tString behav=httpReq.getUrlParameter(fieldName+"_AFFECT"+num);\n\t\t\t\t\t\tString theparm=httpReq.getUrlParameter(fieldName+"_ADATA"+num);\n\t\t\t\t\t\twhile((behav!=null)&&(theparm!=null))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(behav.length()>0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfinal Ability A=CMClass.getAbility(behav);\n\t\t\t\t\t\t\t\tif(A!=null)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(theparm.trim().length()>0)\n\t\t\t\t\t\t\t\t\t\tA.setMiscText(theparm);\n\t\t\t\t\t\t\t\t\tspells.add(A);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfinal Behavior B=CMClass.getBehavior(behav);\n\t\t\t\t\t\t\t\t\tif(theparm.trim().length()>0)\n\t\t\t\t\t\t\t\t\t\tB.setParms(theparm);\n\t\t\t\t\t\t\t\t\tspells.add(B);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnum++;\n\t\t\t\t\t\t\tbehav=httpReq.getUrlParameter(fieldName+"_AFFECT"+num);\n\t\t\t\t\t\t\ttheparm=httpReq.getUrlParameter(fieldName+"_ADATA"+num);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tspells = getCodedSpells(oldVal);\n\t\t\t\t\t}\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\t\t\t\t\t\treturn rebuild(spells);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(final Exception e)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal List<CMObject> spells=getCodedSpells(webValue(httpReq,parms,oldVal,fieldName));\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("");\n\t\t\t\t\tstr.append("<TABLE WIDTH=100% BORDER=\\"1\\" CELLSPACING=0 CELLPADDING=0>");\n\t\t\t\t\tfor(int i=0;i<spells.size();i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal CMObject A=spells.get(i);\n\t\t\t\t\t\tstr.append("<TR><TD WIDTH=50%>");\n\t\t\t\t\t\tstr.append("\\n\\r<SELECT ONCHANGE=\\"EditAffect(this);\\" NAME="+fieldName+"_AFFECT"+(i+1)+">");\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\"\\">Delete!");\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+A.ID()+"\\" SELECTED>"+A.ID());\n\t\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\t\tstr.append("</TD><TD WIDTH=50%>");\n\t\t\t\t\t\tfinal String theparm;\n\t\t\t\t\t\tif(A instanceof Ability)\n\t\t\t\t\t\t\ttheparm=CMStrings.replaceAll(((Ability)A).text(),"\\"","&quot;");\n\t\t\t\t\t\telse\n\t\t\t\t\t\tif(A instanceof Behavior)\n\t\t\t\t\t\t\ttheparm=CMStrings.replaceAll(((Behavior)A).getParms(),"\\"","&quot;");\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tstr.append("\\n\\r<INPUT TYPE=TEXT SIZE=30 NAME="+fieldName+"_ADATA"+(i+1)+" VALUE=\\""+theparm+"\\">");\n\t\t\t\t\t\tstr.append("</TD></TR>");\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("<TR><TD WIDTH=50%>");\n\t\t\t\t\tstr.append("\\n\\r<SELECT ONCHANGE=\\"AddAffect(this);\\" NAME="+fieldName+"_AFFECT"+(spells.size()+1)+">");\n\t\t\t\t\tstr.append("<OPTION SELECTED VALUE=\\"\\">Select Effect/Behavior");\n\t\t\t\t\tfor(final Enumeration<Ability> a=CMClass.abilities();a.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Ability A=a.nextElement();\n\t\t\t\t\t\tif((A.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_ARCHON)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tfinal String cnam=A.ID();\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+cnam+"\\">"+cnam);\n\t\t\t\t\t}\n\t\t\t\t\tfor(final Enumeration<Behavior> a=CMClass.behaviors();a.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Behavior A=a.nextElement();\n\t\t\t\t\t\tfinal String cnam=A.ID();\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+cnam+"\\">"+cnam);\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\tstr.append("</TD><TD WIDTH=50%>");\n\t\t\t\t\tstr.append("\\n\\r<INPUT TYPE=TEXT SIZE=30 NAME="+fieldName+"_ADATA"+(spells.size()+1)+" VALUE=\\"\\">");\n\t\t\t\t\tstr.append("</TD></TR>");\n\t\t\t\t\tstr.append("</TABLE>");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\tfinal List<CMObject> spells=getCodedSpells(oldVal);\n\t\t\t\t\tfinal StringBuffer rawCheck = new StringBuffer("");\n\t\t\t\t\tfor(int s=0;s<spells.size();s++)\n\t\t\t\t\t{\n\t\t\t\t\t\trawCheck.append(spells.get(s).ID()).append(";");\n\t\t\t\t\t\tif(spells.get(s) instanceof Ability)\n\t\t\t\t\t\t\trawCheck.append(((Ability)spells.get(s)).text()).append(";");\n\t\t\t\t\t\telse\n\t\t\t\t\t\tif(spells.get(s) instanceof Behavior)\n\t\t\t\t\t\t\trawCheck.append(((Behavior)spells.get(s)).getParms()).append(";");\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\trawCheck.append(";");\n\t\t\t\t\t}\n\t\t\t\t\tboolean okToProceed = true;\n\t\t\t\t\t++showNumber[0];\n\t\t\t\t\tString newVal = null;\n\t\t\t\t\twhile(okToProceed)\n\t\t\t\t\t{\n\t\t\t\t\t\tokToProceed = false;\n\t\t\t\t\t\tCMLib.genEd().spellsOrBehaviors(mob,spells,showNumber[0],showFlag,true);\n\t\t\t\t\t\tfinal StringBuffer sameCheck = new StringBuffer("");\n\t\t\t\t\t\tfor(int s=0;s<spells.size();s++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(spells.get(s) instanceof Ability)\n\t\t\t\t\t\t\t\trawCheck.append(((Ability)spells.get(s)).text()).append(";");\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif(spells.get(s) instanceof Behavior)\n\t\t\t\t\t\t\t\trawCheck.append(((Behavior)spells.get(s)).getParms()).append(";");\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\trawCheck.append(";");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(sameCheck.toString().equals(rawCheck.toString()))\n\t\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnewVal = rebuild(spells);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch(final CMException e)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmob.tell(e.getMessage());\n\t\t\t\t\t\t\tokToProceed = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn (newVal==null)?oldVal:newVal.toString();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ABILITY_ID","Ability ID",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int maxColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 20;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tfinal Ability A=CMClass.getAbility(oldVal);\n\t\t\t\t\treturn (A instanceof Trap);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(confirmValue(oldVal))\n\t\t\t\t\t\treturn new String[] {oldVal};\n\t\t\t\t\treturn new String[] {defaultValue()};\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tif(confirmValue(httpReq.getUrlParameter(fieldName)))\n\t\t\t\t\t\treturn httpReq.getUrlParameter(fieldName);\n\t\t\t\t\treturn oldVal;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("");\n\t\t\t\t\tfinal String val = webValue(httpReq,parms,oldVal,fieldName);\n\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+">");\n\t\t\t\t\tstr.append("<OPTION SELECTED VALUE=\\"\\">Select Effect/Behavior");\n\t\t\t\t\tfor(final Enumeration<Ability> a=CMClass.abilities();a.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Ability A=a.nextElement();\n\t\t\t\t\t\tif(((A.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_TRAP)\n\t\t\t\t\t\t&&(A instanceof Trap)\n\t\t\t\t\t\t&&(((Trap)A).maySetTrap(null, Integer.MAX_VALUE)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+A.ID()+"\\"");\n\t\t\t\t\t\t\tif(A.ID().equalsIgnoreCase(val))\n\t\t\t\t\t\t\t\tstr.append(" SELECTED");\n\t\t\t\t\t\t\tstr.append(">"+A.ID());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\t++showNumber[0];\n\t\t\t\t\tif((showFlag>0)&&(showFlag!=showNumber[0]))\n\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\tString behave="NO";\n\t\t\t\t\twhile((mob.session()!=null)&&(!mob.session().isStopped())&&(behave.length()>0))\n\t\t\t\t\t{\n\t\t\t\t\t\tmob.tell(L("@x1. Trap ID: \'@x2\'.",""+showNumber,oldVal));\n\t\t\t\t\t\tif((showFlag!=showNumber[0])&&(showFlag>-999))\n\t\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t\tbehave=mob.session().prompt(L("Enter trap ability ID (?):"),"");\n\t\t\t\t\t\tif(behave.length()>0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(behave.equalsIgnoreCase("?"))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmob.tell(CMLib.lister().build3ColTable(mob,CMClass.abilities(new Filterer<Ability>() {\n\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\tpublic boolean passesFilter(final Ability obj)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(((obj.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_TRAP)\n\t\t\t\t\t\t\t\t\t\t&&(obj instanceof Trap)\n\t\t\t\t\t\t\t\t\t\t&&(((Trap)obj).maySetTrap(null, Integer.MAX_VALUE)))\n\t\t\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t})).toString());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tAbility chosenOne=CMClass.getAbility(behave);\n\t\t\t\t\t\t\t\tif((chosenOne instanceof Ability)\n\t\t\t\t\t\t\t\t&&((chosenOne.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_ARCHON)\n\t\t\t\t\t\t\t\t&&(!CMSecurity.isASysOp(mob)))\n\t\t\t\t\t\t\t\t\tchosenOne=null;\n\t\t\t\t\t\t\t\tif((chosenOne!=null)\n\t\t\t\t\t\t\t\t&&((chosenOne.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_TRAP)\n\t\t\t\t\t\t\t\t&&(chosenOne instanceof Trap))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\toldVal = chosenOne.ID();\n\t\t\t\t\t\t\t\t\tbehave="";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tmob.tell(L("\'@x1\' is not a recognized trap.  Try \'?\'.",behave));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tmob.tell(L("(no change)"));\n\t\t\t\t\t}\n\t\t\t\t\treturn oldVal;\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("TRIGGER_MSG","Trigger Msg",ParmType.STRINGORNULL)\n\t\t\t{\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("DAMAGE_MSG","Damage Msg",ParmType.STRINGORNULL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("AVOID_MSG","Avoid Msg",ParmType.STRINGORNULL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ABILITY_ID","Ability ID",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(CMClass.abilities(new Filterer<Ability>() {\n\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic boolean passesFilter(final Ability obj)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn ((obj.classificationCode()&Ability.ALL_DOMAINS)!=Ability.DOMAIN_ARCHON);\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int maxColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 20;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tfinal Ability A=CMClass.getAbility(oldVal);\n\t\t\t\t\tif(A==null)\n\t\t\t\t\t\treturn false;\n\t\t\t\t\treturn ((A.classificationCode()&Ability.ALL_DOMAINS)!=Ability.DOMAIN_ARCHON);\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("TRAP_ID","Trap ID",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(CMClass.abilities(new Filterer<Ability>() {\n\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic boolean passesFilter(final Ability obj)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn (obj instanceof Trap)\n\t\t\t\t\t\t\t\t&&((obj.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_TRAP)\n\t\t\t\t\t\t\t\t&&(((Trap)obj).maySetTrap(null, -1));\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int maxColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 20;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tfinal Ability A=CMClass.getAbility(oldVal);\n\t\t\t\t\treturn (A instanceof Trap);\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("BASE_DAMAGE","Dmg.",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Weapon) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Weapon)\n\t\t\t\t\t\treturn ""+((Weapon)I).basePhyStats().damage();\n\t\t\t\t\treturn "0";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("LID_LOCK","Lid.",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Container) ? 1 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(new String[] { "", "LID", "LOCK" });\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(!(I instanceof Container))\n\t\t\t\t\t\treturn "";\n\t\t\t\t\tfinal Container C=(Container)I;\n\t\t\t\t\tif(C.hasALock())\n\t\t\t\t\t\treturn "LOCK";\n\t\t\t\t\tif(C.hasADoor())\n\t\t\t\t\t\treturn "LID";\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("BUILDING_CODE","Code",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(getBuildingCodesNFlags().first);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "TITLE";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "TITLE";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("STATUE","Statue",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn ((!(o instanceof Armor)) && (!(o instanceof Container)) && (!(o instanceof Drink))) ? 1 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(new String[] { "", "STATUE" });\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t@Override\r\n\t\t\t\tpublic void createChoices()\r\n\t\t\t\t{\r\n\t\t\t\t\tcreateChoices(new String[] { "", "FOOD", "DRINK", "SOAP", "GenPerfume" });\r\n\t\t\t\t}\r\n\r\n\t\t\t\t@Override\r\n\t\t\t\t\tif(x<0)\n\t\t\t\t\t\treturn "";\n\t\t\t\t\tfinal String ender=I.Name();\n\t\t\t\t\tif(!I.displayText().endsWith(ender+" is here"))\n\t\t\t\t\t\treturn "";\n\t\t\t\t\tif(!I.description().startsWith(ender+". "))\n\t\t\t\t\t\treturn "";\n\t\t\t\t\treturn "STATUE";\n\t\t\t\t}\n\t\t\t\t\tif(str.startsWith("SOAP ") || str.endsWith(" SOAP") || (str.indexOf("SOAP")>0))\r\n\t\t\t\t\t\treturn "SOAP";\r\n\t\t\t\t\tif(I instanceof Perfume)\r\n\t\t\t\t\t\treturn "PERFUME";\r\n\t\t\t\t\tif(I instanceof Food)\r\n\t\t\t\t\t\treturn "FOOD";\r\n\t\t\t\t\tif(I instanceof Drink)\r\n\t\t\t\t\t\treturn "DRINK";\r\n\t\t\t\t\treturn "";\r\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(!(I instanceof Rideable))\n\t\t\t\t\t\treturn "";\n\t\t\t\t\tswitch(((Rideable)I).rideBasis())\n\t\t\t\t\t{\n\t\t\t\t\tcase FURNITURE_SIT:\n\t\t\t\t\t\treturn "SIT";\n\t\t\t\t\tcase FURNITURE_TABLE:\n\t\t\t\t\t\treturn "TABLE";\n\t\t\t\t\tcase LADDER:\n\t\t\t\t\t\treturn "LADDER";\n\t\t\t\t\tcase ENTER_IN:\n\t\t\t\t\t\treturn "ENTER";\n\t\t\t\t\tcase FURNITURE_SLEEP:\n\t\t\t\t\t\treturn "BED";\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn "";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("LIQUID_CAPACITY","Liq.",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Drink) ? 4 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "25";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(!(I instanceof Drink))\n\t\t\t\t\t\treturn "";\n\t\t\t\t\treturn ""+((Drink)I).liquidHeld();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("MAX_WAND_USES","Max.",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Wand) ? 5 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "25";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(!(I instanceof Wand))\n\t\t\t\t\t\treturn "";\n\t\t\t\t\treturn ""+((Wand)I).getMaxCharges();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("WAND_TYPE","MagicT",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Wand) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int minColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 3;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal==null)\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tif(oldVal.length()==0)\n\t\t\t\t\t\treturn true;\n\t\t\t\t\treturn super.confirmValue(oldVal);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif((oldVal==null) || (oldVal.length()==0))\n\t\t\t\t\t\treturn new String[] { "ANY" };\n\t\t\t\t\treturn new String[] { oldVal };\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tchoices = new PairVector<String,String>();\n\t\t\t\t\tchoices.add("ANY", "Any");\n\t\t\t\t\tfor(final String[] set : Wand.WandUsage.WAND_OPTIONS)\n\t\t\t\t\t\tchoices.add(set[0], CMStrings.capitalizeAllFirstLettersAndLower(set[1]));\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "ANY";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Wand)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int ofType=((Wand)I).getEnchantType();\n\t\t\t\t\t\tif((ofType<0)||(ofType>Ability.ACODE_DESCS_.length))\n\t\t\t\t\t\t\treturn "ANY";\n\t\t\t\t\t\treturn Ability.ACODE_DESCS_[ofType];\n\t\t\t\t\t}\n\t\t\t\t\treturn "ANY";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("DICE_SIDES","Dice.",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof CMObject)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(((CMObject)o).ID().endsWith("Dice"))\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "6";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn ""+I.basePhyStats().ability();\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("WEAPON_CLASS","WClas",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Weapon) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(Weapon.CLASS_DESCS);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "BLUNT";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Weapon)\n\t\t\t\t\t\treturn Weapon.CLASS_DESCS[((Weapon)I).weaponClassification()];\n\t\t\t\t\treturn "0";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("SMOKE_FLAG","Smoke",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Light) ? 5 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(new String[] { "", "SMOKE" });\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(!(I instanceof Light))\n\t\t\t\t\t\treturn "";\n\t\t\t\t\tif((I instanceof Container)\n\t\t\t\t\t&&(((Light)I).getDuration() > 199)\n\t\t\t\t\t&&(((Container)I).capacity()==0))\n\t\t\t\t\t\treturn "SMOKE";\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("WEAPON_HANDS_REQUIRED","Hand",ParmType.NUMBERORNULL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Weapon) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Weapon)\n\t\t\t\t\t\treturn ((Weapon)I).rawLogicalAnd()?"2":"1";\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("KEY_VALUE_PARMS","Keys",ParmType.STRINGORNULL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\t// how would I even start....\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("LIGHT_DURATION","Dur.",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Light) ? 5 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "10";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Light)\n\t\t\t\t\t\treturn ""+((Light)I).getDuration();\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("CLAN_ITEM_CODENUMBER","Typ.",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof ClanItem) ? 10 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateNumberedChoices(ClanItem.ClanItemType.ALL);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof ClanItem)\n\t\t\t\t\t\treturn ""+((ClanItem)I).getClanItemType().ordinal();\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("CLAN_EXPERIENCE_COST_AMOUNT","Exp",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "100";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(!(I instanceof ClanItem))\n\t\t\t\t\t\treturn "100";\n\t\t\t\t\tif(I.getClass().getName().toString().indexOf("Flag")>0)\n\t\t\t\t\t\treturn "2500";\n\t\t\t\t\tif(I.getClass().getName().toString().indexOf("ClanItem")>0)\n\t\t\t\t\t\treturn "1000";\n\t\t\t\t\tif(I.getClass().getName().toString().indexOf("GenClanSpecialItem")>0)\n\t\t\t\t\t\treturn "500";\n\t\t\t\t\treturn "100";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("CLAN_AREA_FLAG","Area",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn o.getClass().getName().toString().indexOf("LawBook") > 0 ? 5 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(new String[] { "", "AREA" });\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn (I.getClass().getName().toString().indexOf("LawBook")>0)?"AREA":"";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("READABLE_TEXT","Read",ParmType.STRINGORNULL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(CMLib.flags().isReadable(I))\n\t\t\t\t\t\treturn I.readableText();\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("REQUIRED_COMMON_SKILL_ID","Common Skill",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof ClanItem) ? 5 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tfinal Vector<Object> V  = new Vector<Object>();\n\t\t\t\t\tAbility A = null;\n\t\t\t\t\tfor(final Enumeration<Ability> e=CMClass.abilities();e.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tA=e.nextElement();\n\t\t\t\t\t\tif((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_COMMON_SKILL)\n\t\t\t\t\t\t\tV.addElement(A);\n\t\t\t\t\t}\n\t\t\t\t\tV.addElement("");\n\t\t\t\t\tcreateChoices(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I.getClass().getName().toString().indexOf("LawBook")>0)\n\t\t\t\t\t\treturn "";\n\t\t\t\t\tif(I instanceof ClanItem)\n\t\t\t\t\t\treturn ((ClanItem)I).readableText();\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("FOOD_DRINK","ETyp",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(new String[]\n\t\t\t\t\t{\n\t\t\t\t\t\t"", "FOOD", "DRINK", "SOAP",\n\t\t\t\t\t\t"GenPerfume", "GenPowder", "GenCigar",\n\t\t\t\t\t\t"GenFoodResource", "GenLiquidResource", "GenResource"\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tfinal String str=(I.name()+" "+I.displayText()+" "+I.description()).toUpperCase();\n\t\t\t\t\tif(str.startsWith("SOAP ") || str.endsWith(" SOAP") || (str.indexOf("SOAP")>0))\n\t\t\t\t\t\treturn "SOAP";\n\t\t\t\t\tif(I instanceof Perfume)\n\t\t\t\t\t\treturn "GenPerfume";\n\t\t\t\t\tif(I instanceof MagicDust)\n\t\t\t\t\t\treturn "GenPowder";\n\t\t\t\t\tif((I instanceof Container)&&(I instanceof Light))\n\t\t\t\t\t\treturn "GenCigar";\n\t\t\t\t\tif((I instanceof Food)&&(I instanceof RawMaterial))\n\t\t\t\t\t\treturn "GenFoodResource";\n\t\t\t\t\tif(I instanceof Food)\n\t\t\t\t\t\treturn "FOOD";\n\t\t\t\t\tif((I instanceof Drink)&&(I instanceof RawMaterial))\n\t\t\t\t\t\treturn "GenLiquidResource";\n\t\t\t\t\tif(I instanceof Drink)\n\t\t\t\t\t\treturn "DRINK";\n\t\t\t\t\tif(I instanceof RawMaterial)\n\t\t\t\t\t\treturn "GenResource";\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("POTION_POWDER","P-type",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(new String[] { "", "POTION", "POWDER" });\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Potion)\n\t\t\t\t\t\treturn "POTION";\n\t\t\t\t\tif(I instanceof MagicDust)\n\t\t\t\t\t\treturn "POWDER";\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("SMELL_LIST","Smells",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Perfume) ? 5 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Perfume)\n\t\t\t\t\t\treturn ((Perfume)I).getSmellList();\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("RESOURCE_OR_KEYWORD","Resc/Itm",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_WHICH"))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String which=httpReq.getUrlParameter(fieldName+"_WHICH");\n\t\t\t\t\t\tif(which.trim().length()>0)\n\t\t\t\t\t\t\treturn httpReq.getUrlParameter(fieldName+"_RESOURCE");\n\t\t\t\t\t\treturn httpReq.getUrlParameter(fieldName+"_WORD");\n\t\t\t\t\t}\n\t\t\t\t\treturn oldVal;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tString value=webValue(httpReq,parms,oldVal,fieldName);\n\t\t\t\t\tif(value.endsWith("$"))\n\t\t\t\t\t\tvalue = value.substring(0,oldVal.length()-1);\n\t\t\t\t\tvalue = value.trim();\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("");\n\t\t\t\t\tstr.append("\\n\\r<INPUT TYPE=RADIO NAME="+fieldName+"_WHICH ");\n\t\t\t\t\tfinal boolean rsc=(value.trim().length()==0)||(RawMaterial.CODES.FIND_IgnoreCase(value)>=0);\n\t\t\t\t\tif(rsc)\n\t\t\t\t\t\tstr.append("CHECKED ");\n\t\t\t\t\tstr.append("VALUE=\\"RESOURCE\\">");\n\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+"_RESOURCE>");\n\t\t\t\t\tfinal String[] Ss=RawMaterial.CODES.NAMES().clone();\n\t\t\t\t\tArrays.sort(Ss);\n\t\t\t\t\tfor(final String S : Ss)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String VALUE = S.equals("NOTHING")?"":S;\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+VALUE+"\\"");\n\t\t\t\t\t\tif(rsc&&(value.equalsIgnoreCase(VALUE)))\n\t\t\t\t\t\t\tstr.append(" SELECTED");\n\t\t\t\t\t\tstr.append(">"+CMStrings.capitalizeAndLower(S));\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\tstr.append("<BR>");\n\t\t\t\t\tstr.append("\\n\\r<INPUT TYPE=RADIO NAME="+fieldName+"_WHICH ");\n\t\t\t\t\tif(!rsc)\n\t\t\t\t\t\tstr.append("CHECKED ");\n\t\t\t\t\tstr.append("VALUE=\\"\\">");\n\t\t\t\t\tstr.append("\\n\\r<INPUT TYPE=TEXT NAME="+fieldName+"_WORD VALUE=\\""+(rsc?"":value)+"\\">");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn new String[] { oldVal };\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\t++showNumber[0];\n\t\t\t\t\tboolean proceed = true;\n\t\t\t\t\tString str = oldVal;\n\t\t\t\t\twhile(proceed&&(!mob.session().isStopped()))\n\t\t\t\t\t{\n\t\t\t\t\t\tproceed = false;\n\t\t\t\t\t\tstr=CMLib.genEd().prompt(mob,oldVal,showNumber[0],showFlag,prompt(),true,CMParms.toListString(RawMaterial.CODES.NAMES())).trim();\n\t\t\t\t\t\tif(str.equals(oldVal))\n\t\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t\tfinal int r=RawMaterial.CODES.FIND_IgnoreCase(str);\n\t\t\t\t\t\tif(r==0)\n\t\t\t\t\t\t\tstr="";\n\t\t\t\t\t\telse\n\t\t\t\t\t\tif(r>0)\n\t\t\t\t\t\t\tstr=RawMaterial.CODES.NAME(r);\n\t\t\t\t\t\tif(str.equals(oldVal))\n\t\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t\tif(str.length()==0)\n\t\t\t\t\t\t\treturn "";\n\t\t\t\t\t\tfinal boolean isResource = CMParms.contains(RawMaterial.CODES.NAMES(),str);\n\t\t\t\t\t\tif((!isResource)&&(mob.session()!=null)&&(!mob.session().isStopped()))\n\t\t\t\t\t\t\tif(!mob.session().confirm(L("You`ve entered a non-resource item keyword \'@x1\', ok (Y/n)?",str),"Y"))\n\t\t\t\t\t\t\t\tproceed = true;\n\t\t\t\t\t}\n\t\t\t\t\treturn str;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("RESOURCE_NAME_OR_HERB_NAME","Resrc/Herb",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tif(!oldVal.endsWith("$"))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn CMParms.contains(RawMaterial.CODES.NAMES(),oldVal);\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.endsWith("$"))\n\t\t\t\t\t\treturn new String[]{oldVal.substring(0,oldVal.length()-1)};\n\t\t\t\t\treturn new String[]{oldVal};\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal AbilityParmEditor A = CMLib.ableParms().getEditors().get("RESOURCE_OR_KEYWORD");\n\t\t\t\t\tif(oldVal.endsWith("$"))\n\t\t\t\t\t\toldVal = oldVal.substring(0,oldVal.length()-1);\n\t\t\t\t\tfinal String value = A.webValue(httpReq,parms,oldVal,fieldName);\n\t\t\t\t\tfinal int r=RawMaterial.CODES.FIND_IgnoreCase(value);\n\t\t\t\t\tif(r>=0)\n\t\t\t\t\t\treturn RawMaterial.CODES.NAME(r);\n\t\t\t\t\treturn (value.trim().length()==0)?"":(value+"$");\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal AbilityParmEditor A = CMLib.ableParms().getEditors().get("RESOURCE_OR_KEYWORD");\n\t\t\t\t\treturn A.webField(httpReq,parms,oldVal,fieldName);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webTableField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.endsWith("$"))\n\t\t\t\t\t\treturn oldVal.substring(0,oldVal.length()-1);\n\t\t\t\t\treturn oldVal;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\t++showNumber[0];\n\t\t\t\t\tboolean proceed = true;\n\t\t\t\t\tString str = oldVal;\n\t\t\t\t\tfinal String orig = oldVal;\n\t\t\t\t\twhile(proceed&&(!mob.session().isStopped()))\n\t\t\t\t\t{\n\t\t\t\t\t\tproceed = false;\n\t\t\t\t\t\tif(oldVal.trim().endsWith("$"))\n\t\t\t\t\t\t\toldVal=oldVal.trim().substring(0,oldVal.trim().length()-1);\n\t\t\t\t\t\tstr=CMLib.genEd().prompt(mob,oldVal,showNumber[0],showFlag,prompt(),true,CMParms.toListString(RawMaterial.CODES.NAMES())).trim();\n\t\t\t\t\t\tif(str.equals(orig))\n\t\t\t\t\t\t\treturn orig;\n\t\t\t\t\t\tfinal int r=RawMaterial.CODES.FIND_IgnoreCase(str);\n\t\t\t\t\t\tif(r==0)\n\t\t\t\t\t\t\tstr="";\n\t\t\t\t\t\telse\n\t\t\t\t\t\tif(r>0)\n\t\t\t\t\t\t\tstr=RawMaterial.CODES.NAME(r);\n\t\t\t\t\t\tif(str.equals(orig))\n\t\t\t\t\t\t\treturn orig;\n\t\t\t\t\t\tif(str.length()==0)\n\t\t\t\t\t\t\treturn "";\n\t\t\t\t\t\tfinal boolean isResource = CMParms.contains(RawMaterial.CODES.NAMES(),str);\n\t\t\t\t\t\tif((!isResource)&&(mob.session()!=null)&&(!mob.session().isStopped()))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(!mob.session().confirm(L("You`ve entered a non-resource item keyword \'@x1\', ok (Y/n)?",str),"Y"))\n\t\t\t\t\t\t\t\tproceed = true;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr=str+"$";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn str;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("AMMO_TYPE","Ammo",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn ((o instanceof AmmunitionWeapon) || (o instanceof Ammunition)) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "arrows";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Ammunition)\n\t\t\t\t\t\treturn ""+((Ammunition)I).ammunitionType();\n\t\t\t\t\tif((I instanceof AmmunitionWeapon)&&(((AmmunitionWeapon)I).requiresAmmunition()))\n\t\t\t\t\t\treturn ""+((AmmunitionWeapon)I).ammunitionType();\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("AMMO_CAPACITY","Ammo#",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn ((o instanceof AmmunitionWeapon) || (o instanceof Ammunition)) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "1";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Ammunition)\n\t\t\t\t\t\treturn ""+((Ammunition)I).ammunitionRemaining();\n\t\t\t\t\tif((I instanceof AmmunitionWeapon)&&(((AmmunitionWeapon)I).requiresAmmunition()))\n\t\t\t\t\t\treturn ""+((AmmunitionWeapon)I).ammunitionCapacity();\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("MIN_MAX_RANGE","Rng",ParmType.NUMBER_PAIR)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn ((o instanceof Weapon) && (!(o instanceof Ammunition))) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "5";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Weapon)\n\t\t\t\t\t\treturn ""+((Weapon)I).getRanges()[0]+","+((Weapon)I).getRanges()[1];\n\t\t\t\t\telse\n\t\t\t\t\tif(I instanceof Ammunition)\n\t\t\t\t\t\treturn ""+I.minRange()+","+I.maxRange();\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("RESOURCE_OR_MATERIAL","Rsc/ Mat",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tfinal XVector<String> V=new XVector<String>(RawMaterial.CODES.NAMES());\n\t\t\t\t\tCollections.sort(V);\n\t\t\t\t\tfinal XVector<String> V2=new XVector<String>(RawMaterial.Material.names());\n\t\t\t\t\tCollections.sort(V2);\n\t\t\t\t\tV.addAll(V2);\n\t\t\t\t\tcreateChoices(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(CMStrings.containsWordIgnoreCase(I.Name(),"rice"))\n\t\t\t\t\t\treturn "RICE";\n\t\t\t\t\tif(I.material() == RawMaterial.RESOURCE_PAPER)\n\t\t\t\t\t\treturn "WOOD";\n\t\t\t\t\treturn RawMaterial.CODES.NAME(I.material());\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "IRON";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("REQ_RESOURCE_OR_MATERIAL","Rsc/ Mat",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof RawMaterial)\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tfinal XVector<String> V=new XVector<String>(RawMaterial.CODES.NAMES());\n\t\t\t\t\tCollections.sort(V);\n\t\t\t\t\tfinal XVector<String> V2=new XVector<String>(RawMaterial.Material.names());\n\t\t\t\t\tCollections.sort(V2);\n\t\t\t\t\tV.addAll(V2);\n\t\t\t\t\tcreateChoices(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(CMStrings.containsWordIgnoreCase(I.Name(),"rice"))\n\t\t\t\t\t\treturn "RICE";\n\t\t\t\t\tif(I.material() == RawMaterial.RESOURCE_PAPER)\n\t\t\t\t\t\treturn "WOOD";\n\t\t\t\t\treturn RawMaterial.CODES.NAME(I.material());\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "IRON";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("OPTIONAL_RESOURCE_OR_MATERIAL","Rsc/ Mat",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tfinal XVector<String> V=new XVector<String>(RawMaterial.CODES.NAMES());\n\t\t\t\t\tCollections.sort(V);\n\t\t\t\t\tfinal XVector<String> V2=new XVector<String>(RawMaterial.Material.names());\n\t\t\t\t\tCollections.sort(V2);\n\t\t\t\t\tV.addAll(V2);\n\t\t\t\t\tV.addElement("");\n\t\t\t\t\tcreateChoices(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("OPTIONAL_RESOURCE_OR_MATERIAL_AMT","Rsc Amt",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\tif(o instanceof Wand)\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\treturn ((o instanceof Weapon) && (!(o instanceof Ammunition))) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn true;\n\t\t\t\t\treturn CMath.isInteger(oldVal);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I==null)\n\t\t\t\t\t\treturn "";\n\t\t\t\t\tfinal List<String> words=CMParms.parse(I.name());\n\t\t\t\t\tfor(int i=words.size()-1;i>=0;i--)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String s=words.get(i);\n\t\t\t\t\t\tfinal int y=s.indexOf(\'-\');\n\t\t\t\t\t\tif(y>=0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twords.add(s.substring(0, y));\n\t\t\t\t\t\t\twords.add(s.substring(0, y+1));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor(final String word : words)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(word.length()>0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal int rsc=RawMaterial.CODES.FIND_IgnoreCase(word);\n\t\t\t\t\t\t\tif((rsc > 0)&&(rsc != I.material()))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(I.basePhyStats().level()>80)\n\t\t\t\t\t\t\t\t\treturn ""+4;\n\n\t\t\t\t\t\t\t\tif(I.basePhyStats().level()>40)\n\t\t\t\t\t\t\t\t\treturn ""+2;\n\n\t\t\t\t\t\t\t\treturn ""+1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("OPTIONAL_BUILDING_RESOURCE_OR_MATERIAL","Rsc/ Mat",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tfinal XVector<String> V=new XVector<String>(RawMaterial.CODES.NAMES());\n\t\t\t\t\tCollections.sort(V);\n\t\t\t\t\tfinal XVector<String> V2=new XVector<String>(RawMaterial.Material.names());\n\t\t\t\t\tCollections.sort(V2);\n\t\t\t\t\tV.addAll(V2);\n\t\t\t\t\tV.addElement("VALUE");\n\t\t\t\t\tV.addElement("MONEY");\n\t\t\t\t\tV.addElement("");\n\t\t\t\t\tcreateChoices(V);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tfinal List<String> words=CMParms.parse(I.name());\n\t\t\t\t\tfor(int i=words.size()-1;i>=0;i--)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String s=words.get(i);\n\t\t\t\t\t\tfinal int y=s.indexOf(\'-\');\n\t\t\t\t\t\tif(y>=0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twords.add(s.substring(0, y));\n\t\t\t\t\t\t\twords.add(s.substring(0, y+1));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor(final String word : words)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(word.length()>0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal int rsc=RawMaterial.CODES.FIND_IgnoreCase(word);\n\t\t\t\t\t\t\tif((rsc > 0)&&(rsc != I.material()))\n\t\t\t\t\t\t\t\treturn RawMaterial.CODES.NAME(rsc);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("HERB_NAME","Herb Final Name",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "Herb Name";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int minColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 10;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I.material()==RawMaterial.RESOURCE_HERBS)\n\t\t\t\t\t\treturn CMStrings.lastWordIn(I.Name());\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("FLOWER_NAME","Flower Final Name",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "Flower Name";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int minColWidth()\n\t\t\t\t{\n\t\t\t\t\treturn 10;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I.material()==RawMaterial.RESOURCE_FLOWERS)\n\t\t\t\t\t\treturn CMStrings.lastWordIn(I.Name());\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("RIDE_CAPACITY","Ridrs",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Rideable) ? 3 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "2";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof Rideable)\n\t\t\t\t\t\treturn ""+((Rideable)I).riderCapacity();\n\t\t\t\t\treturn "0";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("METAL_OR_WOOD","Metal",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(new String[] { "METAL", "WOOD" });\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "METAL";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tswitch(I.material()&RawMaterial.MATERIAL_MASK)\n\t\t\t\t\t{\n\t\t\t\t\tcase RawMaterial.MATERIAL_METAL:\n\t\t\t\t\tcase RawMaterial.MATERIAL_MITHRIL:\n\t\t\t\t\t\treturn "METAL";\n\t\t\t\t\tcase RawMaterial.MATERIAL_WOODEN:\n\t\t\t\t\t\treturn "WOOD";\n\t\t\t\t\t}\n\t\t\t\t\treturn ""; // absolutely no way to determine\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("OPTIONAL_RACE_ID","Race",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(CMClass.races());\n\t\t\t\t\tchoices().add("","");\n\t\t\t\t\tfor(int x=0;x<choices().size();x++)\n\t\t\t\t\t\tchoices().get(x).first = choices().get(x).first.toUpperCase();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t\t}\r\n\t\t\t\t\treturn oldVal;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic String defaultValue()\r\n\t\t\t\t{\r\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn defaultValue();\r\n\t\t\t\t\treturn CMLib.coffeeMaker().getItemXML(I);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic String prompt()\r\n\t\t\t\t{\r\n\t\t\t\t\treturn "Item";\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\r\n\t\t\t\t{\r\n\t\t\t\t\tVector<String> raceIDs=null;\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_RACE"))\n\t\t\t\t\t{\n\t\t\t\t\t\tString id="";\n\t\t\t\t@Override\r\n\t\t\t\tpublic String webTableField(final HTTPRequest httpReq, final java.util.Map<String, String> parms, final String oldVal)\r\n\t\t\t\t{\r\n\t\t\t\t\tString val=oldVal;\r\n\t\t\t\t\t\r\n\t\t\t\t\tif((val != null)\r\n\t\t\t\t\t&&(val.length()>0)\r\n\t\t\t\t\t&&(val.trim().startsWith("<")))\r\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tfinal Vector<String> raceIDs=CMParms.parse(webValue(httpReq,parms,oldVal,fieldName).toUpperCase());\n\t\t\t\t\tfinal StringBuffer str = new StringBuffer("");\n\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+"_RACE MULTIPLE>");\n\t\t\t\t\tstr.append("<OPTION VALUE=\\"\\" "+((raceIDs.size()==0)?"SELECTED":"")+">");\n\t\t\t\t\tfor(final Enumeration<Race> e=CMClass.races();e.hasMoreElements();)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Race R=e.nextElement();\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+R.ID()+"\\" "+((raceIDs.contains(R.ID().toUpperCase()))?"SELECTED":"")+">"+R.name());\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tfinal Vector<String> parsedVals = CMParms.parse(oldVal.toUpperCase());\n\t\t\t\t\tif(parsedVals.size()==0)\n\t\t\t\t\t\treturn new String[]{""};\n\t\t\t\t\tfinal Vector<String> races = new Vector<String>();\n\t\t\t\t\tfor(int p=0;p<parsedVals.size();p++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Race R=CMClass.getRace(parsedVals.elementAt(p));\n\t\t\t\t\t\traces.addElement(R.name());\n\t\t\t\t\t}\n\t\t\t\t\tfor(int p=0;p<parsedVals.size();p++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal Race R=CMClass.getRace(parsedVals.elementAt(p));\n\t\t\t\t\t\traces.addElement(R.name());\n\t\t\t\t\t}\n\t\t\t\t\traces.addElement("");\n\t\t\t\t\treturn CMParms.toStringArray(races);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\tif((showFlag>0)&&(showFlag!=showNumber[0]))\n\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\tString behave="NO";\n\t\t\t\t\tString newVal = oldVal;\n\t\t\t\t\twhile((mob.session()!=null)&&(!mob.session().isStopped())&&(behave.length()>0))\n\t\t\t\t\t{\n\t\t\t\t\t\tmob.tell(showNumber+". "+prompt()+": \'"+newVal+"\'.");\n\t\t\t\t\t\tif((showFlag!=showNumber[0])&&(showFlag>-999))\n\t\t\t\t\t\t\treturn newVal;\n\t\t\t\t\t\tfinal Vector<String> parsedVals = CMParms.parse(newVal.toUpperCase());\n\t\t\t\t\t\t\t\treturn CMLib.coffeeMaker().getItemXML(I);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tString rowNum=fieldName.substring(5);\r\n\t\t\t\t\t\tint x=rowNum.indexOf(\'_\');\r\n\t\t\t\t\t\tif(x>0)\r\n\t\t\t\t\t\t\trowNum=rowNum.substring(0,x);\r\n\t\t\t\t\t\tItem I=null;\r\n\t\t\t\t\t\t\t\tfinal Race R=CMClass.getRace(behave);\n\t\t\t\t\t\t\t\tif(R!=null)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(parsedVals.contains(R.ID().toUpperCase()))\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmob.tell(L("\'@x1\' removed.",behave));\n\t\t\t\t\t\t\t\t\t\tparsedVals.remove(R.ID().toUpperCase().trim());\n\t\t\t\t\t\t\t\t\t\tnewVal = CMParms.combine(parsedVals,0);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmob.tell(L("@x1 added.",R.ID()));\n\t\t\t\t\t\t\t\t\t\tparsedVals.addElement(R.ID().toUpperCase());\n\t\t\t\t\t\t\t\t\t\tnewVal = CMParms.combine(parsedVals,0);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmob.tell(L("\'@x1\' is not a recognized race.  Try \'?\'.",behave));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn data.toString();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tLog.debugOut("AbilityEditor:ITEM_CMARE:webValue: "+fieldName+": "+oldVal);\r\n\t\t\t\t\treturn oldVal;\r\n\t\t\t\t}\r\n\t\t\tnew AbilityParmEditorImpl("INSTRUMENT_TYPE","Instrmnt",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(MusicalInstrument.InstrumentType.valueNames());\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof MusicalInstrument) ? 5 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "DRUMS";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I instanceof MusicalInstrument)\n\t\t\t\t\t\treturn ((MusicalInstrument)I).getInstrumentTypeName();\n\t\t\t\t\treturn "0";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("STONE_FLAG","Stone",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(new String[] { "", "STONE" });\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof RawMaterial) ? 5 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I.material()==RawMaterial.RESOURCE_STONE)\n\t\t\t\t\t\treturn "STONE";\n\t\t\t\t\t\tI=CMClass.getItem(oldVal);\r\n\t\t\t\t\twhile(!mob.session().isStopped())\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tString showVal = (I==null)?"None?!":(I.Name()+" ("+I.ID()+")");\r\n\t\t\t\t\t\tstr=CMLib.genEd().prompt(mob,showVal,showNumber[0],showFlag,prompt(),true,"").trim();\r\n\t\t\t\t\t\tif(str.equals(oldVal)||(str.equals(showVal))||(str.trim().length()==0))\r\n\t\t\t\t\t\t\treturn oldVal;\r\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "New Post";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("POSE_DESCRIPTION","Pose Description",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "<S-NAME> is standing here.";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(!(I instanceof DeadBody))\n\t\t\t\t\t\treturn "";\n\t\t\t\t\tString pose=I.displayText();\n\t\t\t\t\tpose=CMStrings.replaceAll(pose,I.name(),"<S-NAME>");\n\t\t\t\t\tpose=CMStrings.replaceWord(pose,"himself"," <S-HIM-HERSELF>");\n\t\t\t\t\tpose=CMStrings.replaceWord(pose,"herself"," <S-HIM-HERSELF>");\n\t\t\t\t\tpose=CMStrings.replaceWord(pose,"his"," <S-HIS-HER>");\n\t\t\t\t\tpose=CMStrings.replaceWord(pose,"her"," <S-HIS-HER>");\n\t\t\t\t\tpose=CMStrings.replaceWord(pose,"him"," <S-HIM-HER>");\n\t\t\t\t\tpose=CMStrings.replaceWord(pose,"her"," <S-HIM-HER>");\n\t\t\t\t\treturn pose;\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("WOOD_METAL_CLOTH","",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(new String[] { "WOOD", "METAL", "CLOTH" });\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "WOOD";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tswitch(I.material()&RawMaterial.MATERIAL_MASK)\n\t\t\t\t\t{\n\t\t\t\t\tcase RawMaterial.MATERIAL_CLOTH:\n\t\t\t\t\t\treturn "CLOTH";\n\t\t\t\t\tcase RawMaterial.MATERIAL_METAL:\n\t\t\t\t\t\treturn "METAL";\n\t\t\t\t\tcase RawMaterial.MATERIAL_MITHRIL:\n\t\t\t\t\t\treturn "METAL";\n\t\t\t\t\tcase RawMaterial.MATERIAL_WOODEN:\n\t\t\t\t\t\treturn "WOOD";\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn "";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("WEAPON_TYPE","W.Type",ParmType.CHOICES)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Weapon) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(Weapon.TYPE_DESCS);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn (I instanceof Weapon) ? Weapon.TYPE_DESCS[((Weapon) I).weaponDamageType()] : "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "BASHING";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ATTACK_MODIFICATION","Att.",ParmType.NUMBER)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn (o instanceof Weapon) ? 2 : -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "" + ((I instanceof Weapon) ? ((Weapon) I).basePhyStats().attackAdjustment() : 0);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "0";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("N_A","N/A",ParmType.STRING)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn oldVal.trim().length() == 0 || oldVal.equals("0") || oldVal.equals("NA") || oldVal.equals("-");\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String, String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("RESOURCE_NAME_AMOUNT_MATERIAL_REQUIRED","Resrc/Amt",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t\tcreateChoices(RawMaterial.CODES.NAMES());\n\t\t\t\t\tchoices().add("","");\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tint amt=(int)Math.round(CMath.mul(I.basePhyStats().weight()-1,(A!=null)?A.getItemWeightMultiplier(false):1.0));\n\t\t\t\t\tif(amt<1)\n\t\t\t\t\t\tamt=1;\n\t\t\t\t\treturn RawMaterial.CODES.NAME(I.material())+"/"+amt;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic int appliesToClass(final Object o)\n\t\t\t\t{\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tif(httpReq.isUrlParameter(fieldName+"_RESOURCE"))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String rsc=httpReq.getUrlParameter(fieldName+"_RESOURCE");\n\t\t\t\t\t\tfinal String amt=httpReq.getUrlParameter(fieldName+"_AMOUNT");\n\t\t\t\t\t\tif((rsc.trim().length()==0)||(rsc.equalsIgnoreCase("NOTHING"))||(CMath.s_int(amt)<=0))\n\t\t\t\t\t\t\treturn "";\n\t\t\t\t\t\treturn rsc+"/"+amt;\n\t\t\t\t\t}\n\t\t\t\t\treturn oldVal;\n\t\t\t\t}\n\n\t\t{\r\n\t\t\treturn prompt;\r\n\t\t}\r\n\t\t\r\n\t\t@Override\r\n\t\tpublic String colHeader()\r\n\t\t{\r\n\t\t\t\t\tif(x>0)\n\t\t\t\t\t{\n\t\t\t\t\t\trsc = value.substring(0,x);\n\t\t\t\t\t\tamt = CMath.s_int(value.substring(x+1));\n\t\t\t\t\t}\n\t\t\t\t\tfinal StringBuffer str=new StringBuffer("");\n\t\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+"_RESOURCE MULTIPLE>");\n\t\t\t\t\tfinal String[] Ss=RawMaterial.CODES.NAMES().clone();\n\t\t\t\t\tArrays.sort(Ss);\n\t\t\t\t\tfor(final String S : Ss)\n\t\t\t\t\t{\n\t\t\t\t\t\tstr.append("<OPTION VALUE=\\""+S+"\\" "\n\t\t\t\t\t\t\t\t+((S.equalsIgnoreCase(rsc))?"SELECTED":"")+">"\n\t\t\t\t\t\t\t\t+CMStrings.capitalizeAndLower(S));\n\t\t\t\t\t}\n\t\t\t\t\tstr.append("</SELECT>");\n\t\t\t\t\tstr.append("&nbsp;&nbsp;Amount: ");\n\t\t\t\t\tstr.append("<INPUT TYPE=TEXT NAME="+fieldName+"_AMOUNT VALUE="+amt+">");\n\t\t\t\t\treturn str.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\t\treturn true;\n\t\t\t\t\toldVal=oldVal.trim();\n\t\t\t\t\tfinal int x=oldVal.indexOf(\'/\');\n\t\t\t\t\tif(x<0)\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tif(!CMStrings.contains(choices().toArrayFirst(new String[0]),oldVal.substring(0,x)))\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tif(!CMath.isInteger(oldVal.substring(x+1)))\n\t\t\t\t\t\treturn false;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tfinal int x=oldVal.indexOf(\'/\');\n\t\t\t\t\tif(x<=0) return new String[]{""};\n\t\t\t\t\treturn new String[]{oldVal.substring(0,x),oldVal.substring(x+1)};\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLinePrompt(final MOB mob, String oldVal, final int[] showNumber, final int showFlag) throws java.io.IOException\n\t\t\t\t{\n\t\t\t\t\toldVal=oldVal.trim();\n\t\t\t\t\tfinal int x=oldVal.indexOf(\'/\');\n\t\t\t\t\tString oldRsc = "";\n\t\t\t\t\tint oldAmt = 0;\n\t\t\t\t\tif(x>0)\n\t\t\t\t\t{\n\t\t\t\t\t\toldRsc = oldVal.substring(0,x);\n\t\t\t\t\t\toldAmt = CMath.s_int(oldVal.substring(x));\n\t\t\t\t\t}\n\t\t\t\t\toldRsc = CMLib.genEd().promptChoice(mob,oldRsc,++showNumber[0],showFlag,prompt(),choices());\n\t\t\t\t\tif(oldRsc.length()>0)\n\t\t\t\t\t\treturn oldRsc+"/"+CMLib.genEd().prompt(mob,oldAmt,++showNumber[0],showFlag,prompt());\n\t\t\t\t\treturn "";\n\t\t\t\t}\n\t\t\t},\n\t\t\tnew AbilityParmEditorImpl("ITEM_CMARE","Items",ParmType.SPECIAL)\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic void createChoices()\n\t\t\t\t{\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String commandLineValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.trim().startsWith("<"))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal List<XMLLibrary.XMLTag> xml = CMLib.xml().parseAllXML(oldVal);\n\t\t\t\t\t\tif(xml.size()>0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal String nameXML=CMLib.xml().getValFromPieces(xml.get(0).contents(), "ITEXT");\n\t\t\t\t\t\t\tfinal List<XMLLibrary.XMLTag> nameTags=CMLib.xml().parseAllXML(CMLib.xml().restoreAngleBrackets(nameXML));\n\t\t\t\t\t\t\tfinal String name=CMLib.xml().getValFromPieces(nameTags, "NAME");\n\t\t\t\t\t\t\tfinal String classID=CMLib.xml().getValFromPieces(xml.get(0).contents(), "ICLAS");\n\t\t\t\t\t\t\treturn name+" ("+classID+")";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn oldVal;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String defaultValue()\n\t\t\t\t{\n\t\t\t\t\treturn "<ITEM></ITEM>";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String convertFromItem(final ItemCraftor A, final Item I)\n\t\t\t\t{\n\t\t\t\t\tif(I==null)\n\t\t\t\t\t\treturn defaultValue();\n\t\t\t\t\treturn CMLib.coffeeMaker().getItemXML(I);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String prompt()\n\t\t\t\t{\n\t\t\t\t\treturn "Item";\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean confirmValue(final String oldVal)\n\t\t\t\t{\n\t\t\t\t\treturn ((oldVal != null)\n\t\t\t\t\t\t\t&&(oldVal.length()>0)\n\t\t\t\t\t\t\t&&(oldVal.trim().startsWith("<")));\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webTableField(final HTTPRequest httpReq, final java.util.Map<String, String> parms, final String oldVal)\n\t\t\t\t{\n\t\t\t\t\tfinal String val=oldVal;\n\n\t\t\t\t\tif((val != null)\n\t\t\t\t\t&&(val.length()>0)\n\t\t\t\t\t&&(val.trim().startsWith("<")))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal List<XMLLibrary.XMLTag> xml = CMLib.xml().parseAllXML(oldVal);\n\t\t\t\t\t\tif(xml.size()>0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal String nameXML=CMLib.xml().getValFromPieces(xml.get(0).contents(), "ITEXT");\n\t\t\t\t\t\t\tfinal List<XMLLibrary.XMLTag> nameTags=CMLib.xml().parseAllXML(CMLib.xml().restoreAngleBrackets(nameXML));\n\t\t\t\t\t\t\tfinal String name=CMLib.xml().getValFromPieces(nameTags, "NAME");\n\t\t\t\t\t\t\tfinal String classID=CMLib.xml().getValFromPieces(xml.get(0).contents(), "ICLAS");\n\t\t\t\t\t\t\treturn name+" ("+classID+")";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn oldVal;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tif(fieldName.equalsIgnoreCase("NEWCLASSFIELD"))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn "";\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\tif(fieldName.equalsIgnoreCase("CLASSFIELD"))\n\t\t\t\t\t{\n\t\t\t\t\t\tif(oldVal.trim().startsWith("<"))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal List<XMLLibrary.XMLTag> pieces=CMLib.xml().parseAllXML(oldVal);\n\t\t\t\t\t\t\tif(pieces.size()>0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfinal XMLLibrary.XMLTag tag = CMLib.xml().getPieceFromPieces(pieces, "ITEM");\n\t\t\t\t\t\t\t\tif(tag != null)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tString realClassID=CMLib.xml().getValFromPieces(tag.contents(), "ICLAS");\n\t\t\t\t\t\t\t\t\tif(realClassID == null)\n\t\t\t\t\t\t\t\t\t\trealClassID=CMLib.xml().getValFromPieces(tag.contents(), "CLASSID");\n\t\t\t\t\t\t\t\t\tif((realClassID!=null)\n\t\t\t\t\t\t\t\t\t&&(realClassID.length()>0))\n\t\t\t\t\t\t\t\t\t\treturn realClassID;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\tif(fieldName.startsWith("DATA_"))\n\t\t\t\t\t{\n\t\t\t\t\t\tif(httpReq.isUrlParameter("ITEM"))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal String itemID = httpReq.getUrlParameter("ITEM");\n\t\t\t\t\t\t\tfinal Item I=CMLib.webMacroFilter().getItemFromWebCache(itemID);\n\t\t\t\t\t\t\tif(I!=null)\n\t\t\t\t\t\t\t\treturn CMLib.coffeeMaker().getItemXML(I);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tString rowNum=fieldName.substring(5);\n\t\t\t\t\t\tfinal int x=rowNum.indexOf(\'_\');\n\t\t\t\t\t\tif(x>0)\n\t\t\t\t\t\t\trowNum=rowNum.substring(0,x);\n\t\t\t\t\t\tItem I=null;\n\t\t\t\t\t\tif(oldVal.trim().startsWith("<"))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfinal List<Item> madeItem=new ArrayList<Item>(1);\n\t\t\t\t\t\t\tfinal String error=CMLib.coffeeMaker().addItemsFromXML("<ITEMS>"+oldVal+"</ITEMS>", madeItem, null);\n\t\t\t\t\t\t\tif(((error == null)||(error.length()==0))\n\t\t\t\t\t\t\t&&(madeItem.size()>0))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tI=madeItem.get(0);\n\t\t\t\t\t\t\t\tCMLib.threads().deleteAllTicks(I);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tI=CMClass.getItem(oldVal);\n\t\t\t\t\t\tif(I!=null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tCMLib.webMacroFilter().contributeItemsToWebCache(new XVector<Item>(I));\n\t\t\t\t\t\t\tfinal String cachedID = CMLib.webMacroFilter().findItemWebCacheCode(I);\n\t\t\t\t\t\t\tfinal StringBuilder data = new StringBuilder("");\n\t\t\t\t\t\t\tdata.append("<FONT COLOR=WHITE>"+I.Name()+" ("+I.ID()+")</FONT>&nbsp;&nbsp;");\n\t\t\t\t\t\t\tdata.append("<INPUT TYPE=HIDDEN NAME=\\""+fieldName+"\\" VALUE=\\""+cachedID+"\\">");\n\t\t\t\t\t\t\thttpReq.addFakeUrlParameter("ONMODIFY", "SwitchToItemEditor(\'"+cachedID+"\',\'"+rowNum+"\')");\n\t\t\t\t\t\t\thttpReq.addFakeUrlParameter("HIDESAVEOPTION", "true");\n\t\t\t\t\t\t\t//data.append("<a href=\\"javascript:SwitchToItemEditor(\'"+cachedID+"\',\'"+rowNum+"\');\\">Edit Item</a>\\n\\r ");\n\t\t\t\t\t\t\tI.destroy();\n\t\t\t\t\t\t\treturn data.toString();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tLog.debugOut("AbilityEditor:ITEM_CMARE:webValue: "+fieldName+": "+oldVal);\n\t\t\t\t\treturn oldVal;\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t\t\t{\n\t\t\t\t\tString value=webValue(httpReq,parms,oldVal,fieldName);\n\t\t\t\t\tif(value.endsWith("$"))\n\t\t\t\t\t\tvalue = value.substring(0,oldVal.length()-1);\n\t\t\t\t\tvalue = value.trim();\n\t\t\t\t\tif(fieldName.equalsIgnoreCase("NEWCLASSFIELD"))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal StringBuilder html = new StringBuilder("");\n\t\t\t\t\t\tfinal List<String> sortMe=new Vector<String>();\n\t\t\t\t\t\tCMClass.addAllItemClassNames(sortMe,true,false,true,Area.THEME_ALLTHEMES);\n\t\t\t\t\t\tCollections.sort(sortMe);\n\t\t\t\t\t\thtml.append("<SELECT NAME="+fieldName+" ID="+fieldName+">");\n\t\t\t\t\t\tfor (final Object element : sortMe)\n\t\t\t\t\t\t\thtml.append("<OPTION VALUE=\\""+(String)element+"\\">"+(String)element);\n\t\t\t\t\t\thtml.append("</SELECT>");\n\t\t\t\t\t\treturn html.toString();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\tif(fieldName.equalsIgnoreCase("CLASSFIELD"))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn "*dunno*";\n\t\t\t\t\t}\n\t\t\t\t\tLog.debugOut("AbilityEditor:ITEM_CMARE:webField: "+fieldName+": "+oldVal);\n\t\t\t\t\treturn value.toString();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t{\r\n\t\t\treturn oldVal;\r\n\t\t}\r\n\t\t\r\n\t\t@Override\r\n\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\r\n\t\t{\r\n\t\t\t\t{\n\t\t\t\t\t++showNumber[0];\n\t\t\t\t\tString str = oldVal;\n\t\t\t\t\tItem I = null;\n\t\t\t\t\tif(oldVal.trim().startsWith("<"))\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal List<Item> madeItem=new ArrayList<Item>(1);\n\t\t\t\t\t\tfinal String error=CMLib.coffeeMaker().addItemsFromXML("<ITEMS>"+oldVal+"</ITEMS>", madeItem, null);\n\t\t\t\t\t\tif(((error == null)||(error.length()==0))\n\t\t\t\t\t\t&&(madeItem.size()>0))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tI=madeItem.get(0);\n\t\t\t\t\t\t\tCMLib.threads().deleteAllTicks(I);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tI=CMClass.getItem(oldVal);\n\t\t\t\t\twhile(!mob.session().isStopped())\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal String showVal = (I==null)?"None?!":(I.Name()+" ("+I.ID()+")");\n\t\t\t\t\t\tstr=CMLib.genEd().prompt(mob,showVal,showNumber[0],showFlag,prompt(),true,"").trim();\n\t\t\t\t\t\tif(str.equals(oldVal)||(str.equals(showVal))||(str.trim().length()==0))\n\t\t\t\t\t\t\treturn oldVal;\n\t\t\t\t\t\tfinal Item newI = mob.location().findItem(str);\n\t\t\t\t\t\tif(newI == null)\n\t\t\t\t\t\t\tmob.tell(L("No item \'"+str+"\' found in "+mob.location().displayText(mob)));\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\treturn CMLib.coffeeMaker().getItemXML(newI);\n\t\t\t\t\t}\n\t\t\t\t\tif(I!=null)\n\t\t\t\t\t\tI.destroy();\n\t\t\t\t\treturn str;\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tDEFAULT_EDITORS = new Hashtable<String,AbilityParmEditor>();\n\t\tfor(int v=0;v<V.size();v++)\n\t\t{\n\t\t\tfinal AbilityParmEditor A = V.elementAt(v);\n\t\t\tDEFAULT_EDITORS.put(A.ID(),A);\n\t\t}\n\t\treturn DEFAULT_EDITORS;\n\t}\n\n\tprotected class AbilityRecipeDataImpl implements AbilityRecipeData\n\t{\n\t\tprivate String recipeFilename;\n\t\tprivate String recipeFormat;\n\t\tprivate Vector<Object> columns;\n\t\tprivate Vector<DVector> dataRows;\n\t\tprivate int numberOfDataColumns;\n\t\tpublic String[] columnHeaders;\n\t\tpublic int[] columnLengths;\n\t\tpublic int classFieldIndex;\n\t\tprivate String parseError = null;\n\t\tprivate boolean wasVFS = false;\n\n\t\tpublic AbilityRecipeDataImpl(final String recipeFilename, final String recipeFormat)\n\t\t{\n\t\t\tthis.recipeFilename = recipeFilename;\n\t\t\tthis.recipeFormat = recipeFormat;\n\t\t\tif(recipeFilename.trim().length()==0)\n\t\t\t{\n\t\t\t\tparseError = "No file";\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfinal CMFile F = new CMFile(Resources.buildResourcePath("skills")+recipeFilename,null,CMFile.FLAG_LOGERRORS);\n\t\t\twasVFS=F.isVFSFile();\n\t\t\tfinal StringBuffer str=F.text();\n\t\t\tcolumns = parseRecipeFormatColumns(recipeFormat);\n\t\t\tnumberOfDataColumns = 0;\n\t\t\tfor(int c = 0; c < columns.size(); c++)\n\t\t\t{\n\t\t\t\tif(columns.elementAt(c) instanceof List)\n\t\t\t\t\tnumberOfDataColumns++;\n\t\t\t}\n\t\t\tdataRows = null;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tdataRows = parseDataRows(str,columns,numberOfDataColumns);\n\t\t\t\tfinal DVector editRow = new DVector(2);\n\t\t\t\tfor(int c=0;c<columns().size();c++)\n\t\t\t\t{\n\t\t\t\t\tif(columns().elementAt(c) instanceof List)\n\t\t\t\t\t\teditRow.addElement(columns().elementAt(c),"");\n\t\t\t\t}\n\t\t\t\tif(editRow.size()==0)\n\t\t\t\t{\n\t\t\t\t\t//classFieldIndex = CMAbleParms.getClassFieldIndex(dataRow);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tclassFieldIndex = CMAbleParms.getClassFieldIndex(editRow);\n\t\t\t\tfixDataColumns(dataRows);\n\t\t\t}\n\t\t\tcatch(final CMException e)\n\t\t\t{\n\t\t\t\tparseError = e.getMessage();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcolumnLengths = new int[numberOfDataColumns];\n\t\t\tcolumnHeaders = new String[numberOfDataColumns];\n\t\t\tcalculateRecipeCols(columnLengths,columnHeaders,dataRows);\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean wasVFS()\n\t\t{\n\t\t\treturn wasVFS;\n\t\t}\n\n\t\t@Override\n\t\tpublic DVector newRow(final String classFieldData)\n\t\t{\n\t\t\tfinal DVector editRow = blankRow();\n\t\t\tfinal int keyIndex =classFieldIndex;\n\t\t\tif((keyIndex>=0)&&(classFieldData!=null))\n\t\t\t{\n\t\t\t\teditRow.setElementAt(keyIndex,2,classFieldData);\n\t\t\t}\n\t\t\ttry\n\t\t\t{\n\t\t\t\tfixDataColumn(editRow,-1);\n\t\t\t}\n\t\t\tcatch (final CMException cme)\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tfor(int i=0;i<editRow.size();i++)\n\t\t\t{\n\t\t\t\tif(i!=keyIndex)\n\t\t\t\t{\n\t\t\t\t\tfinal AbilityParmEditor A = getEditors().get(editRow.elementAt(i,1));\n\t\t\t\t\teditRow.setElementAt(i,2,A.defaultValue());\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn editRow;\n\t\t}\n\n\t\t@Override\n\t\tpublic DVector blankRow()\n\t\t{\n\t\t\tfinal DVector editRow = new DVector(2);\n\t\t\tfor(int c=0;c<columns().size();c++)\n\t\t\t{\n\t\t\t\tif(columns().elementAt(c) instanceof List)\n\t\t\t\t\teditRow.addElement(columns().elementAt(c),"");\n\t\t\t}\n\t\t\treturn editRow;\n\t\t}\n\n\t\t@Override\n\t\tpublic int getClassFieldIndex()\n\t\t{\n\t\t\treturn classFieldIndex;\n\t\t}\n\n\t\t@Override\n\t\tpublic String recipeFilename()\n\t\t{\n\t\t\treturn recipeFilename;\n\t\t}\n\n\t\t@Override\n\t\tpublic String recipeFormat()\n\t\t{\n\t\t\treturn recipeFormat;\n\t\t}\n\n\t\t@Override\n\t\tpublic Vector<DVector> dataRows()\n\t\t{\n\t\t\treturn dataRows;\n\t\t}\n\n\t\t@Override\n\t\tpublic Vector<? extends Object> columns()\n\t\t{\n\t\t\treturn columns;\n\t\t}\n\n\t\t@Override\n\t\tpublic int[] columnLengths()\n\t\t{\n\t\t\treturn columnLengths;\n\t\t}\n\n\t\t@Override\n\t\tpublic String[] columnHeaders()\n\t\t{\n\t\t\treturn columnHeaders;\n\t\t}\n\n\t\t@Override\n\t\tpublic int numberOfDataColumns()\n\t\t{\n\t\t\treturn numberOfDataColumns;\n\t\t}\n\n\t\t@Override\n\t\tpublic String parseError()\n\t\t{\n\t\t\treturn parseError;\n\t\t}\n\t}\n\n\tprotected abstract class AbilityParmEditorImpl implements AbilityParmEditor\n\t{\n\t\tprivate final String\tID;\n\t\tprivate final ParmType\tfieldType;\n\t\tprivate String\t\t\tprompt\t= null;\n\t\tprivate String\t\t\theader\t= null;\n\n\t\tprotected PairList<String, String>\tchoices\t= null;\n\n\t\tpublic AbilityParmEditorImpl(final String fieldName, final String shortHeader, final ParmType type)\n\t\t{\n\t\t\tID=fieldName;\n\t\t\tfieldType = type;\n\t\t\theader = shortHeader;\n\t\t\tprompt = CMStrings.capitalizeAndLower(CMStrings.replaceAll(ID,"_"," "));\n\t\t\tcreateChoices();\n\t\t}\n\n\t\t@Override\n\t\tpublic String ID()\n\t\t{\n\t\t\treturn ID;\n\t\t}\n\n\t\t@Override\n\t\tpublic ParmType parmType()\n\t\t{\n\t\t\treturn fieldType;\n\t\t}\n\n\t\t@Override\n\t\tpublic String prompt()\n\t\t{\n\t\t\treturn prompt;\n\t\t}\n\n\t\t@Override\n\t\tpublic String colHeader()\n\t\t{\n\t\t\treturn header;\n\t\t}\n\n\t\t@Override\n\t\tpublic int maxColWidth()\n\t\t{\n\t\t\treturn Integer.MAX_VALUE;\n\t\t}\n\n\t\t@Override\n\t\tpublic int minColWidth()\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean confirmValue(final String oldVal)\n\t\t{\n\t\t\tfinal boolean spaceOK = fieldType != ParmType.ONEWORD;\n\t\t\tboolean emptyOK = false;\n\t\t\tswitch(fieldType)\n\t\t\t{\n\t\t\tcase STRINGORNULL:\n\t\t\t\temptyOK = true;\n\t\t\t//$FALL-THROUGH$\n\t\t\tcase ONEWORD:\n\t\t\tcase STRING:\n\t\t\t{\n\t\t\t\tif((!spaceOK) && (oldVal.indexOf(\' \') >= 0))\n\t\t\t\t\treturn false;\n\t\t\t\treturn (emptyOK)||(oldVal.trim().length()>0);\n\t\t\t}\n\t\t\tcase NUMBERORNULL:\n\t\t\t\tif(oldVal.length()==0)\n\t\t\t\t\treturn true;\n\t\t\t\t//$FALL-THROUGH$\n\t\t\tcase NUMBER:\n\t\t\t\treturn CMath.isInteger(oldVal);\n\t\t\tcase NUMBER_PAIR:\n\t\t\t{\n\t\t\t\tif(oldVal==null)\n\t\t\t\t\treturn emptyOK;\n\t\t\t\tfinal int x=oldVal.indexOf(\',\');\n\t\t\t\treturn CMath.isInteger(oldVal)\n\t\t\t\t\t||((x>0)&&(CMath.isInteger(oldVal.substring(0,x).trim()))&&(CMath.isInteger(oldVal.substring(x+1).trim())));\n\t\t\t}\n\t\t\tcase CHOICES:\n\t\t\t\tif(!CMStrings.contains(choices.toArrayFirst(new String[0]),oldVal))\n\t\t\t\t\treturn CMStrings.contains(choices.toArrayFirst(new String[0]),oldVal.toUpperCase().trim());\n\t\t\t\treturn true;\n\t\t\tcase MULTICHOICES:\n\t\t\t\treturn CMath.isInteger(oldVal)||choices().containsFirst(oldVal);\n\t\t\tcase SPECIAL:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t@Override\n\t\tpublic String[] fakeUserInput(final String oldVal)\n\t\t{\n\t\t\tboolean emptyOK = false;\n\t\t\tswitch(fieldType)\n\t\t\t{\n\t\t\tcase STRINGORNULL:\n\t\t\t\temptyOK = true;\n\t\t\t//$FALL-THROUGH$\n\t\t\tcase ONEWORD:\n\t\t\tcase STRING:\n\t\t\t{\n\t\t\t\tif(emptyOK && (oldVal.trim().length()==0))\n\t\t\t\t\treturn new String[]{"NULL"};\n\t\t\t\treturn new String[]{oldVal};\n\t\t\t}\n\t\t\tcase NUMBERORNULL:\n\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\treturn new String[]{"NULL"};\n\t\t\t\t//$FALL-THROUGH$\n\t\t\tcase NUMBER:\n\t\t\tcase NUMBER_PAIR:\n\t\t\t\treturn new String[]{oldVal};\n\t\t\tcase CHOICES:\n\t\t\t{\n\t\t\t\tif(oldVal.trim().length()==0) return new String[]{"NULL"};\n\t\t\t\tfinal Vector<String> V = new XVector<String>(choices.toArrayFirst(new String[0]));\n\t\t\t\tfor(int v=0;v<V.size();v++)\n\t\t\t\t{\n\t\t\t\t\tif(oldVal.equalsIgnoreCase(V.elementAt(v)))\n\t\t\t\t\t\treturn new String[]{choices.get(v).second};\n\t\t\t\t}\n\t\t\t\treturn new String[]{oldVal};\n\t\t\t}\n\t\t\tcase MULTICHOICES:\n\t\t\t\tif(oldVal.trim().length()==0)\n\t\t\t\t\treturn new String[]{"NULL"};\n\t\t\t\tif(!CMath.isInteger(oldVal))\n\t\t\t\t{\n\t\t\t\t\tfinal Vector<String> V = new XVector<String>(choices.toArrayFirst(new String[0]));\n\t\t\t\t\tfor(int v=0;v<V.size();v++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(oldVal.equalsIgnoreCase(V.elementAt(v)))\n\t\t\t\t\t\t\treturn new String[]{choices.get(v).second,""};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tfinal Vector<String> V = new Vector<String>();\n\t\t\t\t\tfor(int c=0;c<choices.size();c++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(CMath.bset(CMath.s_int(oldVal),CMath.s_int(choices.get(c).first)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tV.addElement(choices.get(c).second);\n\t\t\t\t\t\t\tV.addElement(choices.get(c).second);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(V.size()>0)\n\t\t\t\t\t{\n\t\t\t\t\t\tV.addElement("");\n\t\t\t\t\t\treturn CMParms.toStringArray(V);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn new String[]{"NULL"};\n\t\t\tcase SPECIAL:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn new String[]{};\n\t\t}\n\n\t\t@Override\n\t\tpublic String commandLinePrompt(final MOB mob, final String oldVal, final int[] showNumber, final int showFlag)\n\t\tthrows java.io.IOException\n\t\t{\n\t\t\tString str = null;\n\t\t\tboolean emptyOK = false;\n\t\t\tfinal boolean spaceOK = fieldType != ParmType.ONEWORD;\n\t\t\tswitch(fieldType)\n\t\t\t{\n\t\t\tcase STRINGORNULL:\n\t\t\t\temptyOK = true;\n\t\t\t//$FALL-THROUGH$\n\t\t\tcase ONEWORD:\n\t\t\tcase STRING:\n\t\t\t{\n\t\t\t\t++showNumber[0];\n\t\t\t\tboolean proceed = true;\n\t\t\t\twhile(proceed&&(!mob.session().isStopped()))\n\t\t\t\t{\n\t\t\t\t\tstr = CMLib.genEd().prompt(mob,oldVal,showNumber[0],showFlag,prompt(),emptyOK).trim();\n\t\t\t\t\tif((!spaceOK) && (str.indexOf(\' \') >= 0))\n\t\t\t\t\t\tmob.tell(L("Spaces are not allowed here."));\n\t\t\t\t\telse\n\t\t\t\t\t\tproceed=false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NUMBERORNULL:\n\t\t\tcase NUMBER:\n\t\t\t{\n\t\t\t\tfinal String newStr=CMLib.genEd().prompt(mob,oldVal,++showNumber[0],showFlag,prompt(),true);\n\t\t\t\tif(newStr.trim().length()==0)\n\t\t\t\t\tstr="";\n\t\t\t\telse\n\t\t\t\t\tstr = Integer.toString(CMath.s_int(newStr));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NUMBER_PAIR:\n\t\t\t{\n\t\t\t\tfinal String newStr=CMLib.genEd().prompt(mob,oldVal,++showNumber[0],showFlag,prompt(),true);\n\t\t\t\tif(newStr.trim().length()==0)\n\t\t\t\t\tstr="";\n\t\t\t\telse\n\t\t\t\tif(CMath.isInteger(newStr))\n\t\t\t\t\tstr = Integer.toString(CMath.s_int(newStr));\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tfinal int x=newStr.indexOf(\',\');\n\t\t\t\t\tif(x>0)\n\t\t\t\t\t{\n\t\t\t\t\t\tstr = Integer.toString(CMath.s_int(newStr.substring(0,x).trim()))\n\t\t\t\t\t\t\t+ Integer.toString(CMath.s_int(newStr.substring(x+1).trim()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase CHOICES:\n\t\t\t\tstr = CMLib.genEd().promptMultiOrExtra(mob,oldVal,++showNumber[0],showFlag,prompt(),choices);\n\t\t\t\tbreak;\n\t\t\tcase MULTICHOICES:\n\t\t\t\tstr = CMLib.genEd().promptMultiOrExtra(mob,oldVal,++showNumber[0],showFlag,prompt(),choices);\n\t\t\t\tif(CMath.isInteger(str))\n\t\t\t\t\tstr = Integer.toString(CMath.s_int(str));\n\t\t\t\tbreak;\n\t\t\tcase SPECIAL:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\n\t\t@Override\n\t\tpublic String webValue(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t{\n\t\t\tfinal String webValue = httpReq.getUrlParameter(fieldName);\n\t\t\tswitch(fieldType)\n\t\t\t{\n\t\t\tcase ONEWORD:\n\t\t\tcase STRINGORNULL:\n\t\t\tcase STRING:\n\t\t\tcase NUMBER:\n\t\t\tcase NUMBERORNULL:\n\t\t\tcase NUMBER_PAIR:\n\t\t\t\treturn (webValue == null)?oldVal:webValue;\n\t\t\tcase MULTICHOICES:\n\t\t\t{\n\t\t\t\tif(webValue == null)\n\t\t\t\t\treturn oldVal;\n\t\t\t\tString id="";\n\t\t\t\tlong num=0;\n\t\t\t\tint index=0;\n\t\t\t\tfor(;httpReq.isUrlParameter(fieldName+id);id=""+(++index))\n\t\t\t\t{\n\t\t\t\t\tfinal String newVal = httpReq.getUrlParameter(fieldName+id);\n\t\t\t\t\tif(CMath.s_long(newVal)<=0)\n\t\t\t\t\t\treturn newVal;\n\t\t\t\t\tnum |= CMath.s_long(newVal);\n\t\t\t\t}\n\t\t\t\treturn ""+num;\n\t\t\t}\n\t\t\tcase CHOICES:\n\t\t\t\treturn (webValue == null)?oldVal:webValue;\n\t\t\tcase SPECIAL:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn "";\n\t\t}\n\n\t\t@Override\n\t\tpublic String webTableField(final HTTPRequest httpReq, final java.util.Map<String, String> parms, final String oldVal)\n\t\t{\n\t\t\treturn oldVal;\n\t\t}\n\n\t\t@Override\n\t\tpublic String commandLineValue(final String oldVal)\n\t\t{\n\t\t\treturn oldVal;\n\t\t}\n\n\t\t@Override\n\t\tpublic String webField(final HTTPRequest httpReq, final java.util.Map<String,String> parms, final String oldVal, final String fieldName)\n\t\t{\n\t\t\tint textSize = 50;\n\t\t\tfinal String webValue = webValue(httpReq,parms,oldVal,fieldName);\n\t\t\tString onChange = null;\n\t\t\tfinal Vector<String> choiceValues = new Vector<String>();\n\t\t\tswitch(fieldType)\n\t\t\t{\n\t\t\tcase ONEWORD:\n\t\t\t\ttextSize = 10;\n\t\t\t//$FALL-THROUGH$\n\t\t\tcase STRINGORNULL:\n\t\t\tcase STRING:\n\t\t\t\treturn "\\n\\r<INPUT TYPE=TEXT NAME=" + fieldName + " SIZE=" + textSize + " VALUE=\\"" + webValue + "\\">";\n\t\t\tcase NUMBER:\n\t\t\tcase NUMBERORNULL:\n\t\t\tcase NUMBER_PAIR:\n\t\t\t\treturn "\\n\\r<INPUT TYPE=TEXT NAME=" + fieldName + " SIZE=10 VALUE=\\"" + webValue + "\\">";\n\t\t\tcase MULTICHOICES:\n\t\t\t{\n\t\t\t\tonChange = " MULTIPLE ";\n\t\t\t\tif(!parms.containsKey("NOSELECT"))\n\t\t\t\t\tonChange+= "ONCHANGE=\\"MultiSelect(this);\\"";\n\t\t\t\tif(CMath.isInteger(webValue))\n\t\t\t\t{\n\t\t\t\t\tfinal int bits = CMath.s_int(webValue);\n\t\t\t\t\tfor(int i=0;i<choices.size();i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int bitVal =CMath.s_int(choices.get(i).first);\n\t\t\t\t\t\tif((bitVal>0)&&(CMath.bset(bits,bitVal)))\n\t\t\t\t\t\t\tchoiceValues.addElement(choices.get(i).first);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//$FALL-THROUGH$\n\t\t\tcase CHOICES:\n\t\t\t{\n\t\t\t\tif(choiceValues.size()==0)\n\t\t\t\t\tchoiceValues.addElement(webValue);\n\t\t\t\tif((onChange == null)&&(!parms.containsKey("NOSELECT")))\n\t\t\t\t\tonChange = " ONCHANGE=\\"Select(this);\\"";\n\t\t\t\telse\n\t\t\t\tif(onChange==null)\n\t\t\t\t\tonChange="";\n\t\t\t\tfinal StringBuffer str= new StringBuffer("");\n\t\t\t\tstr.append("\\n\\r<SELECT NAME="+fieldName+onChange+">");\n\t\t\t\tfor(int i=0;i<choices.size();i++)\n\t\t\t\t{\n\t\t\t\t\tfinal String option = (choices.get(i).first);\n\t\t\t\t\tstr.append("<OPTION VALUE=\\""+option+"\\" ");\n\t\t\t\t\tfor(int c=0;c<choiceValues.size();c++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(option.equalsIgnoreCase(choiceValues.elementAt(c)))\n\t\t\t\t\t\t\tstr.append("SELECTED");\n\t\t\t\t\t}\n\t\t\t\t\tstr.append(">"+(choices.get(i).second));\n\t\t\t\t}\n\t\t\t\treturn str.toString()+"</SELECT>";\n\t\t\t}\n\t\t\tcase SPECIAL:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn "";\n\t\t}\n\n\t\tpublic abstract void createChoices();\n\n\t\t@Override\n\t\tpublic PairList<String,String> createChoices(final Enumeration<? extends Object> e)\n\t\t{\n\t\t\tif(choices != null)\n\t\t\t\treturn choices;\n\t\t\tchoices = new PairVector<String,String>();\n\t\t\tObject o = null;\n\t\t\tfor(;e.hasMoreElements();)\n\t\t\t{\n\t\t\t\to = e.nextElement();\n\t\t\t\tif(o instanceof String)\n\t\t\t\t\tchoices.add((String)o,CMStrings.capitalizeAndLower((String)o));\n\t\t\t\telse\n\t\t\t\tif(o instanceof Ability)\n\t\t\t\t\tchoices.add(((Ability)o).ID(),((Ability)o).name());\n\t\t\t\telse\n\t\t\t\tif(o instanceof Race)\n\t\t\t\t\tchoices.add(((Race)o).ID(),((Race)o).name());\n\t\t\t\telse\n\t\t\t\tif(o instanceof Environmental)\n\t\t\t\t\tchoices.add(((Environmental)o).ID(),((Environmental)o).ID());\n\t\t\t}\n\t\t\treturn choices;\n\t\t}\n\n\t\t@SuppressWarnings("unchecked")\n\t\t@Override\n\t\tpublic PairList<String,String> createChoices(final List<? extends Object> V)\n\t\t{\n\t\t\treturn createChoices(new IteratorEnumeration<Object>((Iterator<Object>)V.iterator()));\n\t\t}\n\n\t\t@Override\n\t\tpublic PairList<String,String> createChoices(final String[] S)\n\t\t{\n\t\t\tfinal XVector<String> X=new XVector<String>(S);\n\t\t\tCollections.sort(X);\n\t\t\treturn createChoices(X.elements());\n\t\t}\n\n\t\tpublic PairList<String,String> createBinaryChoices(final String[] S)\n\t\t{\n\t\t\tif(choices != null)\n\t\t\t\treturn choices;\n\t\t\tchoices = createChoices(new XVector<String>(S).elements());\n\t\t\tfor(int i=0;i<choices.size();i++)\n\t\t\t{\n\t\t\t\tif(i==0)\n\t\t\t\t\tchoices.get(i).first =Integer.toString(0);\n\t\t\t\telse\n\t\t\t\t\tchoices.get(i).first = Integer.toString(1<<(i-1));\n\t\t\t}\n\t\t\treturn choices;\n\t\t}\n\n\t\tpublic PairList<String,String> createNumberedChoices(final String[] S)\n\t\t{\n\t\t\tif(choices != null)\n\t\t\t\treturn choices;\n\t\t\tchoices = createChoices(new XVector<String>(S).elements());\n\t\t\tfor(int i=0;i<choices.size();i++)\n\t\t\t\tchoices.get(i).first = Integer.toString(i);\n\t\t\treturn choices;\n\t\t}\n\n\t\t@Override\n\t\tpublic PairList<String, String> choices()\n\t\t{\n\t\t\treturn choices;\n\t\t}\n\n\t\t@Override\n\t\tpublic int appliesToClass(final Object o)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t}\n}\n', 'message': 'Cooking derivatives support more things now.\n\ngit-svn-id: 0cdf8356e41b2d8ccbb41bb76c82068fe80b2514@21531 0d6f1817-ed0e-0410-87c9-987e46238f29\n', 'author_name': 'bozimmerman', 'lang': 'java'}