Exemple #1
0
  public String generateInventory(Inventory inventory) {
    StringBuilder s = new StringBuilder(32 * inventory.getItems().size());

    for (GameItem item : inventory.getItems()) {
      s.append(generateInventoryEntry(item.getEntry())).append(';');
    }

    return s.toString();
  }
Exemple #2
0
  public String generateItemSet(int itemset, ItemSetHandler handler) {

    Set<GameItem> items = handler.getItemsInItemSet(itemset);

    if (items == null || items.isEmpty()) {
      return "-" + itemset;
    }
    StringBuilder packet = new StringBuilder();

    packet.append('+').append(itemset).append('|');

    for (GameItem item : items) {
      packet.append(item.getTemplate().id).append(';');
    }

    packet.append('|').append(generateStats(handler.getStatsByItemSet(itemset)));

    return packet.toString();
  }