mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-27 23:07:41 +01:00
Compare commits
46 Commits
master
...
fix-orderi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86b838f755 | ||
|
|
f66d016d08 | ||
|
|
9ba45fe848 | ||
|
|
f14255ce1c | ||
|
|
c37b56988d | ||
|
|
9654da02c2 | ||
|
|
d5c1ccebce | ||
|
|
0bf6b3f4d1 | ||
|
|
69c031d28e | ||
|
|
6ec4cbf83d | ||
|
|
5b2480920e | ||
|
|
e6f89b8802 | ||
|
|
f2008de3e2 | ||
|
|
0df961c8d3 | ||
|
|
15b98eedcf | ||
|
|
8399ae60ee | ||
|
|
1b643f4aa1 | ||
|
|
4293095e8e | ||
|
|
5f2927e00c | ||
|
|
79eddde155 | ||
|
|
c94c5fb41b | ||
|
|
be040a74bd | ||
|
|
31cbdcabab | ||
|
|
7e5c8d05ab | ||
|
|
b2003bfc38 | ||
|
|
3b99a94654 | ||
|
|
806f0b10e6 | ||
|
|
29241f18b8 | ||
|
|
7df75482eb | ||
|
|
f93d865da7 | ||
|
|
bad86eec93 | ||
|
|
ef9a2a628d | ||
|
|
9dfd217a27 | ||
|
|
6f10e5b94a | ||
|
|
7cbce8e4d7 | ||
|
|
364bf8ee11 | ||
|
|
e2b0b0e81e | ||
|
|
703b723322 | ||
|
|
297bff84db | ||
|
|
67724f5124 | ||
|
|
09d23c8cdf | ||
|
|
749e64e09e | ||
|
|
998560a6ff | ||
|
|
2bf64c417f | ||
|
|
bc3333bd0e | ||
|
|
e6d9d8fbda |
97
.github/workflows/release.yml
vendored
97
.github/workflows/release.yml
vendored
@@ -2,55 +2,68 @@ name: Release Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types: [ created ]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: windows-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Get Version
|
- name: Get Version
|
||||||
id: get_version
|
id: get_version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "Reading version from file:"
|
echo "Reading version from file:"
|
||||||
cat res/ATCS_latest
|
cat res/ATCS_latest
|
||||||
echo ""
|
echo ""
|
||||||
VERSION=$(tr -d '[:space:]' < "res/ATCS_latest")
|
VERSION=$(tr -d '[:space:]' < "res/ATCS_latest")
|
||||||
echo "Processed version: $VERSION"
|
echo "Processed version: $VERSION"
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
echo "Environment variable set to: $VERSION"
|
echo "Environment variable set to: $VERSION"
|
||||||
|
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|
||||||
- name: Build JAR
|
- name: Build JAR
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd packaging
|
cd packaging
|
||||||
chmod +x package.sh
|
chmod +x package.sh
|
||||||
echo "Building JAR and ZIP for version: ${{ env.VERSION }}"
|
echo "Building JAR and ZIP for version: ${{ env.VERSION }}"
|
||||||
./package.sh -windows
|
./package.sh
|
||||||
echo "Created artifacts:"
|
echo "Created artifacts:"
|
||||||
ls -la common/ATCS.jar
|
ls -la common/ATCS.jar
|
||||||
ls -la ATCS_${{ env.VERSION }}.zip
|
ls -la ATCS_${{ env.VERSION }}.zip
|
||||||
|
|
||||||
- name: Install NSIS
|
- name: Upload Release Assets (zip)
|
||||||
uses: joncloud/makensis-action@v4
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
env:
|
||||||
script-file: packaging/Windows/ATCS_Installer.nsi
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
arguments: /DVERSION="${{ env.VERSION }}"
|
with:
|
||||||
|
files: |
|
||||||
|
./packaging/ATCS_${{ env.VERSION }}.zip
|
||||||
|
|
||||||
- name: Upload Release Assets
|
- name: 'Install makensis (apt)'
|
||||||
uses: softprops/action-gh-release@v1
|
run: sudo apt update && sudo apt install -y nsis nsis-pluginapi
|
||||||
env:
|
continue-on-error: true
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
- name: Create Windows-Installer with NSIS
|
||||||
files: |
|
uses: joncloud/makensis-action@v4
|
||||||
./packaging/ATCS_${{ env.VERSION }}.zip
|
with:
|
||||||
./packaging/ATCS_${{ env.VERSION }}_Setup.exe
|
script-file: packaging/Windows/ATCS_Installer.nsi
|
||||||
|
arguments: -DVERSION="${{ env.VERSION }}"
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Upload Release Assets (exe)
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
files: ./packaging/ATCS_${{ env.VERSION }}_Setup.exe
|
||||||
|
continue-on-error: true
|
||||||
|
|||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="temurin-11" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK" />
|
||||||
</project>
|
</project>
|
||||||
BIN
lib/jide-oss.jar
BIN
lib/jide-oss.jar
Binary file not shown.
@@ -67,22 +67,22 @@ Section install
|
|||||||
FileWrite $9 '$\r$\n'
|
FileWrite $9 '$\r$\n'
|
||||||
FileWrite $9 'set "ATCS_DIR=%~dp0"$\r$\n'
|
FileWrite $9 'set "ATCS_DIR=%~dp0"$\r$\n'
|
||||||
FileWrite $9 'set "MAX_MEM=1024M"$\r$\n'
|
FileWrite $9 'set "MAX_MEM=1024M"$\r$\n'
|
||||||
FileWrite $9 'set "CP=%ATCS_DIR%lib\*"$\r$\n'
|
FileWrite $9 'REM required minimum java version is 11$\r$\n'
|
||||||
FileWrite $9 'set "JAVA=$R0"$\r$\n'
|
FileWrite $9 'set "JAVA=$R0"$\r$\n'
|
||||||
FileWrite $9 'set "JAVA_OPTS="$\r$\n'
|
FileWrite $9 'set "JAVA_OPTS=-DFONT_SCALE=1.0 -Dswing.aatext=true"$\r$\n'
|
||||||
FileWrite $9 'set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"$\r$\n'
|
FileWrite $9 'set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"$\r$\n'
|
||||||
FileWrite $9 'set "MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio"$\r$\n'
|
|
||||||
FileWrite $9 '$\r$\n'
|
FileWrite $9 '$\r$\n'
|
||||||
FileWrite $9 'if exist "%ENV_FILE%" ($\r$\n'
|
FileWrite $9 'if exist "%ENV_FILE%" ($\r$\n'
|
||||||
FileWrite $9 ' call "%ENV_FILE%"$\r$\n'
|
FileWrite $9 ' call "%ENV_FILE%"$\r$\n'
|
||||||
FileWrite $9 ') else ($\r$\n'
|
FileWrite $9 ') else ($\r$\n'
|
||||||
FileWrite $9 ' echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"$\r$\n'
|
FileWrite $9 ' echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"$\r$\n'
|
||||||
|
FileWrite $9 ' echo REM required minimum java version is 11$\r$\n'
|
||||||
FileWrite $9 ' echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"$\r$\n'
|
FileWrite $9 ' echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"$\r$\n'
|
||||||
FileWrite $9 ' echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"$\r$\n'
|
FileWrite $9 ' echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"$\r$\n'
|
||||||
FileWrite $9 ' echo.>>"%ENV_FILE%"$\r$\n'
|
FileWrite $9 ' echo.>>"%ENV_FILE%"$\r$\n'
|
||||||
FileWrite $9 ')$\r$\n'
|
FileWrite $9 ')$\r$\n'
|
||||||
FileWrite $9 '$\r$\n'
|
FileWrite $9 '$\r$\n'
|
||||||
FileWrite $9 'start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -jar ATCS.jar$\r$\n'
|
FileWrite $9 'start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -jar "%ATCS_DIR%\ATCS.jar"$\r$\n'
|
||||||
FileClose $9
|
FileClose $9
|
||||||
|
|
||||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
set "ATCS_DIR=%~dp0"
|
set "ATCS_DIR=%~dp0"
|
||||||
set "MAX_MEM=1024M"
|
set "MAX_MEM=1024M"
|
||||||
|
REM required minimum java version is 11
|
||||||
set "JAVA=java.exe"
|
set "JAVA=java.exe"
|
||||||
set "JAVA_OPTS=-DFONT_SCALE=1.0 -Dswing.aatext=true"
|
set "JAVA_OPTS=-DFONT_SCALE=1.0 -Dswing.aatext=true"
|
||||||
set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"
|
set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"
|
||||||
@@ -10,6 +11,7 @@ if exist "%ENV_FILE%" (
|
|||||||
call "%ENV_FILE%"
|
call "%ENV_FILE%"
|
||||||
) else (
|
) else (
|
||||||
echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"
|
echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"
|
||||||
|
echo REM required minimum java version is 11
|
||||||
echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"
|
echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"
|
||||||
echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"
|
echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"
|
||||||
echo.>>"%ENV_FILE%"
|
echo.>>"%ENV_FILE%"
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# get the directory of this script
|
||||||
ATCS_DIR="$(dirname "$(readlink -f "$0" || greadlink -f "$0" || stat -f "$0")")"
|
ATCS_DIR="$(dirname "$(readlink -f "$0" || greadlink -f "$0" || stat -f "$0")")"
|
||||||
echo "ATCS_DIR: '${ATCS_DIR}'"
|
echo "ATCS_DIR: '${ATCS_DIR}'"
|
||||||
|
|
||||||
MAX_MEM="512M"
|
MAX_MEM="512M"
|
||||||
JAVA="java"
|
JAVA="java" # minimum required version is Java 11
|
||||||
JAVA_OPTS='-DFONT_SCALE=1.0 -Dswing.aatext=true'
|
JAVA_OPTS='-DFONT_SCALE=1.0 -Dswing.aatext=true'
|
||||||
|
|
||||||
ENV_FILE="${ATCS_DIR}/ATCS.env"
|
ENV_FILE="${ATCS_DIR}/ATCS.env"
|
||||||
@@ -13,7 +15,7 @@ if [ -f "${ENV_FILE}" ]; then
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "#MAX_MEM=\"${MAX_MEM}\""
|
echo "#MAX_MEM=\"${MAX_MEM}\""
|
||||||
echo "#JAVA=\"${JAVA}\""
|
echo "#JAVA=\"${JAVA}\" # minimum required version is Java 11"
|
||||||
echo "#JAVA_OPTS=\"${JAVA_OPTS}\""
|
echo "#JAVA_OPTS=\"${JAVA_OPTS}\""
|
||||||
echo ""
|
echo ""
|
||||||
}>"${ENV_FILE}"
|
}>"${ENV_FILE}"
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Configuration ---
|
# --- Configuration ---
|
||||||
PACKAGING_DIR=$(dirname "$(readlink -f "$0" || greadlink -f "$0" || stat -f "$0")")
|
PACKAGING_DIR=$(dirname "$(readlink -f "$0" || greadlink -f "$0" || stat -f "$0")") # Directory of this script
|
||||||
ATCS_SOURCE_DIR=$(dirname "${PACKAGING_DIR}")
|
ATCS_SOURCE_DIR=$(dirname "${PACKAGING_DIR}") # Parent directory of this script, assumed to be ATCS source root
|
||||||
TEMP_DIR="${PACKAGING_DIR}/tmp"
|
TEMP_DIR="${PACKAGING_DIR}/tmp"
|
||||||
JAR_LOCATION="${PACKAGING_DIR}/ATCS.jar" # Output JAR location as per script
|
JAR_LOCATION="${PACKAGING_DIR}/ATCS.jar" # Output JAR location as per script
|
||||||
MANIFEST_LOCATION="${PACKAGING_DIR}/Manifest.txt"
|
MANIFEST_LOCATION="${PACKAGING_DIR}/Manifest.txt"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v0.6.21
|
v0.6.24
|
||||||
@@ -45,6 +45,7 @@ atcs.spritesheet.items_weapons.category=item
|
|||||||
atcs.spritesheet.items_weapons_2.category=item
|
atcs.spritesheet.items_weapons_2.category=item
|
||||||
atcs.spritesheet.items_weapons_3.category=item
|
atcs.spritesheet.items_weapons_3.category=item
|
||||||
|
|
||||||
|
atcs.spritesheet.monsters_antison.category=monster
|
||||||
atcs.spritesheet.monsters_armor1.category=monster
|
atcs.spritesheet.monsters_armor1.category=monster
|
||||||
atcs.spritesheet.monsters_arulirs.category=monster
|
atcs.spritesheet.monsters_arulirs.category=monster
|
||||||
|
|
||||||
@@ -132,3 +133,6 @@ atcs.spritesheet.monsters_newb_3.sizey=64
|
|||||||
atcs.spritesheet.monsters_newb_4.category=monster
|
atcs.spritesheet.monsters_newb_4.category=monster
|
||||||
atcs.spritesheet.monsters_newb_4.sizex=32
|
atcs.spritesheet.monsters_newb_4.sizex=32
|
||||||
atcs.spritesheet.monsters_newb_4.sizey=64
|
atcs.spritesheet.monsters_newb_4.sizey=64
|
||||||
|
atcs.spritesheet.monsters_1x2.category=monster
|
||||||
|
atcs.spritesheet.monsters_1x2.sizex=32
|
||||||
|
atcs.spritesheet.monsters_1x2.sizey=64
|
||||||
|
|||||||
@@ -65,22 +65,8 @@ public class ATContentStudio {
|
|||||||
|
|
||||||
ConfigCache.init();
|
ConfigCache.init();
|
||||||
|
|
||||||
try {
|
String laf = ConfigCache.getFavoriteLaFClassName();
|
||||||
String laf = ConfigCache.getFavoriteLaFClassName();
|
setLookAndFeel(laf);
|
||||||
if (laf == null)
|
|
||||||
laf = UIManager.getSystemLookAndFeelClassName();
|
|
||||||
UIManager.setLookAndFeel(laf);
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InstantiationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (UnsupportedLookAndFeelException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
scaleUIFont();
|
|
||||||
|
|
||||||
// Need to keep a strong reference to it, to avoid garbage collection that'll
|
// Need to keep a strong reference to it, to avoid garbage collection that'll
|
||||||
// reset this setting.
|
// reset this setting.
|
||||||
@@ -116,7 +102,6 @@ public class ATContentStudio {
|
|||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
frame.setDefaultCloseOperation(StudioFrame.DO_NOTHING_ON_CLOSE);
|
frame.setDefaultCloseOperation(StudioFrame.DO_NOTHING_ON_CLOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
for (File f : ConfigCache.getKnownWorkspaces()) {
|
for (File f : ConfigCache.getKnownWorkspaces()) {
|
||||||
if (workspaceRoot.equals(f)) {
|
if (workspaceRoot.equals(f)) {
|
||||||
@@ -134,6 +119,34 @@ public class ATContentStudio {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setLookAndFeel(String laf) {
|
||||||
|
if (laf == null)
|
||||||
|
{
|
||||||
|
System.out.println("No look and feel specified, using system default.");
|
||||||
|
laf = UIManager.getSystemLookAndFeelClassName();
|
||||||
|
}
|
||||||
|
System.out.println("Info: Setting look and feel to: " + laf);
|
||||||
|
|
||||||
|
try {
|
||||||
|
UIManager.setLookAndFeel(laf);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
System.err.println("Failed to load system look and feel. ");
|
||||||
|
System.err.println("Installed look and feel classes: ");
|
||||||
|
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
|
||||||
|
System.err.println(" " + info.getName() + " (" + info.getClassName() + ")");
|
||||||
|
}
|
||||||
|
System.err.println("Tried to load: " + laf + " but got this error:");
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InstantiationException | UnsupportedLookAndFeelException | IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
var newLaF = UIManager.getLookAndFeel();
|
||||||
|
System.out.println("Using look and feel: " + newLaF.getName() + " (" + newLaF.getClass().getName() + ")");
|
||||||
|
|
||||||
|
scaleUIFont();
|
||||||
|
}
|
||||||
|
|
||||||
private static void checkUpdate() {
|
private static void checkUpdate() {
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
try {
|
try {
|
||||||
@@ -156,13 +169,13 @@ public class ATContentStudio {
|
|||||||
style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
|
style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
|
||||||
style.append("font-size:" + font.getSize() + "pt;");
|
style.append("font-size:" + font.getSize() + "pt;");
|
||||||
style.append("background-color: rgb(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue()
|
style.append("background-color: rgb(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue()
|
||||||
+ ");");
|
+ ");");
|
||||||
|
|
||||||
JEditorPane ep = new JEditorPane("text/html",
|
JEditorPane ep = new JEditorPane("text/html",
|
||||||
"<html><body style=\"" + style + "\">" + "You are not running the latest ATCS version.<br/>"
|
"<html><body style=\"" + style + "\">" + "You are not running the latest ATCS version.<br/>"
|
||||||
+ "You can get the latest version (" + lastLine + ") by clicking the link below.<br/>"
|
+ "You can get the latest version (" + lastLine + ") by clicking the link below.<br/>"
|
||||||
+ "<a href=\"" + DOWNLOAD_URL + "\">" + DOWNLOAD_URL + "</a><br/>" + "<br/>"
|
+ "<a href=\"" + DOWNLOAD_URL + "\">" + DOWNLOAD_URL + "</a><br/>" + "<br/>"
|
||||||
+ "</body></html>");
|
+ "</body></html>");
|
||||||
|
|
||||||
ep.setEditable(false);
|
ep.setEditable(false);
|
||||||
ep.setBorder(null);
|
ep.setBorder(null);
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ public class Project implements ProjectTreeNode, Serializable, JsonSerializable
|
|||||||
this.fromMap(json);
|
this.fromMap(json);
|
||||||
|
|
||||||
initializeData();
|
initializeData();
|
||||||
linkAll();
|
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
public Project(Workspace w, String name, File source, ResourceSet sourceSet){
|
public Project(Workspace w, String name, File source, ResourceSet sourceSet){
|
||||||
@@ -288,44 +287,23 @@ public class Project implements ProjectTreeNode, Serializable, JsonSerializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void linkAll() {
|
public void linkAll() {
|
||||||
for (ProjectTreeNode node : baseContent.gameData.v.getNonEmptyIterable()) {
|
linkGameData(baseContent);
|
||||||
if (node instanceof GameDataCategory<?>) {
|
linkGameData(alteredContent);
|
||||||
for (GameDataElement e : ((GameDataCategory<?>) node)) {
|
linkGameData(createdContent);
|
||||||
e.link();
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (ProjectTreeNode node : baseContent.gameMaps.tmxMaps) {
|
|
||||||
((TMXMap) node).link();
|
|
||||||
}
|
|
||||||
for (ProjectTreeNode node : alteredContent.gameData.v.getNonEmptyIterable()) {
|
|
||||||
if (node instanceof GameDataCategory<?>) {
|
|
||||||
for (GameDataElement e : ((GameDataCategory<?>) node)) {
|
|
||||||
e.link();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (ProjectTreeNode node : alteredContent.gameMaps.tmxMaps) {
|
|
||||||
((TMXMap) node).link();
|
|
||||||
}
|
|
||||||
for (ProjectTreeNode node : createdContent.gameData.v.getNonEmptyIterable()) {
|
|
||||||
if (node instanceof GameDataCategory<?>) {
|
|
||||||
for (GameDataElement e : ((GameDataCategory<?>) node)) {
|
|
||||||
e.link();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (ProjectTreeNode node : createdContent.gameMaps.tmxMaps) {
|
|
||||||
((TMXMap) node).link();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (WorldmapSegment node : createdContent.worldmap) {
|
private void linkGameData(GameSource source) {
|
||||||
|
for (ProjectTreeNode node : source.gameData.v.getNonEmptyIterable()) {
|
||||||
|
if (node instanceof GameDataCategory<?>) {
|
||||||
|
for (GameDataElement e : ((GameDataCategory<?>) node).toList()) {
|
||||||
|
e.link();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (TMXMap node : source.gameMaps.tmxMaps) {
|
||||||
node.link();
|
node.link();
|
||||||
}
|
}
|
||||||
for (WorldmapSegment node : alteredContent.worldmap) {
|
for (WorldmapSegment node : source.worldmap) {
|
||||||
node.link();
|
|
||||||
}
|
|
||||||
for (WorldmapSegment node : baseContent.worldmap) {
|
|
||||||
node.link();
|
node.link();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -937,14 +915,14 @@ public class Project implements ProjectTreeNode, Serializable, JsonSerializable
|
|||||||
|
|
||||||
public void moveToCreated(JSONElement target) {
|
public void moveToCreated(JSONElement target) {
|
||||||
target.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
target.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
||||||
((GameDataCategory<?>) target.getParent()).remove(target);
|
((GameDataCategory<?>) target.getParent()).removeGeneric(target);
|
||||||
target.state = GameDataElement.State.created;
|
target.state = GameDataElement.State.created;
|
||||||
createdContent.gameData.addElement(target);
|
createdContent.gameData.addElement(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveToAltered(JSONElement target) {
|
public void moveToAltered(JSONElement target) {
|
||||||
target.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
target.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
||||||
((GameDataCategory<?>) target.getParent()).remove(target);
|
((GameDataCategory<?>) target.getParent()).removeGeneric(target);
|
||||||
target.state = GameDataElement.State.created;
|
target.state = GameDataElement.State.created;
|
||||||
((JSONElement) target).jsonFile = new File(baseContent.gameData.getGameDataElement(((JSONElement) target).getClass(), target.id).jsonFile.getAbsolutePath());
|
((JSONElement) target).jsonFile = new File(baseContent.gameData.getGameDataElement(((JSONElement) target).getClass(), target.id).jsonFile.getAbsolutePath());
|
||||||
alteredContent.gameData.addElement((JSONElement) target);
|
alteredContent.gameData.addElement((JSONElement) target);
|
||||||
@@ -1202,18 +1180,18 @@ public class Project implements ProjectTreeNode, Serializable, JsonSerializable
|
|||||||
public List<String> writeDataDeltaForDataType(GameDataCategory<? extends JSONElement> created, GameDataCategory<? extends JSONElement> altered, GameDataCategory<? extends JSONElement> source, Class<? extends JSONElement> gdeClass, File targetFolder) {
|
public List<String> writeDataDeltaForDataType(GameDataCategory<? extends JSONElement> created, GameDataCategory<? extends JSONElement> altered, GameDataCategory<? extends JSONElement> source, Class<? extends JSONElement> gdeClass, File targetFolder) {
|
||||||
List<String> filenamesToWrite = new LinkedList<String>();
|
List<String> filenamesToWrite = new LinkedList<String>();
|
||||||
Map<String, List<Map>> dataToWritePerFilename = new LinkedHashMap<String, List<Map>>();
|
Map<String, List<Map>> dataToWritePerFilename = new LinkedHashMap<String, List<Map>>();
|
||||||
for (JSONElement gde : altered) {
|
for (JSONElement gde : altered.toList()) {
|
||||||
if (!filenamesToWrite.contains(gde.jsonFile.getName())) {
|
if (!filenamesToWrite.contains(gde.jsonFile.getName())) {
|
||||||
filenamesToWrite.add(gde.jsonFile.getName());
|
filenamesToWrite.add(gde.jsonFile.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (JSONElement gde : created) {
|
for (JSONElement gde : created.toList()) {
|
||||||
if (!filenamesToWrite.contains(gde.jsonFile.getName())) {
|
if (!filenamesToWrite.contains(gde.jsonFile.getName())) {
|
||||||
filenamesToWrite.add(gde.jsonFile.getName());
|
filenamesToWrite.add(gde.jsonFile.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String fName : filenamesToWrite) {
|
for (String fName : filenamesToWrite) {
|
||||||
for (JSONElement gde : source) {
|
for (JSONElement gde : source.toList()) {
|
||||||
if (gde.jsonFile.getName().equals(fName)) {
|
if (gde.jsonFile.getName().equals(fName)) {
|
||||||
if (dataToWritePerFilename.get(fName) == null) {
|
if (dataToWritePerFilename.get(fName) == null) {
|
||||||
dataToWritePerFilename.put(fName, new ArrayList<Map>());
|
dataToWritePerFilename.put(fName, new ArrayList<Map>());
|
||||||
@@ -1222,7 +1200,7 @@ public class Project implements ProjectTreeNode, Serializable, JsonSerializable
|
|||||||
dataToWritePerFilename.get(fName).add(getGameDataElement(gdeClass, gde.id).toJson());
|
dataToWritePerFilename.get(fName).add(getGameDataElement(gdeClass, gde.id).toJson());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (JSONElement gde : created) {
|
for (JSONElement gde : created.toList()) {
|
||||||
if (gde.jsonFile.getName().equals(fName)) {
|
if (gde.jsonFile.getName().equals(fName)) {
|
||||||
if (dataToWritePerFilename.get(fName) == null) {
|
if (dataToWritePerFilename.get(fName) == null) {
|
||||||
dataToWritePerFilename.put(fName, new ArrayList<Map>());
|
dataToWritePerFilename.put(fName, new ArrayList<Map>());
|
||||||
|
|||||||
@@ -1,32 +1,115 @@
|
|||||||
package com.gpl.rpg.atcontentstudio.model.gamedata;
|
package com.gpl.rpg.atcontentstudio.model.gamedata;
|
||||||
|
|
||||||
import com.gpl.rpg.atcontentstudio.Notification;
|
import com.gpl.rpg.atcontentstudio.Notification;
|
||||||
import com.gpl.rpg.atcontentstudio.io.JsonPrettyWriter;
|
|
||||||
import com.gpl.rpg.atcontentstudio.model.*;
|
import com.gpl.rpg.atcontentstudio.model.*;
|
||||||
import com.gpl.rpg.atcontentstudio.model.GameSource.Type;
|
|
||||||
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
|
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
|
||||||
import com.gpl.rpg.atcontentstudio.utils.FileUtils;
|
import com.gpl.rpg.atcontentstudio.utils.FileUtils;
|
||||||
import org.json.simple.JSONArray;
|
|
||||||
|
|
||||||
import javax.swing.tree.TreeNode;
|
import javax.swing.tree.TreeNode;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
import java.util.List;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implements ProjectTreeNode, Serializable {
|
public class GameDataCategory<E extends JSONElement> implements ProjectTreeNode {
|
||||||
|
//region Data
|
||||||
|
private final ArrayList<String> keyList = new ArrayList<>();
|
||||||
|
private final HashMap<String, E> dataMap = new HashMap<>();
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
private static final long serialVersionUID = 5486008219704443733L;
|
|
||||||
|
|
||||||
public GameDataSet parent;
|
public GameDataSet parent;
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
public GameDataCategory(GameDataSet parent, String name) {
|
public GameDataCategory(GameDataSet parent, String name) {
|
||||||
super();
|
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//region Helpers
|
||||||
|
public E get(String key) {
|
||||||
|
return dataMap.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public E get(int index) {
|
||||||
|
String key = keyList.get(index);
|
||||||
|
return dataMap.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public E getIgnoreCase(String key) {
|
||||||
|
for (String k : keyList) {
|
||||||
|
if (k.equalsIgnoreCase(key)) {
|
||||||
|
return dataMap.get(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public E put(String key, E element) {
|
||||||
|
if (!dataMap.containsKey(key)) {
|
||||||
|
keyList.add(key);
|
||||||
|
}
|
||||||
|
return dataMap.put(key, element);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(E quest) {
|
||||||
|
String key = quest.id;
|
||||||
|
put(key, quest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public E remove(String key) {
|
||||||
|
if (dataMap.containsKey(key)) {
|
||||||
|
keyList.remove(key);
|
||||||
|
}
|
||||||
|
return dataMap.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public E remove(int index) {
|
||||||
|
String key = keyList.get(index);
|
||||||
|
keyList.remove(index);
|
||||||
|
return dataMap.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeGeneric(JSONElement element){
|
||||||
|
return remove((E) element);
|
||||||
|
}
|
||||||
|
public boolean remove(E element) {
|
||||||
|
String key = element.id;
|
||||||
|
int index = getProject().getNodeIndex(element);
|
||||||
|
boolean result = false;
|
||||||
|
if (dataMap.containsKey(key)) {
|
||||||
|
keyList.remove(key);
|
||||||
|
dataMap.remove(key);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
getProject().fireElementRemoved(element, index);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size() {
|
||||||
|
return dataMap.size();
|
||||||
|
}
|
||||||
|
public int indexOf(String key) {
|
||||||
|
return keyList.indexOf(key);
|
||||||
|
}
|
||||||
|
public int indexOf(E element) {
|
||||||
|
String key = element.id;
|
||||||
|
return keyList.indexOf(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<E> toList() {
|
||||||
|
ArrayList<E> list = new ArrayList<>();
|
||||||
|
for (String key : keyList) {
|
||||||
|
list.add(dataMap.get(key));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
//region copied implementation of ProjectTreeNode
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TreeNode getChildAt(int childIndex) {
|
public TreeNode getChildAt(int childIndex) {
|
||||||
return get(childIndex);
|
return get(childIndex);
|
||||||
@@ -44,7 +127,7 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIndex(TreeNode node) {
|
public int getIndex(TreeNode node) {
|
||||||
return indexOf(node);
|
return indexOf((E) node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,7 +142,7 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enumeration<E> children() {
|
public Enumeration<E> children() {
|
||||||
return Collections.enumeration(this);
|
return Collections.enumeration(toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -87,7 +170,7 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
|
|||||||
@Override
|
@Override
|
||||||
public void notifyCreated() {
|
public void notifyCreated() {
|
||||||
childrenAdded(new ArrayList<ProjectTreeNode>());
|
childrenAdded(new ArrayList<ProjectTreeNode>());
|
||||||
for (E node : this) {
|
for (E node : toList()) {
|
||||||
node.notifyCreated();
|
node.notifyCreated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,10 +216,15 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getDataType() {
|
public GameSource.Type getDataType() {
|
||||||
return parent.getDataType();
|
return parent.getDataType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return dataMap.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public void save(File jsonFile) {
|
public void save(File jsonFile) {
|
||||||
if (getDataType() != GameSource.Type.created && getDataType() != GameSource.Type.altered) {
|
if (getDataType() != GameSource.Type.created && getDataType() != GameSource.Type.altered) {
|
||||||
@@ -144,7 +232,7 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<Map> dataToSave = new ArrayList<Map>();
|
List<Map> dataToSave = new ArrayList<Map>();
|
||||||
for (E element : this) {
|
for (E element : toList()) {
|
||||||
if (element.jsonFile.equals(jsonFile)) {
|
if (element.jsonFile.equals(jsonFile)) {
|
||||||
dataToSave.add(element.toJson());
|
dataToSave.add(element.toJson());
|
||||||
}
|
}
|
||||||
@@ -161,7 +249,7 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
|
|||||||
|
|
||||||
String toWrite = FileUtils.toJsonString(dataToSave);
|
String toWrite = FileUtils.toJsonString(dataToSave);
|
||||||
if(FileUtils.writeStringToFile(toWrite, jsonFile, "JSON file '"+jsonFile.getAbsolutePath()+"'")){
|
if(FileUtils.writeStringToFile(toWrite, jsonFile, "JSON file '"+jsonFile.getAbsolutePath()+"'")){
|
||||||
for (E element : this) {
|
for (E element : dataMap.values()) {
|
||||||
element.state = GameDataElement.State.saved;
|
element.state = GameDataElement.State.saved;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,7 +261,8 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
|
|||||||
GameDataCategory<? extends JSONElement> impactedCategory = null;
|
GameDataCategory<? extends JSONElement> impactedCategory = null;
|
||||||
String impactedFileName = fileName;
|
String impactedFileName = fileName;
|
||||||
Map<String, Integer> containedIds = new LinkedHashMap<String, Integer>();
|
Map<String, Integer> containedIds = new LinkedHashMap<String, Integer>();
|
||||||
for (JSONElement node : this) {
|
ArrayList<E> list = toList();
|
||||||
|
for (JSONElement node : list) {
|
||||||
if (node.getDataType() == GameSource.Type.created && getProject().baseContent.gameData.getGameDataElement(node.getClass(), node.id) != null) {
|
if (node.getDataType() == GameSource.Type.created && getProject().baseContent.gameData.getGameDataElement(node.getClass(), node.id) != null) {
|
||||||
if (getProject().alteredContent.gameData.getGameDataElement(node.getClass(), node.id) != null) {
|
if (getProject().alteredContent.gameData.getGameDataElement(node.getClass(), node.id) != null) {
|
||||||
events.add(new SaveEvent(SaveEvent.Type.moveToAltered, node, true, "Element ID matches one already present in the altered game content. Change this ID before saving."));
|
events.add(new SaveEvent(SaveEvent.Type.moveToAltered, node, true, "Element ID matches one already present in the altered game content. Change this ID before saving."));
|
||||||
@@ -202,7 +291,7 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
|
|||||||
for (String key : containedIds.keySet()) {
|
for (String key : containedIds.keySet()) {
|
||||||
if (containedIds.get(key) > 1) {
|
if (containedIds.get(key) > 1) {
|
||||||
E node = null;
|
E node = null;
|
||||||
for (E n : this) {
|
for (E n : list) {
|
||||||
if (key.equals(n.id)) {
|
if (key.equals(n.id)) {
|
||||||
node = n;
|
node = n;
|
||||||
break;
|
break;
|
||||||
@@ -218,19 +307,15 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
|
|||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean remove(E o) {
|
|
||||||
int index = getProject().getNodeIndex(o);
|
|
||||||
boolean result = super.remove(o);
|
|
||||||
getProject().fireElementRemoved(o, index);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needsSaving() {
|
public boolean needsSaving() {
|
||||||
for (E node : this) {
|
for (E node : dataMap.values()) {
|
||||||
if (node.needsSaving()) return true;
|
if (node.needsSaving()) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import javax.swing.tree.TreeNode;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
public class GameDataSet implements ProjectTreeNode, Serializable {
|
public class GameDataSet implements ProjectTreeNode, Serializable {
|
||||||
@@ -67,7 +67,7 @@ public class GameDataSet implements ProjectTreeNode, Serializable {
|
|||||||
items = new GameDataCategory<Item>(this, Item.getStaticDesc());
|
items = new GameDataCategory<Item>(this, Item.getStaticDesc());
|
||||||
itemCategories = new GameDataCategory<ItemCategory>(this, ItemCategory.getStaticDesc());
|
itemCategories = new GameDataCategory<ItemCategory>(this, ItemCategory.getStaticDesc());
|
||||||
npcs = new GameDataCategory<NPC>(this, NPC.getStaticDesc());
|
npcs = new GameDataCategory<NPC>(this, NPC.getStaticDesc());
|
||||||
quests = new GameDataCategory<Quest>(this, Quest.getStaticDesc());
|
quests = new GameDataCategory<>(this, Quest.getStaticDesc());
|
||||||
|
|
||||||
v.add(actorConditions);
|
v.add(actorConditions);
|
||||||
v.add(dialogues);
|
v.add(dialogues);
|
||||||
@@ -159,7 +159,9 @@ public class GameDataSet implements ProjectTreeNode, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (parent.type != GameSource.Type.referenced) {
|
} else if (parent.type != GameSource.Type.referenced) {
|
||||||
for (File f : baseFolder.listFiles()) {
|
List<File> files = new ArrayList<File>(Arrays.stream(baseFolder.listFiles()).collect(Collectors.toList()));
|
||||||
|
Collections.sort(files,Comparator.comparing(x->x.getName()));
|
||||||
|
for (File f : files) {
|
||||||
if (f.getName().startsWith("actorconditions_")) {
|
if (f.getName().startsWith("actorconditions_")) {
|
||||||
ActorCondition.fromJson(f, actorConditions);
|
ActorCondition.fromJson(f, actorConditions);
|
||||||
} else if (f.getName().startsWith("conversationlist_")) {
|
} else if (f.getName().startsWith("conversationlist_")) {
|
||||||
@@ -256,82 +258,42 @@ public class GameDataSet implements ProjectTreeNode, Serializable {
|
|||||||
|
|
||||||
public ActorCondition getActorCondition(String id) {
|
public ActorCondition getActorCondition(String id) {
|
||||||
if (actorConditions == null) return null;
|
if (actorConditions == null) return null;
|
||||||
for (ActorCondition gde : actorConditions) {
|
return actorConditions.get(id);
|
||||||
if (id.equals(gde.id)) {
|
|
||||||
return gde;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dialogue getDialogue(String id) {
|
public Dialogue getDialogue(String id) {
|
||||||
if (dialogues == null) return null;
|
if (dialogues == null) return null;
|
||||||
for (Dialogue gde : dialogues) {
|
return dialogues.get(id);
|
||||||
if (id.equals(gde.id)) {
|
|
||||||
return gde;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Droplist getDroplist(String id) {
|
public Droplist getDroplist(String id) {
|
||||||
if (droplists == null) return null;
|
if (droplists == null) return null;
|
||||||
for (Droplist gde : droplists) {
|
return droplists.get(id);
|
||||||
if (id.equals(gde.id)) {
|
|
||||||
return gde;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item getItem(String id) {
|
public Item getItem(String id) {
|
||||||
if (items == null) return null;
|
if (items == null) return null;
|
||||||
for (Item gde : items) {
|
return items.get(id);
|
||||||
if (id.equals(gde.id)) {
|
|
||||||
return gde;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemCategory getItemCategory(String id) {
|
public ItemCategory getItemCategory(String id) {
|
||||||
if (itemCategories == null) return null;
|
if (itemCategories == null) return null;
|
||||||
for (ItemCategory gde : itemCategories) {
|
return itemCategories.get(id);
|
||||||
if (id.equals(gde.id)) {
|
|
||||||
return gde;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NPC getNPC(String id) {
|
public NPC getNPC(String id) {
|
||||||
if (npcs == null) return null;
|
if (npcs == null) return null;
|
||||||
for (NPC gde : npcs) {
|
return npcs.get(id);
|
||||||
if (id.equals(gde.id)) {
|
|
||||||
return gde;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NPC getNPCIgnoreCase(String id) {
|
public NPC getNPCIgnoreCase(String id) {
|
||||||
if (npcs == null) return null;
|
if (npcs == null) return null;
|
||||||
for (NPC gde : npcs) {
|
return npcs.getIgnoreCase(id);
|
||||||
if (id.equalsIgnoreCase(gde.id)) {
|
|
||||||
return gde;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Quest getQuest(String id) {
|
public Quest getQuest(String id) {
|
||||||
if (quests == null) return null;
|
if (quests == null) return null;
|
||||||
for (Quest gde : quests) {
|
return quests.get(id);
|
||||||
if (id.equals(gde.id)) {
|
|
||||||
return gde;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ public class Item extends JSONElement {
|
|||||||
public String description = null;
|
public String description = null;
|
||||||
public HitEffect hit_effect = null;
|
public HitEffect hit_effect = null;
|
||||||
public HitReceivedEffect hit_received_effect = null;
|
public HitReceivedEffect hit_received_effect = null;
|
||||||
|
public HitEffect miss_effect = null;
|
||||||
|
public HitReceivedEffect miss_received_effect = null;
|
||||||
public DeathEffect kill_effect = null;
|
public DeathEffect kill_effect = null;
|
||||||
public EquipEffect equip_effect = null;
|
public EquipEffect equip_effect = null;
|
||||||
|
|
||||||
@@ -193,6 +195,16 @@ public class Item extends JSONElement {
|
|||||||
this.hit_received_effect = parseHitReceivedEffect(hitReceivedEffect);
|
this.hit_received_effect = parseHitReceivedEffect(hitReceivedEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map missEffect = (Map) itemJson.get("missEffect");
|
||||||
|
if (missEffect != null) {
|
||||||
|
this.miss_effect = parseHitEffect(missEffect);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map missReceivedEffect = (Map) itemJson.get("missReceivedEffect");
|
||||||
|
if (missReceivedEffect != null) {
|
||||||
|
this.miss_received_effect = parseHitReceivedEffect(missReceivedEffect);
|
||||||
|
}
|
||||||
|
|
||||||
Map killEffect = (Map) itemJson.get("killEffect");
|
Map killEffect = (Map) itemJson.get("killEffect");
|
||||||
if (killEffect == null) {
|
if (killEffect == null) {
|
||||||
killEffect = (Map) itemJson.get("useEffect");
|
killEffect = (Map) itemJson.get("useEffect");
|
||||||
@@ -225,6 +237,8 @@ public class Item extends JSONElement {
|
|||||||
|
|
||||||
linkEffects(this.hit_effect, proj, this);
|
linkEffects(this.hit_effect, proj, this);
|
||||||
linkEffects(this.hit_received_effect, proj, this);
|
linkEffects(this.hit_received_effect, proj, this);
|
||||||
|
linkEffects(this.miss_effect, proj, this);
|
||||||
|
linkEffects(this.miss_received_effect, proj, this);
|
||||||
linkEffects(this.kill_effect, proj, this);
|
linkEffects(this.kill_effect, proj, this);
|
||||||
this.state = State.linked;
|
this.state = State.linked;
|
||||||
}
|
}
|
||||||
@@ -294,6 +308,14 @@ public class Item extends JSONElement {
|
|||||||
clone.hit_received_effect = new HitReceivedEffect();
|
clone.hit_received_effect = new HitReceivedEffect();
|
||||||
copyHitReceivedEffectValues(clone.hit_received_effect, this.hit_received_effect, clone);
|
copyHitReceivedEffectValues(clone.hit_received_effect, this.hit_received_effect, clone);
|
||||||
}
|
}
|
||||||
|
if (this.miss_effect != null) {
|
||||||
|
clone.miss_effect = new HitEffect();
|
||||||
|
copyHitEffectValues(clone.miss_effect, this.miss_effect, clone);
|
||||||
|
}
|
||||||
|
if (this.miss_received_effect != null) {
|
||||||
|
clone.miss_received_effect = new HitReceivedEffect();
|
||||||
|
copyHitReceivedEffectValues(clone.miss_received_effect, this.miss_received_effect, clone);
|
||||||
|
}
|
||||||
if (this.kill_effect != null) {
|
if (this.kill_effect != null) {
|
||||||
clone.kill_effect = new DeathEffect();
|
clone.kill_effect = new DeathEffect();
|
||||||
copyDeathEffectValues(clone.kill_effect, this.kill_effect, clone);
|
copyDeathEffectValues(clone.kill_effect, this.kill_effect, clone);
|
||||||
@@ -317,6 +339,18 @@ public class Item extends JSONElement {
|
|||||||
actorConditionElementChanged(this.hit_effect.conditions_source, oldOne, newOne, this);
|
actorConditionElementChanged(this.hit_effect.conditions_source, oldOne, newOne, this);
|
||||||
actorConditionElementChanged(this.hit_effect.conditions_target, oldOne, newOne, this);
|
actorConditionElementChanged(this.hit_effect.conditions_target, oldOne, newOne, this);
|
||||||
}
|
}
|
||||||
|
if (this.hit_received_effect != null) {
|
||||||
|
actorConditionElementChanged(this.hit_received_effect.conditions_source, oldOne, newOne, this);
|
||||||
|
actorConditionElementChanged(this.hit_received_effect.conditions_target, oldOne, newOne, this);
|
||||||
|
}
|
||||||
|
if (this.miss_effect != null) {
|
||||||
|
actorConditionElementChanged(this.miss_effect.conditions_source, oldOne, newOne, this);
|
||||||
|
actorConditionElementChanged(this.miss_effect.conditions_target, oldOne, newOne, this);
|
||||||
|
}
|
||||||
|
if (this.miss_received_effect != null) {
|
||||||
|
actorConditionElementChanged(this.miss_received_effect.conditions_source, oldOne, newOne, this);
|
||||||
|
actorConditionElementChanged(this.miss_received_effect.conditions_target, oldOne, newOne, this);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.kill_effect != null) {
|
if (this.kill_effect != null) {
|
||||||
actorConditionElementChanged(this.kill_effect.conditions_source, oldOne, newOne, this);
|
actorConditionElementChanged(this.kill_effect.conditions_source, oldOne, newOne, this);
|
||||||
@@ -381,6 +415,8 @@ public class Item extends JSONElement {
|
|||||||
}
|
}
|
||||||
writeHitEffectToMap(itemJson, this.hit_effect, "hitEffect");
|
writeHitEffectToMap(itemJson, this.hit_effect, "hitEffect");
|
||||||
writeHitReceivedEffectToMap(itemJson, this.hit_received_effect, "hitReceivedEffect");
|
writeHitReceivedEffectToMap(itemJson, this.hit_received_effect, "hitReceivedEffect");
|
||||||
|
writeHitEffectToMap(itemJson, this.miss_effect, "missEffect");
|
||||||
|
writeHitReceivedEffectToMap(itemJson, this.miss_received_effect, "missReceivedEffect");
|
||||||
|
|
||||||
String key;
|
String key;
|
||||||
if (this.category != null && this.category.action_type != null && this.category.action_type == ItemCategory.ActionType.equip) {
|
if (this.category != null && this.category.action_type != null && this.category.action_type == ItemCategory.ActionType.equip) {
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public class NPC extends JSONElement {
|
|||||||
public Integer attack_damage_min = null;
|
public Integer attack_damage_min = null;
|
||||||
public String spawngroup_id = null;
|
public String spawngroup_id = null;
|
||||||
public String faction_id = null;
|
public String faction_id = null;
|
||||||
|
public Integer horizontalFlipChance = null;
|
||||||
public String dialogue_id = null;
|
public String dialogue_id = null;
|
||||||
public String droplist_id = null;
|
public String droplist_id = null;
|
||||||
public Integer attack_cost = null;
|
public Integer attack_cost = null;
|
||||||
@@ -155,6 +156,7 @@ public class NPC extends JSONElement {
|
|||||||
}
|
}
|
||||||
this.spawngroup_id = (String) npcJson.get("spawnGroup");
|
this.spawngroup_id = (String) npcJson.get("spawnGroup");
|
||||||
this.faction_id = (String) npcJson.get("faction");
|
this.faction_id = (String) npcJson.get("faction");
|
||||||
|
this.horizontalFlipChance = JSONElement.getInteger((Number) npcJson.get("horizontalFlipChance"));
|
||||||
this.dialogue_id = (String) npcJson.get("phraseID");
|
this.dialogue_id = (String) npcJson.get("phraseID");
|
||||||
this.droplist_id = (String) npcJson.get("droplistID");
|
this.droplist_id = (String) npcJson.get("droplistID");
|
||||||
this.attack_cost = JSONElement.getInteger((Number) npcJson.get("attackCost"));
|
this.attack_cost = JSONElement.getInteger((Number) npcJson.get("attackCost"));
|
||||||
@@ -244,6 +246,7 @@ public class NPC extends JSONElement {
|
|||||||
}
|
}
|
||||||
clone.droplist_id = this.droplist_id;
|
clone.droplist_id = this.droplist_id;
|
||||||
clone.faction_id = this.faction_id;
|
clone.faction_id = this.faction_id;
|
||||||
|
clone.horizontalFlipChance = this.horizontalFlipChance;
|
||||||
if (this.hit_effect != null) {
|
if (this.hit_effect != null) {
|
||||||
clone.hit_effect = new HitEffect();
|
clone.hit_effect = new HitEffect();
|
||||||
copyHitEffectValues(clone.hit_effect, this.hit_effect, clone);
|
copyHitEffectValues(clone.hit_effect, this.hit_effect, clone);
|
||||||
@@ -302,6 +305,7 @@ public class NPC extends JSONElement {
|
|||||||
writeMinMaxToMap(npcJson, "attackDamage", this.attack_damage_min, attack_damage_max, 0);
|
writeMinMaxToMap(npcJson, "attackDamage", this.attack_damage_min, attack_damage_max, 0);
|
||||||
if (this.spawngroup_id != null) npcJson.put("spawnGroup", this.spawngroup_id);
|
if (this.spawngroup_id != null) npcJson.put("spawnGroup", this.spawngroup_id);
|
||||||
if (this.faction_id != null) npcJson.put("faction", this.faction_id);
|
if (this.faction_id != null) npcJson.put("faction", this.faction_id);
|
||||||
|
if (this.horizontalFlipChance != null) npcJson.put("horizontalFlipChance", this.horizontalFlipChance);
|
||||||
if (this.dialogue != null) {
|
if (this.dialogue != null) {
|
||||||
npcJson.put("phraseID", this.dialogue.id);
|
npcJson.put("phraseID", this.dialogue.id);
|
||||||
} else if (this.dialogue_id != null) {
|
} else if (this.dialogue_id != null) {
|
||||||
|
|||||||
@@ -186,5 +186,4 @@ public class Quest extends JSONElement {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ public class Requirement extends JSONElement {
|
|||||||
date,
|
date,
|
||||||
dateEquals,
|
dateEquals,
|
||||||
time,
|
time,
|
||||||
timeEquals
|
timeEquals,
|
||||||
|
skillIncrease
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SkillID {
|
public enum SkillID {
|
||||||
@@ -166,6 +167,7 @@ public class Requirement extends JSONElement {
|
|||||||
case dateEquals:
|
case dateEquals:
|
||||||
case time:
|
case time:
|
||||||
case timeEquals:
|
case timeEquals:
|
||||||
|
case skillIncrease:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this.required_obj != null) this.required_obj.addBacklink((GameDataElement) this.parent);
|
if (this.required_obj != null) this.required_obj.addBacklink((GameDataElement) this.parent);
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ public class PotGenerator {
|
|||||||
|
|
||||||
GameSource gsrc = proj.baseContent;
|
GameSource gsrc = proj.baseContent;
|
||||||
|
|
||||||
for (ActorCondition ac : gsrc.gameData.actorConditions) {
|
for (ActorCondition ac : gsrc.gameData.actorConditions.toList()) {
|
||||||
pushString(stringsResources, resourcesStrings, ac.display_name, getPotContextComment(ac));
|
pushString(stringsResources, resourcesStrings, ac.display_name, getPotContextComment(ac));
|
||||||
pushString(stringsResources, resourcesStrings, ac.description, getPotContextComment(ac) + ":description");
|
pushString(stringsResources, resourcesStrings, ac.description, getPotContextComment(ac) + ":description");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Dialogue d : gsrc.gameData.dialogues) {
|
for (Dialogue d : gsrc.gameData.dialogues.toList()) {
|
||||||
pushString(stringsResources, resourcesStrings, d.message, getPotContextComment(d));
|
pushString(stringsResources, resourcesStrings, d.message, getPotContextComment(d));
|
||||||
if (d.replies == null) continue;
|
if (d.replies == null) continue;
|
||||||
for (Dialogue.Reply r : d.replies) {
|
for (Dialogue.Reply r : d.replies) {
|
||||||
@@ -34,20 +34,20 @@ public class PotGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ItemCategory ic : gsrc.gameData.itemCategories) {
|
for (ItemCategory ic : gsrc.gameData.itemCategories.toList()) {
|
||||||
pushString(stringsResources, resourcesStrings, ic.name, getPotContextComment(ic));
|
pushString(stringsResources, resourcesStrings, ic.name, getPotContextComment(ic));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Item i : gsrc.gameData.items) {
|
for (Item i : gsrc.gameData.items.toList()) {
|
||||||
pushString(stringsResources, resourcesStrings, i.name, getPotContextComment(i));
|
pushString(stringsResources, resourcesStrings, i.name, getPotContextComment(i));
|
||||||
pushString(stringsResources, resourcesStrings, i.description, getPotContextComment(i) + ":description");
|
pushString(stringsResources, resourcesStrings, i.description, getPotContextComment(i) + ":description");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NPC npc : gsrc.gameData.npcs) {
|
for (NPC npc : gsrc.gameData.npcs.toList()) {
|
||||||
pushString(stringsResources, resourcesStrings, npc.name, getPotContextComment(npc));
|
pushString(stringsResources, resourcesStrings, npc.name, getPotContextComment(npc));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Quest q : gsrc.gameData.quests) {
|
for (Quest q : gsrc.gameData.quests.toList()) {
|
||||||
if (q.visible_in_log != null && q.visible_in_log != 0) {
|
if (q.visible_in_log != null && q.visible_in_log != 0) {
|
||||||
pushString(stringsResources, resourcesStrings, q.name, getPotContextComment(q));
|
pushString(stringsResources, resourcesStrings, q.name, getPotContextComment(q));
|
||||||
for (QuestStage qs : q.stages) {
|
for (QuestStage qs : q.stages) {
|
||||||
|
|||||||
@@ -3,10 +3,7 @@ package com.gpl.rpg.atcontentstudio.model.tools.resoptimizer;
|
|||||||
import com.gpl.rpg.atcontentstudio.io.JsonPrettyWriter;
|
import com.gpl.rpg.atcontentstudio.io.JsonPrettyWriter;
|
||||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||||
import com.gpl.rpg.atcontentstudio.model.gamedata.ActorCondition;
|
import com.gpl.rpg.atcontentstudio.model.gamedata.*;
|
||||||
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
|
|
||||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Item;
|
|
||||||
import com.gpl.rpg.atcontentstudio.model.gamedata.NPC;
|
|
||||||
import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
|
import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
|
||||||
import com.gpl.rpg.atcontentstudio.model.maps.TMXMapSet;
|
import com.gpl.rpg.atcontentstudio.model.maps.TMXMapSet;
|
||||||
import com.gpl.rpg.atcontentstudio.model.sprites.SpriteSheetSet;
|
import com.gpl.rpg.atcontentstudio.model.sprites.SpriteSheetSet;
|
||||||
@@ -81,12 +78,13 @@ public class ResourcesCompactor {
|
|||||||
File folder = new File(baseFolder.getAbsolutePath() + File.separator + GameDataSet.DEFAULT_REL_PATH_IN_SOURCE);
|
File folder = new File(baseFolder.getAbsolutePath() + File.separator + GameDataSet.DEFAULT_REL_PATH_IN_SOURCE);
|
||||||
if (!folder.exists()) folder.mkdirs();
|
if (!folder.exists()) folder.mkdirs();
|
||||||
|
|
||||||
for (ActorCondition ac : proj.baseContent.gameData.actorConditions) {
|
ArrayList<ActorCondition> actorConditions = proj.baseContent.gameData.actorConditions.toList();
|
||||||
|
for (ActorCondition ac : actorConditions) {
|
||||||
if (filesCovered.contains(ac.jsonFile)) continue;
|
if (filesCovered.contains(ac.jsonFile)) continue;
|
||||||
File currentFile = ac.jsonFile;
|
File currentFile = ac.jsonFile;
|
||||||
filesCovered.add(currentFile);
|
filesCovered.add(currentFile);
|
||||||
List<Map> dataToSave = new ArrayList<Map>();
|
List<Map> dataToSave = new ArrayList<Map>();
|
||||||
for (ActorCondition acond : proj.baseContent.gameData.actorConditions) {
|
for (ActorCondition acond : actorConditions) {
|
||||||
if (!acond.jsonFile.equals(currentFile)) continue;
|
if (!acond.jsonFile.equals(currentFile)) continue;
|
||||||
Map json = acond.toJson();
|
Map json = acond.toJson();
|
||||||
json.put("iconID", convertObjectSprite(acond.icon_id).toStringID());
|
json.put("iconID", convertObjectSprite(acond.icon_id).toStringID());
|
||||||
@@ -96,12 +94,13 @@ public class ResourcesCompactor {
|
|||||||
writeJson(dataToSave, target);
|
writeJson(dataToSave, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Item it : proj.baseContent.gameData.items) {
|
ArrayList<Item> items = proj.baseContent.gameData.items.toList();
|
||||||
|
for (Item it : items) {
|
||||||
if (filesCovered.contains(it.jsonFile)) continue;
|
if (filesCovered.contains(it.jsonFile)) continue;
|
||||||
File currentFile = it.jsonFile;
|
File currentFile = it.jsonFile;
|
||||||
filesCovered.add(currentFile);
|
filesCovered.add(currentFile);
|
||||||
List<Map> dataToSave = new ArrayList<Map>();
|
List<Map> dataToSave = new ArrayList<Map>();
|
||||||
for (Item item : proj.baseContent.gameData.items) {
|
for (Item item : items) {
|
||||||
if (!item.jsonFile.equals(currentFile)) continue;
|
if (!item.jsonFile.equals(currentFile)) continue;
|
||||||
Map json = item.toJson();
|
Map json = item.toJson();
|
||||||
json.put("iconID", convertObjectSprite(item.icon_id).toStringID());
|
json.put("iconID", convertObjectSprite(item.icon_id).toStringID());
|
||||||
@@ -112,12 +111,13 @@ public class ResourcesCompactor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (NPC np : proj.baseContent.gameData.npcs) {
|
ArrayList<NPC> npcs = proj.baseContent.gameData.npcs.toList();
|
||||||
|
for (NPC np : npcs) {
|
||||||
if (filesCovered.contains(np.jsonFile)) continue;
|
if (filesCovered.contains(np.jsonFile)) continue;
|
||||||
File currentFile = np.jsonFile;
|
File currentFile = np.jsonFile;
|
||||||
filesCovered.add(currentFile);
|
filesCovered.add(currentFile);
|
||||||
List<Map> dataToSave = new ArrayList<Map>();
|
List<Map> dataToSave = new ArrayList<Map>();
|
||||||
for (NPC npc : proj.baseContent.gameData.npcs) {
|
for (NPC npc : npcs) {
|
||||||
if (!npc.jsonFile.equals(currentFile)) continue;
|
if (!npc.jsonFile.equals(currentFile)) continue;
|
||||||
Map json = npc.toJson();
|
Map json = npc.toJson();
|
||||||
if (proj.getImage(npc.icon_id).getWidth(null) == TILE_WIDTH_IN_PIXELS || proj.getImage(npc.icon_id).getHeight(null) == TILE_HEIGHT_IN_PIXELS) {
|
if (proj.getImage(npc.icon_id).getWidth(null) == TILE_WIDTH_IN_PIXELS || proj.getImage(npc.icon_id).getHeight(null) == TILE_HEIGHT_IN_PIXELS) {
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ public class SaveItemsWizard extends JDialog {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
Map<GameDataCategory<JSONElement>, Set<File>> jsonToSave = new IdentityHashMap<GameDataCategory<JSONElement>, Set<File>>();
|
Map<GameDataCategory<JSONElement>, Set<File>> jsonToSave = new IdentityHashMap<>();
|
||||||
for (SaveEvent event : movedToCreatedList) {
|
for (SaveEvent event : movedToCreatedList) {
|
||||||
if (event.target instanceof JSONElement) {
|
if (event.target instanceof JSONElement) {
|
||||||
if (!jsonToSave.containsKey(event.target.getParent())) {
|
if (!jsonToSave.containsKey(event.target.getParent())) {
|
||||||
|
|||||||
@@ -145,20 +145,10 @@ public class StudioFrame extends JFrame {
|
|||||||
lafItem.addActionListener(new ActionListener() {
|
lafItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
String lookAndFeel = i.getClassName();
|
||||||
UIManager.setLookAndFeel(i.getClassName());
|
ATContentStudio.setLookAndFeel(lookAndFeel);
|
||||||
ATContentStudio.scaleUIFont();
|
SwingUtilities.updateComponentTreeUI(ATContentStudio.frame);
|
||||||
SwingUtilities.updateComponentTreeUI(ATContentStudio.frame);
|
ConfigCache.setFavoriteLaFClassName(lookAndFeel);
|
||||||
ConfigCache.setFavoriteLaFClassName(i.getClassName());
|
|
||||||
} catch (ClassNotFoundException e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
} catch (InstantiationException e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
} catch (IllegalAccessException e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
} catch (UnsupportedLookAndFeelException e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -231,5 +221,4 @@ public class StudioFrame extends JFrame {
|
|||||||
editors.showAbout();
|
editors.showAbout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public class WorkspaceActions {
|
|||||||
if (element.getParent() instanceof GameDataCategory<?>) {
|
if (element.getParent() instanceof GameDataCategory<?>) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
GameDataCategory<JSONElement> category = (GameDataCategory<JSONElement>) element.getParent();
|
GameDataCategory<JSONElement> category = (GameDataCategory<JSONElement>) element.getParent();
|
||||||
category.remove(element);
|
category.remove((JSONElement) element);
|
||||||
if (impactedCategories.get(category) == null) {
|
if (impactedCategories.get(category) == null) {
|
||||||
impactedCategories.put(category, new HashSet<File>());
|
impactedCategories.put(category, new HashSet<File>());
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ public class WorkspaceActions {
|
|||||||
node.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
node.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
||||||
if (node instanceof JSONElement) {
|
if (node instanceof JSONElement) {
|
||||||
if (node.getParent() instanceof GameDataCategory<?>) {
|
if (node.getParent() instanceof GameDataCategory<?>) {
|
||||||
((GameDataCategory<?>) node.getParent()).remove(node);
|
((GameDataCategory<?>) node.getParent()).removeGeneric((JSONElement) node);
|
||||||
List<SaveEvent> events = node.attemptSave();
|
List<SaveEvent> events = node.attemptSave();
|
||||||
if (events == null || events.isEmpty()) {
|
if (events == null || events.isEmpty()) {
|
||||||
node.save();
|
node.save();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class CommonEditor {
|
|||||||
private static final long serialVersionUID = 7987880146189575234L;
|
private static final long serialVersionUID = 7987880146189575234L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||||
if (c instanceof JLabel) {
|
if (c instanceof JLabel) {
|
||||||
JLabel label = (JLabel) c;
|
JLabel label = (JLabel) c;
|
||||||
@@ -68,7 +68,7 @@ public class CommonEditor {
|
|||||||
private static final long serialVersionUID = 7987880146189575234L;
|
private static final long serialVersionUID = 7987880146189575234L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||||
if (c instanceof JLabel) {
|
if (c instanceof JLabel) {
|
||||||
JLabel label = (JLabel) c;
|
JLabel label = (JLabel) c;
|
||||||
@@ -90,7 +90,7 @@ public class CommonEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class HitRecievedEffectPane<EFFECT extends Common.HitReceivedEffect, LIST_MODEL_SOURCE, ELEMENT extends Common.TimedActorConditionEffect, MODEL extends OrderedListenerListModel<LIST_MODEL_SOURCE, ELEMENT>> extends HitEffectPane<EFFECT, LIST_MODEL_SOURCE, ELEMENT, MODEL> {
|
public static class HitReceivedEffectPane<EFFECT extends Common.HitReceivedEffect> extends HitEffectPane<EFFECT> {
|
||||||
/// this should just be a convenience field, to access it, without casting. DO NOT SET WITHOUT ALSO SETTING THE FIELD IN THE SUPER-CLASS!
|
/// this should just be a convenience field, to access it, without casting. DO NOT SET WITHOUT ALSO SETTING THE FIELD IN THE SUPER-CLASS!
|
||||||
EFFECT effect;
|
EFFECT effect;
|
||||||
private JSpinner hitReceivedEffectHPMinTarget;
|
private JSpinner hitReceivedEffectHPMinTarget;
|
||||||
@@ -98,13 +98,14 @@ public class CommonEditor {
|
|||||||
private JSpinner hitReceivedEffectAPMinTarget;
|
private JSpinner hitReceivedEffectAPMinTarget;
|
||||||
private JSpinner hitReceivedEffectAPMaxTarget;
|
private JSpinner hitReceivedEffectAPMaxTarget;
|
||||||
|
|
||||||
public HitRecievedEffectPane(String title, Supplier<ELEMENT> sourceNewSupplier, Editor editor, String applyToHint, String applyToTargetHint) {
|
public HitReceivedEffectPane(String title, Editor editor, String applyToHint, String applyToTargetHint) {
|
||||||
super(title, sourceNewSupplier, editor, applyToHint, applyToTargetHint);
|
super(title, editor, applyToHint, applyToTargetHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createHitReceivedEffectPaneContent(FieldUpdateListener listener, boolean writable, EFFECT e, MODEL sourceConditionsModelInput, MODEL targetConditionsModelInput) {
|
@Override
|
||||||
|
public void createPaneContent(FieldUpdateListener listener, boolean writable, EFFECT e) {
|
||||||
effect = e;
|
effect = e;
|
||||||
createHitEffectPaneContent(listener, writable, e, sourceConditionsModelInput, targetConditionsModelInput);
|
super.createPaneContent(listener, writable, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -144,32 +145,35 @@ public class CommonEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class HitEffectPane<EFFECT extends Common.HitEffect, LIST_MODEL_SOURCE, ELEMENT extends Common.TimedActorConditionEffect, MODEL extends OrderedListenerListModel<LIST_MODEL_SOURCE, ELEMENT>> extends DeathEffectPane<EFFECT, LIST_MODEL_SOURCE, ELEMENT, MODEL> {
|
public static class HitEffectPane<EFFECT extends Common.HitEffect>
|
||||||
|
|
||||||
|
extends DeathEffectPane<EFFECT> {
|
||||||
/// this should just be a convenience field, to access it, without casting. DO NOT SET WITHOUT ALSO SETTING THE FIELD IN THE SUPER-CLASS!
|
/// this should just be a convenience field, to access it, without casting. DO NOT SET WITHOUT ALSO SETTING THE FIELD IN THE SUPER-CLASS!
|
||||||
public EFFECT effect;
|
public EFFECT effect;
|
||||||
|
|
||||||
protected final String applyToTargetHint;
|
protected final String applyToTargetHint;
|
||||||
private JList hitTargetConditionsList;
|
private JList<Common.TimedActorConditionEffect> hitTargetConditionsList;
|
||||||
private final ConditionEffectEditorPane<LIST_MODEL_SOURCE, ELEMENT, MODEL> hitTargetConditionPane;
|
private final ConditionEffectEditorPane<Common.HitEffect, TargetTimedConditionsListModel> hitTargetConditionPane;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create a new HitEffectPane with the selections (probably passed in from last time)
|
* create a new HitEffectPane with the selections (probably passed in from last time)
|
||||||
*/
|
*/
|
||||||
public HitEffectPane(String title, Supplier<ELEMENT> sourceNewSupplier, Editor editor, String applyToHint, String applyToTargetHint) {
|
public HitEffectPane(String title, Editor editor, String applyToHint, String applyToTargetHint) {
|
||||||
super(title, sourceNewSupplier, editor, applyToHint);
|
super(title, editor, applyToHint);
|
||||||
hitTargetConditionPane = new ConditionEffectEditorPane<>(editor);
|
hitTargetConditionPane = new ConditionEffectEditorPane<>(editor);
|
||||||
|
|
||||||
if (applyToTargetHint == null || applyToTargetHint == "") {
|
if (applyToTargetHint == null || applyToTargetHint.isEmpty()) {
|
||||||
this.applyToTargetHint = "";
|
this.applyToTargetHint = "";
|
||||||
} else {
|
} else {
|
||||||
this.applyToTargetHint = String.format(" (%s)", applyToTargetHint);
|
this.applyToTargetHint = String.format(" (%s)", applyToTargetHint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void createHitEffectPaneContent(FieldUpdateListener listener, boolean writable, EFFECT e, MODEL sourceConditionsModelInput, MODEL targetConditionsListModel) {
|
@Override
|
||||||
|
public void createPaneContent(FieldUpdateListener listener, boolean writable, EFFECT e) {
|
||||||
effect = e;
|
effect = e;
|
||||||
hitTargetConditionPane.conditionsModel = targetConditionsListModel;
|
hitTargetConditionPane.conditionsModel = new TargetTimedConditionsListModel(e);
|
||||||
createDeathEffectPaneContent(listener, writable, e, sourceConditionsModelInput);
|
super.createPaneContent(listener, writable, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -178,8 +182,8 @@ public class CommonEditor {
|
|||||||
|
|
||||||
String titleTarget = String.format("Actor Conditions applied to the target%s: ", applyToTargetHint);
|
String titleTarget = String.format("Actor Conditions applied to the target%s: ", applyToTargetHint);
|
||||||
CommonEditor.TimedConditionsCellRenderer cellRendererTarget = new CommonEditor.TimedConditionsCellRenderer();
|
CommonEditor.TimedConditionsCellRenderer cellRendererTarget = new CommonEditor.TimedConditionsCellRenderer();
|
||||||
BasicLambdaWithArg<ELEMENT> selectedSetTarget = (value) -> hitTargetConditionPane.selectedCondition = value;
|
BasicLambdaWithArg<Common.TimedActorConditionEffect> selectedSetTarget = (value) -> hitTargetConditionPane.selectedCondition = value;
|
||||||
BasicLambdaWithReturn<ELEMENT> selectedGetTarget = () -> hitTargetConditionPane.selectedCondition;
|
BasicLambdaWithReturn<Common.TimedActorConditionEffect> selectedGetTarget = () -> hitTargetConditionPane.selectedCondition;
|
||||||
BasicLambda selectedResetTarget = () -> hitTargetConditionPane.selectedCondition = null;
|
BasicLambda selectedResetTarget = () -> hitTargetConditionPane.selectedCondition = null;
|
||||||
BasicLambdaWithArg<JPanel> updatePaneTarget = (editorPane) -> hitTargetConditionPane.updateEffectTimedConditionEditorPane(
|
BasicLambdaWithArg<JPanel> updatePaneTarget = (editorPane) -> hitTargetConditionPane.updateEffectTimedConditionEditorPane(
|
||||||
editorPane, hitTargetConditionPane.selectedCondition, listener);
|
editorPane, hitTargetConditionPane.selectedCondition, listener);
|
||||||
@@ -212,8 +216,8 @@ public class CommonEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DeathEffectPane<EFFECT extends Common.DeathEffect, LIST_MODEL_SOURCE, ELEMENT extends Common.TimedActorConditionEffect, MODEL extends OrderedListenerListModel<LIST_MODEL_SOURCE, ELEMENT>> {
|
public static class DeathEffectPane<EFFECT extends Common.DeathEffect> {
|
||||||
protected final Supplier<ELEMENT> conditionSupplier;
|
protected final Supplier<Common.TimedActorConditionEffect> conditionSupplier;
|
||||||
protected final String title;
|
protected final String title;
|
||||||
protected final String applyToHint;
|
protected final String applyToHint;
|
||||||
|
|
||||||
@@ -224,28 +228,27 @@ public class CommonEditor {
|
|||||||
private JSpinner effectHPMax;
|
private JSpinner effectHPMax;
|
||||||
private JSpinner effectAPMin;
|
private JSpinner effectAPMin;
|
||||||
private JSpinner effectAPMax;
|
private JSpinner effectAPMax;
|
||||||
private JList<ELEMENT> sourceConditionsList;
|
private JList<Common.TimedActorConditionEffect> sourceConditionsList;
|
||||||
|
|
||||||
private final ConditionEffectEditorPane<LIST_MODEL_SOURCE, ELEMENT, MODEL> sourceConditionPane;
|
private final ConditionEffectEditorPane<Common.DeathEffect, SourceTimedConditionsListModel> sourceConditionPane;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create a new DeatchEffectPane with the selections (probably passed in from last time)
|
* create a new DeatchEffectPane with the selections (probably passed in from last time)
|
||||||
*/
|
*/
|
||||||
public DeathEffectPane(String title, Supplier<ELEMENT> conditionSupplier, Editor editor, String applyToHint) {
|
public DeathEffectPane(String title, Editor editor, String applyToHint) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.conditionSupplier = conditionSupplier;
|
this.conditionSupplier = Common.TimedActorConditionEffect::new;
|
||||||
this.sourceConditionPane = new ConditionEffectEditorPane<>(editor);
|
this.sourceConditionPane = new ConditionEffectEditorPane<>(editor);
|
||||||
if (applyToHint == null || applyToHint == "") {
|
if (applyToHint == null || applyToHint.isEmpty()) {
|
||||||
this.applyToHint = "";
|
this.applyToHint = "";
|
||||||
} else {
|
} else {
|
||||||
this.applyToHint = String.format(" (%s)", applyToHint);
|
this.applyToHint = String.format(" (%s)", applyToHint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void createPaneContent(FieldUpdateListener listener, boolean writable, EFFECT e) {
|
||||||
void createDeathEffectPaneContent(FieldUpdateListener listener, boolean writable, EFFECT e, MODEL sourceConditionsModel) {
|
|
||||||
effect = e;
|
effect = e;
|
||||||
sourceConditionPane.conditionsModel = sourceConditionsModel;
|
sourceConditionPane.conditionsModel = new SourceTimedConditionsListModel(e);
|
||||||
|
|
||||||
effectPane = new CollapsiblePanel(title);
|
effectPane = new CollapsiblePanel(title);
|
||||||
effectPane.setLayout(new JideBoxLayout(effectPane, JideBoxLayout.PAGE_AXIS));
|
effectPane.setLayout(new JideBoxLayout(effectPane, JideBoxLayout.PAGE_AXIS));
|
||||||
@@ -269,8 +272,8 @@ public class CommonEditor {
|
|||||||
protected void addLists(FieldUpdateListener listener, boolean writable) {
|
protected void addLists(FieldUpdateListener listener, boolean writable) {
|
||||||
String titleSource = String.format("Actor Conditions applied to the source%s: ", applyToHint);
|
String titleSource = String.format("Actor Conditions applied to the source%s: ", applyToHint);
|
||||||
TimedConditionsCellRenderer cellRendererSource = new TimedConditionsCellRenderer();
|
TimedConditionsCellRenderer cellRendererSource = new TimedConditionsCellRenderer();
|
||||||
BasicLambdaWithArg<ELEMENT> selectedSetSource = (value) -> sourceConditionPane.selectedCondition = value;
|
BasicLambdaWithArg<Common.TimedActorConditionEffect> selectedSetSource = (value) -> sourceConditionPane.selectedCondition = value;
|
||||||
BasicLambdaWithReturn<ELEMENT> selectedGetSource = () -> sourceConditionPane.selectedCondition;
|
BasicLambdaWithReturn<Common.TimedActorConditionEffect> selectedGetSource = () -> sourceConditionPane.selectedCondition;
|
||||||
BasicLambda selectedResetSource = () -> sourceConditionPane.selectedCondition = null;
|
BasicLambda selectedResetSource = () -> sourceConditionPane.selectedCondition = null;
|
||||||
BasicLambdaWithArg<JPanel> updatePaneSource = (editorPane) -> sourceConditionPane.updateEffectTimedConditionEditorPane(
|
BasicLambdaWithArg<JPanel> updatePaneSource = (editorPane) -> sourceConditionPane.updateEffectTimedConditionEditorPane(
|
||||||
editorPane, sourceConditionPane.selectedCondition, listener);
|
editorPane, sourceConditionPane.selectedCondition, listener);
|
||||||
@@ -309,9 +312,9 @@ public class CommonEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ConditionEffectEditorPane<LIST_MODEL_SOURCE, ELEMENT extends Common.TimedActorConditionEffect, MODEL extends OrderedListenerListModel<LIST_MODEL_SOURCE, ELEMENT>> {
|
static class ConditionEffectEditorPane<LIST_MODEL_SOURCE, MODEL extends OrderedListenerListModel<LIST_MODEL_SOURCE, Common.TimedActorConditionEffect> > {
|
||||||
private final Editor editor;
|
private final Editor editor;
|
||||||
ELEMENT selectedCondition;
|
Common.TimedActorConditionEffect selectedCondition;
|
||||||
|
|
||||||
MODEL conditionsModel;
|
MODEL conditionsModel;
|
||||||
Editor.MyComboBox conditionBox;
|
Editor.MyComboBox conditionBox;
|
||||||
@@ -328,7 +331,7 @@ public class CommonEditor {
|
|||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEffectTimedConditionWidgets(ELEMENT condition) {
|
public void updateEffectTimedConditionWidgets(Common.TimedActorConditionEffect condition) {
|
||||||
boolean writable = editor.target.writable;
|
boolean writable = editor.target.writable;
|
||||||
|
|
||||||
boolean immunity = condition.isImmunity();
|
boolean immunity = condition.isImmunity();
|
||||||
@@ -352,7 +355,7 @@ public class CommonEditor {
|
|||||||
conditionForever.setEnabled(!clear && writable);
|
conditionForever.setEnabled(!clear && writable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEffectTimedConditionEditorPane(JPanel pane, ELEMENT condition, final FieldUpdateListener listener) {
|
public void updateEffectTimedConditionEditorPane(JPanel pane, Common.TimedActorConditionEffect condition, final FieldUpdateListener listener) {
|
||||||
pane.removeAll();
|
pane.removeAll();
|
||||||
if (conditionBox != null) {
|
if (conditionBox != null) {
|
||||||
editor.removeElementListener(conditionBox);
|
editor.removeElementListener(conditionBox);
|
||||||
@@ -495,7 +498,7 @@ public class CommonEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setDurationToDefaultIfNone() {
|
private void setDurationToDefaultIfNone() {
|
||||||
if (selectedCondition.duration == null || selectedCondition.duration == ActorCondition.DURATION_NONE) {
|
if (selectedCondition.duration == null || selectedCondition.duration.equals(ActorCondition.DURATION_NONE)) {
|
||||||
selectedCondition.duration = 1;
|
selectedCondition.duration = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -610,6 +610,17 @@ public class DialogueEditor extends JSONElementEditor {
|
|||||||
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
|
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
|
||||||
requirementValue = addIntegerField(pane, "Exact time value: ", requirement.required_value, true, writable, listener);
|
requirementValue = addIntegerField(pane, "Exact time value: ", requirement.required_value, true, writable, listener);
|
||||||
break;
|
break;
|
||||||
|
case skillIncrease:
|
||||||
|
skillId = null;
|
||||||
|
try {
|
||||||
|
skillId = requirement.required_obj_id == null ? null : Requirement.SkillID.valueOf(requirement.required_obj_id);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
}
|
||||||
|
requirementObj = null;
|
||||||
|
requirementSkill = addEnumValueBox(pane, "Skill ID:", Requirement.SkillID.values(), skillId, writable, listener);
|
||||||
|
requirementObjId = null;//addTextField(pane, "Skill ID:", requirement.required_obj_id, writable, listener);
|
||||||
|
requirementValue = addIntegerField(pane, "Level up: ", requirement.required_value, false, writable, listener);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener);
|
requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener);
|
||||||
}
|
}
|
||||||
@@ -843,7 +854,7 @@ public class DialogueEditor extends JSONElementEditor {
|
|||||||
if (req.required_obj.getIcon() != null) {
|
if (req.required_obj.getIcon() != null) {
|
||||||
label.setIcon(new ImageIcon(req.required_obj.getIcon()));
|
label.setIcon(new ImageIcon(req.required_obj.getIcon()));
|
||||||
}
|
}
|
||||||
} else if (req.type == Requirement.RequirementType.skillLevel) {
|
} else if (req.type == Requirement.RequirementType.skillLevel || req.type == Requirement.RequirementType.skillIncrease) {
|
||||||
label.setIcon(new ImageIcon(DefaultIcons.getSkillIcon()));
|
label.setIcon(new ImageIcon(DefaultIcons.getSkillIcon()));
|
||||||
} else if (req.type == Requirement.RequirementType.spentGold) {
|
} else if (req.type == Requirement.RequirementType.spentGold) {
|
||||||
label.setIcon(new ImageIcon(DefaultIcons.getGoldIcon()));
|
label.setIcon(new ImageIcon(DefaultIcons.getGoldIcon()));
|
||||||
@@ -1008,7 +1019,7 @@ public class DialogueEditor extends JSONElementEditor {
|
|||||||
selectedRequirement.required_obj.removeBacklink(dialogue);
|
selectedRequirement.required_obj.removeBacklink(dialogue);
|
||||||
selectedRequirement.required_obj = null;
|
selectedRequirement.required_obj = null;
|
||||||
}
|
}
|
||||||
if (selectedRequirement.type == Requirement.RequirementType.skillLevel) {
|
if (selectedRequirement.type == Requirement.RequirementType.skillLevel || selectedRequirement.type == Requirement.RequirementType.skillIncrease) {
|
||||||
selectedRequirement.required_obj_id = value == null ? null : value.toString();
|
selectedRequirement.required_obj_id = value == null ? null : value.toString();
|
||||||
}
|
}
|
||||||
requirementsListModel.itemChanged(selectedRequirement);
|
requirementsListModel.itemChanged(selectedRequirement);
|
||||||
|
|||||||
@@ -76,9 +76,11 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
private JRadioButton equipConditionImmunity;
|
private JRadioButton equipConditionImmunity;
|
||||||
private JSpinner equipConditionMagnitude;
|
private JSpinner equipConditionMagnitude;
|
||||||
|
|
||||||
private CommonEditor.HitEffectPane hitEffectPane = new CommonEditor.HitEffectPane("Effect on every hit: ", TimedActorConditionEffect::new, this, null, null);
|
private final CommonEditor.HitEffectPane<HitEffect> hitEffectPane = new CommonEditor.HitEffectPane<>("Effect on every hit: ", this, null, "npc");
|
||||||
private CommonEditor.DeathEffectPane killEffectPane = new CommonEditor.DeathEffectPane(killLabel, TimedActorConditionEffect::new, this, null);
|
private final CommonEditor.DeathEffectPane<DeathEffect> killEffectPane = new CommonEditor.DeathEffectPane<>(killLabel, this, null);
|
||||||
private CommonEditor.HitRecievedEffectPane hitReceivedEffectPane = new CommonEditor.HitRecievedEffectPane("Effect on every hit received: ", TimedActorConditionEffect::new, this, null, null);
|
private final CommonEditor.HitReceivedEffectPane<HitReceivedEffect> hitReceivedEffectPane = new CommonEditor.HitReceivedEffectPane<>("Effect on every hit received: ", this, "player", "npc");
|
||||||
|
private final CommonEditor.HitEffectPane<HitEffect> missEffectPane = new CommonEditor.HitEffectPane<>("Effect on every miss: ", this, "player", "npc");
|
||||||
|
private final CommonEditor.HitReceivedEffectPane<HitReceivedEffect> missReceivedEffectPane = new CommonEditor.HitReceivedEffectPane<>("Effect on every miss received: ", this, "player", "npc");
|
||||||
|
|
||||||
public ItemEditor(Item item) {
|
public ItemEditor(Item item) {
|
||||||
super(item, item.getDesc(), item.getIcon());
|
super(item, item.getDesc(), item.getIcon());
|
||||||
@@ -86,7 +88,6 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
addEditorTab(json_view_id, getJSONView());
|
addEditorTab(json_view_id, getJSONView());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
|
||||||
@Override
|
@Override
|
||||||
public void insertFormViewDataField(JPanel pane) {
|
public void insertFormViewDataField(JPanel pane) {
|
||||||
|
|
||||||
@@ -111,11 +112,7 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
|
|
||||||
equipEffectPane = new CollapsiblePanel("Effect when equipped: ");
|
equipEffectPane = new CollapsiblePanel("Effect when equipped: ");
|
||||||
equipEffectPane.setLayout(new JideBoxLayout(equipEffectPane, JideBoxLayout.PAGE_AXIS));
|
equipEffectPane.setLayout(new JideBoxLayout(equipEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||||
if (item.equip_effect == null) {
|
equipEffect = Objects.requireNonNullElseGet(item.equip_effect, Item.EquipEffect::new);
|
||||||
equipEffect = new Item.EquipEffect();
|
|
||||||
} else {
|
|
||||||
equipEffect = item.equip_effect;
|
|
||||||
}
|
|
||||||
equipDmgMin = addIntegerField(equipEffectPane, "Attack Damage min: ", equipEffect.damage_boost_min, true, item.writable, listener);
|
equipDmgMin = addIntegerField(equipEffectPane, "Attack Damage min: ", equipEffect.damage_boost_min, true, item.writable, listener);
|
||||||
equipDmgMax = addIntegerField(equipEffectPane, "Attack Damage max: ", equipEffect.damage_boost_max, true, item.writable, listener);
|
equipDmgMax = addIntegerField(equipEffectPane, "Attack Damage max: ", equipEffect.damage_boost_max, true, item.writable, listener);
|
||||||
equipSetDM = addIntegerField(equipEffectPane, "Damage modifier %: ", equipEffect.damage_modifier, 100, false, item.writable, listener);
|
equipSetDM = addIntegerField(equipEffectPane, "Damage modifier %: ", equipEffect.damage_modifier, 100, false, item.writable, listener);
|
||||||
@@ -164,33 +161,38 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HitEffect hitEffect = Objects.requireNonNullElseGet(item.hit_effect, HitEffect::new);
|
HitEffect hitEffect = Objects.requireNonNullElseGet(item.hit_effect, HitEffect::new);
|
||||||
hitEffectPane.createHitEffectPaneContent(listener, item.writable, hitEffect,
|
hitEffectPane.createPaneContent(listener, item.writable, hitEffect);
|
||||||
new CommonEditor.SourceTimedConditionsListModel(hitEffect),
|
|
||||||
new CommonEditor.TargetTimedConditionsListModel(hitEffect));
|
|
||||||
pane.add(hitEffectPane.effectPane, JideBoxLayout.FIX);
|
pane.add(hitEffectPane.effectPane, JideBoxLayout.FIX);
|
||||||
|
|
||||||
DeathEffect killEffect = Objects.requireNonNullElseGet(item.kill_effect, DeathEffect::new);
|
DeathEffect killEffect = Objects.requireNonNullElseGet(item.kill_effect, DeathEffect::new);
|
||||||
killEffectPane.createDeathEffectPaneContent(listener, item.writable, killEffect,
|
killEffectPane.createPaneContent(listener, item.writable, killEffect);
|
||||||
new CommonEditor.SourceTimedConditionsListModel(killEffect));
|
|
||||||
pane.add(killEffectPane.effectPane, JideBoxLayout.FIX);
|
pane.add(killEffectPane.effectPane, JideBoxLayout.FIX);
|
||||||
|
|
||||||
HitReceivedEffect hitReceivedEffect = Objects.requireNonNullElseGet(item.hit_received_effect,
|
HitReceivedEffect hitReceivedEffect = Objects.requireNonNullElseGet(item.hit_received_effect, HitReceivedEffect::new);
|
||||||
HitReceivedEffect::new);
|
hitReceivedEffectPane.createPaneContent(listener, item.writable, hitReceivedEffect);
|
||||||
hitReceivedEffectPane.createHitReceivedEffectPaneContent(listener, item.writable, hitReceivedEffect,
|
pane.add(hitReceivedEffectPane.effectPane, JideBoxLayout.FIX);
|
||||||
new CommonEditor.SourceTimedConditionsListModel(
|
|
||||||
hitReceivedEffect),
|
|
||||||
new CommonEditor.TargetTimedConditionsListModel(
|
|
||||||
hitReceivedEffect));
|
|
||||||
pane.add(killEffectPane.effectPane, JideBoxLayout.FIX);
|
|
||||||
|
|
||||||
|
HitEffect missEffect = Objects.requireNonNullElseGet(item.miss_effect, HitEffect::new);
|
||||||
|
missEffectPane.createPaneContent(listener, item.writable, missEffect);
|
||||||
|
pane.add(missEffectPane.effectPane, JideBoxLayout.FIX);
|
||||||
|
|
||||||
|
HitReceivedEffect missReceivedEffect = Objects.requireNonNullElseGet(item.miss_received_effect, HitReceivedEffect::new);
|
||||||
|
missReceivedEffectPane.createPaneContent(listener, item.writable, missReceivedEffect);
|
||||||
|
pane.add(missReceivedEffectPane.effectPane, JideBoxLayout.FIX);
|
||||||
|
|
||||||
if (item.category == null || item.category.action_type == null || item.category.action_type == ItemCategory.ActionType.none) {
|
if (item.category == null || item.category.action_type == null || item.category.action_type == ItemCategory.ActionType.none) {
|
||||||
equipEffectPane.setVisible(false);
|
equipEffectPane.setVisible(false);
|
||||||
hitEffectPane.effectPane.setVisible(false);
|
hitEffectPane.effectPane.setVisible(false);
|
||||||
|
hitReceivedEffectPane.effectPane.setVisible(false);
|
||||||
|
missEffectPane.effectPane.setVisible(false);
|
||||||
|
missReceivedEffectPane.effectPane.setVisible(false);
|
||||||
killEffectPane.effectPane.setVisible(false);
|
killEffectPane.effectPane.setVisible(false);
|
||||||
} else if (item.category.action_type == ItemCategory.ActionType.use) {
|
} else if (item.category.action_type == ItemCategory.ActionType.use) {
|
||||||
equipEffectPane.setVisible(false);
|
equipEffectPane.setVisible(false);
|
||||||
hitEffectPane.effectPane.setVisible(false);
|
hitEffectPane.effectPane.setVisible(false);
|
||||||
|
hitReceivedEffectPane.effectPane.setVisible(false);
|
||||||
|
missEffectPane.effectPane.setVisible(false);
|
||||||
|
missReceivedEffectPane.effectPane.setVisible(false);
|
||||||
killEffectPane.effectPane.setVisible(true);
|
killEffectPane.effectPane.setVisible(true);
|
||||||
killEffectPane.effectPane.setTitle(useLabel);
|
killEffectPane.effectPane.setTitle(useLabel);
|
||||||
killEffectPane.effectPane.revalidate();
|
killEffectPane.effectPane.revalidate();
|
||||||
@@ -198,6 +200,9 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
} else if (item.category.action_type == ItemCategory.ActionType.equip) {
|
} else if (item.category.action_type == ItemCategory.ActionType.equip) {
|
||||||
equipEffectPane.setVisible(true);
|
equipEffectPane.setVisible(true);
|
||||||
hitEffectPane.effectPane.setVisible(true);
|
hitEffectPane.effectPane.setVisible(true);
|
||||||
|
hitReceivedEffectPane.effectPane.setVisible(true);
|
||||||
|
missEffectPane.effectPane.setVisible(true);
|
||||||
|
missReceivedEffectPane.effectPane.setVisible(true);
|
||||||
killEffectPane.effectPane.setVisible(true);
|
killEffectPane.effectPane.setVisible(true);
|
||||||
killEffectPane.effectPane.setTitle(killLabel);
|
killEffectPane.effectPane.setTitle(killLabel);
|
||||||
killEffectPane.effectPane.revalidate();
|
killEffectPane.effectPane.revalidate();
|
||||||
@@ -294,8 +299,8 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
@Override
|
@Override
|
||||||
public void valueChanged(JComponent source, Object value) {
|
public void valueChanged(JComponent source, Object value) {
|
||||||
Item item = (Item) target;
|
Item item = (Item) target;
|
||||||
boolean updatePrice, updateEquip, updateHit, updateKill, updateHitReceived;
|
boolean updatePrice, updateEquip, updateHit, updateMiss, updateKill, updateHitReceived, updateMissReceived;
|
||||||
updatePrice = updateEquip = updateHit = updateKill = updateHitReceived = false;
|
updatePrice = updateEquip = updateHit = updateMiss = updateKill = updateHitReceived = updateMissReceived = false;
|
||||||
if (source == idField) {
|
if (source == idField) {
|
||||||
//Events caused by cancel an ID edition. Dismiss.
|
//Events caused by cancel an ID edition. Dismiss.
|
||||||
if (skipNext) {
|
if (skipNext) {
|
||||||
@@ -362,10 +367,14 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
item.equip_effect = null;
|
item.equip_effect = null;
|
||||||
hitEffectPane.effectPane.setVisible(false);
|
hitEffectPane.effectPane.setVisible(false);
|
||||||
item.hit_effect = null;
|
item.hit_effect = null;
|
||||||
|
missEffectPane.effectPane.setVisible(false);
|
||||||
|
item.miss_effect = null;
|
||||||
killEffectPane.effectPane.setVisible(false);
|
killEffectPane.effectPane.setVisible(false);
|
||||||
item.kill_effect = null;
|
item.kill_effect = null;
|
||||||
hitReceivedEffectPane.effectPane.setVisible(false);
|
hitReceivedEffectPane.effectPane.setVisible(false);
|
||||||
item.hit_received_effect = null;
|
item.hit_received_effect = null;
|
||||||
|
missReceivedEffectPane.effectPane.setVisible(false);
|
||||||
|
item.miss_received_effect = null;
|
||||||
ItemEditor.this.revalidate();
|
ItemEditor.this.revalidate();
|
||||||
ItemEditor.this.repaint();
|
ItemEditor.this.repaint();
|
||||||
} else if (item.category.action_type == ItemCategory.ActionType.use) {
|
} else if (item.category.action_type == ItemCategory.ActionType.use) {
|
||||||
@@ -373,10 +382,14 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
item.equip_effect = null;
|
item.equip_effect = null;
|
||||||
hitEffectPane.effectPane.setVisible(false);
|
hitEffectPane.effectPane.setVisible(false);
|
||||||
item.hit_effect = null;
|
item.hit_effect = null;
|
||||||
|
missEffectPane.effectPane.setVisible(false);
|
||||||
|
item.miss_effect = null;
|
||||||
killEffectPane.effectPane.setVisible(true);
|
killEffectPane.effectPane.setVisible(true);
|
||||||
updateKill = true;
|
updateKill = true;
|
||||||
hitReceivedEffectPane.effectPane.setVisible(false);
|
hitReceivedEffectPane.effectPane.setVisible(false);
|
||||||
item.hit_received_effect = null;
|
item.hit_received_effect = null;
|
||||||
|
missReceivedEffectPane.effectPane.setVisible(false);
|
||||||
|
item.miss_received_effect = null;
|
||||||
updateHitReceived = true;
|
updateHitReceived = true;
|
||||||
updateEquip = true;
|
updateEquip = true;
|
||||||
killEffectPane.effectPane.setTitle(useLabel);
|
killEffectPane.effectPane.setTitle(useLabel);
|
||||||
@@ -385,9 +398,11 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
} else if (item.category.action_type == ItemCategory.ActionType.equip) {
|
} else if (item.category.action_type == ItemCategory.ActionType.equip) {
|
||||||
equipEffectPane.setVisible(true);
|
equipEffectPane.setVisible(true);
|
||||||
hitEffectPane.effectPane.setVisible(true);
|
hitEffectPane.effectPane.setVisible(true);
|
||||||
|
missEffectPane.effectPane.setVisible(true);
|
||||||
killEffectPane.effectPane.setVisible(true);
|
killEffectPane.effectPane.setVisible(true);
|
||||||
updateKill = true;
|
updateKill = true;
|
||||||
hitReceivedEffectPane.effectPane.setVisible(true);
|
hitReceivedEffectPane.effectPane.setVisible(true);
|
||||||
|
missReceivedEffectPane.effectPane.setVisible(true);
|
||||||
updateHitReceived = true;
|
updateHitReceived = true;
|
||||||
updateEquip = true;
|
updateEquip = true;
|
||||||
killEffectPane.effectPane.setTitle(killLabel);
|
killEffectPane.effectPane.setTitle(killLabel);
|
||||||
@@ -469,12 +484,18 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
} else if (hitEffectPane.valueChanged(source, value, item)) {
|
} else if (hitEffectPane.valueChanged(source, value, item)) {
|
||||||
updatePrice = true;
|
updatePrice = true;
|
||||||
updateHit = true;
|
updateHit = true;
|
||||||
|
} else if (missEffectPane.valueChanged(source, value, item)) {
|
||||||
|
updatePrice = true;
|
||||||
|
updateMiss = true;
|
||||||
} else if (killEffectPane.valueChanged(source, value, item)) {
|
} else if (killEffectPane.valueChanged(source, value, item)) {
|
||||||
updatePrice = true;
|
updatePrice = true;
|
||||||
updateKill = true;
|
updateKill = true;
|
||||||
} else if (hitReceivedEffectPane.valueChanged(source, value, item)) {
|
} else if (hitReceivedEffectPane.valueChanged(source, value, item)) {
|
||||||
updatePrice = true;
|
updatePrice = true;
|
||||||
updateHitReceived = true;
|
updateHitReceived = true;
|
||||||
|
} else if (missReceivedEffectPane.valueChanged(source, value, item)) {
|
||||||
|
updatePrice = true;
|
||||||
|
updateMissReceived = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateEquip) {
|
if (updateEquip) {
|
||||||
@@ -491,6 +512,13 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
item.hit_effect = hitEffectPane.effect;
|
item.hit_effect = hitEffectPane.effect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (updateMiss) {
|
||||||
|
if (missEffectPane.effect.isNull()) {
|
||||||
|
item.miss_effect = null;
|
||||||
|
} else {
|
||||||
|
item.miss_effect = missEffectPane.effect;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (updateKill) {
|
if (updateKill) {
|
||||||
if (killEffectPane.effect.isNull()) {
|
if (killEffectPane.effect.isNull()) {
|
||||||
item.kill_effect = null;
|
item.kill_effect = null;
|
||||||
@@ -505,6 +533,13 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
item.hit_received_effect = hitReceivedEffectPane.effect;
|
item.hit_received_effect = hitReceivedEffectPane.effect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (updateMissReceived) {
|
||||||
|
if (missReceivedEffectPane.effect.isNull()) {
|
||||||
|
item.miss_received_effect = null;
|
||||||
|
} else {
|
||||||
|
item.miss_received_effect = missReceivedEffectPane.effect;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (updatePrice && !manualPriceBox.isSelected()) {
|
if (updatePrice && !manualPriceBox.isSelected()) {
|
||||||
baseCostField.setValue(item.computePrice());
|
baseCostField.setValue(item.computePrice());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ public abstract class JSONElementEditor extends Editor {
|
|||||||
ATContentStudio.frame.closeEditor(node);
|
ATContentStudio.frame.closeEditor(node);
|
||||||
node.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
node.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
||||||
if (node.getParent() instanceof GameDataCategory<?>) {
|
if (node.getParent() instanceof GameDataCategory<?>) {
|
||||||
((GameDataCategory<?>) node.getParent()).remove(node);
|
((GameDataCategory<?>) node.getParent()).removeGeneric(node);
|
||||||
node.save();
|
node.save();
|
||||||
GameDataElement newOne = proj.getGameDataElement(node.getClass(), node.id);
|
GameDataElement newOne = proj.getGameDataElement(node.getClass(), node.id);
|
||||||
if (node instanceof Quest) {
|
if (node instanceof Quest) {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class NPCEditor extends JSONElementEditor {
|
|||||||
private JTextField nameField;
|
private JTextField nameField;
|
||||||
private JTextField spawnGroupField;
|
private JTextField spawnGroupField;
|
||||||
private JTextField factionField;
|
private JTextField factionField;
|
||||||
|
private JSpinner horizontalFlipChanceField;
|
||||||
private JSpinner experienceField;
|
private JSpinner experienceField;
|
||||||
private MyComboBox dialogueBox;
|
private MyComboBox dialogueBox;
|
||||||
private MyComboBox droplistBox;
|
private MyComboBox droplistBox;
|
||||||
@@ -59,10 +60,9 @@ public class NPCEditor extends JSONElementEditor {
|
|||||||
private JSpinner blockChance;
|
private JSpinner blockChance;
|
||||||
private JSpinner dmgRes;
|
private JSpinner dmgRes;
|
||||||
|
|
||||||
private CommonEditor.HitEffectPane hitEffectPane = new CommonEditor.HitEffectPane("Effect on every hit: ", TimedActorConditionEffect::new, this, null, null);
|
private final CommonEditor.HitEffectPane<HitEffect> hitEffectPane = new CommonEditor.HitEffectPane<>("Effect on every hit: ", this, null, "player");
|
||||||
private CommonEditor.HitRecievedEffectPane hitReceivedEffectPane = new CommonEditor.HitRecievedEffectPane("Effect on every hit received: ", TimedActorConditionEffect::new, this, "NPC",
|
private final CommonEditor.HitReceivedEffectPane<HitReceivedEffect> hitReceivedEffectPane = new CommonEditor.HitReceivedEffectPane<>("Effect on every hit received: ", this, "npc", "player");
|
||||||
"Attacker");
|
private final CommonEditor.DeathEffectPane<DeathEffect> deathEffectPane = new CommonEditor.DeathEffectPane<>("Effect when killed: ", this, null);
|
||||||
private CommonEditor.DeathEffectPane deathEffectPane = new CommonEditor.DeathEffectPane("Effect when killed: ", TimedActorConditionEffect::new, this, "Killer");
|
|
||||||
|
|
||||||
private JPanel dialogueGraphPane;
|
private JPanel dialogueGraphPane;
|
||||||
private DialogueGraphView dialogueGraphView;
|
private DialogueGraphView dialogueGraphView;
|
||||||
@@ -117,7 +117,6 @@ public class NPCEditor extends JSONElementEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
|
||||||
@Override
|
@Override
|
||||||
public void insertFormViewDataField(JPanel pane) {
|
public void insertFormViewDataField(JPanel pane) {
|
||||||
final NPC npc = (NPC) target;
|
final NPC npc = (NPC) target;
|
||||||
@@ -130,6 +129,7 @@ public class NPCEditor extends JSONElementEditor {
|
|||||||
nameField = addTranslatableTextField(pane, "Display name: ", npc.name, npc.writable, listener);
|
nameField = addTranslatableTextField(pane, "Display name: ", npc.name, npc.writable, listener);
|
||||||
spawnGroupField = addTextField(pane, "Spawn group ID: ", npc.spawngroup_id, npc.writable, listener);
|
spawnGroupField = addTextField(pane, "Spawn group ID: ", npc.spawngroup_id, npc.writable, listener);
|
||||||
factionField = addTextField(pane, "Faction ID: ", npc.faction_id, npc.writable, listener);
|
factionField = addTextField(pane, "Faction ID: ", npc.faction_id, npc.writable, listener);
|
||||||
|
horizontalFlipChanceField = addIntegerField(pane, "Horizontal flip chance: ", npc.horizontalFlipChance, false, npc.writable, listener);
|
||||||
experienceField = addIntegerField(pane, "Experience reward: ", npc.getMonsterExperience(), false, false, listener);
|
experienceField = addIntegerField(pane, "Experience reward: ", npc.getMonsterExperience(), false, false, listener);
|
||||||
dialogueBox = addDialogueBox(pane, npc.getProject(), "Initial phrase: ", npc.dialogue, npc.writable, listener);
|
dialogueBox = addDialogueBox(pane, npc.getProject(), "Initial phrase: ", npc.dialogue, npc.writable, listener);
|
||||||
droplistBox = addDroplistBox(pane, npc.getProject(), "Droplist / Shop inventory: ", npc.droplist, npc.writable, listener);
|
droplistBox = addDroplistBox(pane, npc.getProject(), "Droplist / Shop inventory: ", npc.droplist, npc.writable, listener);
|
||||||
@@ -151,23 +151,15 @@ public class NPCEditor extends JSONElementEditor {
|
|||||||
dmgRes = addIntegerField(combatTraitPane, "Damage resistance: ", npc.damage_resistance, false, npc.writable, listener);
|
dmgRes = addIntegerField(combatTraitPane, "Damage resistance: ", npc.damage_resistance, false, npc.writable, listener);
|
||||||
|
|
||||||
HitEffect hitEffect = Objects.requireNonNullElseGet(npc.hit_effect, HitEffect::new);
|
HitEffect hitEffect = Objects.requireNonNullElseGet(npc.hit_effect, HitEffect::new);
|
||||||
hitEffectPane.createHitEffectPaneContent(listener, npc.writable, hitEffect,
|
hitEffectPane.createPaneContent(listener, npc.writable, hitEffect);
|
||||||
new CommonEditor.SourceTimedConditionsListModel(hitEffect),
|
|
||||||
new CommonEditor.TargetTimedConditionsListModel(hitEffect));
|
|
||||||
combatTraitPane.add(hitEffectPane.effectPane, JideBoxLayout.FIX);
|
combatTraitPane.add(hitEffectPane.effectPane, JideBoxLayout.FIX);
|
||||||
|
|
||||||
HitReceivedEffect hitReceivedEffect = Objects.requireNonNullElseGet(npc.hit_received_effect,
|
HitReceivedEffect hitReceivedEffect = Objects.requireNonNullElseGet(npc.hit_received_effect, HitReceivedEffect::new);
|
||||||
HitReceivedEffect::new);
|
hitReceivedEffectPane.createPaneContent(listener, npc.writable, hitReceivedEffect);
|
||||||
hitReceivedEffectPane.createHitReceivedEffectPaneContent(listener, npc.writable, hitReceivedEffect,
|
|
||||||
new CommonEditor.SourceTimedConditionsListModel(
|
|
||||||
hitReceivedEffect),
|
|
||||||
new CommonEditor.TargetTimedConditionsListModel(
|
|
||||||
hitReceivedEffect));
|
|
||||||
combatTraitPane.add(hitReceivedEffectPane.effectPane, JideBoxLayout.FIX);
|
combatTraitPane.add(hitReceivedEffectPane.effectPane, JideBoxLayout.FIX);
|
||||||
|
|
||||||
DeathEffect deathEffect = Objects.requireNonNullElseGet(npc.death_effect, DeathEffect::new);
|
DeathEffect deathEffect = Objects.requireNonNullElseGet(npc.death_effect, DeathEffect::new);
|
||||||
deathEffectPane.createDeathEffectPaneContent(listener, npc.writable, deathEffect,
|
deathEffectPane.createPaneContent(listener, npc.writable, deathEffect);
|
||||||
new CommonEditor.SourceTimedConditionsListModel(deathEffect));
|
|
||||||
combatTraitPane.add(deathEffectPane.effectPane, JideBoxLayout.FIX);
|
combatTraitPane.add(deathEffectPane.effectPane, JideBoxLayout.FIX);
|
||||||
|
|
||||||
pane.add(combatTraitPane, JideBoxLayout.FIX);
|
pane.add(combatTraitPane, JideBoxLayout.FIX);
|
||||||
@@ -215,6 +207,8 @@ public class NPCEditor extends JSONElementEditor {
|
|||||||
npc.spawngroup_id = (String) value;
|
npc.spawngroup_id = (String) value;
|
||||||
} else if (source == factionField) {
|
} else if (source == factionField) {
|
||||||
npc.faction_id = (String) value;
|
npc.faction_id = (String) value;
|
||||||
|
} else if (source == horizontalFlipChanceField) {
|
||||||
|
npc.horizontalFlipChance = (Integer) value;
|
||||||
} else if (source == dialogueBox) {
|
} else if (source == dialogueBox) {
|
||||||
if (npc.dialogue != null) {
|
if (npc.dialogue != null) {
|
||||||
npc.dialogue.removeBacklink(npc);
|
npc.dialogue.removeBacklink(npc);
|
||||||
|
|||||||
@@ -674,6 +674,16 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
|
|||||||
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
|
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
|
||||||
requirementValue = addIntegerField(pane, "Exact time value: ", requirement.required_value, true, writable, listener);
|
requirementValue = addIntegerField(pane, "Exact time value: ", requirement.required_value, true, writable, listener);
|
||||||
break;
|
break;
|
||||||
|
case skillIncrease:
|
||||||
|
skillId = null;
|
||||||
|
try {
|
||||||
|
skillId = requirement.required_obj_id == null ? null : Requirement.SkillID.valueOf(requirement.required_obj_id);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
}
|
||||||
|
requirementObj = addEnumValueBox(pane, "Skill ID:", Requirement.SkillID.values(), skillId, writable, listener);
|
||||||
|
requirementObjId = null;//addTextField(pane, "Skill ID:", requirement.required_obj_id, writable, listener);
|
||||||
|
requirementValue = addIntegerField(pane, "Level: ", requirement.required_value, false, writable, listener);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener);
|
requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener);
|
||||||
@@ -1921,7 +1931,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
|
|||||||
} else if (source == requirementObj) {
|
} else if (source == requirementObj) {
|
||||||
if (selectedMapObject instanceof KeyArea) {
|
if (selectedMapObject instanceof KeyArea) {
|
||||||
KeyArea area = (KeyArea) selectedMapObject;
|
KeyArea area = (KeyArea) selectedMapObject;
|
||||||
if (area.requirement.type == Requirement.RequirementType.skillLevel) {
|
if (area.requirement.type == Requirement.RequirementType.skillLevel || area.requirement.type == Requirement.RequirementType.skillIncrease) {
|
||||||
area.requirement.required_obj_id = value == null ? null : value.toString();
|
area.requirement.required_obj_id = value == null ? null : value.toString();
|
||||||
} else {
|
} else {
|
||||||
area.requirement.required_obj = (GameDataElement) value;
|
area.requirement.required_obj = (GameDataElement) value;
|
||||||
@@ -1938,7 +1948,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
|
|||||||
}
|
}
|
||||||
} else if (selectedMapObject instanceof ReplaceArea) {
|
} else if (selectedMapObject instanceof ReplaceArea) {
|
||||||
ReplaceArea area = (ReplaceArea) selectedMapObject;
|
ReplaceArea area = (ReplaceArea) selectedMapObject;
|
||||||
if (area.requirement.type == Requirement.RequirementType.skillLevel) {
|
if (area.requirement.type == Requirement.RequirementType.skillLevel || area.requirement.type == Requirement.RequirementType.skillIncrease) {
|
||||||
area.requirement.required_obj_id = value == null ? null : value.toString();
|
area.requirement.required_obj_id = value == null ? null : value.toString();
|
||||||
} else {
|
} else {
|
||||||
area.requirement.required_obj = (GameDataElement) value;
|
area.requirement.required_obj = (GameDataElement) value;
|
||||||
|
|||||||
Reference in New Issue
Block a user