public Object getValueAt(int row, int col) { Part part; if (data.isEmpty()) { return ""; } else { part = (Part) data.get(row); } String[] inventories = campaign.getPartInventory(part); if (col == COL_NAME) { return part.getName(); } if (col == COL_DETAIL) { String details = part.getDetails(); details = details.replaceFirst("\\d+\\shit\\(s\\),\\s", ""); details = details.replaceFirst("\\d+\\shit\\(s\\)", ""); return details; } if (col == COL_COST) { return formatter.format(part.getActualValue()); } if (col == COL_TON) { return Math.round(part.getTonnage() * 100) / 100.0; } if (col == COL_TECH_BASE) { return part.getTechBaseName(); } if (col == COL_TARGET) { IAcquisitionWork shoppingItem = (MissingPart) part.getMissingPart(); if (null == shoppingItem && part instanceof IAcquisitionWork) { shoppingItem = (IAcquisitionWork) part; } if (null != shoppingItem) { TargetRoll target = campaign.getTargetForAcquisition(shoppingItem, campaign.getLogisticsPerson()); String value = target.getValueAsString(); if (target.getValue() != TargetRoll.IMPOSSIBLE && target.getValue() != TargetRoll.AUTOMATIC_SUCCESS && target.getValue() != TargetRoll.AUTOMATIC_FAIL) { value += "+"; } return value; } else { return "-"; } } if (col == COL_SUPPLY) { return inventories[0]; } if (col == COL_TRANSIT) { return inventories[1]; } if (col == COL_QUEUE) { return inventories[2]; } return "?"; }
@Override protected void handleIgnitionDamage(Vector<Report> vPhaseReport, Building bldg, int hits) { if (!bSalvo) { // hits! Report r = new Report(2270); r.subject = subjectId; r.newlines = 0; vPhaseReport.addElement(r); } TargetRoll tn = new TargetRoll(wtype.getFireTN(), wtype.getName()); if (tn.getValue() != TargetRoll.IMPOSSIBLE) { Report.addNewline(vPhaseReport); server.tryIgniteHex(target.getPosition(), subjectId, true, false, tn, true, -1, vPhaseReport); } }
public String getTooltip(int row, int col) { Part part; if (data.isEmpty()) { return null; } else { part = (Part) data.get(row); } switch (col) { case COL_TARGET: IAcquisitionWork shoppingItem = (MissingPart) part.getMissingPart(); if (null == shoppingItem && part instanceof IAcquisitionWork) { shoppingItem = (IAcquisitionWork) part; } if (null != shoppingItem) { TargetRoll target = campaign.getTargetForAcquisition(shoppingItem, campaign.getLogisticsPerson()); return target.getDesc(); } else { return null; } default: return null; } }