1
0
Fork 0

Changed to IntelliJ, small Bugfixes and refactoring

master
Simon Moser vor 5 Jahren
Ursprung 911b223458
Commit dd2d05d53f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 83765B895FF2CFC6

4
.gitignore vendored

@ -15,6 +15,7 @@ local.properties
.classpath
.settings/
.loadpath
out/
# External tool builders
.externalToolBuilders/
@ -68,14 +69,12 @@ build/
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
@ -194,7 +193,6 @@ $RECYCLE.BIN/
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/

2
.idea/.gitignore vendored

@ -0,0 +1,2 @@
# Default ignored files
/workspace.xml

@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="smoser" />
</component>

@ -0,0 +1,10 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="lib">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/pdfbox-app-2.0.2.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/jgrapht-core-0.9.2.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/jgraphx-2.0.0.1.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/itext-2.1.7.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/jgrapht-ext-0.9.2.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/jgraph-5.13.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" project-jdk-name="10" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/DungeonGenerator.iml" filepath="$PROJECT_DIR$/DungeonGenerator.iml" />
</modules>
</component>
</project>

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib" level="project" />
</component>
</module>

Datei-Diff unterdrückt, da er zu groß ist Diff laden

@ -1,951 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM TEMPLATE - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2013 Oracle and/or its affiliates. All rights reserved.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
Other names may be trademarks of their respective owners.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://www.netbeans.org/cddl-gplv2.html
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License file at
nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the GPL Version 2 section of the License file that
accompanied this code. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 2, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 2] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 2 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 2 code and therefore, elected the GPL
Version 2 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2013 Sun Microsystems, Inc.
-->
<project name="Build Native Packages" default="build-native" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1"
xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:fx="javafx:com.sun.javafx.tools.ant">
<description>Native Packager Ant calls based on SE support in JavaFX packager</description>
<!-- Check system and JDK version -->
<target name="-check-operating-system">
<condition property="running.on.mac">
<os family="mac"/>
</condition>
<condition property="running.on.unix">
<os family="unix"/>
</condition>
<condition property="running.on.windows">
<os family="windows"/>
</condition>
<echo message="running.on.mac = ${running.on.mac}" level="verbose"/>
<echo message="running.on.unix = ${running.on.unix}" level="verbose"/>
<echo message="running.on.windows = ${running.on.windows}" level="verbose"/>
</target>
<!-- Check availability of JavaFX SDK deployment support (ant-javafx.jar) -->
<target name="-check-endorsed-javafx-ant-classpath">
<condition property="endorsed-javafx-ant-classpath-available">
<and>
<isset property="endorsed.javafx.ant.classpath"/>
<not>
<equals arg1="${endorsed.javafx.ant.classpath}" arg2=""/>
</not>
</and>
</condition>
<echo message="endorsed-javafx-ant-classpath-available = ${endorsed-javafx-ant-classpath-available}" level="verbose"/>
</target>
<target name="-check-property-javafx.sdk">
<echo message="javafx.sdk = ${javafx.sdk}" level="verbose"/>
<condition property="javafx.sdk.defined">
<and>
<isset property="javafx.sdk"/>
<not><contains string="${javafx.sdk}" substring="$${platform" casesensitive="false"/></not>
</and>
</condition>
<condition property="javafx.sdk.missing+default">
<and>
<equals arg1="${platform.active}" arg2="Default_JavaFX_Platform" trim="true"/>
<not><isset property="javafx.sdk.defined"/></not>
</and>
</condition>
<condition property="javafx.sdk.missing-default">
<and>
<not><equals arg1="${platform.active}" arg2="Default_JavaFX_Platform" trim="true"/></not>
<not><isset property="javafx.sdk.defined"/></not>
</and>
</condition>
<echo message="javafx.sdk.defined = ${javafx.sdk.defined}" level="verbose"/>
<echo message="javafx.sdk.missing+default = ${javafx.sdk.missing+default}" level="verbose"/>
<echo message="javafx.sdk.missing-default = ${javafx.sdk.missing-default}" level="verbose"/>
</target>
<target name="-check-ant-javafx-in-fxsdk-lib" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
<condition property="do.set.ant-javafx.in.fxsdk.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${javafx.sdk}${file.separator}lib${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-fxsdk-lib" depends="-check-ant-javafx-in-fxsdk-lib" if="do.set.ant-javafx.in.fxsdk.lib">
<property name="ant-javafx.jar.location" value="${javafx.sdk}${file.separator}lib${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-fxsdk-tools" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
<condition property="do.set.ant-javafx.in.fxsdk.tools">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${javafx.sdk}${file.separator}tools${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-fxsdk-tools" depends="-set-ant-javafx-in-fxsdk-lib,-check-ant-javafx-in-fxsdk-tools" if="do.set.ant-javafx.in.fxsdk.tools">
<property name="ant-javafx.jar.location" value="${javafx.sdk}${file.separator}tools${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-platform-home-lib" if="platform.home">
<condition property="do.set.ant-javafx.in.platform.home.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${platform.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-platform-home-lib" depends="-set-ant-javafx-in-fxsdk-tools,-check-ant-javafx-in-platform-home-lib" if="do.set.ant-javafx.in.platform.home.lib">
<property name="ant-javafx.jar.location" value="${platform.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-platform-home-tools" if="platform.home">
<condition property="do.set.ant-javafx.in.platform.home.tools">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${platform.home}${file.separator}tools${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-platform-home-tools" depends="-set-ant-javafx-in-platform-home-lib,-check-ant-javafx-in-platform-home-tools" if="do.set.ant-javafx.in.platform.home.tools">
<property name="ant-javafx.jar.location" value="${platform.home}${file.separator}tools${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-probjdk-lib" unless="ant-javafx.jar.location">
<condition property="do.set.ant-javafx.in.probjdk.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${java.home}${file.separator}..${file.separator}lib${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-probjdk-lib" depends="-set-ant-javafx-in-platform-home-tools,-check-ant-javafx-in-probjdk-lib" if="do.set.ant-javafx.in.probjdk.lib">
<property name="ant-javafx.jar.location" value="${java.home}${file.separator}..${file.separator}lib${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-probjdk-tools" unless="ant-javafx.jar.location">
<condition property="do.set.ant-javafx.in.probjdk.tools">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${java.home}${file.separator}..${file.separator}tools${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-probjdk-tools" depends="-set-ant-javafx-in-probjdk-lib,-check-ant-javafx-in-probjdk-tools" if="do.set.ant-javafx.in.probjdk.tools">
<property name="ant-javafx.jar.location" value="${java.home}${file.separator}..${file.separator}tools${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-macjdk-lib" unless="ant-javafx.jar.location">
<condition property="do.set.ant-javafx.in.macjdk.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${java.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-macjdk-lib" depends="-set-ant-javafx-in-probjdk-tools,-check-ant-javafx-in-macjdk-lib" if="do.set.ant-javafx.in.macjdk.lib">
<property name="ant-javafx.jar.location" value="${java.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-envjdk-lib" unless="ant-javafx.jar.location">
<property environment="env"/>
<condition property="do.set.ant-javafx.in.envjdk.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${env.JAVA_HOME}${file.separator}lib${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-envjdk-lib" depends="-set-ant-javafx-in-macjdk-lib,-check-ant-javafx-in-envjdk-lib" if="do.set.ant-javafx.in.envjdk.lib">
<property name="ant-javafx.jar.location" value="${env.JAVA_HOME}${file.separator}lib${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-envjdk-tools" unless="ant-javafx.jar.location">
<property environment="env"/>
<condition property="do.set.ant-javafx.in.envjdk.tools">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${env.JAVA_HOME}${file.separator}tools${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-envjdk-tools" depends="-set-ant-javafx-in-envjdk-lib,-check-ant-javafx-in-envjdk-tools" if="do.set.ant-javafx.in.envjdk.tools">
<property name="ant-javafx.jar.location" value="${env.JAVA_HOME}${file.separator}tools${file.separator}ant-javafx.jar"/>
</target>
<target name="-pre-check-ant-javafx-version" depends="-set-ant-javafx-in-envjdk-tools" unless="ant-javafx-version-already-checked-in-jfximpl">
<condition property="do.check.ant-javafx.version">
<and>
<isset property="ant-javafx.jar.location"/>
<not><isset property="ant-javafx-version-already-checked-in-jfximpl"/></not>
</and>
</condition>
</target>
<target name="-set-endorsed-javafx-ant-classpath" depends="-check-endorsed-javafx-ant-classpath,-pre-check-ant-javafx-version" if="endorsed-javafx-ant-classpath-available">
<property name="javafx.ant.classpath" value="${endorsed.javafx.ant.classpath}:${ant-javafx.jar.location}"/>
</target>
<target name="-set-javafx-ant-classpath" depends="-check-endorsed-javafx-ant-classpath,-pre-check-ant-javafx-version" unless="endorsed-javafx-ant-classpath-available">
<property name="javafx.ant.classpath" value="${ant-javafx.jar.location}"/>
</target>
<target name="-check-ant-javafx-version" depends="-pre-check-ant-javafx-version,
-set-endorsed-javafx-ant-classpath,-set-javafx-ant-classpath" if="do.check.ant-javafx.version">
<echo message="ant-javafx.jar.location = ${ant-javafx.jar.location}" level="verbose"/>
<echo message="javafx.ant.classpath = ${javafx.ant.classpath}" level="verbose"/>
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant"
classpath="${javafx.ant.classpath}"/>
<condition property="have-fx-ant-init">
<typefound name="javafx:com.sun.javafx.tools.ant:init-ant"/>
</condition>
<property name="ant-javafx-version-already-checked-in-jfximpl" value="true"/>
<echo message="have-fx-ant-init = ${have-fx-ant-init}" level="verbose"/>
</target>
<target name="-check-jfx-sdk-version-old" depends="-check-ant-javafx-version" unless="have-fx-ant-init">
<property name="javafx.ant.version" value="1.0"/>
</target>
<target name="-check-jfx-sdk-version-new" depends="-check-ant-javafx-version" if="have-fx-ant-init">
<fx:init-ant/>
<condition property="have-fx-ant-api-1.1">
<!-- new features from JavaFX 2.0.2 are available in API version 1.1 or later -->
<matches pattern="1.[1-9]" string="${javafx.ant.version}"/>
</condition>
<condition property="have-fx-ant-api-1.2">
<!-- new features from JavaFX 2.2 are available in API version 1.2 or later -->
<matches pattern="1.[2-9]" string="${javafx.ant.version}"/>
</condition>
</target>
<target name="-check-jfx-sdk-version" depends="-check-jfx-sdk-version-old, -check-jfx-sdk-version-new" unless="jfx.sdk.version.checked">
<echo message="Detected JavaFX Ant API version ${javafx.ant.version}" level="info"/>
<echo message="have-fx-ant-api-1.1 = ${have-fx-ant-api-1.1}" level="verbose"/>
<echo message="have-fx-ant-api-1.2 = ${have-fx-ant-api-1.2}" level="verbose"/>
<echo message="javafx.ant.classpath = ${javafx.ant.classpath}" level="verbose"/>
<property name="jfx.sdk.version.checked" value="true"/>
</target>
<target name="-check-ant-jre-version" unless="ant-jre-version-checked-in-jfximpl">
<local name="version-output"/>
<exec executable="${java.home}${file.separator}bin${file.separator}java" outputproperty="version-output">
<arg value="-version"/>
</exec>
<echo message="version-output:${line.separator}${version-output}" level="verbose"/>
<condition property="have-ant-jre-pre7u6">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
<contains string="${version-output}" substring="java version &quot;1.1"/>
<contains string="${version-output}" substring="java version &quot;1.2"/>
<contains string="${version-output}" substring="java version &quot;1.3"/>
<contains string="${version-output}" substring="java version &quot;1.4"/>
<contains string="${version-output}" substring="java version &quot;1.5"/>
<contains string="${version-output}" substring="java version &quot;1.6"/>
<contains string="${version-output}" substring="java version &quot;1.7.0&quot;"/>
<contains string="${version-output}" substring="java version &quot;1.7.0_01"/>
<contains string="${version-output}" substring="java version &quot;1.7.0_02"/>
<contains string="${version-output}" substring="java version &quot;1.7.0_03"/>
<contains string="${version-output}" substring="java version &quot;1.7.0_04"/>
<contains string="${version-output}" substring="java version &quot;1.7.0_05"/>
</or>
</condition>
<property name="ant-jre-version-checked-in-jfximpl" value="true"/>
<echo message="have-ant-jre-pre7u6 = ${have-ant-jre-pre7u6}" level="verbose"/>
</target>
<!-- Native Packaging main target -->
<target name="build-native" depends="-set-do-build-native-package, -check-ant-jre-supports-native-packaging, -check-native-packager-external-tools, -fx-jar-impl, -build-native-impl, -post-build-native-cleanup"/>
<target name="build-native-noscript">
<fail message="Java Application Native Packager requires JDK JavaScript support but has not found any."/>
</target>
<target name="-check-do-jar">
<condition property="do-jar-false">
<and>
<isset property="do.jar"/>
<equals arg1="${do.jar}" arg2="false"/>
</and>
</condition>
</target>
<target name="-set-do-build-native-package">
<property name="do.build.native.package" value="true"/>
<echo message="do.build.native.package = ${do.build.native.package}" level="verbose"/>
</target>
<target name="-check-ant-jre-supports-native-packaging" depends="-check-jfx-sdk-version, -check-ant-javafx-version, -check-ant-jre-version">
<fail message="Error:${line.separator}JavaFX native packager requires NetBeans to run on JDK 1.7u6 or later !" if="have-ant-jre-pre7u6"/>
</target>
<target name="-check-native-bundling-type" depends="-check-operating-system" if="do.build.native.package">
<condition property="need.Inno.presence">
<and>
<isset property="running.on.windows"/>
<isset property="native.bundling.type"/>
<or>
<equals arg1="${native.bundling.type}" arg2="all" casesensitive="false"/>
<equals arg1="${native.bundling.type}" arg2="installer" casesensitive="false"/>
<equals arg1="${native.bundling.type}" arg2="exe" casesensitive="false"/>
</or>
</and>
</condition>
<condition property="need.WiX.presence">
<and>
<isset property="running.on.windows"/>
<isset property="native.bundling.type"/>
<or>
<equals arg1="${native.bundling.type}" arg2="all" casesensitive="false"/>
<equals arg1="${native.bundling.type}" arg2="installer" casesensitive="false"/>
<equals arg1="${native.bundling.type}" arg2="msi" casesensitive="false"/>
</or>
</and>
</condition>
<condition property="need.dpkg.presence">
<and>
<isset property="running.on.unix"/>
<isset property="native.bundling.type"/>
<or>
<equals arg1="${native.bundling.type}" arg2="deb" casesensitive="false"/>
</or>
</and>
</condition>
<condition property="need.rpmbuild.presence">
<and>
<isset property="running.on.unix"/>
<isset property="native.bundling.type"/>
<or>
<equals arg1="${native.bundling.type}" arg2="rpm" casesensitive="false"/>
</or>
</and>
</condition>
<echo message="need.Inno.presence:${need.Inno.presence}" level="verbose"/>
<echo message="need.WiX.presence:${need.WiX.presence}" level="verbose"/>
<echo message="need.dpkg.presence:${need.dpkg.presence}" level="verbose"/>
<echo message="need.rpmbuild.presence:${need.rpmbuild.presence}" level="verbose"/>
</target>
<target name="-check-Inno-presence" depends="-check-native-bundling-type" if="need.Inno.presence">
<local name="exec-output"/>
<local name="exec-error"/>
<local name="exec-result"/>
<exec executable="iscc" outputproperty="exec-output" failifexecutionfails="false" errorproperty="exec-error" resultproperty="exec-result"/>
<echo message="exec-output:${exec-output}" level="verbose"/>
<echo message="exec-error:${exec-error}" level="verbose"/>
<echo message="exec-result:${exec-result}" level="verbose"/>
<condition property="missing.Inno">
<not><and>
<contains string="${exec-output}" substring="Inno Setup"/>
<not><contains string="${exec-output}" substring="Inno Setup 1"/></not>
<not><contains string="${exec-output}" substring="Inno Setup 2"/></not>
<not><contains string="${exec-output}" substring="Inno Setup 3"/></not>
<not><contains string="${exec-output}" substring="Inno Setup 4"/></not>
</and></not>
</condition>
</target>
<target name="-check-WiX-presence" depends="-check-native-bundling-type" if="need.WiX.presence">
<local name="exec-output"/>
<local name="exec-error"/>
<local name="exec-result"/>
<exec executable="candle" outputproperty="exec-output" failifexecutionfails="false" errorproperty="exec-error" resultproperty="exec-result">
<arg value="-?"/>
</exec>
<echo message="exec-output:${exec-output}" level="verbose"/>
<echo message="exec-error:${exec-error}" level="verbose"/>
<echo message="exec-result:${exec-result}" level="verbose"/>
<condition property="missing.WiX">
<not>
<matches string="${exec-output}" pattern="windows\s+installer\s+xml\s+(toolset\s+)?compiler\s+version\s+3.*" casesensitive="false"/>
</not>
</condition>
</target>
<target name="-check-dpkg-presence" depends="-check-native-bundling-type" if="need.dpkg.presence">
<local name="exec.which.dpkg.result"/>
<local name="exec.which.dpkg.output"/>
<exec executable="command" failifexecutionfails="false" failonerror="false" resultproperty="exec.which.dpkg.result" outputproperty="exec.which.dpkg.output">
<arg line="-v dpkg"/>
</exec>
<condition property="missing.dpkg">
<not><and>
<isset property="exec.which.dpkg.result"/>
<equals arg1="${exec.which.dpkg.result}" arg2="0"/>
<isset property="exec.which.dpkg.output"/>
<not><equals arg1="${exec.which.dpkg.output}" arg2=""/></not>
</and></not>
</condition>
</target>
<target name="-check-rpmbuild-presence" depends="-check-native-bundling-type" if="need.rpmbuild.presence">
<local name="exec.which.rpmbuild.result"/>
<local name="exec.which.rpmbuild.output"/>
<exec executable="command" failifexecutionfails="false" failonerror="false" resultproperty="exec.which.rpmbuild.result" outputproperty="exec.which.rpmbuild.output">
<arg line="-v rpmbuild"/>
</exec>
<condition property="missing.rpmbuild">
<not><and>
<isset property="exec.which.rpmbuild.result"/>
<equals arg1="${exec.which.rpmbuild.result}" arg2="0"/>
<isset property="exec.which.rpmbuild.output"/>
<not><equals arg1="${exec.which.rpmbuild.output}" arg2=""/></not>
</and></not>
</condition>
</target>
<target name="-check-native-packager-external-tools" depends="-check-Inno-presence, -check-WiX-presence, -check-dpkg-presence, -check-rpmbuild-presence">
<property name="missing.Inno.message" value="JavaFX native packager requires external Inno Setup 5+ tools installed and included on PATH to create EXE installer. See http://www.jrsoftware.org/"/>
<property name="missing.WiX.message" value="JavaFX native packager requires external WiX 3.0+ tools installed and included on PATH to create MSI installer. See http://wix.sourceforge.net/"/>
<property name="missing.dpkg.message" value="JavaFX native packager requires Debian Packager tools to create DEB package, but dpkg could not be found."/>
<property name="missing.rpmbuild.message" value="JavaFX native packager requires RPMBuild to create RPM package, but rpmbuild could not be found."/>
<condition property="missing.Inno.WiX">
<and>
<isset property="missing.Inno"/>
<isset property="missing.WiX"/>
</and>
</condition>
<fail message="Error:${line.separator}${missing.Inno.message}${line.separator}${missing.WiX.message}" if="missing.Inno.WiX"/>
<fail message="Error:${line.separator}${missing.Inno.message}" if="missing.Inno"/>
<fail message="Error:${line.separator}${missing.WiX.message}" if="missing.WiX"/>
<fail message="Error:${line.separator}${missing.dpkg.message}" if="missing.dpkg"/>
<fail message="Error:${line.separator}${missing.rpmbuild.message}" if="missing.rpmbuild"/>
</target>
<!-- Copy dependent libraries -->
<target name="-jfx-copylibs" depends="init,compile,-pre-pre-jar,-pre-jar,-jfx-copylibs-warning" unless="fallback.no.javascript">
<jfx-copylibs-js-impl/>
</target>
<target name="-jfx-copylibs-warning" if="fallback.no.javascript">
<echo message="Warning: Dependent Libraries copy (-jfx-copylibs) skipped in fallback build mode due to JDK missing JavaScript support."/>
</target>
<macrodef name="jfx-copylibs-js-impl">
<sequential>
<local name="run.classpath.without.build.classes.and.dist.dir"/>
<pathconvert property="run.classpath.without.build.classes.and.dist.dir">
<path path="${run.classpath}"/>
<map from="${basedir}${file.separator}${build.classes.dir}" to=""/>
<map from="${basedir}${file.separator}${dist.jar}" to=""/>
<scriptmapper language="javascript">
self.addMappedName(
(source.indexOf("jfxrt.jar") >= 0) ||
(source.indexOf("deploy.jar") >= 0) ||
(source.indexOf("javaws.jar") >= 0) ||
(source.indexOf("plugin.jar") >= 0)
? "" : source
);
</scriptmapper>
</pathconvert>
<!-- add possibly missing dependencies at distance 2 (build system logic thus provides transitive closure) -->
<local name="run.and.lib.classpath"/>
<echo message="JavaScript: -jfx-copylibs" level="verbose"/>
<script language="javascript">
<![CDATA[
function prefix(s, len) {
if(s == null || len <= 0 || s.length == 0) {
return new String("");
}
return new String(s.substr(0, len));
}
function defined(s) {
return (s != null) && (s != "null") && (s.length > 0);
}
var classPath = new String(project.getProperty("run.classpath.without.build.classes.and.dist.dir"));
if(defined(classPath)) {
var fileSeparator = new String(project.getProperty("file.separator"));
var pathConvert = project.createTask("pathconvert");
pathConvert.setProperty("run.and.lib.classpath");
var classPathCopy = pathConvert.createPath();
classPathCopy.setPath(classPath);
var pathArray;
if(classPath.indexOf(";") != -1) {
pathArray = classPath.split(";");
} else {
pathArray = classPath.split(":");
}
var added = new java.lang.StringBuilder();
for (var i = 0; i < pathArray.length; i++) {
var index = pathArray[i].lastIndexOf(fileSeparator);
if (index >= 0) {
var onePath = prefix(pathArray[i], index+1).concat("lib");
var oneDir = new java.io.File(onePath);
if(oneDir.exists()) {
var fs = project.createDataType( "fileset" );
fs.setDir( oneDir );
fs.setIncludes("*.jar");
var ds = fs.getDirectoryScanner(project);
var srcFiles = ds.getIncludedFiles();
for (var j = 0; j < srcFiles.length; j++) {
if(classPath.indexOf( srcFiles[j] ) == -1 && added.indexOf( srcFiles[j] ) == -1) {
var path = pathConvert.createPath();
path.setPath( onePath.concat(fileSeparator).concat(srcFiles[j]) );
added.append( srcFiles[j] );
}
}
}
}
}
pathConvert.perform();
}
]]>
</script>
<echo message="run.and.lib.classpath = ${run.and.lib.classpath}" level="verbose"/>
<property name="run.and.lib.classpath" value=""/> <!-- fallback -->
<delete dir="${dist.dir}${file.separator}lib" includeEmptyDirs="true" quiet="true"/>
<copy todir="${dist.dir}${file.separator}lib" flatten="true" preservelastmodified="true" overwrite="true">
<path>
<pathelement path="${run.and.lib.classpath}"/>
</path>
</copy>
</sequential>
</macrodef>
<!-- <fx:jar> replacing standard jar, because native packager up to JDK7u21 refuses to package standard jars -->
<target name="-fx-jar-impl" depends="-check-jfx-sdk-version, -check-ant-javafx-version, -check-ant-jre-version, clean, compile, -jfx-copylibs">
<echo message="javafx.ant.classpath = ${javafx.ant.classpath}" level="verbose"/>
<typedef name="fx_jar" classname="com.sun.javafx.tools.ant.FXJar" classpath="${javafx.ant.classpath}"/>
<echo message="Launching &lt;fx:jar&gt; task from ${ant-javafx.jar.location}" level="info"/>
<property name="deployment.dir" location="${dist.dir}"/>
<basename property="deployment.jar" file="${dist.jar}"/>
<property name="pp_jar_destfile" value="${deployment.dir}${file.separator}${deployment.jar}"/>
<property name="pp_jar_buildclasses" value="${basedir}${file.separator}${build.classes.dir}"/>
<property name="pp_jar_dir" value="${deployment.dir}"/>
<property name="pp_jar_fs2" value="lib${file.separator}*.jar"/>
<echo message="fx_jar: pp_jar_destfile = ${pp_jar_destfile}" level="verbose"/>
<echo message="fx_jar: pp_jar_buildclasses = ${pp_jar_buildclasses}" level="verbose"/>
<echo message="fx_jar: pp_jar_dir = ${pp_jar_dir}" level="verbose"/>
<echo message="fx_jar: pp_jar_fs2 = ${pp_jar_fs2}" level="verbose"/>
<echo message="JavaScript: fx-jar" level="verbose"/>
<script language="javascript">
<![CDATA[
function isTrue(prop) {
return prop != null &&
( prop.toLowerCase() == "true" || prop.toLowerCase() == "yes" || prop.toLowerCase() == "on" );
}
function prefix(s, len) {
if(s == null || len <= 0 || s.length == 0) {
return new String("");
}
return new String(s.substr(0, len));
}
function replaceSuffix(s, os, ns) {
return prefix(s, s.indexOf(os)).concat(ns);
}
function startsWith(s, prefix) {
return (s != null) && (s.indexOf(prefix) == 0);
}
function endsWith(s, suffix) {
var i = s.lastIndexOf(suffix);
return (i != -1) && (i == (s.length - suffix.length));
}
function defined(s) {
return (s != null) && (s != "null") && (s.length > 0);
}
function contains(array, prop) {
for (var i = 0; i < array.length; i++) {
var s1 = new String(array[i]);
var s2 = new String(prop);
if( s1.toLowerCase() == s2.toLowerCase() ) {
return true;
}
}
return false;
}
var S = new String(java.io.File.separator);
var JFXLAZY = "download.mode.lazy.jar";
var fx_ant_api_1_1 = new String(project.getProperty("have-fx-ant-api-1.1"));
var fx_ant_api_1_2 = new String(project.getProperty("have-fx-ant-api-1.2"));
// get jars with lazy download mode property set
function getLazyJars() {
var jars = new Array();
var keys = project.getProperties().keys();
while(keys.hasMoreElements()) {
var pn = new String(keys.nextElement());
if(startsWith(pn, JFXLAZY)) {
var fname = new String(pn.substring(JFXLAZY.length+1));
jars.push(fname);
}
}
return jars.length > 0 ? jars : null;
}
// set download mode of dependent libraries
function setDownloadMode(fsEager, fsLazy, jars) {
for(var i = 0; i < jars.length; i++) {
fsEager.setExcludes("lib" + S + jars[i]);
fsLazy.setIncludes("lib" + S + jars[i]);
}
}
// fx:jar
var jar = project.createTask("fx_jar");
jar.setProject(project);
var destfile = new String(project.getProperty("pp_jar_destfile"));
jar.setDestfile(destfile);
// fx:application
var app = jar.createApplication();
app.setProject(project);
var title = new String(project.getProperty("application.title"));
var mainclass;
mainclass = new String(project.getProperty("main.class"));
if(isTrue(fx_ant_api_1_2)) {
app.setToolkit("swing");
}
app.setName(title);
app.setMainClass(mainclass);
var appversion = new String(project.getProperty("application.implementation.version"));
if(defined(appversion)) {
app.setVersion(appversion);
} else {
app.setVersion("1.0");
}
// fx:resources
var res = jar.createResources();
res.setProject(project);
var pdir = new String(project.getProperty("pp_jar_dir"));
var fn = res.createFileSet();
fn.setProject(project);
fn.setDir(new java.io.File(pdir));
var ia = new String(project.getProperty("deployment.jar"));
var ib = new String(project.getProperty("pp_jar_fs2"));
fn.setIncludes(ia);
fn.setIncludes(ib);
fn.setRequiredFor("startup");
var lazyjars = getLazyJars();
if(lazyjars != null) {
var fn2 = res.createFileSet();
fn2.setProject(project);
fn2.setDir(new java.io.File(pdir));
fn2.setRequiredFor("runtime");
setDownloadMode(fn,fn2,lazyjars);
}
// fileset to include classes
var fs = jar.createFileSet();
fs.setProject(project);
var buildcls = new String(project.getProperty("pp_jar_buildclasses"));
fs.setDir(new java.io.File(buildcls));
// manifest
var man = jar.createManifest();
var a1val = new String(project.getProperty("application.vendor"));
var a1 = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
a1.setName("Implementation-Vendor");
a1.setValue(a1val);
man.addConfiguredAttribute(a1);
var a2val = new String(project.getProperty("application.title"));
var a2 = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
a2.setName("Implementation-Title");
a2.setValue(a2val);
man.addConfiguredAttribute(a2);
if(defined(appversion)) {
var a3 = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
a3.setName("Implementation-Version");
a3.setValue(appversion);
man.addConfiguredAttribute(a3);
}
var profileAvailable = new String(project.getProperty("profile.available"));
if (defined(profileAvailable)) {
var profileAttribute = new org.apache.tools.ant.taskdefs.Manifest.Attribute();
profileAttribute.setName("Profile");
profileAttribute.setValue(new String(project.getProperty("javac.profile")));
man.addConfiguredAttribute(profileAttribute);
}
var splashScreenAvailable = new String(project.getProperty("splashscreen.available"));
if (defined(splashScreenAvailable)) {
project.setProperty("deploy.splash.image",new String(project.getProperty("application.splash")));
}
jar.perform();
]]>
</script>
</target>
<!-- Native Packaging main implementation -->
<target name="-build-native-impl" depends="-check-ant-jre-supports-native-packaging, -check-native-packager-external-tools, -fx-jar-impl">
<!--<property name="runtime.jre.home" value="${platform.home}"/>-->
<echo message="javafx.ant.classpath = ${javafx.ant.classpath}" level="verbose"/>
<typedef name="fx_deploy" classname="com.sun.javafx.tools.ant.DeployFXTask" classpath="${javafx.ant.classpath}"/>
<echo message="Launching &lt;fx:deploy&gt; task from ${ant-javafx.jar.location}" level="info"/>
<property name="deployment.dir" location="${dist.dir}"/>
<property name="pp_deploy_fs2" value="lib${file.separator}*.jar"/>
<basename property="deployment.jar" file="${dist.jar}"/>
<basename property="deployment.base" file="${deployment.jar}" suffix=".jar"/>
<echo message="deploy_deploy: pp_deploy_fs2 = ${pp_deploy_fs2}" level="verbose"/>
<echo message="deploy_deploy: deployment.dir = ${deployment.dir}" level="verbose"/>
<echo message="deploy_deploy: deployment.jar = ${deployment.jar}" level="verbose"/>
<echo message="deploy_deploy: deployment.base = ${deployment.base}" level="verbose"/>
<echo message="JavaScript: deploy-deploy" level="verbose"/>
<script language="javascript">
<![CDATA[
function isTrue(prop) {
return prop != null &&
(prop.toLowerCase()=="true" || prop.toLowerCase()=="yes" || prop.toLowerCase()=="on");
}
function prefix(s, len) {
if(s == null || len <= 0 || s.length == 0) {
return new String("");
}
return new String(s.substr(0, len));
}
function replaceSuffix(s, os, ns) {
return prefix(s, s.indexOf(os)).concat(ns);
}
function startsWith(s, prefix) {
return (s != null) && (s.indexOf(prefix) == 0);
}
function endsWith(s, suffix) {
var i = s.lastIndexOf(suffix);
return (i != -1) && (i == (s.length - suffix.length));
}
function defined(s) {
return (s != null) && (s != "null") && (s.length > 0);
}
function contains(array, prop) {
for (var i = 0; i < array.length; i++) {
var s1 = new String(array[i]);
var s2 = new String(prop);
if( s1.toLowerCase() == s2.toLowerCase() ) {
return true;
}
}
return false;
}
var S = java.io.File.separator;
var JFXLAZY = "download.mode.lazy.jar";
var fx_ant_api_1_1 = new String(project.getProperty("have-fx-ant-api-1.1"));
var fx_ant_api_1_2 = new String(project.getProperty("have-fx-ant-api-1.2"));
var have_jdk_pre7u14 = new String(project.getProperty("have-jdk-pre7u14"));
// get jars with lazy download mode property set
function getLazyJars() {
var jars = new Array();
var keys = project.getProperties().keys();
while(keys.hasMoreElements()) {
var pn = new String(keys.nextElement());
if(startsWith(pn, JFXLAZY)) {
var fname = pn.substring(JFXLAZY.length+1);
jars.push(fname);
}
}
return jars.length > 0 ? jars : null;
}
// set download mode of dependent libraries
function setDownloadMode(fsEager, fsLazy, jars) {
for(var i = 0; i < jars.length; i++) {
fsEager.setExcludes("lib" + S + jars[i]);
fsLazy.setIncludes("lib" + S + jars[i]);
}
}
// convert path to absolute if relative
function derelativizePath(path) {
var f = new java.io.File(path);
if(!f.exists()) {
f = new java.io.File(new String(project.getBaseDir()) + S + path);
}
if(f.exists()) {
try {
return f.getCanonicalPath();
} catch(err) {
return path;
}
}
return path;
}
// fx:deploy
var deploy = project.createTask("fx_deploy");
deploy.setProject(project);
var width = new String(project.getProperty("javafx.width"));
var height = new String(project.getProperty("javafx.height"));
var outdir = new String(project.getProperty("deployment.dir"));
var outfile = new String(project.getProperty("application.title"));
if(!defined(width)) width=new String("0");
if(!defined(height)) height=new String("0");
deploy.setWidth(width);
deploy.setHeight(height);
deploy.setOutdir(outdir);
deploy.setOutfile(outfile);
// native packaging (time consuming, thus applied in explicit build only)
var nativeEnabled = new String(project.getProperty("do.build.native.package"));
var nativeType = new String(project.getProperty("native.bundling.type"));
var projStateRun = new String(project.getProperty("project.state.running"));
var projStateDbg = new String(project.getProperty("project.state.debugging"));
var projStatePrf = new String(project.getProperty("project.state.profiling"));
if(isTrue(nativeEnabled) && defined(nativeType) && nativeType != "none") {
if(!isTrue(projStateRun) && !isTrue(projStateDbg) && !isTrue(projStatePrf)) {
if(isTrue(fx_ant_api_1_2)) {
deploy.setNativeBundles(nativeType);
print("Note: To create native bundles the <fx:deploy> task may require external tools. See JavaFX 2.2+ documentation for details.");
print("");
print("Launching <fx:deploy> in native packager mode...");
} else {
print("Warning: Native packaging is not supported by this version of JavaFX SDK deployment Ant task. Please upgrade to JDK 7u6 or higher.");
}
}
}
// fx:application
var app = deploy.createApplication();
app.setProject(project);
var title = new String(project.getProperty("application.title"));
var mainclass;
mainclass = new String(project.getProperty("main.class"));
if(isTrue(fx_ant_api_1_2)) {
app.setToolkit("swing");
}
app.setName(title);
app.setMainClass(mainclass);
var appversion = new String(project.getProperty("application.implementation.version"));
if(defined(appversion)) {
app.setVersion(appversion);
} else {
app.setVersion("1.0");
}
// fx:resources
var res = deploy.createResources();
res.setProject(project);
var deploydir = new String(project.getProperty("deployment.dir"));
var fn = res.createFileSet();
fn.setProject(project);
fn.setDir(new java.io.File(deploydir));
var ia = new String(project.getProperty("deployment.jar"));
var ib = new String(project.getProperty("pp_deploy_fs2"));
fn.setIncludes(ia);
fn.setIncludes(ib);
fn.setRequiredFor("startup");
var lazyjars = getLazyJars();
if(lazyjars != null) {
var fn2 = res.createFileSet();
fn2.setProject(project);
fn2.setDir(new java.io.File(deploydir));
fn2.setRequiredFor("runtime");
setDownloadMode(fn,fn2,lazyjars);
}
// fx:info
var info = deploy.createInfo();
info.setProject(project);
var vendor = new String(project.getProperty("application.vendor"));
var description = new String(project.getProperty("application.desc"));
info.setTitle(title); // title known from before
info.setVendor(vendor);
info.setDescription(description);
var splash = new String(project.getProperty("deploy.splash.image"));
if(defined(splash)) {
if(isTrue(fx_ant_api_1_1)) {
var sicon = info.createSplash();
sicon.setHref(splash);
sicon.setMode("any");
print("Adding splash image reference: " + splash);
} else {
print("Warning: Splash Image not supported by this version of JavaFX SDK deployment Ant task. Please upgrade JavaFX to 2.0.2 or higher.");
}
}
if(isTrue(nativeEnabled) && defined(nativeType) && nativeType != "none") {
var icon = new String(project.getProperty("deploy.icon.native"));
if(defined(icon)) {
if(isTrue(fx_ant_api_1_2) && !isTrue(have_jdk_pre7u14)) {
var dicon = derelativizePath(icon);
// create temporary icon copy renamed to application name (required by native packager)
var baseDir = new String(project.getProperty("basedir"));
var buildDir = new String(project.getProperty("build.dir"));
var deployBase = new String(project.getProperty("deployment.base"));
var copyTask = project.createTask("copy");
var source = new java.io.File(dicon);
var sourceName = new String(source.getName());
var lastDot = sourceName.lastIndexOf(".");
var sourceExt;
if(lastDot >=0) {
sourceExt = sourceName.substr(lastDot);
} else {
sourceExt = new String("");
}
var target = new java.io.File(baseDir.concat(S).concat(buildDir).concat(S).concat("icon").concat(S).concat(deployBase).concat(sourceExt));
copyTask.setFile(source);
copyTask.setTofile(target);
copyTask.setFlatten(true);
copyTask.setFailOnError(false);
copyTask.perform();
var tempicon;
if(target.exists()) {
try {
tempicon = target.getCanonicalPath();
} catch(err) {
tempicon = dicon;
}
} else {
tempicon = dicon;
}
var nicon = info.createIcon();
nicon.setHref(tempicon);
print("Source native icon reference: " + dicon);
print("Processed native icon reference: " + tempicon);
} else {
print("Warning: Native Package icon not supported by this version of JavaFX SDK deployment Ant task. Please upgrade to JDK7u14.");
}
}
} else {
var icon = new String(project.getProperty("deploy.icon.webstart"));
if(defined(icon)) {
if(isTrue(fx_ant_api_1_1)) {
var iicon = info.createIcon();
iicon.setHref(icon);
print("Adding WebStart icon reference: " + icon);
} else {
print("Warning: WebStart Icon not supported by this version of JavaFX SDK deployment Ant task. Please upgrade JavaFX to 2.0.2 or higher.");
}
}
}
deploy.perform();
]]>
</script>
</target>
<target name="-post-build-native-cleanup">
<delete file="${dist.dir}/${application.title}.html" quiet="true"/>
<delete file="${dist.dir}/${application.title}.jnlp" quiet="true"/>
<delete file="${dist.dir}/${application.title}_browser.jnlp" quiet="true"/>
</target>
</project>

@ -1,8 +0,0 @@
build.xml.data.CRC32=111761a0
build.xml.script.CRC32=4709d7a9
build.xml.stylesheet.CRC32=8064a381@1.79.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=857ef569
nbproject/build-impl.xml.script.CRC32=6e9dc783
nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48

@ -1,6 +0,0 @@
compile.on.save=true
do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
user.properties.file=C:\\Users\\MrMcX\\AppData\\Roaming\\NetBeans\\8.1\\build.properties

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
</open-files>
</project-private>

@ -1,114 +0,0 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.splash=C:\\Users\\MrMcX\\ownCloud\\Rollenspiel\\DSA\\Meister\\DungeonGenerator\\resources\\images\\firewall.png
application.title=DungeonGenerator
application.vendor=MrMcX
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/DungeonGenerator.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.itext-2.1.7.jar=lib/itext-2.1.7.jar
file.reference.jgraph-5.13.0.0.jar=lib/jgraph-5.13.0.0.jar
file.reference.jgrapht-core-0.9.2.jar=lib/jgrapht-core-0.9.2.jar
file.reference.jgrapht-ext-0.9.2.jar=lib/jgrapht-ext-0.9.2.jar
file.reference.jgraphx-2.0.0.1.jar=lib/jgraphx-2.0.0.1.jar
file.reference.pdfbox-app-2.0.2.jar=lib/pdfbox-app-2.0.2.jar
file.reference.resources-images=resources/images
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${libs.absolutelayout.classpath}:\
${file.reference.resources-images}:\
${file.reference.jgraph-5.13.0.0.jar}:\
${file.reference.jgrapht-core-0.9.2.jar}:\
${file.reference.jgrapht-ext-0.9.2.jar}:\
${file.reference.jgraphx-2.0.0.1.jar}:\
${file.reference.itext-2.1.7.jar}:\
${file.reference.pdfbox-app-2.0.2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
main.class=eu.smoser.dungeongenerator.main.DungeonGeneratorUI
# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found.
manifest.custom.application.library.allowable.codebase=
# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts.
manifest.custom.caller.allowable.codebase=
# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed
manifest.custom.codebase=
# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions)
manifest.custom.permissions=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
native.bundling.enabled=true
platform.active=default_platform
project.license=mit
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1">
<extension file="build-native.xml" id="j2sedeploy"/>
</buildExtensions>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>DungeonGenerator</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

@ -1,26 +1,4 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.dungeon;
import java.util.*;
@ -39,7 +17,7 @@ public class Dungeon {
private final List<Room> rooms;
private final LinkedList<Room> toGenerate;
private final Counter counter;
private final HashMap greedyMap;
private final HashMap<Integer, Object> greedyMap;
/**
* Standard constructor, creates a new dungeon
@ -56,7 +34,7 @@ public class Dungeon {
/**
* Returns the greedy map
* @return
* @return HashMap greedy HashMap
*/
public HashMap GetGreedyMap(){
return greedyMap;
@ -69,26 +47,22 @@ public class Dungeon {
* @param mode generation mode
*/
public void generate(int size, Type type, Mode mode) {
toGenerate.add(Room.RandomRoom(true, Exit.Start(), counter, type, greedyMap));
toGenerate.add(Room.RandomRoom(true, Exit.Start(), type, greedyMap));
while (!toGenerate.isEmpty() && (rooms.size() < size || Experimental(type))) {
Room next;
switch (mode) {
case STRAIGHT:
next = toGenerate.getLast();
break;
case BRANCHED:
next = toGenerate.getFirst();
break;
case RANDOM:
next = toGenerate.get(Dice.Roll(toGenerate.size(), 1) - 1);
break;
default:
// case BRANCHED
next = toGenerate.getFirst();
break;
}
next.generate(counter, type, greedyMap).stream().forEach((r) -> {
toGenerate.add((Room) r);
});
toGenerate.addAll(next.generate(counter, type, greedyMap));
toGenerate.remove(next);
rooms.add(next);
}
@ -105,11 +79,9 @@ public class Dungeon {
* @return UndirectedGraph from JGraphT
*/
public UndirectedGraph toGraph() {
UndirectedGraph g = new SimpleGraph(DefaultEdge.class);
rooms.stream().forEach((r) -> {
g.addVertex(r);
});
rooms.stream().forEach((r) -> {
UndirectedGraph<Room, Exit> g = new SimpleGraph(DefaultEdge.class);
rooms.forEach(g::addVertex);
rooms.forEach((r) -> {
for (Exit e : r.exits) {
if (e.isStart || e.room.number == 0 || g.containsEdge(r, e.room)) {
continue;
@ -143,7 +115,7 @@ public class Dungeon {
/**
* Different room generation sequence modes
*/
public static enum Mode {
public enum Mode {
/**
* FILO - straight dungeon
@ -162,7 +134,7 @@ public class Dungeon {
/**
* The type of rooms to generate
*/
public static enum Type {
public enum Type {
/**
* Nature-made rooms
@ -182,8 +154,8 @@ public class Dungeon {
EXP_ARTIFICIAL
}
private static HashMap GreedyMap(int size, Type type) {
HashMap expMap = new HashMap();
private static HashMap<Integer, Object> GreedyMap(int size, Type type) {
HashMap<Integer, Object> expMap = new HashMap<>();
if (Experimental(type)) {
double expVal = 1.0 - (1.0 / size);
expMap.put(0, expVal);

@ -1,26 +1,3 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.dungeon;
import eu.smoser.dungeongenerator.util.Dice;
@ -44,12 +21,12 @@ public class Exit {
/**
* If the exit is start
*/
public boolean isStart;
boolean isStart;
/**
* If there is a trap in this exit
*/
public boolean isTrap;
private boolean isTrap;
/**
* Type of trap
@ -94,7 +71,7 @@ public class Exit {
* Gives this exits description
* @return Description string
*/
public String toLongString(){
String toLongString(){
String out = "- ";
if(isStart){
out += "Aus-/Eingang";
@ -114,7 +91,7 @@ public class Exit {
* Gives the entry
* @return Entry of dungeon
*/
public static Exit Start(){
static Exit Start(){
return new Exit(null, null, true);
}

@ -1,33 +1,11 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.dungeon;
import eu.smoser.dungeongenerator.dungeon.objects.*;
import eu.smoser.dungeongenerator.util.*;
import java.util.*;
/**
*
* @author MrMcX
*/
public class Room {
@ -47,17 +25,17 @@ public class Room {
private final boolean isRoom;
private boolean hasMonster, hasTrap, hasMagic, hasSpecial, hasTreasure = false;
private ADungeonObject treasure, magic, enemy, trap, special;
private String desc = null;
private String desc; // = null
/**
* Constructs a room with a given predecessor, number of exits, description and counter
*
* @param predecessor Predecessor room
* @param numberOfExits Number of exits
* @param room Whether it is a room
* @param desc Description of room
* @param c Room counter
*/
public Room(Exit predecessor, int numberOfExits, boolean room, String desc, Counter c){
public Room(Exit predecessor, int numberOfExits, boolean room, String desc) {
exits = new Exit[numberOfExits];
exits[0] = predecessor;
this.isRoom = room;
@ -67,18 +45,19 @@ public class Room {
/**
* Generates the content of the room
*
* @param c Room counter
* @param type Environment type
* @param map Experimental map
* @return Returns more rooms to generate
*/
public List<Room> generate(Counter c, Dungeon.Type type, HashMap<Integer, Integer> map){
public List<Room> generate(Counter c, Dungeon.Type type, HashMap<Integer, Object> map) {
number = c.Next();
List<Room> list = new LinkedList();
List<Room> list = new LinkedList<>();
for (int i = 0; i < exits.length; i++) {
if (exits[i] == null) {
Exit predecessor = new Exit(this);
Room newRoom = RandomRoom(false, predecessor, c, type, map);
Room newRoom = RandomRoom(false, predecessor, type, map);
exits[i] = new Exit(newRoom, predecessor.type);
list.add(newRoom);
}
@ -91,7 +70,8 @@ public class Room {
if (isRoom) {
switch (Dice.Roll(6, 2)) {
case 2:
case 3: return;
case 3:
return;
case 4:
hasMonster = true;
enemy = new Enemy(type);
@ -140,7 +120,8 @@ public class Room {
switch (Dice.Roll(6, 1)) {
case 1:
case 2:
case 3: return;
case 3:
return;
case 4:
hasMonster = true;
enemy = new Enemy(type);
@ -171,43 +152,44 @@ public class Room {
/**
* Returns a long description
*
* @return Long description string
*/
public String toLongString(){
String out = "";
String toLongString() {
StringBuilder out = new StringBuilder();
if (isRoom) {
out += "Raum ";
out.append("Raum ");
} else {
out += "Gang ";
out.append("Gang ");
}
out += "Nummer " + number + ": " + desc + "\n" +
"Ausgänge:\n";
out.append("Nummer ").append(number).append(": ").append(desc).append("\n").append("Ausgänge:\n");
for (Exit x : exits) {
out += x.toLongString();
out.append(x.toLongString());
}
if (hasMonster) {
out += "Gegner:\n- " + enemy + "\n";
out.append("Gegner:\n- ").append(enemy).append("\n");
}
if (hasTrap) {
out += "Fallen:\n- " + trap + "\n";
out.append("Fallen:\n- ").append(trap).append("\n");
}
if (hasMagic) {
out += "Magische Phänomene:\n- " + magic + "\n";
out.append("Magische Phänomene:\n- ").append(magic).append("\n");
}
if (hasSpecial) {
out += "Besondere Phänomene:\n- " + special + "\n";
out.append("Besondere Phänomene:\n- ").append(special).append("\n");
}
if (hasTreasure) {
out += "Fundsache:\n- " + treasure + "\n";
out.append("Fundsache:\n- ").append(treasure).append("\n");
}
return out;
return out.toString();
}
/**
* Returns a short description
*
* @return Short description string
*/
public String toShortString(){
String toShortString() {
if (isRoom) {
return "Raum Nummer " + number;
} else {
@ -215,120 +197,131 @@ public class Room {
}
}
private static Room RoomBigExits(Exit predecessor, Counter c, Dungeon.Type type){
private static Room RoomBigExits(Exit predecessor, Dungeon.Type type) {
int rand = Dice.Roll(3, 1);
if (Dungeon.Natural(type)) {
return new Room(predecessor, rand + 1, true, "große Höhle mit " + rand + " Ausgängen", c);
return new Room(predecessor, rand + 1, true, "große Höhle mit " + rand + " Ausgängen");
} else {
return new Room(predecessor, rand + 1, true, "großer Raum mit " + rand + " Ausgängen", c);
return new Room(predecessor, rand + 1, true, "großer Raum mit " + rand + " Ausgängen");
}
}
private static Room RoomSmallExits(Exit predecessor, Counter c, Dungeon.Type type){
private static Room RoomSmallExits(Exit predecessor, Dungeon.Type type) {
int rand = Dice.Roll(3, 1);
if (Dungeon.Natural(type)) {
return new Room(predecessor, rand + 1, true, "kleine Höhle mit " + rand + " Ausgängen", c);
return new Room(predecessor, rand + 1, true, "kleine Höhle mit " + rand + " Ausgängen");
} else {
return new Room(predecessor, rand + 1, true, "kleiner Raum mit " + rand + " Ausgängen", c);
return new Room(predecessor, rand + 1, true, "kleiner Raum mit " + rand + " Ausgängen");
}
}
private static Room RoomBigNoExits(Exit predecessor, Counter c, Dungeon.Type type){
private static Room RoomBigNoExits(Exit predecessor, Dungeon.Type type) {
if (Dungeon.Natural(type)) {
return new Room(predecessor, 1, true, "große Höhle ohne Ausgang", c);
return new Room(predecessor, 1, true, "große Höhle ohne Ausgang");
} else {
return new Room(predecessor, 1, true, "großer Raum ohne Ausgang", c);
return new Room(predecessor, 1, true, "großer Raum ohne Ausgang");
}
}
private static Room RoomBigExitsStair(Exit predecessor, Counter c, Dungeon.Type type){
private static Room RoomBigExitsStair(Exit predecessor, Dungeon.Type type) {
int rand = Dice.Roll(2, 1);
if (Dungeon.Natural(type)) {
return new Room(predecessor, rand + 2, true, "große Höhle mit " + rand + " Ausgängen und einer Treppe", c);
return new Room(predecessor, rand + 2, true, "große Höhle mit " + rand + " Ausgängen und einer Treppe");
} else {
return new Room(predecessor, rand + 2, true, "großer Raum mit " + rand + " Ausgängen und einer Treppe", c);
return new Room(predecessor, rand + 2, true, "großer Raum mit " + rand + " Ausgängen und einer Treppe");
}
}
private static Room RoomSmallNoExits(Exit predecessor, Counter c, Dungeon.Type type){
private static Room RoomSmallNoExits(Exit predecessor, Dungeon.Type type) {
if (Dungeon.Natural(type)) {
return new Room(predecessor, 1, true, "kleine Höhle ohne Ausgang", c);
return new Room(predecessor, 1, true, "kleine Höhle ohne Ausgang");
} else {
return new Room(predecessor, 1, true, "kleiner Raum ohne Ausgang", c);
return new Room(predecessor, 1, true, "kleiner Raum ohne Ausgang");
}
}
private static Room RoomSmallExitsStair(Exit predecessor, Counter c, Dungeon.Type type){
private static Room RoomSmallExitsStair(Exit predecessor, Dungeon.Type type) {
int rand = Dice.Roll(2, 1);
if (Dungeon.Natural(type)) {
return new Room(predecessor, rand + 2, true, "kleine Höhle mit " + rand + " Ausgängen und einer Treppe", c);
return new Room(predecessor, rand + 2, true, "kleine Höhle mit " + rand + " Ausgängen und einer Treppe");
} else {
return new Room(predecessor, rand + 2, true, "kleiner Raum mit " + rand + " Ausgängen und einer Treppe", c);
return new Room(predecessor, rand + 2, true, "kleiner Raum mit " + rand + " Ausgängen und einer Treppe");
}
}
private static Room RoomGiant(Exit predecessor, Counter c, Dungeon.Type type){
private static Room RoomGiant(Exit predecessor, Dungeon.Type type) {
int rand = Dice.Roll(2, 1);
if (Dungeon.Natural(type)) {
return new Room(predecessor, rand + 1, true, "gigantische Höhle mit " + rand + " Ausgängen", c);
return new Room(predecessor, rand + 1, true, "gigantische Höhle mit " + rand + " Ausgängen");
} else {
return new Room(predecessor, rand + 1, true, "gigantischer Raum mit " + rand + " Ausgängen", c);
return new Room(predecessor, rand + 1, true, "gigantischer Raum mit " + rand + " Ausgängen");
}
}
private static Room Corridor(Exit predecessor, Counter c){
return new Room(predecessor, 2, false, "Gang", c);
private static Room Corridor(Exit predecessor) {
return new Room(predecessor, 2, false, "Gang");
}
private static Room CrossingT(Exit predecessor, Counter c){
return new Room(predecessor, 3, false, "T-Kreuzung mit Abzweigungen nach links und rechts", c);
private static Room CrossingT(Exit predecessor) {
return new Room(predecessor, 3, false, "T-Kreuzung mit Abzweigungen nach links und rechts");
}
private static Room Crossing(Exit predecessor, Counter c){
return new Room(predecessor, 4, false, "Kreuzung, die in alle Richtungen weitergeht", c);
private static Room Crossing(Exit predecessor) {
return new Room(predecessor, 4, false, "Kreuzung, die in alle Richtungen weitergeht");
}
private static Room DeadEnd(Exit predecessor, Counter c){
return new Room(predecessor, 1, false, "Sackgasse", c);
private static Room DeadEnd(Exit predecessor) {
return new Room(predecessor, 1, false, "Sackgasse");
}
/**
* Generates a random room
*
* @param first Whether it is the first room
* @param predecessor Predecessor room
* @param c Room counter
* @param type Environment type
* @param map The map for experimental mode
* @return random room
*/
public static Room RandomRoom(boolean first, Exit predecessor, Counter c, Dungeon.Type type, HashMap<Integer, Integer> map){
static Room RandomRoom(boolean first, Exit predecessor, Dungeon.Type type, HashMap<Integer, Object> map) {
int number;
if (first) {
number = Dice.Roll(6, 1);
} else {
number = Dice.Roll(20, 1);
}
switch(map.get(number)){
switch ((int) map.get(number)) {
case 1:
case 2:
case 3: return RoomBigExits(predecessor, c, type);
case 3:
return RoomBigExits(predecessor, type);
case 4:
case 5:
case 6: return RoomSmallExits(predecessor, c, type);
case 7: return RoomBigNoExits(predecessor, c, type);
case 6:
return RoomSmallExits(predecessor, type);
case 7:
return RoomBigNoExits(predecessor, type);
case 8:
case 9: return RoomBigExitsStair(predecessor, c, type);
case 10: return RoomSmallNoExits(predecessor, c, type);
case 9:
return RoomBigExitsStair(predecessor, type);
case 10:
return RoomSmallNoExits(predecessor, type);
case 11:
case 12: return RoomSmallExitsStair(predecessor, c, type);
case 12:
return RoomSmallExitsStair(predecessor, type);
case 13:
case 14: return RoomGiant(predecessor, c, type);
case 14:
return RoomGiant(predecessor, type);
case 15:
case 16:
case 17: return Corridor(predecessor, c);
case 18: return CrossingT(predecessor, c);
case 19: return Crossing(predecessor, c);
case 20: return DeadEnd(predecessor, c);
case 17:
return Corridor(predecessor);
case 18:
return CrossingT(predecessor);
case 19:
return Crossing(predecessor);
case 20:
return DeadEnd(predecessor);
}
return null;
}

@ -1,26 +1,3 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.dungeon.objects;
/**

@ -1,26 +1,3 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.dungeon.objects;
import eu.smoser.dungeongenerator.dungeon.Dungeon;
@ -32,13 +9,17 @@ import eu.smoser.dungeongenerator.util.Dice;
*/
public class Encounters extends ADungeonObject{
public Encounters(int num, Dungeon.Type type){
descString = "";
StringBuilder sb = new StringBuilder();
for(int i = 1; i <= num; i++){
descString += i + ": " + Encounter(type) + "\n";
sb.append(i);
sb.append(": ");
sb.append(Encounter(type));
sb.append("\n");
}
descString = sb.toString();
}
public static String Encounter(Dungeon.Type type){
private static String Encounter(Dungeon.Type type){
if(Dungeon.Natural(type)){
switch(Dice.Roll(20, 1)){
case 1: return "Ein Höhlenbewohner behauptet, er sei der Häuptling eines ganzen Stammes und bietet den Helden die Freundschaft an. In Wirklichkeit ist er nur ein unbedeutender Kundschafter, der keinerlei Befehlsgewalt hat, nachdem er die Helden zum Stamm geführt hat.";
@ -90,13 +71,13 @@ public class Encounters extends ADungeonObject{
}
private static String EnemyList(int num, Dungeon.Type type){
String out = "";
StringBuilder out = new StringBuilder();
for(int i = 0; i < num; i++){
out += new Enemy(type).toString();
out.append(new Enemy(type).toString());
if(i < (num - 1)){
out += ", ";
out.append(", ");
}
}
return out;
return out.toString();
}
}

@ -1,26 +1,3 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.dungeon.objects;
import eu.smoser.dungeongenerator.dungeon.Dungeon;

@ -1,26 +1,3 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.dungeon.objects;
import eu.smoser.dungeongenerator.dungeon.Dungeon;

@ -1,26 +1,3 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.dungeon.objects;
import eu.smoser.dungeongenerator.dungeon.Dungeon;

@ -1,26 +1,3 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.dungeon.objects;
import eu.smoser.dungeongenerator.util.Dice;

@ -1,26 +1,3 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.dungeon.objects;
import eu.smoser.dungeongenerator.util.Dice;

@ -0,0 +1,40 @@
package eu.smoser.dungeongenerator.main;
import javax.swing.*;
abstract class AGenerator extends javax.swing.JFrame {
AGenerator() {
JButton jButtonStart = new JButton();
JPanel jPanel1 = new JPanel();
Box.Filler filler1 = new 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();
JLabel jLabel1 = new JLabel();
Box.Filler filler2 = new Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
JScrollPane jScrollPane1 = new JScrollPane();
JTextArea jText = new JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
cInitComponents(jButtonStart, jLabel1, jPanel1);
jButtonStart.addActionListener(e -> jText.setText(getText()));
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);
jPanel1.add(jLabel1);
jPanel1.add(filler2);
getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);
jText.setColumns(20);
jText.setRows(5);
jScrollPane1.setViewportView(jText);
getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
pack();
}
abstract void cInitComponents(JButton jButtonStart, JLabel jLabel1, JPanel jPanel1);
abstract String getText();
javax.swing.JSpinner jSpinner;
}

@ -552,7 +552,7 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
private void jMenuItemHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemHelpActionPerformed
try {
Desktop.getDesktop().browse(new URI("https://github.com/MrMcX/DungeonGenerator/issues"));
Desktop.getDesktop().browse(new URI("https://naclador.de/git/mosers/DungeonGenerator/issues"));
} catch (URISyntaxException | IOException ex) {
Logger.getLogger(DungeonGeneratorUI.class.getName()).log(Level.SEVERE, null, ex);
}
@ -560,7 +560,7 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
private void jMenuItemGithubActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemGithubActionPerformed
try {
Desktop.getDesktop().browse(new URI("https://github.com/MrMcX/DungeonGenerator/"));
Desktop.getDesktop().browse(new URI("https://naclador.de/git/mosers/DungeonGenerator/"));
} catch (URISyntaxException | IOException ex) {
Logger.getLogger(DungeonGeneratorUI.class.getName()).log(Level.SEVERE, null, ex);
}

@ -1,158 +1,67 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.Dungeon;
import eu.smoser.dungeongenerator.dungeon.objects.Encounters;
import javax.swing.*;
import java.util.Objects;
/**
*
* @author MrMcX
*/
public class EncounterGenerator extends javax.swing.JFrame {
/**
* Creates new form EncounterGenerator
*/
public EncounterGenerator() {
initComponents();
}
public class EncounterGenerator extends AGenerator {
/**
* 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();
filler3 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
jLabel2 = new javax.swing.JLabel();
jCombo = new javax.swing.JComboBox<>();
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.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@Override
void cInitComponents(JButton jButtonStart, JLabel jLabel1, JPanel jPanel1) {
JLabel jLabel2 = new JLabel();
Box.Filler filler3 = new Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
jCombo = new JComboBox<>();
setTitle("Zufallsbegegnungen generieren");
setMinimumSize(new java.awt.Dimension(800, 600));
setName("Zufallsbegegnungen"); // NOI18N
setName("Zufallsbegegnungen");
jButtonStart.setText("Zufallsbegegnungen starten");
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, 7));
jPanel1.add(filler1);
jSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, null, 1));
jPanel1.add(jSpinner);
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
jLabel1.setText("Begegnungen");
jPanel1.add(jLabel1);
jPanel1.add(filler3);
jLabel2.setText("Dungeonart");
jPanel1.add(jLabel2);
jCombo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Natürlich", "Künstlich" }));
jCombo.setModel(new DefaultComboBoxModel<>(new String[] { "Natürlich", "Künstlich" }));
jPanel1.add(jCombo);
jPanel1.add(filler2);
getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);
jText.setColumns(20);
jText.setRows(5);
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
Encounters e = new Encounters((int) jSpinner.getValue(), jCombo.getSelectedItem().equals("Natürlich") ? Dungeon.Type.NATURAL : Dungeon.Type.ARTIFICIAL);
jText.setText(e.toString());
}//GEN-LAST:event_jButtonStartActionPerformed
@Override
String getText() {
Encounters e = new Encounters((int) jSpinner.getValue(), Objects.equals(jCombo.getSelectedItem(), "Natürlich") ? Dungeon.Type.NATURAL : Dungeon.Type.ARTIFICIAL);
return e.toString();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
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()) {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(EncounterGenerator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(EncounterGenerator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(EncounterGenerator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(EncounterGenerator.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 EncounterGenerator().setVisible(true);
}
});
java.awt.EventQueue.invokeLater(() -> new EncounterGenerator().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.Box.Filler filler3;
private javax.swing.JButton jButtonStart;
private javax.swing.JComboBox<String> jCombo;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSpinner jSpinner;
private javax.swing.JTextArea jText;
// End of variables declaration//GEN-END:variables
private JComboBox<String> jCombo;
}

@ -1,146 +1,58 @@
/*
* 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;
import javax.swing.*;
/**
*
* @author mosers
*/
public class TreasureGenerator extends javax.swing.JFrame {
/**
* Creates new form TreasureGenerator
*/
public TreasureGenerator() {
initComponents();
}
public class TreasureGenerator extends AGenerator {
/**
* 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.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@Override
void cInitComponents(JButton jButtonStart, JLabel jLabel1, JPanel jPanel1) {
setTitle("Schätze generieren");
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.setColumns(20);
jText.setRows(5);
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 = "";
@Override
String getText() {
StringBuilder text = new StringBuilder();
for(int i = 1; i <= (int) jSpinner.getValue(); i++){
text += i + " Handvoll:\n" + Treasure.DetailedTreasure() + "\n\n";
text.append(i);
text.append(". Handvoll:\n");
text.append(Treasure.DetailedTreasure());
text.append("\n\n");
}
return text.toString();
}
jText.setText(text);
}//GEN-LAST:event_jButtonStartActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
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()) {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
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) {
} catch (ClassNotFoundException | UnsupportedLookAndFeelException | IllegalAccessException | InstantiationException 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);
}
});
java.awt.EventQueue.invokeLater(() -> 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.JTextArea jText;
// End of variables declaration//GEN-END:variables
}

@ -1,26 +1,3 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.util;
/**
@ -45,12 +22,4 @@ public class Counter {
counter++;
return counter;
}
/**
* Shows the current number without increasing it
* @return current number
*/
public int Peek(){
return counter;
}
}

@ -1,26 +1,3 @@
/*
* The MIT License
*
* Copyright 2016 MrMcX.
*
* 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.util;
import java.util.Random;

Laden…
Abbrechen
Speichern