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;
}
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);
// }
}
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;
}
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;
}
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);
}
Aggregations