use of main.content.VALUE in project Eidolons by IDemiurge.
the class HeroTextComp method refresh.
@Override
public void refresh() {
if (getMouseListeners().length == 0) {
addMouseListener(this);
}
if (hero == null) {
return;
}
List<String> lines = new ArrayList<>();
for (VALUE V : VALUES) {
String value = hero.getValue(V);
if (V instanceof PARAMETER) {
value = V.getName() + " " + value;
}
lines.add(value);
}
setTextLines(lines);
}
use of main.content.VALUE in project Eidolons by IDemiurge.
the class ValueInfoPage method init.
protected void init() {
if (!isInitialized()) {
return;
}
X = getDefaultX();
Y = getDefaultY();
i = 0;
Z = getDefaultZ();
if (isAddHeader()) {
addHeader();
}
for (VALUE p : values) {
EntityValueComponent comp = getComponent(p);
addComponent(comp, p);
}
initialized = true;
}
use of main.content.VALUE in project Eidolons by IDemiurge.
the class ValueHelper method getValue.
public VALUE getValue(String valueName) {
VALUE value;
value = checkFoundValues(valueName);
if (value != null) {
if (!checkRejectedValue(valueName, value)) {
return value;
}
}
ContentManager.setExcludedValueSet(rejectedValues.get(valueName));
try {
value = ContentManager.getValue(valueName);
if (value == null) {
value = ContentManager.getValue(valueName, true);
}
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
} finally {
ContentManager.setExcludedValueSet(null);
}
return value;
}
use of main.content.VALUE in project Eidolons by IDemiurge.
the class ValueHelper method setValue.
public void setValue(String valueName) {
if (getEntity() == null) {
return;
}
VALUE v = getValue(valueName);
String amount;
if (v != null) {
amount = getEntity().getValue(v);
foundValues.put(valueName, v);
} else {
valueName = CounterMaster.findCounter(valueName);
amount = "" + getEntity().getCounter(valueName);
}
String name = valueName;
if (v != null) {
name = v.getName();
}
String message = "Set value: " + name + " for " + getEntity().getName();
String input = JOptionPane.showInputDialog(parent, message, amount);
Set<VALUE> set = rejectedValues.get(valueName);
if (set == null) {
set = new HashSet<>();
rejectedValues.put(valueName, set);
}
if (input != null) {
set.remove(v);
} else {
set.add(v);
}
if (!StringMaster.isEmpty(input)) {
if (!input.equalsIgnoreCase(amount)) {
if (v != null) {
getEntity().setValue(v, input);
if (getEntity() instanceof Obj) {
getEntity().getType().setValue(v, input);
}
// if (getEntity() instanceof DC_HeroObj ) //set items
// initialized false!
} else {
getEntity().setCounter(valueName, StringMaster.getInteger(input));
}
game.getManager().reset();
game.getManager().refreshAll();
}
}
if (getEntity() instanceof ObjType) {
if (CoreEngine.isArcaneVault()) {
XML_Writer.writeXML_ForType((ObjType) getEntity());
}
}
}
use of main.content.VALUE in project Eidolons by IDemiurge.
the class XlsMaster method createSheet.
private static void createSheet(HSSFWorkbook workbook, DC_TYPE TYPE, String[] groups, PARAMS[] params, String[] formulas) {
HSSFSheet sheet = workbook.createSheet(TYPE.getName());
int row = 0;
HSSFRow rowhead = sheet.createRow((short) row);
rowhead.createCell(0).setCellValue("Name");
int column = 1;
for (String formula : formulas) {
rowhead.createCell(column).setCellValue(formula.split(formula_sep)[0]);
column++;
}
for (PARAMS param : params) {
rowhead.createCell(column).setCellValue((param).getShortName());
column++;
}
row++;
for (String group : groups) {
rowhead = sheet.createRow((short) row);
row++;
rowhead.createCell(0).setCellValue(group);
for (ObjType objType : DataManager.getTypesGroup(TYPE, group)) {
rowhead = sheet.createRow((short) row);
row++;
column = 0;
rowhead.createCell(column).setCellValue(objType.getName());
column++;
final ObjType simUnit = DataManager.getType(simUnitName, C_OBJ_TYPE.UNITS_CHARS);
Ref ref = new Ref() {
@Override
public ObjType getType(String string) {
if (string.equalsIgnoreCase(TYPE_KEY))
return objType;
return simUnit;
}
};
Map<VALUE, Integer> valueMap = null;
int simUnitRow = 0;
// Map<VALUE, Integer> entityMap;
for (String raw_formula : formulas) {
String formula = getFormula(raw_formula, row, column, valueMap, simUnitRow);
rowhead.createCell(column).setCellFormula(formula);
column++;
}
for (PARAMS param : params) {
rowhead.createCell(column).setCellValue(objType.getParam(param));
column++;
}
}
}
}
Aggregations