public EquipmentPto createPto(IEquipmentItem item) { EquipmentPto pto = new EquipmentPto(); pto.templateId = item.getTemplateId(); pto.customTitle = item.getTitle(); if (!item.getBaseDescription().equals(item.getDescription())) { pto.description = item.getDescription(); } if (item.getMaterialComposition() == MaterialComposition.Variable) { pto.material = item.getMaterial().name(); } for (IEquipmentStats stats : item.getStats()) { if (item.isPrintEnabled(stats)) { EquipmentStatsPto printPto = createStatsPto(item, stats); pto.printStats.add(printPto); } } return pto; }
@Override public ICardData[] getCards(ICharacter character, ICardReportResourceProvider resourceProvider) { IEquipmentAdditionalModel model = (IEquipmentAdditionalModel) character .getStatistics() .getCharacterContext() .getAdditionalModel(IEquipmentAdditionalModelTemplate.ID); List<ICardData> data = new ArrayList<ICardData>(); for (IEquipmentItem item : model.getEquipmentItems()) { String title = item.getTitle(); Paragraph headerText = new Paragraph(); if (hasCustomTitle(item)) { headerText.add(new Phrase(item.getTemplateId(), resourceProvider.getNormalFont())); } if (item.getMaterialComposition() == MaterialComposition.Variable) { String itemMaterial = ""; if (hasCustomTitle(item)) itemMaterial += " ("; itemMaterial += item.getMaterial().getId(); if (hasCustomTitle(item)) itemMaterial += ")"; headerText.add(new Phrase(itemMaterial + "\n", resourceProvider.getNormalFont())); } if (item.getCost() != null) { headerText.add(new Phrase(item.getCost().toString(), resourceProvider.getNormalFont())); } List<Phrase> bodyText = new ArrayList<Phrase>(); String description = item.getDescription(); if (description != null && !description.isEmpty()) { bodyText.add(new Phrase(description, resourceProvider.getNormalFont())); bodyText.add(new Phrase("\n", resourceProvider.getNormalFont())); } for (IEquipmentStats stats : item.getStats()) { Paragraph statsParagraph = new Paragraph(); if (stats instanceof IArtifactStats) { IArtifactStats artifactStats = (IArtifactStats) stats; if (artifactStats.getAttuneType() != ArtifactAttuneType.FullyAttuned) { continue; } statsParagraph.add( new Phrase( resources.getString("Equipment.Stats.Short.AttuneCost").trim() + ": ", resourceProvider.getBoldFont())); statsParagraph.add( new Phrase(artifactStats.getAttuneCost() + "m", resourceProvider.getNormalFont())); } else { String statsString = stringBuilder.createString(item, stats); statsParagraph.add(new Phrase(stats.getId() + ": ", resourceProvider.getBoldFont())); statsParagraph.add( new Phrase( statsString.substring(statsString.indexOf(':') + 2), resourceProvider.getNormalFont())); } bodyText.add(statsParagraph); } data.add( new EquipmentCardData( title, headerText, bodyText.toArray(new Phrase[0]), resourceProvider.getNullIcon())); } return data.toArray(new ICardData[0]); }