Compare commits

..

2 Commits

Author SHA1 Message Date
Zukero
547f76de33 Merge branch 'master' into git_integration
Conflicts:
	.classpath
	src/com/gpl/rpg/atcontentstudio/ATContentStudio.java
2018-09-28 09:48:36 +02:00
Zukero
6701d9784d Added JGit libs and deps in classpath. Update to Java 8 needed. 2017-10-20 17:22:25 +02:00
27 changed files with 103 additions and 244 deletions

View File

@@ -1,19 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/> <classpathentry kind="src" path="res"/>
<classpathentry kind="src" path="hacked-libtiled"/> <classpathentry kind="src" path="hacked-libtiled"/>
<classpathentry kind="src" path="siphash-zackehh/src/main/java"/> <classpathentry kind="src" path="siphash-zackehh/src/main/java"/>
<classpathentry kind="src" path="minify"/> <classpathentry kind="src" path="minify"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_152"/>
<classpathentry kind="lib" path="lib/jide-oss.jar"/> <classpathentry kind="lib" path="lib/jide-oss.jar"/>
<classpathentry kind="lib" path="lib/json_simple-1.1.jar"/> <classpathentry kind="lib" path="lib/json_simple-1.1.jar"/>
<classpathentry kind="lib" path="lib/junit-4.10.jar"/> <classpathentry kind="lib" path="lib/junit-4.10.jar"/>
<classpathentry kind="lib" path="lib/prefuse.jar"/> <classpathentry kind="lib" path="lib/prefuse.jar"/>
<classpathentry kind="lib" path="lib/rsyntaxtextarea.jar"/> <classpathentry kind="lib" path="lib/rsyntaxtextarea.jar"/>
<classpathentry kind="lib" path="lib/ui.jar"/> <classpathentry kind="lib" path="lib/ui.jar"/>
<classpathentry kind="lib" path="lib/bsh-2.0b4.jar"/> <classpathentry kind="lib" path="lib/bsh-2.0b4.jar"/>
<classpathentry kind="lib" path="lib/jsoup-1.10.2.jar" sourcepath="lib/jsoup-1.10.2-sources.jar"/> <classpathentry kind="lib" path="lib/jsoup-1.10.2.jar" sourcepath="lib/jsoup-1.10.2-sources.jar"/>
<classpathentry kind="lib" path="lib/AndorsTrainer_v0.1.5.jar"/> <classpathentry kind="lib" path="lib/AndorsTrainer_v0.1.4.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="lib" path="lib/JGit/commons-codec-1.6.jar"/>
</classpath> <classpathentry kind="lib" path="lib/JGit/commons-logging-1.1.3.jar"/>
<classpathentry kind="lib" path="lib/JGit/httpclient-4.3.6.jar"/>
<classpathentry kind="lib" path="lib/JGit/httpcore-4.3.3.jar"/>
<classpathentry kind="lib" path="lib/JGit/JavaEWAH-1.1.6.jar"/>
<classpathentry kind="lib" path="lib/JGit/jsch-0.1.54.jar"/>
<classpathentry kind="lib" path="lib/JGit/jzlib-1.0.7.jar"/>
<classpathentry kind="lib" path="lib/JGit/org.eclipse.jgit-4.9.0.201710071750-r.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/ATContentStudio/lib/JGit/org.eclipse.jgit-4.9.0.201710071750-r-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/JGit/slf4j-api-1.7.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -1,11 +1,12 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.8

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.15.jar"/> <jar path="ATContentStudio/ATCS_v0.6.14.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/>

Binary file not shown.

Binary file not shown.

BIN
lib/JGit/JavaEWAH-1.1.6.jar Executable file

Binary file not shown.

BIN
lib/JGit/commons-codec-1.6.jar Executable file

Binary file not shown.

Binary file not shown.

BIN
lib/JGit/httpclient-4.3.6.jar Executable file

Binary file not shown.

BIN
lib/JGit/httpcore-4.3.3.jar Executable file

Binary file not shown.

BIN
lib/JGit/jsch-0.1.54.jar Executable file

Binary file not shown.

BIN
lib/JGit/jzlib-1.0.7.jar Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/JGit/slf4j-api-1.7.2.jar Executable file

Binary file not shown.

View File

@@ -1 +1 @@
v0.6.15 v0.6.14

View File

@@ -1,7 +1,7 @@
!include MUI2.nsh !include MUI2.nsh
!define VERSION "0.6.15" !define VERSION "0.6.14"
!define TRAINER_VERSION "0.1.5" !define TRAINER_VERSION "0.1.4"
!define JAVA_BIN "javaw" !define JAVA_BIN "javaw"
Name "Andor's Trail Content Studio v${VERSION}" Name "Andor's Trail Content Studio v${VERSION}"

View File

@@ -32,6 +32,17 @@ import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener; import javax.swing.event.HyperlinkListener;
import javax.swing.plaf.FontUIResource; import javax.swing.plaf.FontUIResource;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.attributes.AttributesNodeProvider;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.lib.ObjectDatabase;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefDatabase;
import org.eclipse.jgit.lib.ReflogReader;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import prefuse.data.expression.parser.ExpressionParser; import prefuse.data.expression.parser.ExpressionParser;
import com.gpl.rpg.atcontentstudio.model.Workspace; import com.gpl.rpg.atcontentstudio.model.Workspace;
@@ -43,7 +54,7 @@ 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.15"; public static final String APP_VERSION = "v0.6.14";
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";
@@ -73,6 +84,19 @@ public class ATContentStudio {
} }
} }
// try {
// Git git = new Git(new FileRepository("/home/xxx/git_repos/andors-trail/.git/"));
// List<Ref> branches = git.branchList().call();
// for (Ref branch : branches) {
// System.out.println(branch.getName());
// }
// } catch (IOException e1) {
// e1.printStackTrace();
// } catch (GitAPIException e1) {
// e1.printStackTrace();
// }
ConfigCache.init(); ConfigCache.init();
try { try {

View File

@@ -36,7 +36,7 @@ public class Droplist extends JSONElement {
public static class DroppedItem { public static class DroppedItem {
//Available from parsed state; //Available from parsed state;
public String item_id = null; public String item_id = null;
public String chance = null; public Double chance = null;
public Integer quantity_min = null; public Integer quantity_min = null;
public Integer quantity_max = null; public Integer quantity_max = null;
@@ -114,8 +114,7 @@ public class Droplist extends JSONElement {
Map droppedItemJson = (Map)droppedItemJsonObj; Map droppedItemJson = (Map)droppedItemJsonObj;
DroppedItem droppedItem = new DroppedItem(); DroppedItem droppedItem = new DroppedItem();
droppedItem.item_id = (String) droppedItemJson.get("itemID"); droppedItem.item_id = (String) droppedItemJson.get("itemID");
//if (droppedItemJson.get("chance") != null) droppedItem.chance = JSONElement.parseChance(droppedItemJson.get("chance").toString()); if (droppedItemJson.get("chance") != null) droppedItem.chance = JSONElement.parseChance(droppedItemJson.get("chance").toString());
droppedItem.chance = (String) droppedItemJson.get("chance");
Map droppedItemQtyJson = (Map) droppedItemJson.get("quantity"); Map droppedItemQtyJson = (Map) droppedItemJson.get("quantity");
if (droppedItemQtyJson != null) { if (droppedItemQtyJson != null) {
droppedItem.quantity_min = JSONElement.getInteger((Number) droppedItemQtyJson.get("min")); droppedItem.quantity_min = JSONElement.getInteger((Number) droppedItemQtyJson.get("min"));
@@ -218,8 +217,7 @@ public class Droplist extends JSONElement {
} else if (droppedItem.item_id != null) { } else if (droppedItem.item_id != null) {
droppedItemJson.put("itemID", droppedItem.item_id); droppedItemJson.put("itemID", droppedItem.item_id);
} }
//if (droppedItem.chance != null) droppedItemJson.put("chance", JSONElement.printJsonChance(droppedItem.chance)); if (droppedItem.chance != null) droppedItemJson.put("chance", JSONElement.printJsonChance(droppedItem.chance));
if (droppedItem.chance != null) droppedItemJson.put("chance", droppedItem.chance);
if (droppedItem.quantity_min != null || droppedItem.quantity_max != null) { if (droppedItem.quantity_min != null || droppedItem.quantity_max != null) {
Map quantityJson = new LinkedHashMap(); Map quantityJson = new LinkedHashMap();
droppedItemJson.put("quantity", quantityJson); droppedItemJson.put("quantity", quantityJson);

View File

@@ -54,8 +54,7 @@ public class Requirement extends JSONElement {
spentGold, spentGold,
consumedBonemeals, consumedBonemeals,
hasActorCondition, hasActorCondition,
factionScore, factionScore
random
} }
public enum SkillID { public enum SkillID {
@@ -105,21 +104,9 @@ public class Requirement extends JSONElement {
@Override @Override
public String getDesc() { public String getDesc() {
String obj_id = "";
if (required_obj_id != null)
{
obj_id = required_obj_id;
if (type != null && type == RequirementType.random){
obj_id = " Chance " + obj_id + (required_obj_id.contains("/") ? "" : "%");
}
else {
obj_id += ":";
}
}
return ((negated != null && negated) ? "NOT " : "") return ((negated != null && negated) ? "NOT " : "")
+(type == null ? "" : type.toString()+":") +(type == null ? "" : type.toString()+":")
+obj_id +(required_obj_id == null ? "" : required_obj_id+":")
+(required_value == null ? "" : required_value.toString()); +(required_value == null ? "" : required_value.toString());
} }
@@ -186,7 +173,6 @@ public class Requirement extends JSONElement {
case spentGold: case spentGold:
case timerElapsed: case timerElapsed:
case factionScore: case factionScore:
case random:
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);
@@ -239,12 +225,6 @@ public class Requirement extends JSONElement {
required_obj_id = null; required_obj_id = null;
required_value = null; required_value = null;
} }
if(destType==RequirementType.random)
{
required_obj_id = "50/100";
}
type = destType; type = destType;
} }

View File

@@ -100,7 +100,7 @@ public class TMXMapSet implements ProjectTreeNode {
while(getProject().open) { while(getProject().open) {
try { try {
watchService = FileSystems.getDefault().newWatchService(); watchService = FileSystems.getDefault().newWatchService();
/*WatchKey watchKey = */folderPath.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_CREATE); /*WatchKey watchKey = */folderPath.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY);
WatchKey wk; WatchKey wk;
validService: while(getProject().open) { validService: while(getProject().open) {
wk = watchService.poll(10, TimeUnit.SECONDS); wk = watchService.poll(10, TimeUnit.SECONDS);

View File

@@ -26,9 +26,7 @@ public class AboutEditor extends Editor {
private static final long serialVersionUID = 6230549148222457139L; private static final long serialVersionUID = 6230549148222457139L;
public static final String WELCOME_STRING = public static final String WELCOME_STRING =
"<html><head>" + "<html><body>" +
"<meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=UTF-8\\\" />" +
"</head><body>" +
"<table><tr valign=\"top\">" + "<table><tr valign=\"top\">" +
"<td><img src=\""+ATContentStudio.class.getResource("/com/gpl/rpg/atcontentstudio/img/atcs_border_banner.png")+"\"/></td>" + "<td><img src=\""+ATContentStudio.class.getResource("/com/gpl/rpg/atcontentstudio/img/atcs_border_banner.png")+"\"/></td>" +
"<td><font size=+1>Welcome to "+ATContentStudio.APP_NAME+" "+ATContentStudio.APP_VERSION+"</font><br/>" + "<td><font size=+1>Welcome to "+ATContentStudio.APP_NAME+" "+ATContentStudio.APP_VERSION+"</font><br/>" +
@@ -53,8 +51,7 @@ public class AboutEditor extends Editor {
"<br/>" + "<br/>" +
"Contributors: <br/>" + "Contributors: <br/>" +
"Quentin Delvallet<br/>" + "Quentin Delvallet<br/>" +
"Žižkin<br/>" + "<EFBFBD>i<EFBFBD>kin<br/>" +
"Gonk<br/>" +
"<br/>" + "<br/>" +
"This project uses the following libraries:<br/>" + "This project uses the following libraries:<br/>" +
"<a href=\"http://code.google.com/p/json-simple/\">JSON.simple</a> by Yidong Fang & Chris Nokleberg.<br/>" + "<a href=\"http://code.google.com/p/json-simple/\">JSON.simple</a> by Yidong Fang & Chris Nokleberg.<br/>" +
@@ -82,7 +79,7 @@ public class AboutEditor extends Editor {
"<a href=\"https://jsoup.org/\">jsoup</a> by Jonathan Hedley<br/>" + "<a href=\"https://jsoup.org/\">jsoup</a> by Jonathan Hedley<br/>" +
"License: <a href=\"https://jsoup.org/license\">MIT License</a><br/>" + "License: <a href=\"https://jsoup.org/license\">MIT License</a><br/>" +
"<br/>" + "<br/>" +
"A slightly modified version of <a href=\"https://launchpad.net/po-parser\">General PO Parser</a> by Bal<61>zs T<>th<br/>" + "A slightly modified version of <a href=\"https://launchpad.net/po-parser\">General PO Parser</a> by Bal<61>zs T<>th<br/>" +
"License: <a href=\"http://www.gnu.org/licenses/gpl-3.0.html\">GPL v3</a><br/>" + "License: <a href=\"http://www.gnu.org/licenses/gpl-3.0.html\">GPL v3</a><br/>" +
"<br/>" + "<br/>" +
"A slightly modified version of <a href=\"www.whoischarles.com\">Minify.java</a> by Charles Bihis<br/>" + "A slightly modified version of <a href=\"www.whoischarles.com\">Minify.java</a> by Charles Bihis<br/>" +

View File

@@ -348,138 +348,6 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
return spinner; return spinner;
} }
private static final String percent = "%";
private static final String ratio = "x/y";
public static JComponent addChanceField(JPanel pane, String label, String initialValue, String defaultValue, boolean editable, final FieldUpdateListener listener) {
int defaultChance = 1;
int defaultMaxChance = 100;
if (defaultValue != null) {
if (defaultValue.contains("/")) {
int c = defaultValue.indexOf('/');
try { defaultChance = Integer.parseInt(defaultValue.substring(0, c)); } catch (NumberFormatException nfe) {};
try { defaultMaxChance = Integer.parseInt(defaultValue.substring(c+1)); } catch (NumberFormatException nfe) {};
} else {
try { defaultChance = Integer.parseInt(defaultValue); } catch (NumberFormatException nfe) {};
}
}
boolean currentFormIsRatio = true;
int chance = defaultChance;
int maxChance = defaultMaxChance;
if (initialValue != null) {
if (initialValue.contains("/")) {
int c = initialValue.indexOf('/');
try { chance = Integer.parseInt(initialValue.substring(0, c)); } catch (NumberFormatException nfe) {};
try { maxChance = Integer.parseInt(initialValue.substring(c+1)); } catch (NumberFormatException nfe) {};
} else {
try {
chance = Integer.parseInt(initialValue);
currentFormIsRatio = false;
} catch (NumberFormatException nfe) {};
}
}
final JPanel tfPane = new JPanel();
tfPane.setLayout(new JideBoxLayout(tfPane, JideBoxLayout.LINE_AXIS, 6));
JLabel tfLabel = new JLabel(label);
tfPane.add(tfLabel, JideBoxLayout.FIX);
final JComboBox<String> entryTypeBox = new JComboBox<String>(new String[] {percent, ratio});
if (currentFormIsRatio) {
entryTypeBox.setSelectedItem(ratio);
} else {
entryTypeBox.setSelectedItem(percent);
}
entryTypeBox.setEnabled(editable);
tfPane.add(entryTypeBox, JideBoxLayout.FIX);
/////////////////////////////////////////////////////////////////////////////////////////////////// make sure "chance" is between 1 and 100. If lower than 1 get 1. If higher than 100, get chance/maxChance * 100... Then do the same with defaultChance, in case no value exist.
final SpinnerNumberModel percentModel = new SpinnerNumberModel(initialValue != null ? ((chance > 1 ? chance : 1) < 100 ? chance : (chance * 100 / maxChance)) : ((defaultChance > 1 ? defaultChance : 1) < 100 ? defaultChance : (defaultChance * 100 / defaultMaxChance)) , 1, 100, 1);
final SpinnerNumberModel ratioChanceModel = new SpinnerNumberModel(initialValue != null ? chance : defaultChance, 1, Integer.MAX_VALUE, 1);
final JSpinner chanceSpinner = new JSpinner(currentFormIsRatio ? ratioChanceModel : percentModel);
if (!currentFormIsRatio) ((JSpinner.DefaultEditor)chanceSpinner.getEditor()).getTextField().setHorizontalAlignment(JTextField.LEFT);
chanceSpinner.setEnabled(editable);
((DefaultFormatter)((NumberEditor)chanceSpinner.getEditor()).getTextField().getFormatter()).setCommitsOnValidEdit(true);
tfPane.add(chanceSpinner, JideBoxLayout.FLEXIBLE);
final JLabel ratioLabel = new JLabel("/");
tfPane.add(ratioLabel, JideBoxLayout.FIX);
final JSpinner maxChanceSpinner = new JSpinner(new SpinnerNumberModel(initialValue != null ? maxChance : defaultMaxChance, 1, Integer.MAX_VALUE, 1));
((JSpinner.DefaultEditor)maxChanceSpinner.getEditor()).getTextField().setHorizontalAlignment(JTextField.LEFT);
maxChanceSpinner.setEnabled(editable);
((DefaultFormatter)((NumberEditor)maxChanceSpinner.getEditor()).getTextField().getFormatter()).setCommitsOnValidEdit(true);
tfPane.add(maxChanceSpinner, JideBoxLayout.FLEXIBLE);
if (!currentFormIsRatio) {
ratioLabel.setVisible(false);
maxChanceSpinner.setVisible(false);
tfPane.revalidate();
tfPane.repaint();
}
final JButton nullify = new JButton(new ImageIcon(DefaultIcons.getNullifyIcon()));
tfPane.add(nullify, JideBoxLayout.FIX);
nullify.setEnabled(editable);
pane.add(tfPane, JideBoxLayout.FIX);
entryTypeBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (entryTypeBox.getSelectedItem() == percent) {
int chance = ((Integer)chanceSpinner.getValue());
int maxChance = ((Integer)maxChanceSpinner.getValue());
chance *= 100;
chance /= maxChance;
chance = Math.max(0, Math.min(100, chance));
chanceSpinner.setModel(percentModel);
chanceSpinner.setValue(chance);
((JSpinner.DefaultEditor)chanceSpinner.getEditor()).getTextField().setHorizontalAlignment(JTextField.LEFT);
ratioLabel.setVisible(false);
maxChanceSpinner.setVisible(false);
tfPane.revalidate();
tfPane.repaint();
listener.valueChanged(chanceSpinner, chanceSpinner.getValue().toString());
} else if (entryTypeBox.getSelectedItem() == ratio) {
int chance = ((Integer)chanceSpinner.getValue());
chanceSpinner.setModel(ratioChanceModel);
chanceSpinner.setValue(chance);
maxChanceSpinner.setValue(100);
ratioLabel.setVisible(true);
maxChanceSpinner.setVisible(true);
tfPane.revalidate();
tfPane.repaint();
listener.valueChanged(chanceSpinner, chanceSpinner.getValue().toString() + "/" + maxChanceSpinner.getValue().toString());
}
}
});
chanceSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (entryTypeBox.getSelectedItem() == percent) {
listener.valueChanged(chanceSpinner, chanceSpinner.getValue().toString());
} else if (entryTypeBox.getSelectedItem() == ratio) {
listener.valueChanged(chanceSpinner, chanceSpinner.getValue().toString() + "/" + maxChanceSpinner.getValue().toString());
}
}
});
maxChanceSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
listener.valueChanged(chanceSpinner, chanceSpinner.getValue().toString() + "/" + maxChanceSpinner.getValue().toString());
}
});
nullify.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
chanceSpinner.setValue(1);
listener.valueChanged(chanceSpinner, null);
}
});
return chanceSpinner;
}
// public static JSpinner addDoubleField(JPanel pane, String label, Double initialValue, boolean editable) { // public static JSpinner addDoubleField(JPanel pane, String label, Double initialValue, boolean editable) {
// return addDoubleField(pane, label, initialValue, editable, nullListener); // return addDoubleField(pane, label, initialValue, editable, nullListener);
// } // }

View File

@@ -123,7 +123,7 @@ public class DialogueEditor extends JSONElementEditor {
private MyComboBox requirementObj; private MyComboBox requirementObj;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private JComboBox requirementSkill; private JComboBox requirementSkill;
private JComponent requirementObjId; private JTextField requirementObjId;
private JComponent requirementValue; private JComponent requirementValue;
private BooleanBasedCheckBox requirementNegated; private BooleanBasedCheckBox requirementNegated;
@@ -722,11 +722,6 @@ public class DialogueEditor extends JSONElementEditor {
requirementObjId = null; requirementObjId = null;
requirementValue = addIntegerField(pane, "Quantity: ", requirement.required_value, false, writable, listener); requirementValue = addIntegerField(pane, "Quantity: ", requirement.required_value, false, writable, listener);
break; break;
case random:
requirementObj = null;
requirementObjId = addChanceField(pane, "Chance: ", requirement.required_obj_id, "50/100", writable, listener);
requirementValue = null;
break;
case hasActorCondition: case hasActorCondition:
requirementObj = addActorConditionBox(pane, project, "Actor Condition: ", (ActorCondition) requirement.required_obj, writable, listener); requirementObj = addActorConditionBox(pane, project, "Actor Condition: ", (ActorCondition) requirement.required_obj, writable, listener);
requirementObjId = null; requirementObjId = null;

View File

@@ -50,7 +50,7 @@ public class DroplistEditor extends JSONElementEditor {
private DroppedItemsListModel droppedItemsListModel; private DroppedItemsListModel droppedItemsListModel;
private JSpinner qtyMinField; private JSpinner qtyMinField;
private JSpinner qtyMaxField; private JSpinner qtyMaxField;
private JComponent chanceField; private JSpinner chanceField;
public DroplistEditor(Droplist droplist) { public DroplistEditor(Droplist droplist) {
super(droplist, droplist.getDesc(), droplist.getIcon()); super(droplist, droplist.getDesc(), droplist.getIcon());
@@ -142,7 +142,7 @@ public class DroplistEditor extends JSONElementEditor {
itemCombo = addItemBox(pane, proj, "Item: ", di.item, writable, listener); itemCombo = addItemBox(pane, proj, "Item: ", di.item, writable, listener);
qtyMinField = addIntegerField(pane, "Quantity min: ", di.quantity_min, false, writable, listener); qtyMinField = addIntegerField(pane, "Quantity min: ", di.quantity_min, false, writable, listener);
qtyMaxField = addIntegerField(pane, "Quantity max: ", di.quantity_max, false, writable, listener); qtyMaxField = addIntegerField(pane, "Quantity max: ", di.quantity_max, false, writable, listener);
chanceField = addChanceField(pane, "Chance: ", di.chance, "100", writable, listener);//addDoubleField(pane, "Chance: ", di.chance, writable, listener); chanceField = addDoubleField(pane, "Chance: ", di.chance, writable, listener);
} }
pane.revalidate(); pane.revalidate();
pane.repaint(); pane.repaint();
@@ -221,9 +221,9 @@ public class DroplistEditor extends JSONElementEditor {
Droplist.DroppedItem di = (Droplist.DroppedItem)value; Droplist.DroppedItem di = (Droplist.DroppedItem)value;
if (di.item != null) { if (di.item != null) {
label.setIcon(new ImageIcon(di.item.getIcon())); label.setIcon(new ImageIcon(di.item.getIcon()));
label.setText(di.chance+(di.chance != null && di.chance.contains("/") ? "" : "%")+" to get "+di.quantity_min+"-"+di.quantity_max+" "+di.item.getDesc()); label.setText(di.chance+"% to get "+di.quantity_min+"-"+di.quantity_max+" "+di.item.getDesc());
} else if (!isNull(di)) { } else if (!isNull(di)) {
label.setText(di.chance+(di.chance != null && di.chance.contains("/") ? "" : "%")+" to get "+di.quantity_min+"-"+di.quantity_max+" "+di.item_id); label.setText(di.chance+"% to get "+di.quantity_min+"-"+di.quantity_max+" "+di.item_id);
} else { } else {
label.setText("New, undefined, dropped item."); label.setText("New, undefined, dropped item.");
} }
@@ -283,7 +283,7 @@ public class DroplistEditor extends JSONElementEditor {
selectedItem.quantity_max = (Integer) value; selectedItem.quantity_max = (Integer) value;
droppedItemsListModel.itemChanged(selectedItem); droppedItemsListModel.itemChanged(selectedItem);
} else if (source == chanceField) { } else if (source == chanceField) {
selectedItem.chance = (String) value; selectedItem.chance = (Double) value;
droppedItemsListModel.itemChanged(selectedItem); droppedItemsListModel.itemChanged(selectedItem);
} }

View File

@@ -173,7 +173,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
private JPanel requirementParamsPane; private JPanel requirementParamsPane;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private JComboBox requirementObj; private JComboBox requirementObj;
private JComponent requirementObjId; private JTextField requirementObjId;
private JComponent requirementValue; private JComponent requirementValue;
private BooleanBasedCheckBox requirementNegated; private BooleanBasedCheckBox requirementNegated;
@@ -675,11 +675,6 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
requirementObjId = null; requirementObjId = null;
requirementValue = addIntegerField(pane, "Quantity: ", requirement.required_value, false, writable, listener); requirementValue = addIntegerField(pane, "Quantity: ", requirement.required_value, false, writable, listener);
break; break;
case random:
requirementObj = null;
requirementObjId = addChanceField(pane, "Chance: ", requirement.required_obj_id, "50/100", writable, listener);
requirementValue = null;
break;
case hasActorCondition: case hasActorCondition:
requirementObj = addActorConditionBox(pane, project, "Actor Condition: ", (ActorCondition) requirement.required_obj, writable, listener); requirementObj = addActorConditionBox(pane, project, "Actor Condition: ", (ActorCondition) requirement.required_obj, writable, listener);
requirementObjId = null; requirementObjId = null;
@@ -2323,14 +2318,11 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
if (!activeReplacements.containsKey(area)) { if (!activeReplacements.containsKey(area)) {
activeReplacements.put(area, true); activeReplacements.put(area, true);
} }
for (ReplaceArea.Replacement repl : area.replacements) {
if(area.replacements != null) { if (replacementsForLayer.get(repl.sourceLayer) == null) {
for (ReplaceArea.Replacement repl : area.replacements) { replacementsForLayer.put(repl.sourceLayer, new ArrayList<ReplaceArea>());
if (replacementsForLayer.get(repl.sourceLayer) == null) { }
replacementsForLayer.put(repl.sourceLayer, new ArrayList<ReplaceArea>()); replacementsForLayer.get(repl.sourceLayer).add(area);
}
replacementsForLayer.get(repl.sourceLayer).add(area);
}
} }
} }
} }
@@ -2463,10 +2455,10 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
return false; return false;
} }
JLabel noTileGround = new JLabel("None", new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)), SwingConstants.LEFT); JLabel noTileGround = new JLabel(new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)));
JLabel noTileObjects = new JLabel("None", new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)), SwingConstants.LEFT); JLabel noTileObjects = new JLabel(new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)));
JLabel noTileAbove = new JLabel("None", new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)), SwingConstants.LEFT); JLabel noTileAbove = new JLabel(new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)));
JLabel noTileTop = new JLabel("None", new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)), SwingConstants.LEFT); JLabel noTileTop = new JLabel(new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)));
{ {
noTileGround.setPreferredSize(new Dimension(32, 32)); noTileGround.setPreferredSize(new Dimension(32, 32));
noTileObjects.setPreferredSize(new Dimension(32, 32)); noTileObjects.setPreferredSize(new Dimension(32, 32));
@@ -2491,19 +2483,16 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
JPanel content = new JPanel(); JPanel content = new JPanel();
content.setLayout(new JideBoxLayout(content, JideBoxLayout.PAGE_AXIS)); content.setLayout(new JideBoxLayout(content, JideBoxLayout.PAGE_AXIS));
if (tooltippedTile != null) { if (tooltippedTile != null) {
tiled.core.Tile tile; Image tile;
Image tileImage;
JLabel label; JLabel label;
if (top != null && top.getTileAt(tooltippedTile.x, tooltippedTile.y) != null) { if (top != null && top.getTileAt(tooltippedTile.x, tooltippedTile.y) != null) {
tile = top.getTileAt(tooltippedTile.x, tooltippedTile.y); tile = top.getTileAt(tooltippedTile.x, tooltippedTile.y).getImage();
tileImage = tile.getImage();
} else { } else {
tile = null; tile = null;
tileImage = null;
} }
if (tileImage != null) { if (tile != null) {
label = new JLabel(tile.getTileSet().getName(), new ImageIcon(tileImage), SwingConstants.LEFT); label = new JLabel(new ImageIcon(tile));
label.setPreferredSize(new Dimension(32,32)); label.setPreferredSize(new Dimension(32,32));
content.add(label, JideBoxLayout.FIX); content.add(label, JideBoxLayout.FIX);
//Fix when (if?) Top is advertised publicly. //Fix when (if?) Top is advertised publicly.
@@ -2512,14 +2501,12 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
} }
if (above != null && above.getTileAt(tooltippedTile.x, tooltippedTile.y) != null) { if (above != null && above.getTileAt(tooltippedTile.x, tooltippedTile.y) != null) {
tile = above.getTileAt(tooltippedTile.x, tooltippedTile.y); tile = above.getTileAt(tooltippedTile.x, tooltippedTile.y).getImage();
tileImage = tile.getImage();
} else { } else {
tile = null; tile = null;
tileImage = null;
} }
if (tileImage != null) { if (tile != null) {
label = new JLabel(tile.getTileSet().getName(), new ImageIcon(tileImage), SwingConstants.LEFT); label = new JLabel(new ImageIcon(tile));
label.setPreferredSize(new Dimension(32,32)); label.setPreferredSize(new Dimension(32,32));
content.add(label, JideBoxLayout.FIX); content.add(label, JideBoxLayout.FIX);
} else { } else {
@@ -2527,14 +2514,12 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
} }
if (objects != null && objects.getTileAt(tooltippedTile.x, tooltippedTile.y) != null) { if (objects != null && objects.getTileAt(tooltippedTile.x, tooltippedTile.y) != null) {
tile = objects.getTileAt(tooltippedTile.x, tooltippedTile.y); tile = objects.getTileAt(tooltippedTile.x, tooltippedTile.y).getImage();
tileImage = tile.getImage();
} else { } else {
tile = null; tile = null;
tileImage = null;
} }
if (tileImage != null) { if (tile != null) {
label = new JLabel(tile.getTileSet().getName(), new ImageIcon(tileImage), SwingConstants.LEFT); label = new JLabel(new ImageIcon(tile));
label.setPreferredSize(new Dimension(32,32)); label.setPreferredSize(new Dimension(32,32));
content.add(label, JideBoxLayout.FIX); content.add(label, JideBoxLayout.FIX);
} else { } else {
@@ -2542,14 +2527,12 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
} }
if (ground != null && ground.getTileAt(tooltippedTile.x, tooltippedTile.y) != null) { if (ground != null && ground.getTileAt(tooltippedTile.x, tooltippedTile.y) != null) {
tile = ground.getTileAt(tooltippedTile.x, tooltippedTile.y); tile = ground.getTileAt(tooltippedTile.x, tooltippedTile.y).getImage();
tileImage = tile.getImage();
} else { } else {
tile = null; tile = null;
tileImage = null;
} }
if (tileImage != null) { if (tile != null) {
label = new JLabel(tile.getTileSet().getName(), new ImageIcon(tileImage), SwingConstants.LEFT); label = new JLabel(new ImageIcon(tile));
label.setPreferredSize(new Dimension(32,32)); label.setPreferredSize(new Dimension(32,32));
content.add(label, JideBoxLayout.FIX); content.add(label, JideBoxLayout.FIX);
} else { } else {