mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-28 15:27:41 +01:00
Compare commits
7 Commits
git_integr
...
v0.6.15
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac68006a69 | ||
|
|
92e07e76d2 | ||
|
|
5a3315da1a | ||
|
|
e12c6bcc25 | ||
|
|
44c4e1f998 | ||
|
|
450b0de02a | ||
|
|
57702a3a4a |
17
.classpath
17
.classpath
@@ -5,7 +5,7 @@
|
|||||||
<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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_152"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<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"/>
|
||||||
@@ -14,19 +14,6 @@
|
|||||||
<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.4.jar"/>
|
<classpathentry kind="lib" path="lib/AndorsTrainer_v0.1.5.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/JGit/commons-codec-1.6.jar"/>
|
|
||||||
<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"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
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.methodParameters=do not generate
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
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.8
|
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||||
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.8
|
org.eclipse.jdt.core.compiler.source=1.6
|
||||||
|
|||||||
@@ -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.14.jar"/>
|
<jar path="ATContentStudio/ATCS_v0.6.15.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.
BIN
lib/AndorsTrainer_v0.1.5.jar
Normal file
BIN
lib/AndorsTrainer_v0.1.5.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
v0.6.14
|
v0.6.15
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
!include MUI2.nsh
|
!include MUI2.nsh
|
||||||
|
|
||||||
!define VERSION "0.6.14"
|
!define VERSION "0.6.15"
|
||||||
!define TRAINER_VERSION "0.1.4"
|
!define TRAINER_VERSION "0.1.5"
|
||||||
!define JAVA_BIN "javaw"
|
!define JAVA_BIN "javaw"
|
||||||
|
|
||||||
Name "Andor's Trail Content Studio v${VERSION}"
|
Name "Andor's Trail Content Studio v${VERSION}"
|
||||||
|
|||||||
@@ -32,17 +32,6 @@ 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;
|
||||||
@@ -54,7 +43,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.14";
|
public static final String APP_VERSION = "v0.6.15";
|
||||||
|
|
||||||
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";
|
||||||
@@ -84,19 +73,6 @@ 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 {
|
||||||
|
|||||||
@@ -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 Double chance = null;
|
public String chance = null;
|
||||||
public Integer quantity_min = null;
|
public Integer quantity_min = null;
|
||||||
public Integer quantity_max = null;
|
public Integer quantity_max = null;
|
||||||
|
|
||||||
@@ -114,7 +114,8 @@ 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"));
|
||||||
@@ -217,7 +218,8 @@ 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);
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ public class Requirement extends JSONElement {
|
|||||||
spentGold,
|
spentGold,
|
||||||
consumedBonemeals,
|
consumedBonemeals,
|
||||||
hasActorCondition,
|
hasActorCondition,
|
||||||
factionScore
|
factionScore,
|
||||||
|
random
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SkillID {
|
public enum SkillID {
|
||||||
@@ -104,9 +105,21 @@ 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()+":")
|
||||||
+(required_obj_id == null ? "" : required_obj_id+":")
|
+obj_id
|
||||||
+(required_value == null ? "" : required_value.toString());
|
+(required_value == null ? "" : required_value.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,6 +186,7 @@ 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);
|
||||||
@@ -225,6 +239,12 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
/*WatchKey watchKey = */folderPath.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_CREATE);
|
||||||
WatchKey wk;
|
WatchKey wk;
|
||||||
validService: while(getProject().open) {
|
validService: while(getProject().open) {
|
||||||
wk = watchService.poll(10, TimeUnit.SECONDS);
|
wk = watchService.poll(10, TimeUnit.SECONDS);
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ 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><body>" +
|
"<html><head>" +
|
||||||
|
"<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/>" +
|
||||||
@@ -51,7 +53,8 @@ public class AboutEditor extends Editor {
|
|||||||
"<br/>" +
|
"<br/>" +
|
||||||
"Contributors: <br/>" +
|
"Contributors: <br/>" +
|
||||||
"Quentin Delvallet<br/>" +
|
"Quentin Delvallet<br/>" +
|
||||||
"<EFBFBD>i<EFBFBD>kin<br/>" +
|
"Žiž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/>" +
|
||||||
@@ -79,7 +82,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/>" +
|
||||||
|
|||||||
@@ -348,6 +348,138 @@ 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);
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -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 JTextField requirementObjId;
|
private JComponent requirementObjId;
|
||||||
private JComponent requirementValue;
|
private JComponent requirementValue;
|
||||||
private BooleanBasedCheckBox requirementNegated;
|
private BooleanBasedCheckBox requirementNegated;
|
||||||
|
|
||||||
@@ -722,6 +722,11 @@ 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;
|
||||||
|
|||||||
@@ -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 JSpinner chanceField;
|
private JComponent 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 = addDoubleField(pane, "Chance: ", di.chance, writable, listener);
|
chanceField = addChanceField(pane, "Chance: ", di.chance, "100", writable, listener);//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+"% to get "+di.quantity_min+"-"+di.quantity_max+" "+di.item.getDesc());
|
label.setText(di.chance+(di.chance != null && di.chance.contains("/") ? "" : "%")+" to get "+di.quantity_min+"-"+di.quantity_max+" "+di.item.getDesc());
|
||||||
} else if (!isNull(di)) {
|
} else if (!isNull(di)) {
|
||||||
label.setText(di.chance+"% to get "+di.quantity_min+"-"+di.quantity_max+" "+di.item_id);
|
label.setText(di.chance+(di.chance != null && di.chance.contains("/") ? "" : "%")+" 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 = (Double) value;
|
selectedItem.chance = (String) value;
|
||||||
droppedItemsListModel.itemChanged(selectedItem);
|
droppedItemsListModel.itemChanged(selectedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 JTextField requirementObjId;
|
private JComponent requirementObjId;
|
||||||
private JComponent requirementValue;
|
private JComponent requirementValue;
|
||||||
private BooleanBasedCheckBox requirementNegated;
|
private BooleanBasedCheckBox requirementNegated;
|
||||||
|
|
||||||
@@ -675,6 +675,11 @@ 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;
|
||||||
@@ -2318,11 +2323,14 @@ 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 (replacementsForLayer.get(repl.sourceLayer) == null) {
|
if(area.replacements != null) {
|
||||||
replacementsForLayer.put(repl.sourceLayer, new ArrayList<ReplaceArea>());
|
for (ReplaceArea.Replacement repl : area.replacements) {
|
||||||
}
|
if (replacementsForLayer.get(repl.sourceLayer) == null) {
|
||||||
replacementsForLayer.get(repl.sourceLayer).add(area);
|
replacementsForLayer.put(repl.sourceLayer, new ArrayList<ReplaceArea>());
|
||||||
|
}
|
||||||
|
replacementsForLayer.get(repl.sourceLayer).add(area);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2455,10 +2463,10 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
JLabel noTileGround = new JLabel(new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)));
|
JLabel noTileGround = 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 noTileObjects = 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 noTileAbove = 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)));
|
JLabel noTileTop = new JLabel("None", new ImageIcon(DefaultIcons.getNullifyImage().getScaledInstance(32, 32, Image.SCALE_DEFAULT)), SwingConstants.LEFT);
|
||||||
{
|
{
|
||||||
noTileGround.setPreferredSize(new Dimension(32, 32));
|
noTileGround.setPreferredSize(new Dimension(32, 32));
|
||||||
noTileObjects.setPreferredSize(new Dimension(32, 32));
|
noTileObjects.setPreferredSize(new Dimension(32, 32));
|
||||||
@@ -2483,16 +2491,19 @@ 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) {
|
||||||
Image tile;
|
tiled.core.Tile 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).getImage();
|
tile = top.getTileAt(tooltippedTile.x, tooltippedTile.y);
|
||||||
|
tileImage = tile.getImage();
|
||||||
} else {
|
} else {
|
||||||
tile = null;
|
tile = null;
|
||||||
|
tileImage = null;
|
||||||
}
|
}
|
||||||
if (tile != null) {
|
if (tileImage != null) {
|
||||||
label = new JLabel(new ImageIcon(tile));
|
label = new JLabel(tile.getTileSet().getName(), new ImageIcon(tileImage), SwingConstants.LEFT);
|
||||||
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.
|
||||||
@@ -2501,12 +2512,14 @@ 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).getImage();
|
tile = above.getTileAt(tooltippedTile.x, tooltippedTile.y);
|
||||||
|
tileImage = tile.getImage();
|
||||||
} else {
|
} else {
|
||||||
tile = null;
|
tile = null;
|
||||||
|
tileImage = null;
|
||||||
}
|
}
|
||||||
if (tile != null) {
|
if (tileImage != null) {
|
||||||
label = new JLabel(new ImageIcon(tile));
|
label = new JLabel(tile.getTileSet().getName(), new ImageIcon(tileImage), SwingConstants.LEFT);
|
||||||
label.setPreferredSize(new Dimension(32,32));
|
label.setPreferredSize(new Dimension(32,32));
|
||||||
content.add(label, JideBoxLayout.FIX);
|
content.add(label, JideBoxLayout.FIX);
|
||||||
} else {
|
} else {
|
||||||
@@ -2514,12 +2527,14 @@ 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).getImage();
|
tile = objects.getTileAt(tooltippedTile.x, tooltippedTile.y);
|
||||||
|
tileImage = tile.getImage();
|
||||||
} else {
|
} else {
|
||||||
tile = null;
|
tile = null;
|
||||||
|
tileImage = null;
|
||||||
}
|
}
|
||||||
if (tile != null) {
|
if (tileImage != null) {
|
||||||
label = new JLabel(new ImageIcon(tile));
|
label = new JLabel(tile.getTileSet().getName(), new ImageIcon(tileImage), SwingConstants.LEFT);
|
||||||
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,12 +2542,14 @@ 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).getImage();
|
tile = ground.getTileAt(tooltippedTile.x, tooltippedTile.y);
|
||||||
|
tileImage = tile.getImage();
|
||||||
} else {
|
} else {
|
||||||
tile = null;
|
tile = null;
|
||||||
|
tileImage = null;
|
||||||
}
|
}
|
||||||
if (tile != null) {
|
if (tileImage != null) {
|
||||||
label = new JLabel(new ImageIcon(tile));
|
label = new JLabel(tile.getTileSet().getName(), new ImageIcon(tileImage), SwingConstants.LEFT);
|
||||||
label.setPreferredSize(new Dimension(32,32));
|
label.setPreferredSize(new Dimension(32,32));
|
||||||
content.add(label, JideBoxLayout.FIX);
|
content.add(label, JideBoxLayout.FIX);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user