use of main.entity.type.ObjType 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);
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class DataManager method addType.
public static ObjType addType(String typeName, OBJ_TYPE TYPE) {
ObjType objType = new ObjType(typeName, TYPE);
addType(objType);
return objType;
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class DataManager method getFilteredTypes.
public static List<ObjType> getFilteredTypes(String filter, OBJ_TYPE OBJ_TYPE, VALUE filterValue) {
Map<String, ObjType> map = XML_Reader.getTypeMaps().get(OBJ_TYPE.toString());
List<ObjType> list = new ArrayList<>();
boolean or = false;
if (filter.contains(StringMaster.OR)) {
or = true;
}
for (ObjType objName : map.values()) {
if (or) {
if (StringMaster.contains(filter, objName.getValue(filterValue))) {
list.add(objName);
}
} else if (StringMaster.compare(objName.getValue(filterValue), filter, true)) {
list.add(objName);
}
}
if (list.isEmpty()) {
for (ObjType objName : map.values()) {
if (StringMaster.compare(objName.getValue(filterValue), filter, false)) {
list.add(objName);
}
}
}
return list;
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class DataManager method findTypes.
public static List<ObjType> findTypes(String typeName, boolean strict, OBJ_TYPE... TYPES) {
List<ObjType> list = new ArrayList<>();
for (OBJ_TYPE TYPE : TYPES) {
if (TYPE instanceof C_OBJ_TYPE) {
C_OBJ_TYPE C_TYPE = (C_OBJ_TYPE) TYPE;
list.addAll(findTypes(typeName, strict, C_TYPE.getTypes()));
continue;
}
// C_TYPES
Map<String, ObjType> map = getTypeMap(TYPE);
if (map != null) {
for (String name : map.keySet()) {
if (StringMaster.compareByChar(name, typeName, false)) {
list.add(map.get(name));
continue;
}
if (!strict) {
if (StringMaster.compare(name, typeName, false)) {
list.add(map.get(name));
}
}
}
}
}
return list;
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class DataManager method overwriteType.
public static void overwriteType(ObjType type) {
ObjType oldType = getType(type.getName(), type.getOBJ_TYPE_ENUM());
if (oldType != null) {
if (overwrittenTypes == null) {
overwrittenTypes = new ArrayList<>();
}
overwrittenTypes.add(oldType);
}
addType(type);
}
Aggregations