Search in sources :

Example 1 with C_MACRO_OBJ_TYPE

use of main.content.enums.macro.C_MACRO_OBJ_TYPE 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)

Aggregations

C_MACRO_OBJ_TYPE (main.content.enums.macro.C_MACRO_OBJ_TYPE)1 ObjType (main.entity.type.ObjType)1