use of pcgen.core.XPTable in project pcgen by PCGen.
the class LevelLoader method validateLevelInfo.
private static boolean validateLevelInfo(GameMode gameMode, String xpTable, LevelInfo levelInfo, String inputLine, int lineNum, URI source) {
String level = levelInfo.getLevelString();
if (level == null) {
Logging.errorPrint("LevelLoader got empty level value in '" + inputLine + "' at line " + lineNum + " of " + source + ". Line ignored.");
return false;
}
XPTable existingTable = gameMode.getLevelInfo(xpTable);
if (existingTable == null) {
// No data on this table held yet, so it has to be right
return true;
}
// Not a number so just check for a duplicate
if (existingTable.getLevelInfo(level) != null) {
Logging.errorPrint("LevelLoader got duplicate level value of '" + level + "' in '" + inputLine + "' at line " + lineNum + " of " + source + ". Line ignored.");
return false;
}
if (!isNumeric(level)) {
// Not a number so must be good now
return true;
}
if (!existingTable.validateSequence(level)) {
Logging.errorPrint("LevelLoader got out of sequence level value of '" + level + "' in '" + inputLine + "' at line " + lineNum + " of " + source + ". Line ignored.");
}
return true;
}
use of pcgen.core.XPTable in project pcgen by PCGen.
the class XPTableFacetTest method testGetLevelInfoWrongLevel.
@Test
public void testGetLevelInfoWrongLevel() {
XPTable t1 = getItem();
LevelInfo li = new LevelInfo();
t1.addLevelInfo("2", li);
CharID id = getCharID();
facet.set(id, t1);
LevelInfo xpt = facet.getLevelInfo(id, 1);
assertNull(xpt);
}
use of pcgen.core.XPTable in project pcgen by PCGen.
the class XPTableFacetTest method testGetLevelInfoEmptyTable.
@Test
public void testGetLevelInfoEmptyTable() {
XPTable t1 = getItem();
CharID id = getCharID();
facet.set(id, t1);
assertNull(facet.getLevelInfo(id, 1));
}
use of pcgen.core.XPTable in project pcgen by PCGen.
the class XPTableFacetTest method testGetLevelInfoZeroLevel.
@Test
public void testGetLevelInfoZeroLevel() {
XPTable t1 = getItem();
CharID id = getCharID();
facet.set(id, t1);
assertNull(facet.getLevelInfo(id, 0));
}
use of pcgen.core.XPTable in project pcgen by PCGen.
the class XPTableFacetTest method testGetLevelInfoLevel.
@Test
public void testGetLevelInfoLevel() {
XPTable t1 = getItem();
LevelInfo li = new LevelInfo();
t1.addLevelInfo("LEVEL", li);
CharID id = getCharID();
facet.set(id, t1);
LevelInfo xpt = facet.getLevelInfo(id, 1);
assertNotNull(xpt);
assertSame(li, xpt);
}
Aggregations