use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class ArcaneTower method initTasks.
public static void initTasks() {
tasks = new ArrayList<>();
for (ObjType type : DataManager.getTypes(AT_OBJ_TYPE.TASK)) {
// if (isTestMode()
// || type.checkProperty(AT_PROPS.TASK_STATUS,
// TASK_STATUS.PENDING.name()))
tasks.add((Task) getEntity(type));
getEntity(type).toBase();
}
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class CaptureParser method getType.
private static ObjType getType(AT_OBJ_TYPE scope, String header, ObjType enclosingType, boolean update) {
ObjType type = DataManager.getType(header, scope);
if (type == null) {
// prompts
type = new ObjType(header, scope);
DataManager.addType(type);
} else {
if (!update) {
header = DialogMaster.inputText("Name already exists! Delete to turn on Update Mode or input a different name!", header + " New");
if (StringMaster.isEmpty(header)) {
updateMode = true;
return type;
}
type = new ObjType(header, scope);
DataManager.addType(type);
}
}
if (enclosingType == null) {
if (CaptureParser.directionHeader != null) {
enclosingType = DataManager.getType(CaptureParser.directionHeader, scope.getParentType());
if (enclosingType == null) {
enclosingType = DataManager.addType(CaptureParser.directionHeader, scope.getParentType());
}
} else // group = CreationHelper.getInput(groupValue, type, group);
{
if (promptsMode == null) {
promptsMode = DialogMaster.confirm(type + " has no enclosingType; choice prompts on?");
}
if (promptsMode) {
enclosingType = ListChooser.chooseTypeFromSubgroup_(scope.getParentType(), "");
}
// else enclosingType = DataManager.getTypes(scope).getOrCreate(0);
}
}
if (enclosingType != null) {
type.setProperty(AT_OBJ_TYPE.getParentValue((AT_OBJ_TYPE) type.getOBJ_TYPE_ENUM()), enclosingType.getName());
}
return type;
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class CaptureParser method parseBlock.
private static ObjType parseBlock(String data, AT_OBJ_TYPE scope, String header, ObjType enclosingType) {
// static header?!
String group = getGroupPrefix(scope, data);
data = data.replace(group, "");
String[] parts = data.split(BLOCK_DESCRIPTION_SEPARATOR);
if (parts.length == 1) {
parts = data.split(BLOCK_DESCRIPTION_SEPARATOR_ALT);
}
String name = formatBlockName(parts);
String description = "";
if (parts.length > 1) {
description = parts[1].trim();
}
// String[] lines = blockValue.split(DETAILS_SEPARATOR);
// if (lines.length > 1) {
// blockValue = blockValue.substring(0,
// blockValue.indexOf(DETAILS_SEPARATOR));
// }
String[] lines = StringMaster.getLastPart(data, DETAILS_SEPARATOR).split(";");
group = getGroupForPrefix(group, scope.getChildType());
if (data.indexOf(DETAILS_SEPARATOR) > 0) {
data = data.substring(0, data.indexOf(DETAILS_SEPARATOR));
}
ObjType type = createType(enclosingType, scope, header, name, description, lines, group);
try {
XML_Converter.getDoc(XML_Writer.getTypeXML(type));
DataManager.addType(type);
LogMaster.log(1, "Capture type added " + type + " from text" + data);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
LogMaster.log(1, "*********Broken Capture type from text: " + data);
}
return type;
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class VersionMaster method readVersionFile.
private static void readVersionFile(OBJ_TYPE t, String version) {
String xml = FileManager.readFile(getVersionFolderPath(t, version));
List<ObjType> types = XML_Reader.createCustomTypeList(xml, t, ArcaneTower.getSimulation(), false, false, false);
Map<String, ObjType> idMap = new XLinkedMap<>();
for (ObjType type : types) {
String id = type.getUniqueId();
idMap.put(id, type);
}
map.put(version, idMap);
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class XML_Reader method createCustomTypeList.
public static List<ObjType> createCustomTypeList(String xml, OBJ_TYPE TYPE, Game game, boolean overwrite, boolean incompleteTypes, boolean wrap) {
List<ObjType> types = new ArrayList<>();
if (wrap) {
xml = XML_Converter.wrap("wrapped", xml);
}
Document doc = XML_Converter.getDoc(xml);
List<Node> nodes = XML_Converter.getNodeList(XML_Converter.getNodeList(doc).get(0));
for (Node node : nodes) {
// typeName = node.getNodeName();
ObjType type = TypeBuilder.buildType(node, TYPE.toString());
game.initType(type);
if (incompleteTypes) {
ObjType parent = DataManager.getType(type.getProperty(G_PROPS.PARENT_TYPE), type.getOBJ_TYPE_ENUM());
if (parent != null) {
type.setType(parent);
for (PROPERTY prop : parent.getPropMap().keySet()) {
if (type.getProperty(prop).isEmpty()) {
type.setProperty(prop, parent.getProperty(prop));
}
}
for (PARAMETER param : parent.getParamMap().keySet()) {
if (type.getParam(param).isEmpty()) {
type.setParam(param, parent.getParam(param));
}
}
}
}
if (overwrite) {
DataManager.overwriteType(type);
}
types.add(type);
}
return types;
}
Aggregations