示例#1
0
  /**
   * Retrieve the link list of all chest items.
   *
   * @return LinkedList<ItemInstance>
   */
  private LinkedList<ItemInstance> getChestItems() {
    LinkedList<ItemInstance> itemList = new LinkedList<ItemInstance>();

    for (int i = 0; i < tfChestItems.length; i++) {
      ItemInstance tItem = getItem(false, i);
      if (tItem != null) itemList.insert(tItem);
    }

    return (itemList.getSize() < 1) ? null : itemList;
  }
示例#2
0
  public boolean updateRoom() {
    if (!validateRoom()) return false;

    room.setStud(isStud.isSelected());

    if (jrBooty[0].isSelected()) {
      room.setChest(null);
    } else if (jrBooty[1].isSelected() || jrBooty[2].isSelected()) {
      Chest chest = new Chest();
      chest.setGold(Integer.parseInt(tfChestGold.getText().trim()));
      chest.setTrapType(Trap.type(cmbChestTrap.getSelectedIndex()));
      chest.setLockLevel(Byte.parseByte(tfChestTrapLevel.getText().trim()));

      chest.setItems(getChestItems());
      chest.setMagicLock(isMagicLock.isSelected());
      room.setChest(chest);
    }

    room.setItem(getItem(true, 0));

    for (byte i = 0; i < Util.MON_MAXSTACKSIZE; i++) {
      Monster tMon = getMonster(tfLairedMonsterName[i]);
      if (tMon != null) room.setLairedMonster(tMon, i);
    }

    LinkedList<LinkedList<MonsterInstance>> monStacks =
        new LinkedList<LinkedList<MonsterInstance>>();

    for (byte i = 0; i < tfMonsters.length; i++) {
      Monster tMon = getMonster(tfMonsters[i]);
      if (tMon != null) {
        LinkedList<MonsterInstance> monList = new LinkedList<MonsterInstance>();

        for (int j = 0; j < Byte.parseByte(tfMonsterCounts[i].getText().trim()); i++)
          monList.insert(tMon.createInstance());

        monStacks.insert(monList);
      }
    }

    for (MonsterClass mc : MonsterClass.values())
      room.setMonsterType(mc, monsterTypes[mc.value()].isSelected());

    return true;
  }