Search in sources :

Example 1 with QUALITY_LEVEL

use of main.content.enums.entity.ItemEnums.QUALITY_LEVEL in project Eidolons by IDemiurge.

the class DataManager method getItemType.

private static ObjType getItemType(String typeName, OBJ_TYPE obj_type) {
    ObjType type = getBaseItemType(typeName, obj_type);
    if (type != null) {
        return type;
    }
    if (obj_type.equals(DC_TYPE.JEWELRY)) {
        // main.system.auxiliary.log.LogMaster.log(log,"NO JEWELRY!  "  );
        return null;
    }
    int i = 0;
    List<String> parts = StringMaster.openContainer(typeName, " ");
    String qualityName = parts.get(0);
    QUALITY_LEVEL q = new EnumMaster<QUALITY_LEVEL>().retrieveEnumConst(QUALITY_LEVEL.class, qualityName);
    if (q == null) {
        q = ItemEnums.QUALITY_LEVEL.NORMAL;
    } else {
        i++;
    }
    String materialName = parts.get(i);
    MATERIAL m = new EnumMaster<MATERIAL>().retrieveEnumConst(MATERIAL.class, materialName);
    while (m == null) {
        i++;
        if (i > parts.size() - 1) {
            return null;
        }
        materialName += " " + parts.get(i);
        m = new EnumMaster<MATERIAL>().retrieveEnumConst(MATERIAL.class, materialName);
    }
    String baseTypeName = "";
    for (int a = i; a <= parts.size() - 1; a++) {
        baseTypeName += parts.get(a) + " ";
    }
    ObjType baseType = getBaseItemType(baseTypeName, obj_type);
    // int j = 0;
    // if (baseType == null) {
    // baseType = getBaseItemType(parts.get(parts.size() - 2) + " "
    // + baseTypeName, obj_type);
    // j++;
    // }
    // typeName.replace(baseTypeName, "");
    // materialName = typeName.replace(qualityName, "");
    // while (parts.size() - i > j) {
    // materialName += parts.get(i) + " ";
    // i++;
    // }
    Map<MATERIAL, Map<ObjType, ObjType>> map = itemMaps.get(q);
    Map<ObjType, ObjType> map2 = map.get(m);
    return map2.get(baseType);
}
Also used : ObjType(main.entity.type.ObjType) EnumMaster(main.system.auxiliary.EnumMaster) QUALITY_LEVEL(main.content.enums.entity.ItemEnums.QUALITY_LEVEL) MATERIAL(main.content.enums.entity.ItemEnums.MATERIAL)

Example 2 with QUALITY_LEVEL

use of main.content.enums.entity.ItemEnums.QUALITY_LEVEL in project Eidolons by IDemiurge.

the class UnitShop method chooseQualityForItem.

private static ObjType chooseQualityForItem(MATERIAL materialType, int costLimit, Unit unit, ObjType baseType, boolean canExceed) {
    String allowed = unit.getProperty(PROPS.QUALITY_LEVEL_RANGE);
    int minIndex = 0;
    int maxIndex = 999;
    if (allowed.contains(";")) {
        minIndex = EnumMaster.getEnumConstIndex(QUALITY_LEVEL.class, allowed.split(";")[0]);
        maxIndex = EnumMaster.getEnumConstIndex(QUALITY_LEVEL.class, allowed.split(";")[1]);
    }
    List<ObjType> types = new ArrayList<>();
    for (QUALITY_LEVEL sub : DataManager.getItemMaps().keySet()) {
        int index = EnumMaster.getEnumConstIndex(QUALITY_LEVEL.class, sub);
        if (index > maxIndex)
            continue;
        if (index < minIndex)
            continue;
        ObjType type = DataManager.getItem(sub, materialType, baseType);
        if (type.getIntParam(PARAMS.GOLD_COST) <= costLimit) {
            return type;
        } else if (canExceed)
            types.add(type);
    }
    if (!canExceed)
        return null;
    SortMaster.sortEntitiesByExpression(types, (type) -> -type.getIntParam(PARAMS.GOLD_COST));
    return types.get(0);
}
Also used : ObjType(main.entity.type.ObjType) QUALITY_LEVEL(main.content.enums.entity.ItemEnums.QUALITY_LEVEL) ArrayList(java.util.ArrayList)

Example 3 with QUALITY_LEVEL

use of main.content.enums.entity.ItemEnums.QUALITY_LEVEL in project Eidolons by IDemiurge.

the class ArcadeManager method generateMaterialQualityForRegion.

public Condition generateMaterialQualityForRegion(ARCADE_REGION region) {
    Conditions c = new Conditions();
    MATERIAL[] materials = new MATERIAL[0];
    QUALITY_LEVEL[] qualities = new QUALITY_LEVEL[0];
    // TODO and what about jewelry?
    switch(region) {
        case DUSK_DALE:
            break;
        case GREYLEAF_WOODS:
            break;
        case WRAITH_MARSHES:
            break;
        case MISTY_SHORES:
            break;
        case BLIGHTSTONE_DESERT:
            qualities = new QUALITY_LEVEL[] { ItemEnums.QUALITY_LEVEL.ANCIENT, ItemEnums.QUALITY_LEVEL.OLD, ItemEnums.QUALITY_LEVEL.MASTERPIECE };
            materials = new MATERIAL[] { ItemEnums.MATERIAL.ADAMANTIUM };
            break;
    }
    OrConditions mC = new OrConditions();
    OrConditions qC = new OrConditions();
    for (MATERIAL m : materials) {
        mC.add(new StringComparison(StringMaster.getValueRef(KEYS.MATCH, G_PROPS.MATERIAL), m.getName(), true));
    }
    for (QUALITY_LEVEL q : qualities) {
        mC.add(new StringComparison(StringMaster.getValueRef(KEYS.MATCH, G_PROPS.QUALITY_LEVEL), q.getName(), true));
    }
    c.add(mC);
    c.add(qC);
    return c;
}
Also used : OrConditions(main.elements.conditions.OrConditions) StringComparison(main.elements.conditions.StringComparison) QUALITY_LEVEL(main.content.enums.entity.ItemEnums.QUALITY_LEVEL) Conditions(main.elements.conditions.Conditions) OrConditions(main.elements.conditions.OrConditions) MATERIAL(main.content.enums.entity.ItemEnums.MATERIAL)

Example 4 with QUALITY_LEVEL

use of main.content.enums.entity.ItemEnums.QUALITY_LEVEL in project Eidolons by IDemiurge.

the class ItemGenerator method generateCloaks.

private void generateCloaks() {
    List<MATERIAL> materials = new ArrayList<>();
    materials.addAll(Arrays.asList(DEFAULT_MATERIALS_CLOTH));
    materials.addAll(Arrays.asList(DEFAULT_MATERIALS_SKINS));
    for (ObjType type : DataManager.getTypesSubGroup(DC_TYPE.GARMENT, ItemEnums.GARMENT_TYPE.BOOTS + "")) {
        for (QUALITY_LEVEL q : ItemEnums.QUALITY_LEVEL.values()) {
            for (MATERIAL m : materials) {
            // generateItem_(quality, material, type)
            }
        }
    }
}
Also used : ObjType(main.entity.type.ObjType) ArrayList(java.util.ArrayList) QUALITY_LEVEL(main.content.enums.entity.ItemEnums.QUALITY_LEVEL) MATERIAL(main.content.enums.entity.ItemEnums.MATERIAL)

Example 5 with QUALITY_LEVEL

use of main.content.enums.entity.ItemEnums.QUALITY_LEVEL in project Eidolons by IDemiurge.

the class ItemGenerator method generateItemType.

@Override
public ObjType generateItemType(String typeName, OBJ_TYPE type) {
    if (type == (DC_TYPE.JEWELRY)) {
        if (ItemGenerator.isJewelryOn())
            return generateJewelry(typeName);
        return null;
    }
    if (type == (DC_TYPE.ITEMS)) {
    // return getOrCreateItem(typeName);
    }
    // TODO generic C_TYPE for armor?
    boolean weapon = type.equals(DC_TYPE.WEAPONS);
    // String baseTypeName = typeName;
    String name = StringMaster.getFirstItem(typeName, " ");
    QUALITY_LEVEL quality = new EnumMaster<QUALITY_LEVEL>().retrieveEnumConst(QUALITY_LEVEL.class, name);
    if (quality != null)
        typeName = typeName.replace(quality.toString(), "").trim();
    else
        quality = QUALITY_LEVEL.NORMAL;
    name = StringMaster.getFirstItem(typeName, " ");
    MATERIAL material = new EnumMaster<MATERIAL>().retrieveEnumConst(MATERIAL.class, name, true, false);
    if (material == null) {
        name = name + StringMaster.getFirstItem(typeName.replace(name, "").trim(), " ");
        material = new EnumMaster<MATERIAL>().retrieveEnumConst(MATERIAL.class, name);
    }
    if (material == null) {
        return null;
    }
    typeName = typeName.replace(material.toString(), "").trim();
    ObjType baseType = DataManager.getType(typeName, type, true);
    if (baseType == null)
        return null;
    return generateItem(weapon, quality, material, baseType);
}
Also used : EnumMaster(main.system.auxiliary.EnumMaster) ObjType(main.entity.type.ObjType) QUALITY_LEVEL(main.content.enums.entity.ItemEnums.QUALITY_LEVEL) MATERIAL(main.content.enums.entity.ItemEnums.MATERIAL)

Aggregations

QUALITY_LEVEL (main.content.enums.entity.ItemEnums.QUALITY_LEVEL)11 MATERIAL (main.content.enums.entity.ItemEnums.MATERIAL)8 ObjType (main.entity.type.ObjType)7 ArrayList (java.util.ArrayList)3 EnumMaster (main.system.auxiliary.EnumMaster)3 ItemGenerator (eidolons.client.cc.logic.items.ItemGenerator)1 ConcurrentMap (main.data.ConcurrentMap)1 Conditions (main.elements.conditions.Conditions)1 OrConditions (main.elements.conditions.OrConditions)1 StringComparison (main.elements.conditions.StringComparison)1