@Override public String displayText() { final StringBuilder str = new StringBuilder(""); for (final Object[] A : affects) if (A[0] instanceof Ability) str.append(((Ability) A[0]).displayText()); return str.toString(); }
public StringBuilder getInventory(MOB seer, MOB mob, String mask) { final StringBuilder msg = new StringBuilder(""); final InventoryList list = fetchInventory(seer, mob); if (((list.viewItems.size() > 0) || (list.moneyItems.size() > 0)) && (!list.foundAndSeen)) { list.viewItems.clear(); list.moneyItems.clear(); list.foundButUnseen = true; } else if ((mask != null) && (mask.trim().length() > 0)) { mask = mask.trim().toUpperCase(); if (!mask.startsWith("all")) mask = "all " + mask; final Vector<Item> V = (Vector<Item>) list.viewItems.clone(); list.viewItems.clear(); Item I = (V.size() > 0) ? (Item) V.get(0) : null; while (I != null) { I = (Item) CMLib.english().fetchEnvironmental(V, mask, false); if (I != null) { list.viewItems.add(I); V.remove(I); } } } if ((list.viewItems.size() == 0) && (list.moneyItems.size() == 0)) { if ((mask != null) && (mask.trim().length() > 0)) msg.append(L("(nothing like that you can see right now)")); else msg.append(L("(nothing you can see right now)")); } else { if (list.viewItems.size() > 0) msg.append( CMLib.lister() .lister( seer, list.viewItems, true, "MItem", "", false, seer.isAttribute(MOB.Attrib.COMPRESS))); if (list.foundButUnseen) msg.append(L("(stuff you can't see right now)")); msg.append(getShowableMoney(list)); } return msg; }
protected String getShowableMoney(InventoryList list) { final StringBuilder msg = new StringBuilder(""); if (list.moneyItems.size() > 0) { msg.append(L("\n\r^HMoney:^N\n\r")); Item I = null; for (final Enumeration e = list.moneyItems.keys(); e.hasMoreElements(); ) { final String key = (String) e.nextElement(); final Vector<Coins> V = list.moneyItems.get(key); double totalValue = 0.0; for (int v = 0; v < V.size(); v++) { I = V.get(v); if (I != null) { if (v > 0) msg.append(", "); if (I instanceof Coins) totalValue += ((Coins) I).getTotalValue(); msg.append(I.name()); } } msg.append(" ^N(" + CMLib.beanCounter().abbreviatedPrice(key, totalValue) + ")"); if (e.hasMoreElements()) msg.append("\n\r"); } } return msg.toString(); }