Search in sources :

Example 6 with ObjType

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();
    }
}
Also used : ObjType(main.entity.type.ObjType)

Example 7 with ObjType

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;
}
Also used : ObjType(main.entity.type.ObjType)

Example 8 with ObjType

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;
}
Also used : ObjType(main.entity.type.ObjType)

Example 9 with ObjType

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);
}
Also used : ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap)

Example 10 with ObjType

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;
}
Also used : ObjType(main.entity.type.ObjType) PROPERTY(main.content.values.properties.PROPERTY) Node(org.w3c.dom.Node) Document(org.w3c.dom.Document) PARAMETER(main.content.values.parameters.PARAMETER)

Aggregations

ObjType (main.entity.type.ObjType)354 ArrayList (java.util.ArrayList)42 Coordinates (main.game.bf.Coordinates)30 Ref (main.entity.Ref)25 Unit (eidolons.entity.obj.unit.Unit)24 OBJ_TYPE (main.content.OBJ_TYPE)18 PROPERTY (main.content.values.properties.PROPERTY)18 DC_TYPE (main.content.DC_TYPE)16 PARAMETER (main.content.values.parameters.PARAMETER)16 File (java.io.File)15 Entity (main.entity.Entity)12 XLinkedMap (main.data.XLinkedMap)11 EnumMaster (main.system.auxiliary.EnumMaster)11 DC_SpellObj (eidolons.entity.active.DC_SpellObj)9 MATERIAL (main.content.enums.entity.ItemEnums.MATERIAL)9 Obj (main.entity.obj.Obj)9 QUALITY_LEVEL (main.content.enums.entity.ItemEnums.QUALITY_LEVEL)8 MusicList (main.music.entity.MusicList)8 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)6 C_OBJ_TYPE (main.content.C_OBJ_TYPE)6