Search in sources :

Example 16 with ObjType

use of main.entity.type.ObjType in project Eidolons by IDemiurge.

the class DataManager method getTypesSubGroupNames.

public static List<String> getTypesSubGroupNames(OBJ_TYPE TYPE, String subgroup) {
    if (TYPE instanceof C_OBJ_TYPE) {
        List<String> data = null;
        for (DC_TYPE type : ((C_OBJ_TYPE) TYPE).getTypes()) {
            try {
                data = getTypesSubGroupNames(type, subgroup);
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
                continue;
            }
            if (data != null) {
                if (!data.isEmpty()) {
                    break;
                }
            }
        }
        return data;
    }
    if (subgroup == null) {
        return getTypeNames(TYPE);
    }
    List<String> list = getTypesSubGroups().get(TYPE).get(subgroup);
    // if (list != null)
    // return list;
    List<String> groupsList = EnumMaster.findEnumConstantNames(TYPE.getSubGroupingKey().toString());
    // TODO preCheck TYPES!
    if (groupsList.isEmpty()) {
        if (DC_TYPE.isOBJ_TYPE(subgroup)) {
            groupsList = toStringList(getTypes(DC_TYPE.getType(subgroup)));
        } else {
            if (isTypeName(subgroup)) {
                groupsList = toStringList(getTypes(getType(subgroup).getOBJ_TYPE_ENUM()));
            }
        }
    }
    // if (ListMaster.contains(groupsList, subgroup, true)
    // || isCustomGroup(subgroup)) {
    list = new ArrayList<>();
    Map<String, Map<String, ObjType>> map = XML_Reader.getTypeMaps();
    Collection<ObjType> set = map.get(TYPE.toString()).values();
    for (ObjType type : set) {
        if (StringMaster.compare(type.getProperty(TYPE.getSubGroupingKey()), subgroup, true)) {
            list.add(type.getName());
        }
    }
    // }
    getTypesSubGroups().get(TYPE).put(subgroup, list);
    return list;
}
Also used : ObjType(main.entity.type.ObjType)

Example 17 with ObjType

use of main.entity.type.ObjType in project Eidolons by IDemiurge.

the class DataManager method getType.

public static ObjType getType(String typeName, OBJ_TYPE TYPE, boolean recursion) {
    if (C_OBJ_TYPE.ITEMS.equals(TYPE)) {
        // 1) get quality 2) find base type name 3) crop and use
        ObjType type = null;
        try {
            type = getItemType(typeName, TYPE);
        } catch (Exception e) {
        }
        if (type != null) {
            return type;
        }
    }
    if (StringMaster.isEmpty(typeName)) {
        return null;
    }
    typeName = typeName.trim();
    if (TYPE == null) {
        if (recursion) {
            return getType(typeName, false);
        }
    }
    if (TYPE instanceof C_OBJ_TYPE) {
        return getConstructedType(typeName, (C_OBJ_TYPE) TYPE);
    }
    if (TYPE instanceof C_MACRO_OBJ_TYPE) {
        return getConstructedMacroType(typeName, (C_MACRO_OBJ_TYPE) TYPE);
    }
    Map<String, ObjType> map = getTypeMap(TYPE);
    if (map == null) {
        // main.system.auxiliary.log.LogMaster.log(log,"NO TYPE MAP: "+obj_type );
        return null;
    }
    ObjType type = map.get(typeName);
    if (type == null) {
        // typeName = typeName.replace(";", " "); never needed???
        type = map.get(typeName);
    }
    if (type != null) {
        return type;
    }
    // }
    if (!recursion) {
        LogMaster.log(log, "Type not found: " + TYPE + ":" + typeName);
        return null;
    }
    if (typeName.endsWith(";")) {
        LogMaster.log(log, "endsWith(\";\"): " + TYPE + ":" + typeName);
        typeName = StringMaster.getFormattedTypeName(typeName);
        type = getType(typeName, TYPE, false);
        if (type != null) {
            return type;
        }
    }
    // if (typeName.contains(" ")) {
    LogMaster.log(log, "Type getWellFormattedString: " + TYPE + ":" + typeName);
    return getType(StringMaster.getWellFormattedString(typeName), TYPE, false);
// }
}
Also used : C_MACRO_OBJ_TYPE(main.content.enums.macro.C_MACRO_OBJ_TYPE) ObjType(main.entity.type.ObjType)

Example 18 with ObjType

use of main.entity.type.ObjType in project Eidolons by IDemiurge.

the class DataManager method getType.

public static ObjType getType(String typeName, boolean recursion) {
    for (String group : XML_Reader.getTypeMaps().keySet()) {
        ObjType type;
        OBJ_TYPE TYPE = ContentManager.getOBJ_TYPE(group);
        try {
            type = getType(typeName, TYPE, recursion);
        } catch (Exception e) {
            continue;
        }
        if (type != null) {
            return type;
        } else {
            continue;
        }
    }
    return null;
}
Also used : C_MACRO_OBJ_TYPE(main.content.enums.macro.C_MACRO_OBJ_TYPE) ObjType(main.entity.type.ObjType)

Example 19 with ObjType

use of main.entity.type.ObjType in project Eidolons by IDemiurge.

the class XML_Converter method getTypeListFromXML.

public static List<ObjType> getTypeListFromXML(String xml, boolean layerDown) {
    if (layerDown) {
        xml = layerDown(xml);
    }
    Document doc = getDoc(xml);
    List<ObjType> list = new ArrayList<>();
    List<Node> typeGroupsList = null;
    for (Node n : getNodeList(doc)) {
        if (n.getNodeName().equalsIgnoreCase(TYPES_NODE)) {
            typeGroupsList = getNodeList(n);
        }
    }
    if (typeGroupsList == null) {
        return new ArrayList<>();
    }
    for (Node groupNode : typeGroupsList) {
        DC_TYPE obj_type = DC_TYPE.getType(groupNode.getNodeName());
        for (Node typeNode : getNodeList(groupNode)) {
            ObjType type = DataManager.getType(typeNode.getNodeName(), obj_type);
            if (// TODO find?
            type != null) {
                list.add(type);
            }
        // TODO each type node could have some spec data for workspace?
        }
    }
    return list;
}
Also used : DC_TYPE(main.content.DC_TYPE) ObjType(main.entity.type.ObjType) TreeNode(javax.swing.tree.TreeNode) Node(org.w3c.dom.Node) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ArrayList(java.util.ArrayList) Document(org.w3c.dom.Document)

Example 20 with ObjType

use of main.entity.type.ObjType in project Eidolons by IDemiurge.

the class CastNewSpellEffect method applyThis.

// TODO spellpower/mastery mods!!!
@Override
public boolean applyThis() {
    ObjType type = DataManager.getType(spelltype, DC_TYPE.SPELLS);
    Ref REF = new Ref(ref.getGame(), ref.getSource());
    Obj obj = game.createSpell(type, ref.getSourceObj().getOwner(), REF);
    DC_SpellObj spell = (DC_SpellObj) obj;
    spell.setFree(free);
    spell.setQuietMode(true);
    if (group) {
        REF.setGroup(ref.getGroup());
        return spell.activatedOn(REF);
    }
    if (chooseTarget) {
        spell.getTargeting().select(REF);
    } else {
        REF.setTarget(ref.getId(target_key));
    }
    return spell.activatedOn(REF);
}
Also used : Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) Obj(main.entity.obj.Obj) DC_SpellObj(eidolons.entity.active.DC_SpellObj) DC_SpellObj(eidolons.entity.active.DC_SpellObj)

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