diff --git a/.gitignore b/.gitignore
index a5e85c3..dec5c1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,10 @@
/ATCS_v*.jar
/Project
/bin
+/packaging/tmp/
+/out
+packaging/common/lib
+packaging/common/ATCS.jar
+packaging/ATCS_*.zip
+ATCS_v*.tar.gz
+ATCS.jar
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/artifacts/ATContentStudio_jar.xml b/.idea/artifacts/ATContentStudio_jar.xml
new file mode 100644
index 0000000..32836f9
--- /dev/null
+++ b/.idea/artifacts/ATContentStudio_jar.xml
@@ -0,0 +1,18 @@
+
+
+ $PROJECT_DIR$/out/artifacts/ATContentStudio_jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..59f6372
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..7e729c5
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ATContentStudio.iml b/ATContentStudio.iml
new file mode 100644
index 0000000..951cf5c
--- /dev/null
+++ b/ATContentStudio.iml
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packaging/Manifest.txt b/packaging/Manifest.txt
new file mode 100644
index 0000000..31c84bc
--- /dev/null
+++ b/packaging/Manifest.txt
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Main-Class: com.gpl.rpg.atcontentstudio.ATContentStudio
diff --git a/packaging/common/ATCS.cmd b/packaging/common/ATCS.cmd
new file mode 100644
index 0000000..2974600
--- /dev/null
+++ b/packaging/common/ATCS.cmd
@@ -0,0 +1,18 @@
+@echo off
+
+set "ATCS_DIR=%~dp0"
+set "MAX_MEM=512M"
+set "JAVA=javaw.exe"
+set "JAVA_OPTS=-DFONT_SCALE=1.0 -Dswing.aatext=true"
+set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"
+
+if exist "%ENV_FILE%" (
+ call "%ENV_FILE%"
+) else (
+ echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"
+ echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"
+ echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"
+ echo.>>"%ENV_FILE%"
+)
+
+start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -jar "%ATCS_DIR%\ATCS.jar"
diff --git a/packaging/common/ATCS.env b/packaging/common/ATCS.env
new file mode 100644
index 0000000..b8b1645
--- /dev/null
+++ b/packaging/common/ATCS.env
@@ -0,0 +1,4 @@
+#MAX_MEM=512M
+#JAVA=java
+#JAVA_OPTS=-DFONT_SCALE=1.0 -Dswing.aatext=true
+
diff --git a/packaging/common/ATCS.ico b/packaging/common/ATCS.ico
new file mode 100644
index 0000000..4f829e4
Binary files /dev/null and b/packaging/common/ATCS.ico differ
diff --git a/packaging/common/ATCS.sh b/packaging/common/ATCS.sh
new file mode 100755
index 0000000..41d78b2
--- /dev/null
+++ b/packaging/common/ATCS.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+ATCS_DIR=$(dirname $(readlink -f "$0" || greadlink -f "$0" || stat -f "$0"))
+
+MAX_MEM=512M
+
+JAVA=java
+JAVA_OPTS='-DFONT_SCALE=1.0 -Dswing.aatext=true'
+ENV_FILE=${ATCS_DIR}/ATCS.env
+
+if [ -f ${ENV_FILE} ]; then
+ source ${ENV_FILE}
+else
+ echo "#MAX_MEM=${MAX_MEM}" >${ENV_FILE}
+ echo "#JAVA=${JAVA}" >>${ENV_FILE}
+ echo "#JAVA_OPTS=${JAVA_OPTS}" >>${ENV_FILE}
+ echo "" >>${ENV_FILE}
+fi
+
+export ENV_FILE
+
+$JAVA ${JAVA_OPTS} -Xmx${MAX_MEM} -jar ${ATCS_DIR}/ATCS.jar
diff --git a/packaging/package-windows.sh b/packaging/package-windows.sh
new file mode 100644
index 0000000..49f3808
--- /dev/null
+++ b/packaging/package-windows.sh
@@ -0,0 +1 @@
+sh ./package.sh -windows
diff --git a/packaging/package.sh b/packaging/package.sh
new file mode 100755
index 0000000..94fe1f1
--- /dev/null
+++ b/packaging/package.sh
@@ -0,0 +1,119 @@
+#!/bin/bash
+
+# Script to build ATCS.jar, replicating IntelliJ artifact definition
+# Linux and Windows compatible
+
+# --- Platform Detection ---
+if [ "$1" = "-windows" ]; then
+ echo "Got '-windows' flag. Running Windows version"
+ PLATFORM="WINDOWS"
+else
+ echo "No '-windows' flag. Running Linux version"
+ PLATFORM="LINUX"
+fi
+
+# --- Configuration ---
+PACKAGING_DIR=$(dirname "$(readlink -f "$0" || greadlink -f "$0" || stat -f "$0")")
+ATCS_SOURCE_DIR=$(dirname "${PACKAGING_DIR}")
+TEMP_DIR="${PACKAGING_DIR}/tmp"
+JAR_LOCATION="${PACKAGING_DIR}/ATCS.jar" # Output JAR location as per script
+MANIFEST_LOCATION="${PACKAGING_DIR}/Manifest.txt"
+VERSION_FILE="${PACKAGING_DIR}/ATCS_latest"
+SOURCE_BASE_DIR="${ATCS_SOURCE_DIR}/src" # Base directory for standard source code
+LIB_BASE_DIR="${ATCS_SOURCE_DIR}/lib" # Base directory for libraries
+OUTPUT_JAR_DIR="${PACKAGING_DIR}" # Directory where the final JAR will be placed - as per script
+
+# --- **ADDITIONAL SOURCE CODE FOLDERS** ---
+EXTRA_SOURCE_DIRS=(
+ "hacked-libtiled"
+ "minify"
+ "siphash-zackehh/src/main/java"
+)
+
+# --- Libraries to include (from IntelliJ artifact definition) ---
+LIBRARIES=(
+ "AndorsTrainer_v0.1.5.jar"
+ "bsh-2.0b4.jar"
+ "jide-oss.jar"
+ "json_simple-1.1.jar"
+ "jsoup-1.10.2.jar"
+ "junit-4.10.jar"
+ "prefuse.jar"
+ "rsyntaxtextarea.jar"
+ "ui.jar"
+)
+
+# --- Get version ---
+echo "Getting version"
+VERSION=$(cat "${VERSION_FILE}")
+echo "Got version ${VERSION}"
+
+# --- Prepare temporary directory ---
+echo "Removing tmp folder"
+rm -rf "${TEMP_DIR}"
+echo "Recreating tmp folder"
+mkdir -p "${TEMP_DIR}"
+
+# --- **EXTRACT lib files directly to TEMP_DIR** ---
+echo 'Extracting lib files to TEMP_DIR'
+for LIB in "${LIBRARIES[@]}"; do
+ echo "Extracting library: ${LIB}"
+ unzip -qo "${LIB_BASE_DIR}/${LIB}" -d "${TEMP_DIR}" # Extract JAR contents to TEMP_DIR root
+done
+
+# --- Set ClassPath ---
+echo "Getting source files"
+# Find all java files in source directories and compile them
+SOURCE_FILES=$(find "${SOURCE_BASE_DIR}" "${EXTRA_SOURCE_DIRS[@]/#/${ATCS_SOURCE_DIR}/}" -name "*.java" -print)
+#echo "SourceFiles: ${SOURCE_FILES}"
+echo ""
+
+# --- Build Java classes ---
+echo 'Building java classes'
+
+javac -cp "${TEMP_DIR}" -d "${TEMP_DIR}" ${SOURCE_FILES}
+if [ $? -ne 0 ]; then
+ echo "Compilation failed. Please check errors above."
+ exit 1
+fi
+echo "Compilation successful"
+
+# --- Copy res stuff to temp folder ---
+echo "Copying some stuff to temp folder"
+cp -r "${ATCS_SOURCE_DIR}"/res/* "${TEMP_DIR}/"
+mkdir -p "${TEMP_DIR}/com/gpl/rpg/atcontentstudio/img"
+mkdir -p "${TEMP_DIR}/tiled/io/resources/"
+cp -r "${ATCS_SOURCE_DIR}"/src/com/gpl/rpg/atcontentstudio/img/* "${TEMP_DIR}/com/gpl/rpg/atcontentstudio/img/" # some icons
+cp -r "${ATCS_SOURCE_DIR}"/hacked-libtiled/tiled/io/resources/* "${TEMP_DIR}/tiled/io/resources/" # dtd file for tmx maps
+
+# --- Create JAR file ---
+echo ""
+echo "Creating jar at location: ${JAR_LOCATION}"
+
+cd "${TEMP_DIR}" || exit # Change to temp dir for JAR command
+
+# JAR command WITHOUT lib directory
+jar cfm "${JAR_LOCATION}" "${MANIFEST_LOCATION}" -C . .
+if [ $? -ne 0 ]; then
+ echo "JAR creation failed."
+ exit 1
+fi
+
+cd "${PACKAGING_DIR}" || exit # Go back to packaging dir
+
+echo ''
+echo "Done creating jar at ${JAR_LOCATION}"
+cp -f "${JAR_LOCATION}" "${OUTPUT_JAR_DIR}/common/ATCS.jar" # Copy JAR to versioned name
+
+# --- Create archive ---
+if [ "$PLATFORM" = "LINUX" ]; then
+ cd "${OUTPUT_JAR_DIR}" || exit
+ echo "Creating archive"
+ tar caf "ATCS_${VERSION}.tar.gz" common/* # archive the 'common' folder which now contains the JAR and libs
+ echo "Created archive at ${OUTPUT_JAR_DIR}/ATCS_${VERSION}.tar.gz"
+ cd "${PACKAGING_DIR}" || exit
+else
+ echo "Can't create zip files on windows yet. Please pack the content of the '${OUTPUT_JAR_DIR}/common/' folder yourself"
+fi
+
+echo "Script finished."
diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9a4ed97
--- /dev/null
+++ b/src/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Main-Class: com.gpl.rpg.atcontentstudio.ATContentStudio
+Class-Path: jide-oss.jar jsoup-1.10.2.jar ui.jar junit-4.10.jar AndorsTr
+ ainer_v0.1.5.jar prefuse.jar rsyntaxtextarea.jar bsh-2.0b4.jar json_sim
+ ple-1.1.jar
+
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java
index b721ed4..3e40d14 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java
@@ -236,7 +236,12 @@ public class ActorCondition extends JSONElement {
if (this.icon_id != null) {
String spritesheetId = this.icon_id.split(":")[0];
if (getProject().getSpritesheet(spritesheetId) == null) {
+ System.out.println("Actor Condition");
System.out.println(this.id);
+ System.out.println("failed to load spritesheet:");
+ System.out.println(spritesheetId);
+ System.out.println("while creating backlink for icon_id:");
+ System.out.println(this.icon_id);
}
getProject().getSpritesheet(spritesheetId).addBacklink(this);
}
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/JSONElement.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/JSONElement.java
index 6a6359f..3910742 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/JSONElement.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/JSONElement.java
@@ -39,14 +39,15 @@ public abstract class JSONElement extends GameDataElement {
Map jsonObj = (Map)obj;
String id = (String) jsonObj.get("id");
try {
- if (id != null && id.equals(this.id )) {
- this.parse(jsonObj);
- this.state = State.parsed;
- break;
- }
+ if (id != null && id.equals(this.id )) {
+ this.parse(jsonObj);
+ this.state = State.parsed;
+ break;
+ }
}
catch(Exception e){
System.out.println("Error in ID: " + id);
+ System.out.println(e.getMessage());
}
}
} catch (FileNotFoundException e) {