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; }
public void actionPerformed(ActionEvent e) { if (e.getSource() == jrBooty[0]) { if (jrBooty[0].isSelected()) { room.setChest(null); tfChestGold.setEnabled(false); for (int i = 0; i < tfChestItems.length; i++) { tfChestItems[i].setEnabled(false); jbVerifyCItem[i].setEnabled(false); jbBrowseCItem[i].setEnabled(false); } cmbChestTrap.setEnabled(false); tfChestTrapLevel.setEnabled(false); isMagicLock.setEnabled(false); } } else if (e.getSource() == jrBooty[1] || e.getSource() == jrBooty[2]) { if (jrBooty[1].isSelected() || jrBooty[2].isSelected()) { room.setChest(new Chest()); tfChestGold.setEnabled(true); for (int i = 0; i < tfChestItems.length; i++) { tfChestItems[i].setEnabled(true); jbVerifyCItem[i].setEnabled(true); jbBrowseCItem[i].setEnabled(true); } cmbChestTrap.setEnabled(true); tfChestTrapLevel.setEnabled(true); isMagicLock.setEnabled(true); } } else if (e.getSource() == jbBrowseRItem) { JFrame itemBrowse = new JFrame(); itemBrowse.add( new ListChooserPanel( itemBrowse, tfRoomItem, dataBank, ListChooserPanel.BrowseTypes.items)); itemBrowse.pack(); itemBrowse.setVisible(true); } else if (e.getSource() == jbVerifyRItem) findItem(true, 0); else if (e.getSource() == jbOK) { updateRoom(); parent.dispose(); } else if (e.getSource() == jbCancel) parent.dispose(); else if (e.getSource() == jbMTNone) for (int i = 0; i < monsterTypes.length; i++) monsterTypes[i].setSelected(false); else if (e.getSource() == jbMTAll) for (int i = 0; i < monsterTypes.length; i++) monsterTypes[i].setSelected(true); else if (e.getSource() == jbMTInvert) for (int i = 0; i < monsterTypes.length; i++) monsterTypes[i].setSelected(!(monsterTypes[i].isSelected())); else { for (byte i = 0; i < jbVerify.length; i++) { if (e.getSource() == jbVerify[i]) findMonster(tfMonsters[i]); else if (e.getSource() == jbBrowse[i]) { JFrame monBrowse = new JFrame(); monBrowse.add( new ListChooserPanel( monBrowse, tfMonsters[i], dataBank, ListChooserPanel.BrowseTypes.monster)); monBrowse.pack(); monBrowse.setVisible(true); } } for (int i = 0; i < jbBrowseCItem.length; i++) { if (e.getSource() == jbBrowseCItem[i]) { JFrame itemBrowse = new JFrame(); itemBrowse.add( new ListChooserPanel( itemBrowse, tfChestItems[i], dataBank, ListChooserPanel.BrowseTypes.items)); itemBrowse.pack(); itemBrowse.setVisible(true); } else if (e.getSource() == jbVerifyCItem[i]) findItem(false, i); } for (byte i = 0; i < jbLairBrowse.length; i++) { if (e.getSource() == jbLairBrowse[i]) { JFrame monBrowse = new JFrame(); monBrowse.add( new ListChooserPanel( monBrowse, tfLairedMonsterName[i], dataBank, ListChooserPanel.BrowseTypes.monster)); monBrowse.pack(); monBrowse.setVisible(true); } else if (e.getSource() == jbLairVerify[i]) findMonster(tfLairedMonsterName[i]); } } }