version nbr 6.20

new requirements: date, dateEquals, time, timeEquals
new rewards: mapchange
This commit is contained in:
Nut.andor
2023-10-03 21:19:49 +02:00
parent b2584a24cc
commit 2bc8b65264
10 changed files with 134 additions and 55 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jardesc> <jardesc>
<jar path="ATContentStudio/ATCS_v0.6.19.jar"/> <jar path="ATContentStudio/ATCS_v0.6.20.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/ATContentStudio/ATCS_JAR.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/> <options buildIfNeeded="true" compress="true" descriptionLocation="/ATContentStudio/ATCS_JAR.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/> <storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/> <selectedProjects/>

View File

@@ -1,6 +1,6 @@
!include MUI2.nsh !include MUI2.nsh
!define VERSION "0.6.19" !define VERSION "0.6.20"
!define TRAINER_VERSION "0.1.5" !define TRAINER_VERSION "0.1.5"
!define JAVA_BIN "java" !define JAVA_BIN "java"
@@ -88,7 +88,7 @@ Section install
file "C:\AT\ATCS_source\lib\AndorsTrainer_v${TRAINER_VERSION}.jar" file "C:\AT\ATCS_source\lib\AndorsTrainer_v${TRAINER_VERSION}.jar"
file "C:\AT\ATCS_source\lib\junit-4.10.jar" file "C:\AT\ATCS_source\lib\junit-4.10.jar"
file "C:\AT\ATCS_source\lib\json_simple-1.1.jar" file "C:\AT\ATCS_source\lib\json_simple-1.1.jar"
file "C:\AT\temp\ATCS_v0.6.19\ATCS_v${VERSION}.jar" file "C:\AT\temp\ATCS_v0.6.20\ATCS_v${VERSION}.jar"
file "C:\AT\ATCS_source\lib\rsyntaxtextarea.jar" file "C:\AT\ATCS_source\lib\rsyntaxtextarea.jar"
file "C:\AT\ATCS_source\lib\prefuse.jar" file "C:\AT\ATCS_source\lib\prefuse.jar"
file "C:\AT\ATCS_source\lib\bsh-2.0b4.jar" file "C:\AT\ATCS_source\lib\bsh-2.0b4.jar"

View File

@@ -39,24 +39,24 @@ import com.gpl.rpg.atcontentstudio.ui.StudioFrame;
import com.gpl.rpg.atcontentstudio.ui.WorkerDialog; import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector; import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
public class ATContentStudio { public class ATContentStudio {
public static final String APP_NAME = "Andor's Trail Content Studio"; public static final String APP_NAME = "Andor's Trail Content Studio";
public static final String APP_VERSION = "v0.6.19"; public static final String APP_VERSION = "v0.6.20";
public static final String CHECK_UPDATE_URL = "https://andorstrail.com/static/ATCS_latest"; public static final String CHECK_UPDATE_URL = "https://andorstrail.com/static/ATCS_latest";
public static final String DOWNLOAD_URL = "https://andorstrail.com/viewtopic.php?f=6&t=4806"; public static final String DOWNLOAD_URL = "https://andorstrail.com/viewtopic.php?f=6&t=4806";
public static final String FONT_SCALE_ENV_VAR_NAME = "FONT_SCALE"; public static final String FONT_SCALE_ENV_VAR_NAME = "FONT_SCALE";
public static boolean STARTED = false; public static boolean STARTED = false;
public static float SCALING=1.0f; public static float SCALING = 1.0f;
public static StudioFrame frame = null; public static StudioFrame frame = null;
//Need to keep a strong reference to it, to avoid garbage collection that'll reset these loggers. // Need to keep a strong reference to it, to avoid garbage collection that'll
// reset these loggers.
public static final List<Logger> configuredLoggers = new LinkedList<Logger>(); public static final List<Logger> configuredLoggers = new LinkedList<Logger>();
/** /**
* @param args * @param args
*/ */
@@ -66,18 +66,19 @@ public class ATContentStudio {
if (fontScaling != null) { if (fontScaling != null) {
try { try {
fontScale = Float.parseFloat(fontScaling); fontScale = Float.parseFloat(fontScaling);
SCALING=fontScale; SCALING = fontScale;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
System.err.println("Failed to parse font scaling parameter. Using default."); System.err.println("Failed to parse font scaling parameter. Using default.");
e.printStackTrace(); e.printStackTrace();
} }
} }
ConfigCache.init(); ConfigCache.init();
try { try {
String laf = ConfigCache.getFavoriteLaFClassName(); String laf = ConfigCache.getFavoriteLaFClassName();
if (laf == null) laf = UIManager.getSystemLookAndFeelClassName(); if (laf == null)
laf = UIManager.getSystemLookAndFeelClassName();
UIManager.setLookAndFeel(laf); UIManager.setLookAndFeel(laf);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
@@ -88,37 +89,40 @@ public class ATContentStudio {
} catch (UnsupportedLookAndFeelException e) { } catch (UnsupportedLookAndFeelException e) {
e.printStackTrace(); e.printStackTrace();
} }
scaleUIFont(); scaleUIFont();
//Need to keep a strong reference to it, to avoid garbage collection that'll reset this setting. // Need to keep a strong reference to it, to avoid garbage collection that'll
// reset this setting.
Logger l = Logger.getLogger(ExpressionParser.class.getName()); Logger l = Logger.getLogger(ExpressionParser.class.getName());
l.setLevel(Level.OFF); l.setLevel(Level.OFF);
configuredLoggers.add(l); configuredLoggers.add(l);
final WorkspaceSelector wsSelect = new WorkspaceSelector(); final WorkspaceSelector wsSelect = new WorkspaceSelector();
wsSelect.pack(); wsSelect.pack();
Dimension sdim = Toolkit.getDefaultToolkit().getScreenSize(); Dimension sdim = Toolkit.getDefaultToolkit().getScreenSize();
Dimension wdim = wsSelect.getSize(); Dimension wdim = wsSelect.getSize();
wsSelect.setLocation((sdim.width - wdim.width)/2, (sdim.height - wdim.height)/2); wsSelect.setLocation((sdim.width - wdim.width) / 2, (sdim.height - wdim.height) / 2);
wsSelect.setVisible(true); wsSelect.setVisible(true);
wsSelect.addWindowListener(new WindowAdapter() { wsSelect.addWindowListener(new WindowAdapter() {
@Override @Override
public synchronized void windowClosed(WindowEvent e) { public synchronized void windowClosed(WindowEvent e) {
if (wsSelect.selected != null && !STARTED) { if (wsSelect.selected != null && !STARTED) {
ATContentStudio.STARTED = true; ATContentStudio.STARTED = true;
final File workspaceRoot = new File(wsSelect.selected); final File workspaceRoot = new File(wsSelect.selected);
WorkerDialog.showTaskMessage("Loading your workspace...", null, new Runnable(){ WorkerDialog.showTaskMessage("Loading your workspace...", null, new Runnable() {
public void run() { public void run() {
Workspace.setActive(workspaceRoot); Workspace.setActive(workspaceRoot);
if (Workspace.activeWorkspace.settings.useInternet.getCurrentValue() && Workspace.activeWorkspace.settings.checkUpdates.getCurrentValue()) { if (Workspace.activeWorkspace.settings.useInternet.getCurrentValue()
&& Workspace.activeWorkspace.settings.checkUpdates.getCurrentValue()) {
new Thread() { new Thread() {
public void run() {checkUpdate();} public void run() {
checkUpdate();
}
}.start(); }.start();
} }
frame = new StudioFrame(APP_NAME+" "+APP_VERSION); frame = new StudioFrame(APP_NAME + " " + APP_VERSION);
frame.setVisible(true); frame.setVisible(true);
frame.setDefaultCloseOperation(StudioFrame.DO_NOTHING_ON_CLOSE); frame.setDefaultCloseOperation(StudioFrame.DO_NOTHING_ON_CLOSE);
}; };
@@ -138,7 +142,7 @@ public class ATContentStudio {
} }
}); });
} }
private static void checkUpdate() { private static void checkUpdate() {
BufferedReader in = null; BufferedReader in = null;
try { try {
@@ -146,32 +150,34 @@ public class ATContentStudio {
in = new BufferedReader(new InputStreamReader(url.openStream())); in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine, lastLine = null; String inputLine, lastLine = null;
while ((inputLine = in.readLine()) != null) {lastLine = inputLine;} while ((inputLine = in.readLine()) != null) {
lastLine = inputLine;
}
if (lastLine != null && !lastLine.equals(APP_VERSION)) { if (lastLine != null && !lastLine.equals(APP_VERSION)) {
// for copying style
JLabel label = new JLabel();
Font font = label.getFont();
Color color = label.getBackground();
// create some css from the label's font // for copying style
StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";"); JLabel label = new JLabel();
style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";"); Font font = label.getFont();
style.append("font-size:" + font.getSize() + "pt;"); Color color = label.getBackground();
style.append("background-color: rgb("+color.getRed()+","+color.getGreen()+","+color.getBlue()+");");
// create some css from the label's font
JEditorPane ep = new JEditorPane("text/html", "<html><body style=\"" + style + "\">" StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";");
+ "You are not running the latest ATCS version.<br/>" style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
+ "You can get the latest version ("+lastLine+") by clicking the link below.<br/>" style.append("font-size:" + font.getSize() + "pt;");
+ "<a href=\""+DOWNLOAD_URL+"\">"+DOWNLOAD_URL+"</a><br/>" style.append("background-color: rgb(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue()
+ "<br/>" + ");");
+ "</body></html>");
JEditorPane ep = new JEditorPane("text/html",
"<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/>"
+ "<a href=\"" + DOWNLOAD_URL + "\">" + DOWNLOAD_URL + "</a><br/>" + "<br/>"
+ "</body></html>");
ep.setEditable(false); ep.setEditable(false);
ep.setBorder(null); ep.setBorder(null);
ep.addHyperlinkListener(new HyperlinkListener() { ep.addHyperlinkListener(new HyperlinkListener() {
@Override @Override
public void hyperlinkUpdate(HyperlinkEvent e) { public void hyperlinkUpdate(HyperlinkEvent e) {
try { try {
@@ -185,7 +191,7 @@ public class ATContentStudio {
} }
} }
}); });
JOptionPane.showMessageDialog(null, ep, "Update available", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, ep, "Update available", JOptionPane.INFORMATION_MESSAGE);
} }
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
@@ -194,16 +200,17 @@ public class ATContentStudio {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
try { try {
if (in != null) in.close(); if (in != null)
in.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
public static void scaleUIFont() { public static void scaleUIFont() {
if (SCALING != 1.0f) { if (SCALING != 1.0f) {
System.out.println("Scaling fonts to "+SCALING); System.out.println("Scaling fonts to " + SCALING);
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); UIDefaults defaults = UIManager.getLookAndFeelDefaults();
Map<Object, Object> newDefaults = new HashMap<Object, Object>(); Map<Object, Object> newDefaults = new HashMap<Object, Object>();
for (Enumeration<Object> e = defaults.keys(); e.hasMoreElements();) { for (Enumeration<Object> e = defaults.keys(); e.hasMoreElements();) {
@@ -211,7 +218,7 @@ public class ATContentStudio {
Object value = defaults.get(key); Object value = defaults.get(key);
if (value instanceof Font) { if (value instanceof Font) {
Font font = (Font) value; Font font = (Font) value;
int newSize = (int)(font.getSize() * SCALING); int newSize = (int) (font.getSize() * SCALING);
if (value instanceof FontUIResource) { if (value instanceof FontUIResource) {
newDefaults.put(key, new FontUIResource(font.getName(), font.getStyle(), newSize)); newDefaults.put(key, new FontUIResource(font.getName(), font.getStyle(), newSize));
} else { } else {

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 B

View File

@@ -68,7 +68,8 @@ public class Dialogue extends JSONElement {
deactivateSpawnArea, deactivateSpawnArea,
activateMapObjectGroup, activateMapObjectGroup,
deactivateMapObjectGroup, deactivateMapObjectGroup,
changeMapFilter changeMapFilter,
mapchange
} }
} }
@@ -249,6 +250,7 @@ public class Dialogue extends JSONElement {
case removeSpawnArea: case removeSpawnArea:
case deactivateSpawnArea: case deactivateSpawnArea:
case changeMapFilter: case changeMapFilter:
case mapchange:
reward.map = reward.map_name != null ? proj.getMap(reward.map_name) : null; reward.map = reward.map_name != null ? proj.getMap(reward.map_name) : null;
break; break;
case actorCondition: case actorCondition:

View File

@@ -60,7 +60,11 @@ public class Requirement extends JSONElement {
factionScore, factionScore,
random, random,
factionScoreEquals, factionScoreEquals,
wearRemove wearRemove,
date,
dateEquals,
time,
timeEquals
} }
public enum SkillID { public enum SkillID {
@@ -196,6 +200,10 @@ public class Requirement extends JSONElement {
case factionScore: case factionScore:
case factionScoreEquals: case factionScoreEquals:
case random: case random:
case date:
case dateEquals:
case time:
case timeEquals:
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);

View File

@@ -260,6 +260,14 @@ public class DefaultIcons {
public static Image getTimerImage() { return getImage(TIMER_RES); } public static Image getTimerImage() { return getImage(TIMER_RES); }
public static Image getTimerIcon() { return getIcon(TIMER_RES); } public static Image getTimerIcon() { return getIcon(TIMER_RES); }
private static String DATE_RES = "/com/gpl/rpg/atcontentstudio/img/date.png";
public static Image getDateImage() { return getImage(DATE_RES); }
public static Image getDateIcon() { return getIcon(DATE_RES); }
private static String TIME_RES = "/com/gpl/rpg/atcontentstudio/img/date.png";
public static Image getTimeImage() { return getImage(TIME_RES); }
public static Image getTimeIcon() { return getIcon(TIME_RES); }
private static String ALIGNMENT_RES = "/com/gpl/rpg/atcontentstudio/img/alignment.png"; private static String ALIGNMENT_RES = "/com/gpl/rpg/atcontentstudio/img/alignment.png";
public static Image getAlignmentImage() { return getImage(ALIGNMENT_RES); } public static Image getAlignmentImage() { return getImage(ALIGNMENT_RES); }
public static Image getAlignmentIcon() { return getIcon(ALIGNMENT_RES); } public static Image getAlignmentIcon() { return getIcon(ALIGNMENT_RES); }
@@ -273,7 +281,7 @@ public class DefaultIcons {
public static Image getStatusOrangeIcon() { return getIcon(STATUS_ORANGE_RES); } public static Image getStatusOrangeIcon() { return getIcon(STATUS_ORANGE_RES); }
private static String STATUS_GREEN_RES = "/com/gpl/rpg/atcontentstudio/img/status_green.png"; private static String STATUS_GREEN_RES = "/com/gpl/rpg/atcontentstudio/img/status_green.png";
public static Image getStatusGreenImage() { return getImage(STATUS_GREEN_RES); } public static Image getStatusGreenImage() { return getImage(STATUS_GREEN_RES); }
public static Image getStatusGreenIcon() { return getIcon(STATUS_GREEN_RES); } public static Image getStatusGreenIcon() { return getIcon(STATUS_GREEN_RES); }
private static String STATUS_BLUE_RES = "/com/gpl/rpg/atcontentstudio/img/status_blue.png"; private static String STATUS_BLUE_RES = "/com/gpl/rpg/atcontentstudio/img/status_blue.png";

View File

@@ -384,6 +384,13 @@ public class DialogueEditor extends JSONElementEditor {
rewardObj = null; rewardObj = null;
rewardValue = null; rewardValue = null;
break; break;
case mapchange:
rewardMap = addMapBox(pane, ((Dialogue)target).getProject(), "Map Name: ", reward.map, writable, listener);
rewardObjId = addTextField(pane, "Place: ", reward.reward_obj_id, writable, listener);
rewardObjIdCombo = null;
rewardObj = null;
rewardValue = null;
break;
case deactivateSpawnArea: case deactivateSpawnArea:
case removeSpawnArea: case removeSpawnArea:
case spawnAll: case spawnAll:
@@ -777,6 +784,26 @@ public class DialogueEditor extends JSONElementEditor {
requirementObjId = addTextField(pane, "Faction ID:", requirement.required_obj_id, writable, listener); requirementObjId = addTextField(pane, "Faction ID:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Exact value: ", requirement.required_value, true, writable, listener); requirementValue = addIntegerField(pane, "Exact value: ", requirement.required_value, true, writable, listener);
break; break;
case date:
requirementObj = null;
requirementObjId = addTextField(pane, "Date type YYYYMMTT:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Minimum date value: ", requirement.required_value, true, writable, listener);
break;
case dateEquals:
requirementObj = null;
requirementObjId = addTextField(pane, "Date type YYYYMMTT:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Exact date value: ", requirement.required_value, true, writable, listener);
break;
case time:
requirementObj = null;
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Minimum time value: ", requirement.required_value, true, writable, listener);
break;
case timeEquals:
requirementObj = null;
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Exact time value: ", requirement.required_value, true, writable, listener);
break;
} }
requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener); requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener);
} }
@@ -943,6 +970,10 @@ public class DialogueEditor extends JSONElementEditor {
label.setText("Change map filter to "+rewardObjDesc+" on map "+reward.map_name); label.setText("Change map filter to "+rewardObjDesc+" on map "+reward.map_name);
label.setIcon(new ImageIcon(DefaultIcons.getReplaceIcon())); label.setIcon(new ImageIcon(DefaultIcons.getReplaceIcon()));
break; break;
case mapchange:
label.setText("Teleport to "+rewardObjDesc+" on map "+reward.map_name);
label.setIcon(new ImageIcon(DefaultIcons.getMapchangeIcon()));
break;
} }
} else { } else {
label.setText("New, undefined reward"); label.setText("New, undefined reward");
@@ -1178,6 +1209,9 @@ public class DialogueEditor extends JSONElementEditor {
label.setIcon(new ImageIcon(DefaultIcons.getTimerIcon())); label.setIcon(new ImageIcon(DefaultIcons.getTimerIcon()));
} else if (req.type == Requirement.RequirementType.factionScore || req.type == Requirement.RequirementType.factionScoreEquals) { } else if (req.type == Requirement.RequirementType.factionScore || req.type == Requirement.RequirementType.factionScoreEquals) {
label.setIcon(new ImageIcon(DefaultIcons.getAlignmentIcon())); label.setIcon(new ImageIcon(DefaultIcons.getAlignmentIcon()));
} else if (req.type == Requirement.RequirementType.date || req.type == Requirement.RequirementType.dateEquals ||
req.type == Requirement.RequirementType.time || req.type == Requirement.RequirementType.timeEquals) {
label.setIcon(new ImageIcon(DefaultIcons.getDateIcon()));
} }
if (req.type == null) { if (req.type == null) {
label.setText("New, undefined requirement."); label.setText("New, undefined requirement.");

View File

@@ -731,6 +731,26 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
requirementObjId = addTextField(pane, "Faction ID:", requirement.required_obj_id, writable, listener); requirementObjId = addTextField(pane, "Faction ID:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Exact value: ", requirement.required_value, true, writable, listener); requirementValue = addIntegerField(pane, "Exact value: ", requirement.required_value, true, writable, listener);
break; break;
case date:
requirementObj = null;
requirementObjId = addTextField(pane, "Date type YYYYMMTT:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Minimum date value: ", requirement.required_value, true, writable, listener);
break;
case dateEquals:
requirementObj = null;
requirementObjId = addTextField(pane, "Date type YYYYMMTT:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Exact date value: ", requirement.required_value, true, writable, listener);
break;
case time:
requirementObj = null;
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Minimum time value: ", requirement.required_value, true, writable, listener);
break;
case timeEquals:
requirementObj = null;
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Exact time value: ", requirement.required_value, true, writable, listener);
break;
} }
} }
requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener); requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener);