1
0
Fork 0

TreasureGenerator added

master
MrMcX vor 8 Jahren
Ursprung 8d0a7142e9
Commit 68e110d706

@ -108,7 +108,11 @@ public class Treasure extends ADungeonObject{
}
}
private String DetailedTreasure(){
/**
* Generates a handfull of treasures
* @return description of tresure
*/
public static String DetailedTreasure(){
switch(Dice.Roll(20,1)){
case 1:
case 2:
@ -134,7 +138,7 @@ public class Treasure extends ADungeonObject{
return "";
}
private String Coins(){
private static String Coins(){
switch(Dice.Roll(20,1)){
case 1:
case 2: return Dice.Roll(20, 2) + " Kreuzer";
@ -160,7 +164,7 @@ public class Treasure extends ADungeonObject{
return "";
}
private String Jewelry(){
private static String Jewelry(){
switch(Dice.Roll(20,1)){
case 1:
case 2: return Material() + "-Amulett";
@ -186,7 +190,7 @@ public class Treasure extends ADungeonObject{
return "";
}
private String Material(){
private static String Material(){
switch(Dice.Roll(20,1)){
case 1: return "rostige(s/r) Eisen";
case 2: return "Eisen";
@ -212,7 +216,7 @@ public class Treasure extends ADungeonObject{
return "";
}
private String Gem(){
private static String Gem(){
switch(Dice.Roll(20,1)){
case 1:
case 2: return "Speckstein (weiß/braun/rot, " + Karat() + ")";
@ -238,7 +242,7 @@ public class Treasure extends ADungeonObject{
return "";
}
private String Karat(){
private static String Karat(){
switch(Dice.Roll(6,2)){
case 2: return Dice.Roll(20, 2) + " Karat";
case 3:

@ -21,6 +21,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuNewActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuTreasure">
<Properties>
<Property name="text" type="java.lang.String" value="Neuer Schatz"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuTreasureActionPerformed"/>
</Events>
</MenuItem>
<Menu class="javax.swing.JMenu" name="jMenuDescription">
<Properties>
<Property name="text" type="java.lang.String" value="Beschreibung exportieren"/>

@ -110,6 +110,7 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
jMenuBar = new javax.swing.JMenuBar();
jMenu = new javax.swing.JMenu();
jMenuNew = new javax.swing.JMenuItem();
jMenuTreasure = new javax.swing.JMenuItem();
jMenuDescription = new javax.swing.JMenu();
jMenuDescTxt = new javax.swing.JMenuItem();
jMenuDescPdf = new javax.swing.JMenuItem();
@ -230,6 +231,14 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
});
jMenu.add(jMenuNew);
jMenuTreasure.setText("Neuer Schatz");
jMenuTreasure.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuTreasureActionPerformed(evt);
}
});
jMenu.add(jMenuTreasure);
jMenuDescription.setText("Beschreibung exportieren");
jMenuDescription.setEnabled(false);
jMenuDescription.addActionListener(new java.awt.event.ActionListener() {
@ -645,6 +654,11 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
//jComboBoxMode.setSelectedItem("Zufällig");
}//GEN-LAST:event_jCheckBoxExpActionPerformed
private void jMenuTreasureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuTreasureActionPerformed
JFrame treasureGenerator = new TreasureGenerator();
treasureGenerator.setVisible(true);
}//GEN-LAST:event_jMenuTreasureActionPerformed
private void CreateGraphPDF(File file) throws BadElementException, IOException, DocumentException {
Document document = new Document(PageSize.A4);
Image image = Image.getInstance(mxCellRenderer.createBufferedImage(mGraphComponent.getGraph(), null, 10, Color.WHITE, true, null), Color.WHITE);
@ -764,6 +778,7 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
private javax.swing.JMenuItem jMenuItemHelp;
private javax.swing.JMenuItem jMenuNew;
private javax.swing.JMenuItem jMenuPdf;
private javax.swing.JMenuItem jMenuTreasure;
private javax.swing.JPanel jPanelCardDraw;
private javax.swing.JPanel jPanelCardNew;
private javax.swing.JPanel jPanelCardShow;

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[800, 600]"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButtonStart">
<Properties>
<Property name="text" type="java.lang.String" value="Schatz generieren"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonStartActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Last"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
<Property name="columns" type="int" value="4"/>
<Property name="rows" type="int" value="1"/>
</Layout>
<SubComponents>
<Component class="javax.swing.Box$Filler" name="filler1">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32767, 0]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalGlue"/>
</AuxValues>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Handvoll"/>
</Properties>
</Component>
<Component class="javax.swing.Box$Filler" name="filler2">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32767, 0]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalGlue"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextField" name="jText">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

@ -0,0 +1,144 @@
/*
* The MIT License
*
* Copyright 2016 mosers.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package eu.smoser.dungeongenerator.main;
import eu.smoser.dungeongenerator.dungeon.objects.Treasure;
/**
*
* @author mosers
*/
public class TreasureGenerator extends javax.swing.JFrame {
/**
* Creates new form TreasureGenerator
*/
public TreasureGenerator() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButtonStart = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
jSpinner = new javax.swing.JSpinner();
jLabel1 = new javax.swing.JLabel();
filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
jScrollPane1 = new javax.swing.JScrollPane();
jText = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(800, 600));
jButtonStart.setText("Schatz generieren");
jButtonStart.setToolTipText("");
jButtonStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonStartActionPerformed(evt);
}
});
getContentPane().add(jButtonStart, java.awt.BorderLayout.PAGE_END);
jPanel1.setLayout(new java.awt.GridLayout(1, 4));
jPanel1.add(filler1);
jSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, null, 1));
jPanel1.add(jSpinner);
jLabel1.setText("Handvoll");
jPanel1.add(jLabel1);
jPanel1.add(filler2);
getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);
jText.setEditable(false);
jScrollPane1.setViewportView(jText);
getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButtonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonStartActionPerformed
String text = "";
for(int i = 1; i <= (int) jSpinner.getValue(); i++){
text += i + ": " + Treasure.DetailedTreasure() + "\n\n";
}
jText.setText(text);
}//GEN-LAST:event_jButtonStartActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(TreasureGenerator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TreasureGenerator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TreasureGenerator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TreasureGenerator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TreasureGenerator().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.Box.Filler filler1;
private javax.swing.Box.Filler filler2;
private javax.swing.JButton jButtonStart;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSpinner jSpinner;
private javax.swing.JTextField jText;
// End of variables declaration//GEN-END:variables
}
Laden…
Abbrechen
Speichern