use of main.system.auxiliary.EnumMaster 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.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.
the class OptionsMaster method applySoundOptions_.
private static void applySoundOptions_(SoundOptions soundOptions) {
for (Object sub : soundOptions.getValues().keySet()) {
new EnumMaster<SOUND_OPTION>().retrieveEnumConst(SOUND_OPTION.class, soundOptions.getValues().get(sub).toString());
SOUND_OPTION key = soundOptions.getKey((sub.toString()));
String value = soundOptions.getValue(key);
if (!StringMaster.isInteger(value)) {
switch(key) {
case SOUNDS_OFF:
SoundMaster.setOn(false);
// MusicMaster.resetSwitcher();
break;
case MUSIC_OFF:
MusicMaster.resetSwitcher();
break;
case MUSIC_VARIANT:
MusicMaster.getInstance().setVariant(new EnumMaster<MUSIC_VARIANT>().retrieveEnumConst(MUSIC_VARIANT.class, soundOptions.getValue(key)));
break;
}
} else {
Integer integer = Integer.valueOf(value.toLowerCase());
Float v = new Float(integer) / 100;
switch(key) {
case MASTER_VOLUME:
SoundMaster.setMasterVolume(integer);
MusicMaster.resetVolume();
break;
case MUSIC_VOLUME:
MusicMaster.resetVolume();
// auto
break;
}
}
}
}
use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.
the class HT_View method adjustLink.
public void adjustLink(Boolean vertical_horizontal_manual, HT_Node node) {
ObjType type = node.getType();
LINK_VARIANT variant = null;
if (tree.getMap().getLinkForChildType(type) != null) {
variant = tree.getMap().getLinkForChildType(type).getVariant();
}
if (variant == null || vertical_horizontal_manual == null) {
variant = new EnumMaster<LINK_VARIANT>().retrieveEnumConst(LINK_VARIANT.class, new ListChooser(SELECTION_MODE.SINGLE, LINK_VARIANT.class).choose());
} else {
variant = HT_MapBuilder.getShiftedLinkVariant(variant, vertical_horizontal_manual);
}
if (variant == null) {
LogMaster.log(1, type + "'s LINK_VARIANT null !!! ");
return;
}
type.setProperty(PROPS.LINK_VARIANT, variant.toString());
if (!CoreEngine.isArcaneVault()) {
XML_Writer.writeXML_ForType(type, isSkill() ? DC_TYPE.SKILLS : DC_TYPE.CLASSES);
}
LogMaster.log(1, type + "'s LINK_VARIANT set for " + variant);
rebuildAndSetTree();
}
use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.
the class ActivesConstructor method wrapInSaveRollEffect.
public static void wrapInSaveRollEffect(Effects effects, String saveRoll) {
// TODO
ArrayList<ROLL_TYPES> rolls = new ArrayList<>();
ArrayList<String> vars = new ArrayList<>();
for (String roll : StringMaster.open(saveRoll, StringMaster.AND_SEPARATOR)) {
String varArgs = VariableManager.getVarPart(roll);
roll = roll.replace(varArgs, "");
rolls.add(new EnumMaster<ROLL_TYPES>().retrieveEnumConst(ROLL_TYPES.class, roll));
vars.add(varArgs);
}
int i = 0;
for (Effect e : effects) {
for (ROLL_TYPES roll : rolls) {
String args = StringMaster.cropParenthesises(vars.get(i));
e = wrapInRoll(e, roll, args);
i++;
}
}
}
use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.
the class ItemCondition method check.
@Override
public boolean check(Ref ref) {
if (ref.getGame().isSimulation()) {
return true;
}
if (slot == null) {
slot = (weapon) ? ItemEnums.ITEM_SLOT.MAIN_HAND.toString() : ItemEnums.ITEM_SLOT.ARMOR.toString();
}
Entity item;
Unit unit = (Unit) ref.getObj(obj_ref);
if (unit == null) {
return false;
}
if (slot.equalsIgnoreCase(KEYS.RANGED.toString())) {
item = unit.getRef().getObj(KEYS.RANGED);
} else {
if (slot.equalsIgnoreCase("weapon"))
item = unit.getItem(!ref.getActive().isOffhand() ? ITEM_SLOT.MAIN_HAND : ITEM_SLOT.OFF_HAND);
else
item = unit.getItem(new EnumMaster<ITEM_SLOT>().retrieveEnumConst(ITEM_SLOT.class, slot, true));
}
if (item == null) {
return false;
}
if (// any item in the slot
prop == null) {
return true;
}
String string = item.getProp(prop);
return new StringComparison(string, val, strict).preCheck(ref);
// String prop2 = ref.getObj(obj_string).getProp(slot);
// if (StringMaster.isEmpty(prop2)) {
// try {
// prop2 = "" + ref.getObj(obj_string).getRef().getObj(slot).getId();
// } catch (Exception e) {
// return false;
// }
// }
// item = DataManager.getType(prop2, C_OBJ_TYPE.ITEMS);
// return StringMaster.compare(string, val, true);
}
Aggregations