|
From: <th...@us...> - 2007-09-29 18:46:27
|
Revision: 4180
http://pcgen.svn.sourceforge.net/pcgen/?rev=4180&view=rev
Author: thpr
Date: 2007-09-29 11:36:32 -0700 (Sat, 29 Sep 2007)
Log Message:
-----------
Bring CDOM up to 4173
Modified Paths:
--------------
branches/cdom/code/src/java/plugin/lsttokens/gamemode/abilitycategory/VisibleToken.java
branches/cdom/code/src/java/plugin/lsttokens/pcclass/KnownspellsToken.java
branches/cdom/code/src/java/plugin/lsttokens/pcclass/SpelllistToken.java
branches/cdom/code/src/java/plugin/lsttokens/pcclass/VfeatToken.java
Added Paths:
-----------
branches/cdom/code/src/java/plugin/lsttokens/SabLst.java
branches/cdom/code/src/java/plugin/lsttokens/choose/StringToken.java
branches/cdom/code/src/java/plugin/lsttokens/gamemode/PreviewDirToken.java
branches/cdom/code/src/java/plugin/lsttokens/gamemode/PreviewSheetToken.java
branches/cdom/code/src/java/plugin/lsttokens/gamemode/abilitycategory/DisplayLocationToken.java
Removed Paths:
-------------
branches/cdom/code/src/java/plugin/lsttokens/SaLst.java
branches/cdom/code/src/java/plugin/lsttokens/choose/EqBuilderToken.java
Deleted: branches/cdom/code/src/java/plugin/lsttokens/SaLst.java
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/SaLst.java 2007-09-29 18:36:05 UTC (rev 4179)
+++ branches/cdom/code/src/java/plugin/lsttokens/SaLst.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -1,338 +0,0 @@
-/*
- * Copyright 2006-2007 (C) Tom Parker <th...@us...>
- * Copyright 2005-2006 (C) Devon Jones
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Current Ver: $Revision$
- * Last Editor: $Author$
- * Last Edited: $Date$
- */
-package plugin.lsttokens;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import pcgen.cdom.base.CDOMObject;
-import pcgen.cdom.base.Constants;
-import pcgen.cdom.base.LSTWriteable;
-import pcgen.core.Globals;
-import pcgen.core.PCClass;
-import pcgen.core.PObject;
-import pcgen.core.Skill;
-import pcgen.core.SpecialAbility;
-import pcgen.core.prereq.Prerequisite;
-import pcgen.persistence.AssociatedChanges;
-import pcgen.persistence.LoadContext;
-import pcgen.persistence.PersistenceLayerException;
-import pcgen.persistence.lst.AbstractToken;
-import pcgen.persistence.lst.GlobalLstToken;
-import pcgen.persistence.lst.prereq.PreParserFactory;
-import pcgen.util.Logging;
-
-/**
- * @author djones4
- *
- */
-public class SaLst extends AbstractToken implements GlobalLstToken
-{
-
- private static final Class<SpecialAbility> SA_CLASS = SpecialAbility.class;
-
- @Override
- public String getTokenName()
- {
- return "SA";
- }
-
- public boolean parse(PObject obj, String value, int anInt)
- {
- if (obj instanceof Skill)
- {
- Logging.errorPrint("SA not supported in Skills");
- return false;
- }
- parseSpecialAbility(obj, value, anInt);
- return true;
- }
-
- /**
- * This method sets the special abilities granted by this [object]. For
- * efficiency, avoid calling this method except from I/O routines.
- *
- * @param obj
- * the PObject that is to receive the new SpecialAbility
- * @param aString
- * String of special abilities delimited by pipes
- * @param level
- * int level at which the ability is gained
- */
- public void parseSpecialAbility(PObject obj, String aString, int level)
- {
- StringTokenizer aTok = new StringTokenizer(aString, "|", true);
-
- if (!aTok.hasMoreTokens())
- {
- return;
- }
-
- StringBuffer saName = new StringBuffer();
- saName.append(aTok.nextToken());
-
- SpecialAbility sa = new SpecialAbility();
-
- boolean isPre = false;
-
- while (aTok.hasMoreTokens())
- {
- String cString = aTok.nextToken();
-
- // Check to see if it's a PRExxx: tag
- if (PreParserFactory.isPreReqString(cString))
- {
- isPre = true;
- try
- {
- PreParserFactory factory = PreParserFactory.getInstance();
- Prerequisite prereq = factory.parse(cString);
- /*
- * The following subkey is required in order to give context
- * to the variables as they are calculated (make the context
- * the current class, so that items like Class Level can be
- * correctly calculated.
- */
- if (obj instanceof PCClass
- && "var".equals(prereq.getKind()))
- {
- prereq.setSubKey("CLASS:" + obj.getKeyName());
- }
- sa.addPreReq(prereq);
- }
- catch (PersistenceLayerException ple)
- {
- Logging.errorPrint(ple.getMessage(), ple);
- }
- }
- else
- {
- if (isPre)
- {
- if (!"|".equals(cString))
- {
- Logging.errorPrint("Invalid " + getTokenName() + ": "
- + aString);
- Logging
- .errorPrint(" PRExxx must be at the END of the Token");
- isPre = false;
- }
- }
- saName.append(cString);
- }
-
- if (".CLEAR".equals(cString))
- {
- obj.clearSpecialAbilityList();
- saName.setLength(0);
- }
- }
-
- sa.setName(saName.toString());
-
- if (level >= 0)
- {
- try
- {
- sa.addPreReq(PreParserFactory.createLevelPrereq(obj, level));
- }
- catch (PersistenceLayerException notUsed)
- {
- Logging.errorPrint("Failed to assign level prerequisite.",
- notUsed);
- }
- }
- if (obj instanceof PCClass)
- {
- sa.setSASource("PCCLASS=" + obj.getKeyName() + "|" + level);
- }
-
- if (!aString.equals(".CLEAR"))
- {
- Globals.addToSASet(sa);
- obj.addSpecialAbilityToList(sa);
- }
- }
-
- public boolean parse(LoadContext context, CDOMObject obj, String value)
- {
- return parseSpecialAbility(context, obj, value);
- }
-
- /**
- * This method sets the special abilities granted by this [object]. For
- * efficiency, avoid calling this method except from I/O routines.
- *
- * @param obj
- * the PObject that is to receive the new SpecialAbility
- * @param aString
- * String of special abilities delimited by pipes
- * @param level
- * int level at which the ability is gained
- */
- public boolean parseSpecialAbility(LoadContext context, CDOMObject obj,
- String aString)
- {
- if (isEmpty(aString) || hasIllegalSeparator('|', aString))
- {
- return false;
- }
-
- StringTokenizer tok = new StringTokenizer(aString, Constants.PIPE);
-
- String firstToken = tok.nextToken();
- if (firstToken.startsWith("PRE") || firstToken.startsWith("!PRE"))
- {
- Logging.errorPrint("Cannot have only PRExxx subtoken in "
- + getTokenName());
- return false;
- }
-
- if (Constants.LST_DOT_CLEAR.equals(firstToken))
- {
- context.getGraphContext().removeAll(getTokenName(), obj);
- if (!tok.hasMoreTokens())
- {
- return true;
- }
- firstToken = tok.nextToken();
- }
-
- if (Constants.LST_DOT_CLEAR.equals(firstToken))
- {
- Logging.errorPrint("SA tag confused by redundant '.CLEAR'"
- + aString);
- return false;
- }
-
- SpecialAbility sa = new SpecialAbility(firstToken);
-
- if (!tok.hasMoreTokens())
- {
- context.getGraphContext().grant(getTokenName(), obj, sa);
- return true;
- }
-
- StringBuilder saName = new StringBuilder();
- saName.append(firstToken);
-
- String token = tok.nextToken();
- while (true)
- {
- if (Constants.LST_DOT_CLEAR.equals(token))
- {
- Logging.errorPrint("SA tag confused by '.CLEAR' as a "
- + "middle token: " + aString);
- return false;
- }
- else if (token.startsWith("PRE") || token.startsWith("!PRE"))
- {
- break;
- }
- else
- {
- saName.append(Constants.PIPE).append(token);
- // sa.addVariable(FormulaFactory.getFormulaFor(token));
- }
-
- if (!tok.hasMoreTokens())
- {
- // No prereqs, so we're done
- // CONSIDER This is a HACK and not the long term strategy of SA:
- sa.setName(saName.toString());
- context.getGraphContext().grant(getTokenName(), obj, sa);
- return true;
- }
- token = tok.nextToken();
- }
- // CONSIDER This is a HACK and not the long term strategy of SA:
- sa.setName(saName.toString());
-
- while (true)
- {
- Prerequisite prereq = getPrerequisite(token);
- if (prereq == null)
- {
- Logging.errorPrint(" (Did you put Abilities after the "
- + "PRExxx tags in " + getTokenName() + ":?)");
- return false;
- }
- /*
- * The following subkey is required in order to give context to the
- * variables as they are calculated (make the context the current
- * class, so that items like Class Level can be correctly
- * calculated).
- */
- if (obj instanceof PCClass && "var".equals(prereq.getKind()))
- {
- prereq.setSubKey("CLASS:" + obj.getKeyName());
- }
- sa.addPrerequisite(prereq);
- if (!tok.hasMoreTokens())
- {
- break;
- }
- token = tok.nextToken();
- }
- context.getGraphContext().grant(getTokenName(), obj, sa);
- return true;
- }
-
- public String[] unparse(LoadContext context, CDOMObject obj)
- {
- AssociatedChanges<SpecialAbility> changes =
- context.getGraphContext().getChangesFromToken(getTokenName(),
- obj, SA_CLASS);
- if (changes == null)
- {
- return null;
- }
- Collection<LSTWriteable> added = changes.getAdded();
- List<String> list = new ArrayList<String>(added.size() + 1);
- if (changes.includesGlobalClear())
- {
- list.add(Constants.LST_DOT_CLEAR);
- }
- else if (added.isEmpty())
- {
- // Zero indicates no Token (and no global clear, so nothing to do)
- return null;
- }
- for (LSTWriteable lw : added)
- {
- StringBuilder sb = new StringBuilder();
- SpecialAbility ab = (SpecialAbility) lw;
- sb.append(ab.getDisplayName());
- if (ab.hasPrerequisites())
- {
- sb.append(Constants.PIPE);
- sb.append(getPrerequisiteString(context, ab
- .getPrerequisiteList()));
- }
- list.add(sb.toString());
- }
- return list.toArray(new String[list.size()]);
- }
-}
Copied: branches/cdom/code/src/java/plugin/lsttokens/SabLst.java (from rev 4173, Trunk/pcgen/code/src/java/plugin/lsttokens/SabLst.java)
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/SabLst.java (rev 0)
+++ branches/cdom/code/src/java/plugin/lsttokens/SabLst.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -0,0 +1,325 @@
+package plugin.lsttokens;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import pcgen.cdom.base.CDOMObject;
+import pcgen.cdom.base.Constants;
+import pcgen.cdom.base.LSTWriteable;
+import pcgen.core.Globals;
+import pcgen.core.PCClass;
+import pcgen.core.PObject;
+import pcgen.core.Skill;
+import pcgen.core.SpecialAbility;
+import pcgen.core.prereq.Prerequisite;
+import pcgen.persistence.AssociatedChanges;
+import pcgen.persistence.LoadContext;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.persistence.lst.AbstractToken;
+import pcgen.persistence.lst.GlobalLstToken;
+import pcgen.persistence.lst.prereq.PreParserFactory;
+import pcgen.util.Logging;
+
+public class SabLst extends AbstractToken implements GlobalLstToken
+{
+
+ private static final Class<SpecialAbility> SA_CLASS = SpecialAbility.class;
+
+ @Override
+ public String getTokenName()
+ {
+ return "SAB";
+ }
+
+ public boolean parse(PObject obj, String value, int anInt)
+ {
+ if (obj instanceof Skill)
+ {
+ Logging.errorPrint("SA not supported in Skills");
+ return false;
+ }
+ return parseSpecialAbility(obj, value, anInt);
+ }
+
+ /**
+ * This method sets the special abilities granted by this [object].
+ *
+ * @param obj
+ * the PObject that is to receive the new SpecialAbility
+ * @param aString
+ * String of special abilities delimited by pipes
+ * @param level
+ * int level at which the ability is gained
+ */
+ public boolean parseSpecialAbility(PObject obj, String value, int level)
+ {
+ if (value.startsWith(".CLEAR."))
+ {
+ String saName = value.substring(7);
+ if (saName.indexOf("|") != -1)
+ {
+ Logging
+ .errorPrint("Cannot .CLEAR. an SAB with a | in the token: "
+ + value);
+ return false;
+ }
+ obj.removeSAB(saName, level);
+ return true;
+ }
+ StringTokenizer tok = new StringTokenizer(value, "|");
+
+ String token = tok.nextToken();
+
+ if (".CLEAR".equals(token))
+ {
+ obj.clearSABList(level);
+ if (!tok.hasMoreTokens())
+ {
+ return true;
+ }
+ token = tok.nextToken();
+ }
+
+ StringBuffer saName = new StringBuffer();
+ saName.append(token);
+ SpecialAbility sa = new SpecialAbility();
+
+ boolean isPre = false;
+ boolean first = false;
+
+ while (tok.hasMoreTokens())
+ {
+ String argument = tok.nextToken();
+
+ // Check to see if it's a PRExxx: tag
+ if (PreParserFactory.isPreReqString(argument))
+ {
+ isPre = true;
+ try
+ {
+ PreParserFactory factory = PreParserFactory.getInstance();
+ Prerequisite prereq = factory.parse(argument);
+ if (obj instanceof PCClass
+ && "var".equals(prereq.getKind()))
+ {
+ prereq.setSubKey("CLASS:" + obj.getKeyName());
+ }
+ sa.addPreReq(prereq);
+ }
+ catch (PersistenceLayerException ple)
+ {
+ Logging.errorPrint(ple.getMessage(), ple);
+ return false;
+ }
+ }
+ else if (token.startsWith(".CLEAR"))
+ {
+ Logging.errorPrint("Embedded .CLEAR in " + getTokenName()
+ + " is not supported: " + value);
+ return false;
+ }
+ else
+ {
+ if (isPre)
+ {
+ Logging.errorPrint("Invalid " + getTokenName() + ": "
+ + value);
+ Logging
+ .errorPrint(" PRExxx must be at the END of the Token");
+ return false;
+ }
+ if (!first)
+ {
+ saName.append("|");
+ }
+ saName.append(argument);
+ }
+ first = false;
+ }
+
+ sa.setName(saName.toString());
+
+ if (level >= 0)
+ {
+ try
+ {
+ sa.addPreReq(PreParserFactory.createLevelPrereq(obj, level));
+ }
+ catch (PersistenceLayerException notUsed)
+ {
+ Logging.errorPrint("Failed to assign level prerequisite.",
+ notUsed);
+ }
+ }
+ if (obj instanceof PCClass)
+ {
+ sa.setSASource("PCCLASS=" + obj.getKeyName() + "|" + level);
+ }
+
+ Globals.addToSASet(sa);
+ obj.addSAB(sa, level);
+ return true;
+ }
+
+ public boolean parse(LoadContext context, CDOMObject obj, String value)
+ {
+ return parseSpecialAbility(context, obj, value);
+ }
+
+ /**
+ * This method sets the special abilities granted by this [object]. For
+ * efficiency, avoid calling this method except from I/O routines.
+ *
+ * @param obj
+ * the PObject that is to receive the new SpecialAbility
+ * @param aString
+ * String of special abilities delimited by pipes
+ * @param level
+ * int level at which the ability is gained
+ */
+ public boolean parseSpecialAbility(LoadContext context, CDOMObject obj,
+ String aString)
+ {
+ if (isEmpty(aString) || hasIllegalSeparator('|', aString))
+ {
+ return false;
+ }
+
+ StringTokenizer tok = new StringTokenizer(aString, Constants.PIPE);
+
+ String firstToken = tok.nextToken();
+ if (firstToken.startsWith("PRE") || firstToken.startsWith("!PRE"))
+ {
+ Logging.errorPrint("Cannot have only PRExxx subtoken in "
+ + getTokenName());
+ return false;
+ }
+
+ if (Constants.LST_DOT_CLEAR.equals(firstToken))
+ {
+ context.getGraphContext().removeAll(getTokenName(), obj);
+ if (!tok.hasMoreTokens())
+ {
+ return true;
+ }
+ firstToken = tok.nextToken();
+ }
+
+ if (Constants.LST_DOT_CLEAR.equals(firstToken))
+ {
+ Logging.errorPrint("SA tag confused by redundant '.CLEAR'"
+ + aString);
+ return false;
+ }
+
+ SpecialAbility sa = new SpecialAbility(firstToken);
+
+ if (!tok.hasMoreTokens())
+ {
+ context.getGraphContext().grant(getTokenName(), obj, sa);
+ return true;
+ }
+
+ StringBuilder saName = new StringBuilder();
+ saName.append(firstToken);
+
+ String token = tok.nextToken();
+ while (true)
+ {
+ if (Constants.LST_DOT_CLEAR.equals(token))
+ {
+ Logging.errorPrint("SA tag confused by '.CLEAR' as a "
+ + "middle token: " + aString);
+ return false;
+ }
+ else if (token.startsWith("PRE") || token.startsWith("!PRE"))
+ {
+ break;
+ }
+ else
+ {
+ saName.append(Constants.PIPE).append(token);
+ // sa.addVariable(FormulaFactory.getFormulaFor(token));
+ }
+
+ if (!tok.hasMoreTokens())
+ {
+ // No prereqs, so we're done
+ // CONSIDER This is a HACK and not the long term strategy of SA:
+ sa.setName(saName.toString());
+ context.getGraphContext().grant(getTokenName(), obj, sa);
+ return true;
+ }
+ token = tok.nextToken();
+ }
+ // CONSIDER This is a HACK and not the long term strategy of SA:
+ sa.setName(saName.toString());
+
+ while (true)
+ {
+ Prerequisite prereq = getPrerequisite(token);
+ if (prereq == null)
+ {
+ Logging.errorPrint(" (Did you put Abilities after the "
+ + "PRExxx tags in " + getTokenName() + ":?)");
+ return false;
+ }
+ /*
+ * The following subkey is required in order to give context to the
+ * variables as they are calculated (make the context the current
+ * class, so that items like Class Level can be correctly
+ * calculated).
+ */
+ if (obj instanceof PCClass && "var".equals(prereq.getKind()))
+ {
+ prereq.setSubKey("CLASS:" + obj.getKeyName());
+ }
+ sa.addPrerequisite(prereq);
+ if (!tok.hasMoreTokens())
+ {
+ break;
+ }
+ token = tok.nextToken();
+ }
+ context.getGraphContext().grant(getTokenName(), obj, sa);
+ return true;
+ }
+
+ public String[] unparse(LoadContext context, CDOMObject obj)
+ {
+ AssociatedChanges<SpecialAbility> changes =
+ context.getGraphContext().getChangesFromToken(getTokenName(),
+ obj, SA_CLASS);
+ if (changes == null)
+ {
+ return null;
+ }
+ Collection<LSTWriteable> added = changes.getAdded();
+ List<String> list = new ArrayList<String>(added.size() + 1);
+ if (changes.includesGlobalClear())
+ {
+ list.add(Constants.LST_DOT_CLEAR);
+ }
+ else if (added.isEmpty())
+ {
+ // Zero indicates no Token (and no global clear, so nothing to do)
+ return null;
+ }
+ for (LSTWriteable lw : added)
+ {
+ StringBuilder sb = new StringBuilder();
+ SpecialAbility ab = (SpecialAbility) lw;
+ sb.append(ab.getDisplayName());
+ if (ab.hasPrerequisites())
+ {
+ sb.append(Constants.PIPE);
+ sb.append(getPrerequisiteString(context, ab
+ .getPrerequisiteList()));
+ }
+ list.add(sb.toString());
+ }
+ return list.toArray(new String[list.size()]);
+ }
+}
Deleted: branches/cdom/code/src/java/plugin/lsttokens/choose/EqBuilderToken.java
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/choose/EqBuilderToken.java 2007-09-29 18:36:05 UTC (rev 4179)
+++ branches/cdom/code/src/java/plugin/lsttokens/choose/EqBuilderToken.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -1,49 +0,0 @@
-/*
- * Copyright 2007 (C) Thomas Parker <th...@us...>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package plugin.lsttokens.choose;
-
-import pcgen.core.PObject;
-import pcgen.persistence.lst.ChooseLstToken;
-import pcgen.util.Logging;
-
-public class EqBuilderToken implements ChooseLstToken
-{
-
- public boolean parse(PObject po, String prefix, String value)
- {
- if (value != null)
- {
- Logging.deprecationPrint("CHOOSE:" + getTokenName()
- + " will ignore arguments: " + value);
- }
- // No args - legal
- StringBuilder sb = new StringBuilder();
- if (prefix.length() > 0)
- {
- sb.append(prefix).append('|');
- }
- sb.append(getTokenName());
- po.setChoiceString(sb.toString());
- return true;
- }
-
- public String getTokenName()
- {
- return "EQBUILDER";
- }
-}
Copied: branches/cdom/code/src/java/plugin/lsttokens/choose/StringToken.java (from rev 4173, Trunk/pcgen/code/src/java/plugin/lsttokens/choose/StringToken.java)
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/choose/StringToken.java (rev 0)
+++ branches/cdom/code/src/java/plugin/lsttokens/choose/StringToken.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2007 (C) Thomas Parker <th...@us...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package plugin.lsttokens.choose;
+
+import pcgen.core.EquipmentModifier;
+import pcgen.core.PObject;
+import pcgen.persistence.lst.ChooseLstToken;
+import pcgen.util.Logging;
+
+public class StringToken implements ChooseLstToken
+{
+
+ public boolean parse(PObject po, String prefix, String value)
+ {
+ if (po instanceof EquipmentModifier)
+ {
+ Logging.errorPrint("CHOOSE:" + getTokenName()
+ + " may not be used in EquipmentModifier");
+ return false;
+ }
+ if (value.indexOf(',') != -1)
+ {
+ Logging.errorPrint("CHOOSE:" + getTokenName()
+ + " arguments may not contain , : " + value);
+ return false;
+ }
+ if (value.indexOf('[') != -1)
+ {
+ Logging.errorPrint("CHOOSE:" + getTokenName()
+ + " arguments may not contain [] : " + value);
+ return false;
+ }
+ if (value.charAt(0) == '|')
+ {
+ Logging.errorPrint("CHOOSE:" + getTokenName()
+ + " arguments may not start with | : " + value);
+ return false;
+ }
+ if (value.charAt(value.length() - 1) == '|')
+ {
+ Logging.errorPrint("CHOOSE:" + getTokenName()
+ + " arguments may not end with | : " + value);
+ return false;
+ }
+ if (value.indexOf("||") != -1)
+ {
+ Logging.errorPrint("CHOOSE:" + getTokenName()
+ + " arguments uses double separator || : " + value);
+ return false;
+ }
+ StringBuilder sb = new StringBuilder();
+ if (prefix.length() > 0)
+ {
+ sb.append(prefix).append('|');
+ }
+ sb.append(value);
+ po.setChoiceString(sb.toString());
+ return true;
+ }
+
+ public String getTokenName()
+ {
+ return "STRING";
+ }
+}
Copied: branches/cdom/code/src/java/plugin/lsttokens/gamemode/PreviewDirToken.java (from rev 4173, Trunk/pcgen/code/src/java/plugin/lsttokens/gamemode/PreviewDirToken.java)
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/gamemode/PreviewDirToken.java (rev 0)
+++ branches/cdom/code/src/java/plugin/lsttokens/gamemode/PreviewDirToken.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -0,0 +1,56 @@
+/*
+ * PreviewDirToken.java
+ * Copyright 2007 (C) Aaron Divinsky <boo...@ya...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Current Ver: $Revision$
+ * Last Editor: $Author: $
+ * Last Edited: $Date$
+ */
+package plugin.lsttokens.gamemode;
+
+import java.net.URI;
+
+import pcgen.core.GameMode;
+import pcgen.persistence.lst.GameModeLstToken;
+
+/**
+ * This class handles the PREVIEWDIR game mode token.
+ *
+ * @author boomer70 <boo...@ya...>
+ *
+ * @since 5.13.2
+ */
+public class PreviewDirToken implements GameModeLstToken
+{
+
+ public boolean parse(GameMode gameMode, String value, URI source)
+ {
+ gameMode.setPreviewDir(value);
+ return true;
+ }
+
+ /**
+ * Returns the name of the token this class handles.
+ *
+ * @see pcgen.persistence.lst.LstToken#getTokenName()
+ */
+ public String getTokenName()
+ {
+ return "PREVIEWDIR"; //$NON-NLS-1$
+ }
+
+}
Copied: branches/cdom/code/src/java/plugin/lsttokens/gamemode/PreviewSheetToken.java (from rev 4173, Trunk/pcgen/code/src/java/plugin/lsttokens/gamemode/PreviewSheetToken.java)
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/gamemode/PreviewSheetToken.java (rev 0)
+++ branches/cdom/code/src/java/plugin/lsttokens/gamemode/PreviewSheetToken.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -0,0 +1,56 @@
+/*
+ * PreviewSheetToken.java
+ * Copyright 2007 (C) Aaron Divinsky <boo...@ya...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Current Ver: $Revision$
+ * Last Editor: $Author: $
+ * Last Edited: $Date$
+ */
+package plugin.lsttokens.gamemode;
+
+import java.net.URI;
+
+import pcgen.core.GameMode;
+import pcgen.persistence.lst.GameModeLstToken;
+
+/**
+ * This class handles the PREVIEWSHEET game mode token.
+ *
+ * @author boomer70 <boo...@ya...>
+ *
+ * @since 5.13.2
+ */
+public class PreviewSheetToken implements GameModeLstToken
+{
+
+ public boolean parse(GameMode gameMode, String value, URI source)
+ {
+ gameMode.setDefaultPreviewSheet(value);
+ return true;
+ }
+
+ /**
+ * Returns the name of the token this class handles.
+ *
+ * @see pcgen.persistence.lst.LstToken#getTokenName()
+ */
+ public String getTokenName()
+ {
+ return "PREVIEWSHEET"; //$NON-NLS-1$
+ }
+
+}
Copied: branches/cdom/code/src/java/plugin/lsttokens/gamemode/abilitycategory/DisplayLocationToken.java (from rev 4173, Trunk/pcgen/code/src/java/plugin/lsttokens/gamemode/abilitycategory/DisplayLocationToken.java)
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/gamemode/abilitycategory/DisplayLocationToken.java (rev 0)
+++ branches/cdom/code/src/java/plugin/lsttokens/gamemode/abilitycategory/DisplayLocationToken.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -0,0 +1,54 @@
+/*
+ * DisplayLocationToken.java
+ * Copyright 2007 (C) James Dempsey <jde...@us...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Current Ver: $Revision$
+ * Last Editor: $Author$
+ * Last Edited: $Date$
+ */
+package plugin.lsttokens.gamemode.abilitycategory;
+
+import pcgen.core.AbilityCategory;
+import pcgen.persistence.lst.AbilityCategoryLstToken;
+
+/**
+ * Handles the DISPLAYLOCATION token on an ABILITYCATEGORY line.
+ *
+ * @author James Dempsey <jde...@us...>
+ *
+ * @since 5.13.0
+ */
+public class DisplayLocationToken implements AbilityCategoryLstToken
+{
+
+ /**
+ * @see pcgen.persistence.lst.AbilityCategoryLstToken#parse(pcgen.core.AbilityCategory, java.lang.String)
+ */
+ public boolean parse(final AbilityCategory aCat, final String aValue)
+ {
+ aCat.setDisplayLocation(aValue);
+ return true;
+ }
+
+ /**
+ * @see pcgen.persistence.lst.LstToken#getTokenName()
+ */
+ public String getTokenName()
+ {
+ return "DISPLAYLOCATION"; //$NON-NLS-1$
+ }
+}
Modified: branches/cdom/code/src/java/plugin/lsttokens/gamemode/abilitycategory/VisibleToken.java
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/gamemode/abilitycategory/VisibleToken.java 2007-09-29 18:36:05 UTC (rev 4179)
+++ branches/cdom/code/src/java/plugin/lsttokens/gamemode/abilitycategory/VisibleToken.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -24,6 +24,7 @@
import pcgen.core.AbilityCategory;
import pcgen.persistence.lst.AbilityCategoryLstToken;
+import pcgen.util.Logging;
/**
* Handles the VISIBLE token on an ABILITYCATEGORY line.
@@ -39,14 +40,53 @@
*/
public boolean parse(final AbilityCategory aCat, final String aValue)
{
- if (aValue.charAt(0) == 'Y')
+ if ((aValue.length() > 0) && (aValue.charAt(0) == 'Y'))
{
- aCat.setVisible(true);
+ if (!aValue.equals("YES"))
+ {
+ Logging
+ .deprecationPrint("Abbreviation used in VISIBLE in AbilityCategory");
+ Logging.deprecationPrint(" " + aValue
+ + " is not a valid value for VISIBLE");
+ Logging
+ .deprecationPrint(" Valid values in AbilityCategory are NO, QUALIFY and YES");
+ Logging
+ .deprecationPrint(" assuming you meant YES, please use YES (exact String, upper case) in the LST file");
+ Logging.deprecationPrint(" This will break after PCGen 5.14");
+ }
+ aCat.setVisible(AbilityCategory.VISIBLE_YES);
}
- else if (aValue.charAt(0) == 'N')
+ else if ((aValue.length() > 0) && (aValue.charAt(0) == 'Q'))
{
- aCat.setVisible(false);
+ if (!aValue.equals("QUALIFY"))
+ {
+ Logging
+ .deprecationPrint("Abbreviation used in VISIBLE in AbilityCategory");
+ Logging.deprecationPrint(" " + aValue
+ + " is not a valid value for VISIBLE");
+ Logging
+ .deprecationPrint(" Valid values in AbilityCategory are NO, QUALIFY and YES");
+ Logging
+ .deprecationPrint(" assuming you meant QUALIFY, please use QUALIFY (exact String, upper case) in the LST file");
+ Logging.deprecationPrint(" This will break after PCGen 5.14");
+ }
+ aCat.setVisible(AbilityCategory.VISIBLE_QUALIFIED);
}
+ else if ((aValue.length() > 0) && (aValue.charAt(0) == 'N'))
+ {
+ if (!aValue.equals("NO")) {
+ Logging
+ .deprecationPrint("Abbreviation used in VISIBLE in AbilityCategory");
+ Logging.deprecationPrint(" " + aValue
+ + " is not a valid value for VISIBLE");
+ Logging
+ .deprecationPrint(" Valid values in AbilityCategory are NO, QUALIFY and YES");
+ Logging
+ .deprecationPrint(" assuming you meant NO, please use NO (exact String, upper case) in the LST file");
+ Logging.deprecationPrint(" This will break after PCGen 5.14");
+ }
+ aCat.setVisible(AbilityCategory.VISIBLE_NO);
+ }
else
{
return false;
Modified: branches/cdom/code/src/java/plugin/lsttokens/pcclass/KnownspellsToken.java
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/pcclass/KnownspellsToken.java 2007-09-29 18:36:05 UTC (rev 4179)
+++ branches/cdom/code/src/java/plugin/lsttokens/pcclass/KnownspellsToken.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -71,11 +71,18 @@
if (".CLEAR".equals(value))
{
+ Logging.errorPrint(getTokenName()
+ + " uses deprecated syntax. "
+ + "Use .CLEARALL (not .CLEAR) to clear the values");
return true;
}
+ else if (".CLEARALL".equals(value))
+ {
+ return true;
+ }
String rest;
- if (value.startsWith(".CLEAR|"))
+ if (value.startsWith(".CLEARALL|"))
{
rest = value.substring(7);
}
@@ -83,7 +90,7 @@
{
Logging.errorPrint("Invalid KNOWNSPELLS Syntax using .CLEAR");
Logging
- .errorPrint("Please separate .CLEAR from the rest of the token with a |");
+ .errorPrint("Please separate .CLEARALL from the rest of the token with a |");
rest = value.substring(6);
}
pipeTok = new StringTokenizer(rest, Constants.PIPE);
Modified: branches/cdom/code/src/java/plugin/lsttokens/pcclass/SpelllistToken.java
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/pcclass/SpelllistToken.java 2007-09-29 18:36:05 UTC (rev 4179)
+++ branches/cdom/code/src/java/plugin/lsttokens/pcclass/SpelllistToken.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -36,6 +36,7 @@
import pcgen.cdom.helper.GrantActor;
import pcgen.cdom.helper.ReferenceChoiceSet;
import pcgen.core.ClassSpellList;
+import pcgen.core.Globals;
import pcgen.core.PCClass;
import pcgen.core.PCTemplate;
import pcgen.persistence.AssociatedChanges;
@@ -83,7 +84,30 @@
while (aTok.hasMoreTokens())
{
- spellChoices.add(aTok.nextToken());
+ String className = aTok.nextToken();
+ if (Globals.getDomainKeyed(className) != null)
+ {
+ Logging.deprecationPrint(getTokenName()
+ + " now requires a DOMAIN. prefix "
+ + "when used with a DOMAIN rather than a Class");
+ }
+ if (className.startsWith("DOMAIN."))
+ {
+ String domainName = className.substring(7);
+ if (Globals.getDomainKeyed(domainName) != null)
+ {
+ Logging.errorPrint(getTokenName()
+ + " could not find Domain: " + domainName);
+ return false;
+ }
+ // This is safe in 5.x since the class & domain names can't
+ // conflict
+ spellChoices.add(domainName);
+ }
+ else
+ {
+ spellChoices.add(className);
+ }
}
// Protection against a "" value parameter
Modified: branches/cdom/code/src/java/plugin/lsttokens/pcclass/VfeatToken.java
===================================================================
--- branches/cdom/code/src/java/plugin/lsttokens/pcclass/VfeatToken.java 2007-09-29 18:36:05 UTC (rev 4179)
+++ branches/cdom/code/src/java/plugin/lsttokens/pcclass/VfeatToken.java 2007-09-29 18:36:32 UTC (rev 4180)
@@ -93,7 +93,6 @@
pcclass.addAbility(AbilityCategory.FEAT, Ability.Nature.VIRTUAL,
ability);
}
- pcclass.addVirtualFeats(level, FeatParser.parseVirtualFeatList(value));
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|