use of main.elements.Filter in project Eidolons by IDemiurge.
the class DC_MathManager method calculateClaimedObjects.
@Override
public int calculateClaimedObjects(Obj obj, String BF_OBJECT_TYPE) {
Conditions conditions = ConditionMaster.getClaimedBfObjConditions(BF_OBJECT_TYPE);
Ref ref = new Ref(game, obj.getId());
int i = new Filter<>(ref, conditions).getObjects().size();
PARAMETER param = ContentManager.getPARAM("CLAIMED_" + BF_OBJECT_TYPE + "S");
obj.setParam(param, i);
return i;
}
use of main.elements.Filter in project Eidolons by IDemiurge.
the class ClassView method getAdditionalTypesData.
@Override
protected List<ObjType> getAdditionalTypesData() {
String group = vendorPanel.getSelectedTabName();
List<ObjType> list = getAdditionalTypesMap().get(group);
if (list != null) {
return list;
}
String types = StringMaster.joinStringList(DataManager.getTypeNamesGroup(getTYPE(), group), ";");
Filter<ObjType> filter = new Filter<>(hero.getRef(), new Conditions(new StringComparison("{Match_}" + G_PROPS.CLASS_GROUP, MULTICLASS, true), new OrConditions(new Conditions(// ,
new StringComparison(group, "{Match_}" + G_PROPS.BASE_TYPE, false)), new StringComparison("{Match_}" + PROPS.BASE_CLASSES_ONE, types, false), new StringComparison("{Match_}" + PROPS.BASE_CLASSES_TWO, types, false))), DC_TYPE.CLASSES);
list = new ArrayList<>(filter.getTypes());
getAdditionalTypesMap().put(vendorPanel.getSelectedTabName(), list);
return list;
}
use of main.elements.Filter in project Eidolons by IDemiurge.
the class ListEditor method launch.
@Override
public String launch(String value, String name) {
if (listData == null && !listDataSet) {
if (res_name != null) {
listData = ResourceManager.getFilesInFolder(res_name);
// StringMaster.formatResList(listData);
Collections.sort(listData);
} else if (ENUM) {
// TODO get enum class by name (constants)
if (enumClass != null) {
listData = EnumMaster.getEnumConstantNames(enumClass);
} else {
Class<?> ENUM_CLASS = EnumMaster.getEnumClass(name);
if (// TODO find
ENUM_CLASS == null) {
ENUM_CLASS = EnumMaster.getEnumClass(name, MACRO_CONTENT_CONSTS.class);
}
listData = EnumMaster.getEnumConstantNames(ENUM_CLASS);
StringMaster.formatList(listData);
}
} else {
if (TYPE == null) {
TYPE = DC_TYPE.ABILS;
subgroup = name;
if (!XML_Reader.getSubGroups(TYPE.toString()).contains(subgroup)) {
Err.info("No subgroup found! - " + subgroup);
}
if (getBASE_TYPE() instanceof DC_TYPE) {
switch((DC_TYPE) getBASE_TYPE()) {
case BF_OBJ:
TYPE = DC_TYPE.ACTIONS;
subgroup = null;
break;
case CHARS:
TYPE = DC_TYPE.ACTIONS;
subgroup = null;
break;
case UNITS:
TYPE = DC_TYPE.ACTIONS;
subgroup = null;
break;
}
}
}
listData = DataManager.getTypeNamesGroup(TYPE, subgroup);
if (filterGroup != null) {
listData = DataManager.getTypeNamesGroup(TYPE, filterGroup);
} else if (filterSubgroup != null) {
listData = DataManager.getTypesSubGroupNames(TYPE, filterSubgroup);
}
if (getConditions() != null) {
Ref ref = new Ref(Game.game, getEntity().getId());
listData = DataManager.toStringList(new Filter<ObjType>(ref, getConditions()).filter(DataManager.toTypeList(listData, TYPE)));
}
}
}
ListChooser listChooser;
if (mode == SELECTION_MODE.SINGLE) {
listChooser = new ListChooser(listData, ENUM, TYPE);
} else {
secondListData = new ArrayList<>();
if (value != null) {
if (!value.equals(ContentManager.getDefaultEmptyValue())) {
secondListData = ListMaster.toList(value.toString(), ENUM);
}
}
listChooser = new ListChooser(listData, secondListData, ENUM, TYPE);
}
if (ENUM || TYPE == DC_TYPE.UNITS || TYPE == DC_TYPE.CHARS || TYPE == DC_TYPE.DEITIES) {
columns = 1;
}
listChooser.setColumns(columns);
listChooser.setVarTypes(getVarTypes());
listChooser.setVarClass(getVarTypesClass());
String newValue = listChooser.getString();
return newValue;
}
use of main.elements.Filter in project Eidolons by IDemiurge.
the class EntityChoiceView method initData.
protected void initData() {
if (list != null) {
// empty?
if (list.get(0) instanceof ObjType) {
data = new ArrayList<>(new DequeImpl<ObjType>().getAddAllCast(list));
} else {
// TODO
}
} else {
if (getGroup() != null) {
data = DataManager.getFilteredTypes(getGroup(), getTYPE(), getFilterValue());
} else {
data = DataManager.getTypes(getTYPE());
}
Ref ref = new Ref(DC_Game.game);
if (hero != null) {
ref = Ref.getCopy(hero.getRef());
}
if (getFilterOption() != null) {
WORKSPACE_GROUP ws = new EnumMaster<WORKSPACE_GROUP>().retrieveEnumConst(WORKSPACE_GROUP.class, getFilterOption());
data = new Filter<ObjType>(ref, ConditionMaster.getWorkspaceCondition(true, ws)).filter(data);
}
if (getFilterConditions() != null) {
data = new Filter<ObjType>(ref, getFilterConditions()).filter(data);
}
}
sortData();
}
use of main.elements.Filter in project Eidolons by IDemiurge.
the class GatewayEffect method getUnitType.
public String getUnitType() {
if (unitType != null) {
return unitType;
}
Obj obj = ref.getSourceObj().getOwner().getHeroObj();
typeList = null;
if (prop == null) {
typeList = DataManager.toTypeList(((Unit) obj).getDeity().getUnitPool(), DC_TYPE.UNITS);
} else {
typeList = new Filter<ObjType>(ref, getCondition()).filter(DataManager.getTypes(C_OBJ_TYPE.UNITS_CHARS));
}
if (typeList.isEmpty()) {
return null;
}
random = ref.getObj(KEYS.ACTIVE).checkBool(GenericEnums.STD_BOOLS.RANDOM);
if (!obj.getOwner().isAi()) {
random = true;
}
if (random) {
unitType = typeList.get(RandomWizard.getRandomListIndex(typeList)).getName();
} else {
if (!getGame().isOffline()) {
if (!obj.isMine()) {
// unitType = WaitingThread.waitOrGetInput(code);
return unitType;
}
}
unitType = ListChooser.chooseType(DataManager.toStringList(typeList), C_OBJ_TYPE.BF_OBJ);
if (!getGame().isOffline()) {
if (obj.isMine()) {
// getGame().getConnection().send(code, unitType);
}
}
}
return unitType;
}
Aggregations