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"?>
<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"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>

View File

@@ -1,6 +1,6 @@
!include MUI2.nsh
!define VERSION "0.6.19"
!define VERSION "0.6.20"
!define TRAINER_VERSION "0.1.5"
!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\junit-4.10.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\prefuse.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.WorkspaceSelector;
public class ATContentStudio {
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 DOWNLOAD_URL = "https://andorstrail.com/viewtopic.php?f=6&t=4806";
public static final String FONT_SCALE_ENV_VAR_NAME = "FONT_SCALE";
public static boolean STARTED = false;
public static float SCALING=1.0f;
public static float SCALING = 1.0f;
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>();
/**
* @param args
*/
@@ -66,18 +66,19 @@ public class ATContentStudio {
if (fontScaling != null) {
try {
fontScale = Float.parseFloat(fontScaling);
SCALING=fontScale;
SCALING = fontScale;
} catch (NumberFormatException e) {
System.err.println("Failed to parse font scaling parameter. Using default.");
e.printStackTrace();
}
}
ConfigCache.init();
try {
String laf = ConfigCache.getFavoriteLaFClassName();
if (laf == null) laf = UIManager.getSystemLookAndFeelClassName();
if (laf == null)
laf = UIManager.getSystemLookAndFeelClassName();
UIManager.setLookAndFeel(laf);
} catch (ClassNotFoundException e) {
e.printStackTrace();
@@ -88,37 +89,40 @@ public class ATContentStudio {
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
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());
l.setLevel(Level.OFF);
configuredLoggers.add(l);
configuredLoggers.add(l);
final WorkspaceSelector wsSelect = new WorkspaceSelector();
wsSelect.pack();
Dimension sdim = Toolkit.getDefaultToolkit().getScreenSize();
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.addWindowListener(new WindowAdapter() {
@Override
public synchronized void windowClosed(WindowEvent e) {
if (wsSelect.selected != null && !STARTED) {
ATContentStudio.STARTED = true;
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() {
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() {
public void run() {checkUpdate();}
public void run() {
checkUpdate();
}
}.start();
}
frame = new StudioFrame(APP_NAME+" "+APP_VERSION);
frame = new StudioFrame(APP_NAME + " " + APP_VERSION);
frame.setVisible(true);
frame.setDefaultCloseOperation(StudioFrame.DO_NOTHING_ON_CLOSE);
};
@@ -138,7 +142,7 @@ public class ATContentStudio {
}
});
}
private static void checkUpdate() {
BufferedReader in = null;
try {
@@ -146,32 +150,34 @@ public class ATContentStudio {
in = new BufferedReader(new InputStreamReader(url.openStream()));
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)) {
// for copying style
JLabel label = new JLabel();
Font font = label.getFont();
Color color = label.getBackground();
// create some css from the label's font
StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";");
style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
style.append("font-size:" + font.getSize() + "pt;");
style.append("background-color: rgb("+color.getRed()+","+color.getGreen()+","+color.getBlue()+");");
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>");
// for copying style
JLabel label = new JLabel();
Font font = label.getFont();
Color color = label.getBackground();
// create some css from the label's font
StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";");
style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
style.append("font-size:" + font.getSize() + "pt;");
style.append("background-color: rgb(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue()
+ ");");
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.setBorder(null);
ep.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
try {
@@ -185,7 +191,7 @@ public class ATContentStudio {
}
}
});
JOptionPane.showMessageDialog(null, ep, "Update available", JOptionPane.INFORMATION_MESSAGE);
}
} catch (MalformedURLException e) {
@@ -194,16 +200,17 @@ public class ATContentStudio {
e.printStackTrace();
} finally {
try {
if (in != null) in.close();
if (in != null)
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void scaleUIFont() {
if (SCALING != 1.0f) {
System.out.println("Scaling fonts to "+SCALING);
System.out.println("Scaling fonts to " + SCALING);
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
Map<Object, Object> newDefaults = new HashMap<Object, Object>();
for (Enumeration<Object> e = defaults.keys(); e.hasMoreElements();) {
@@ -211,7 +218,7 @@ public class ATContentStudio {
Object value = defaults.get(key);
if (value instanceof Font) {
Font font = (Font) value;
int newSize = (int)(font.getSize() * SCALING);
int newSize = (int) (font.getSize() * SCALING);
if (value instanceof FontUIResource) {
newDefaults.put(key, new FontUIResource(font.getName(), font.getStyle(), newSize));
} 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,
activateMapObjectGroup,
deactivateMapObjectGroup,
changeMapFilter
changeMapFilter,
mapchange
}
}
@@ -249,6 +250,7 @@ public class Dialogue extends JSONElement {
case removeSpawnArea:
case deactivateSpawnArea:
case changeMapFilter:
case mapchange:
reward.map = reward.map_name != null ? proj.getMap(reward.map_name) : null;
break;
case actorCondition:

View File

@@ -60,7 +60,11 @@ public class Requirement extends JSONElement {
factionScore,
random,
factionScoreEquals,
wearRemove
wearRemove,
date,
dateEquals,
time,
timeEquals
}
public enum SkillID {
@@ -196,6 +200,10 @@ public class Requirement extends JSONElement {
case factionScore:
case factionScoreEquals:
case random:
case date:
case dateEquals:
case time:
case timeEquals:
break;
}
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 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";
public static Image getAlignmentImage() { return getImage(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); }
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); }
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;
rewardValue = null;
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 removeSpawnArea:
case spawnAll:
@@ -777,6 +784,26 @@ public class DialogueEditor extends JSONElementEditor {
requirementObjId = addTextField(pane, "Faction ID:", requirement.required_obj_id, writable, listener);
requirementValue = addIntegerField(pane, "Exact value: ", requirement.required_value, true, writable, listener);
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);
}
@@ -943,6 +970,10 @@ public class DialogueEditor extends JSONElementEditor {
label.setText("Change map filter to "+rewardObjDesc+" on map "+reward.map_name);
label.setIcon(new ImageIcon(DefaultIcons.getReplaceIcon()));
break;
case mapchange:
label.setText("Teleport to "+rewardObjDesc+" on map "+reward.map_name);
label.setIcon(new ImageIcon(DefaultIcons.getMapchangeIcon()));
break;
}
} else {
label.setText("New, undefined reward");
@@ -1178,6 +1209,9 @@ public class DialogueEditor extends JSONElementEditor {
label.setIcon(new ImageIcon(DefaultIcons.getTimerIcon()));
} else if (req.type == Requirement.RequirementType.factionScore || req.type == Requirement.RequirementType.factionScoreEquals) {
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) {
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);
requirementValue = addIntegerField(pane, "Exact value: ", requirement.required_value, true, writable, listener);
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);