diff --git a/hacked-libtiled/tiled/core/Map.java b/hacked-libtiled/tiled/core/Map.java
index f796e5c..4738097 100644
--- a/hacked-libtiled/tiled/core/Map.java
+++ b/hacked-libtiled/tiled/core/Map.java
@@ -29,7 +29,9 @@
package tiled.core;
import java.awt.Rectangle;
-import java.util.*;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
/**
* The Map class is the focal point of the tiled.core package.
diff --git a/hacked-libtiled/tiled/core/MapObject.java b/hacked-libtiled/tiled/core/MapObject.java
index 2904758..111b825 100644
--- a/hacked-libtiled/tiled/core/MapObject.java
+++ b/hacked-libtiled/tiled/core/MapObject.java
@@ -28,10 +28,12 @@
package tiled.core;
-import java.awt.*;
-import java.util.Properties;
+import java.awt.Image;
+import java.awt.Rectangle;
import java.io.File;
import java.io.IOException;
+import java.util.Properties;
+
import javax.imageio.ImageIO;
/**
diff --git a/hacked-libtiled/tiled/core/ObjectGroup.java b/hacked-libtiled/tiled/core/ObjectGroup.java
index 67f1b47..4b72432 100644
--- a/hacked-libtiled/tiled/core/ObjectGroup.java
+++ b/hacked-libtiled/tiled/core/ObjectGroup.java
@@ -33,8 +33,8 @@ import java.awt.Shape;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
-import java.util.LinkedList;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
/**
diff --git a/hacked-libtiled/tiled/core/Tile.java b/hacked-libtiled/tiled/core/Tile.java
index c44d325..d520851 100644
--- a/hacked-libtiled/tiled/core/Tile.java
+++ b/hacked-libtiled/tiled/core/Tile.java
@@ -28,7 +28,6 @@
package tiled.core;
-import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.Properties;
diff --git a/hacked-libtiled/tiled/io/TMXMapReader.java b/hacked-libtiled/tiled/io/TMXMapReader.java
index 6777e8b..8817bcd 100644
--- a/hacked-libtiled/tiled/io/TMXMapReader.java
+++ b/hacked-libtiled/tiled/io/TMXMapReader.java
@@ -38,7 +38,6 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
-import java.io.StringReader;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
diff --git a/hacked-libtiled/tiled/io/TMXMapWriter.java b/hacked-libtiled/tiled/io/TMXMapWriter.java
index 062ca06..0d78cfa 100644
--- a/hacked-libtiled/tiled/io/TMXMapWriter.java
+++ b/hacked-libtiled/tiled/io/TMXMapWriter.java
@@ -30,14 +30,32 @@ package tiled.io;
import java.awt.Color;
import java.awt.Rectangle;
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
import java.nio.charset.Charset;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.Vector;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.GZIPOutputStream;
-import tiled.core.*;
+import tiled.core.AnimatedTile;
import tiled.core.Map;
+import tiled.core.MapLayer;
+import tiled.core.MapObject;
+import tiled.core.ObjectGroup;
+import tiled.core.Sprite;
+import tiled.core.Tile;
+import tiled.core.TileLayer;
+import tiled.core.TileSet;
import tiled.io.xml.XMLWriter;
import tiled.util.Base64;
diff --git a/hacked-libtiled/tiled/io/xml/XMLWriter.java b/hacked-libtiled/tiled/io/xml/XMLWriter.java
index f47905e..65682ca 100644
--- a/hacked-libtiled/tiled/io/xml/XMLWriter.java
+++ b/hacked-libtiled/tiled/io/xml/XMLWriter.java
@@ -28,9 +28,8 @@
package tiled.io.xml;
-import java.lang.String;
-import java.io.Writer;
import java.io.IOException;
+import java.io.Writer;
import java.util.Stack;
/**
diff --git a/hacked-libtiled/tiled/util/BasicTileCutter.java b/hacked-libtiled/tiled/util/BasicTileCutter.java
index 96a9f6a..2a4e49b 100644
--- a/hacked-libtiled/tiled/util/BasicTileCutter.java
+++ b/hacked-libtiled/tiled/util/BasicTileCutter.java
@@ -29,7 +29,6 @@
package tiled.util;
import java.awt.Dimension;
-import java.awt.Image;
import java.awt.image.BufferedImage;
/**
diff --git a/hacked-libtiled/tiled/util/ImageHelper.java b/hacked-libtiled/tiled/util/ImageHelper.java
index 55a63e8..1694b33 100644
--- a/hacked-libtiled/tiled/util/ImageHelper.java
+++ b/hacked-libtiled/tiled/util/ImageHelper.java
@@ -33,6 +33,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+
import javax.imageio.ImageIO;
/**
diff --git a/hacked-libtiled/tiled/util/TileCutter.java b/hacked-libtiled/tiled/util/TileCutter.java
index af91f97..cfe2515 100644
--- a/hacked-libtiled/tiled/util/TileCutter.java
+++ b/hacked-libtiled/tiled/util/TileCutter.java
@@ -29,7 +29,6 @@
package tiled.util;
import java.awt.Dimension;
-import java.awt.Image;
import java.awt.image.BufferedImage;
/**
diff --git a/hacked-libtiled/tiled/view/MapRenderer.java b/hacked-libtiled/tiled/view/MapRenderer.java
index 3a51b51..37e27ba 100644
--- a/hacked-libtiled/tiled/view/MapRenderer.java
+++ b/hacked-libtiled/tiled/view/MapRenderer.java
@@ -27,10 +27,10 @@
package tiled.view;
-import tiled.core.TileLayer;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
-import java.awt.*;
-import java.awt.image.BufferedImageOp;
+import tiled.core.TileLayer;
/**
* An interface defining methods to render a map.
diff --git a/hacked-libtiled/tiled/view/OrthogonalRenderer.java b/hacked-libtiled/tiled/view/OrthogonalRenderer.java
index ddf0b0b..7324332 100644
--- a/hacked-libtiled/tiled/view/OrthogonalRenderer.java
+++ b/hacked-libtiled/tiled/view/OrthogonalRenderer.java
@@ -27,14 +27,15 @@
package tiled.view;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.image.BufferedImage;
+
import tiled.core.Map;
import tiled.core.Tile;
import tiled.core.TileLayer;
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.awt.image.BufferedImageOp;
-
/**
* The orthogonal map renderer. This is the most basic map renderer, dealing
* with maps that use rectangular tiles.
diff --git a/src/com/gpl/rpg/atcontentstudio/model/GameDataElement.java b/src/com/gpl/rpg/atcontentstudio/model/GameDataElement.java
index 96d6bcf..3eefc54 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/GameDataElement.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/GameDataElement.java
@@ -4,7 +4,7 @@ import java.awt.Image;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -32,7 +32,7 @@ public abstract class GameDataElement implements ProjectTreeNode, Serializable {
public boolean writable = false;
//List of objects whose transition to "linked" state made them point to this instance.
- private Map backlinks = new HashMap();
+ private Map backlinks = new LinkedHashMap();
public String id = null;
diff --git a/src/com/gpl/rpg/atcontentstudio/model/GameSource.java b/src/com/gpl/rpg/atcontentstudio/model/GameSource.java
index 72c070e..5fe86b4 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/GameSource.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/GameSource.java
@@ -9,7 +9,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.LinkedHashMap;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -31,7 +31,7 @@ import com.gpl.rpg.atcontentstudio.model.maps.Worldmap;
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
import com.gpl.rpg.atcontentstudio.model.sprites.SpriteSheetSet;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
-import com.gpl.rpg.atcontentstudio.model.tools.WriterModeDataSet;
+import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeDataSet;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
public class GameSource implements ProjectTreeNode, Serializable {
@@ -135,7 +135,7 @@ public class GameSource implements ProjectTreeNode, Serializable {
for (int i = 0; i < arraysList.getLength(); i++) {
Element arrayNode = (Element) arraysList.item(i);
String name = arrayNode.getAttribute("name");
- List arrayContents = new LinkedList();
+ List arrayContents = new ArrayList();
NodeList arrayItems = arrayNode.getElementsByTagName("item");
if (arrayItems != null) {
for (int j = 0; j < arrayItems.getLength(); j++) {
diff --git a/src/com/gpl/rpg/atcontentstudio/model/Project.java b/src/com/gpl/rpg/atcontentstudio/model/Project.java
index 87f2a99..e54aac3 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/Project.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/Project.java
@@ -9,7 +9,9 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -44,7 +46,7 @@ import com.gpl.rpg.atcontentstudio.model.maps.Worldmap;
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
import com.gpl.rpg.atcontentstudio.model.saves.SavedGamesSet;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
-import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData;
+import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
import com.gpl.rpg.atcontentstudio.utils.FileUtils;
@@ -1018,8 +1020,8 @@ public class Project implements ProjectTreeNode, Serializable {
@SuppressWarnings("rawtypes")
public void writeAltered(GameDataCategory extends JSONElement> altered, GameDataCategory extends JSONElement> source, Class extends JSONElement> gdeClass, File targetFolder) {
- Set alteredFileNames = new HashSet();
- Map> toWrite = new HashMap>();
+ Set alteredFileNames = new LinkedHashSet();
+ Map> toWrite = new LinkedHashMap>();
for (JSONElement gde : altered) {
alteredFileNames.add(gde.jsonFile.getName());
}
diff --git a/src/com/gpl/rpg/atcontentstudio/model/Workspace.java b/src/com/gpl/rpg/atcontentstudio/model/Workspace.java
index 7bcb029..643e9fa 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/Workspace.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/Workspace.java
@@ -9,6 +9,7 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -21,8 +22,8 @@ import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.io.SettingsSave;
import com.gpl.rpg.atcontentstudio.model.GameSource.Type;
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
-import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
import com.gpl.rpg.atcontentstudio.ui.ProjectsTree.ProjectsTreeModel;
+import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
public class Workspace implements ProjectTreeNode, Serializable {
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java
index 361aa55..65b485c 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java
@@ -5,7 +5,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -264,7 +264,7 @@ public class ActorCondition extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
- Map jsonAC = new HashMap();
+ Map jsonAC = new LinkedHashMap();
jsonAC.put("id", this.id);
if (this.icon_id != null) jsonAC.put("iconID", this.icon_id);
if (this.display_name != null) jsonAC.put("name", this.display_name);
@@ -272,10 +272,10 @@ public class ActorCondition extends JSONElement {
if (this.positive != null && this.positive == 1) jsonAC.put("positive", this.positive);
if (this.stacking != null && this.stacking == 1) jsonAC.put("stacking", this.stacking);
if (this.round_effect != null) {
- Map jsonRound = new HashMap();
+ Map jsonRound = new LinkedHashMap();
if (this.round_effect.visual_effect != null) jsonRound.put("visualEffectID", this.round_effect.visual_effect);
if (this.round_effect.hp_boost_min != null || this.round_effect.hp_boost_max != null) {
- Map jsonHP = new HashMap();
+ Map jsonHP = new LinkedHashMap();
if (this.round_effect.hp_boost_min != null) jsonHP.put("min", this.round_effect.hp_boost_min);
else jsonHP.put("min", 0);
if (this.round_effect.hp_boost_max != null) jsonHP.put("max", this.round_effect.hp_boost_max);
@@ -283,7 +283,7 @@ public class ActorCondition extends JSONElement {
jsonRound.put("increaseCurrentHP", jsonHP);
}
if (this.round_effect.ap_boost_min != null || this.round_effect.ap_boost_max != null) {
- Map jsonAP = new HashMap();
+ Map jsonAP = new LinkedHashMap();
if (this.round_effect.ap_boost_min != null) jsonAP.put("min", this.round_effect.ap_boost_min);
else jsonAP.put("min", 0);
if (this.round_effect.ap_boost_max != null) jsonAP.put("max", this.round_effect.ap_boost_max);
@@ -293,10 +293,10 @@ public class ActorCondition extends JSONElement {
jsonAC.put("roundEffect", jsonRound);
}
if (this.full_round_effect != null) {
- Map jsonFullRound = new HashMap();
+ Map jsonFullRound = new LinkedHashMap();
if (this.full_round_effect.visual_effect != null) jsonFullRound.put("visualEffectID", this.full_round_effect.visual_effect);
if (this.full_round_effect.hp_boost_min != null || this.full_round_effect.hp_boost_max != null) {
- Map jsonHP = new HashMap();
+ Map jsonHP = new LinkedHashMap();
if (this.full_round_effect.hp_boost_min != null) jsonHP.put("min", this.full_round_effect.hp_boost_min);
else jsonHP.put("min", 0);
if (this.full_round_effect.hp_boost_max != null) jsonHP.put("max", this.full_round_effect.hp_boost_max);
@@ -304,7 +304,7 @@ public class ActorCondition extends JSONElement {
jsonFullRound.put("increaseCurrentHP", jsonHP);
}
if (this.full_round_effect.ap_boost_min != null || this.full_round_effect.ap_boost_max != null) {
- Map jsonAP = new HashMap();
+ Map jsonAP = new LinkedHashMap();
if (this.full_round_effect.ap_boost_min != null) jsonAP.put("min", this.full_round_effect.ap_boost_min);
else jsonAP.put("min", 0);
if (this.full_round_effect.ap_boost_max != null) jsonAP.put("max", this.full_round_effect.ap_boost_max);
@@ -314,10 +314,10 @@ public class ActorCondition extends JSONElement {
jsonAC.put("fullRoundEffect", jsonFullRound);
}
if (this.constant_ability_effect != null) {
- Map jsonAbility = new HashMap();
+ Map jsonAbility = new LinkedHashMap();
if (this.constant_ability_effect.increase_attack_chance != null) jsonAbility.put("increaseAttackChance", this.constant_ability_effect.increase_attack_chance);
if (this.constant_ability_effect.increase_damage_min != null || this.constant_ability_effect.increase_damage_max != null) {
- Map jsonAD = new HashMap();
+ Map jsonAD = new LinkedHashMap();
if (this.constant_ability_effect.increase_damage_min != null) jsonAD.put("min", this.constant_ability_effect.increase_damage_min);
else jsonAD.put("min", 0);
if (this.constant_ability_effect.increase_damage_max != null) jsonAD.put("max", this.constant_ability_effect.increase_damage_max);
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Dialogue.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Dialogue.java
index 3d60dc5..87bf3a0 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Dialogue.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Dialogue.java
@@ -7,7 +7,8 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -382,7 +383,7 @@ public class Dialogue extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
- Map dialogueJson = new HashMap();
+ Map dialogueJson = new LinkedHashMap();
dialogueJson.put("id", this.id);
if (this.message != null) dialogueJson.put("message", this.message);
if (this.switch_to_npc != null) {
@@ -394,7 +395,7 @@ public class Dialogue extends JSONElement {
List repliesJson = new ArrayList();
dialogueJson.put("replies", repliesJson);
for (Reply reply : this.replies){
- Map replyJson = new HashMap();
+ Map replyJson = new LinkedHashMap();
repliesJson.add(replyJson);
if (reply.text != null) replyJson.put("text", reply.text);
if (reply.next_phrase != null) {
@@ -406,7 +407,7 @@ public class Dialogue extends JSONElement {
List requirementsJson = new ArrayList();
replyJson.put("requires", requirementsJson);
for (Requirement requirement : reply.requirements) {
- Map requirementJson = new HashMap();
+ Map requirementJson = new LinkedHashMap();
requirementsJson.add(requirementJson);
if (requirement.type != null) requirementJson.put("requireType", requirement.type.toString());
if (requirement.required_obj != null) {
@@ -426,7 +427,7 @@ public class Dialogue extends JSONElement {
List rewardsJson = new ArrayList();
dialogueJson.put("rewards", rewardsJson);
for (Reward reward : this.rewards) {
- Map rewardJson = new HashMap();
+ Map rewardJson = new LinkedHashMap();
rewardsJson.add(rewardJson);
if (reward.type != null) rewardJson.put("rewardType", reward.type.toString());
if (reward.reward_obj != null) {
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Droplist.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Droplist.java
index 0f95c74..24af3e5 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Droplist.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Droplist.java
@@ -5,8 +5,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.util.LinkedHashMap;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -203,13 +203,13 @@ public class Droplist extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
- Map droplistJson = new HashMap();
+ Map droplistJson = new LinkedHashMap();
droplistJson.put("id", this.id);
if (this.dropped_items != null) {
List droppedItemsJson = new ArrayList();
droplistJson.put("items", droppedItemsJson);
for (DroppedItem droppedItem : this.dropped_items) {
- Map droppedItemJson = new HashMap();
+ Map droppedItemJson = new LinkedHashMap();
droppedItemsJson.add(droppedItemJson);
if (droppedItem.item != null) {
droppedItemJson.put("itemID", droppedItem.item.id);
@@ -218,7 +218,7 @@ public class Droplist extends JSONElement {
}
if (droppedItem.chance != null) droppedItemJson.put("chance", JSONElement.printJsonChance(droppedItem.chance));
if (droppedItem.quantity_min != null || droppedItem.quantity_max != null) {
- Map quantityJson = new HashMap();
+ Map quantityJson = new LinkedHashMap();
droppedItemJson.put("quantity", quantityJson);
if (droppedItem.quantity_min != null) quantityJson.put("min", droppedItem.quantity_min);
else quantityJson.put("min", 0);
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/GameDataCategory.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/GameDataCategory.java
index bc659ba..b79ef8e 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/GameDataCategory.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/GameDataCategory.java
@@ -9,7 +9,8 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -190,7 +191,7 @@ public class GameDataCategory extends ArrayList implem
List events = new ArrayList();
GameDataCategory extends JSONElement> impactedCategory = null;
String impactedFileName = fileName;
- Map containedIds = new HashMap();
+ Map containedIds = new LinkedHashMap();
for (JSONElement node : this) {
if (node.getDataType() == GameSource.Type.created && getProject().baseContent.gameData.getGameDataElement(node.getClass(), node.id) != null) {
if (getProject().alteredContent.gameData.getGameDataElement(node.getClass(), node.id) != null) {
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Item.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Item.java
index cb1d45f..381475c 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Item.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Item.java
@@ -5,8 +5,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.util.LinkedHashMap;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -492,7 +492,7 @@ public class Item extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
- Map itemJson = new HashMap();
+ Map itemJson = new LinkedHashMap();
itemJson.put("id", this.id);
if (this.icon_id != null) itemJson.put("iconID", this.icon_id);
if (this.name != null) itemJson.put("name", this.name);
@@ -507,10 +507,10 @@ public class Item extends JSONElement {
}
if (this.description != null) itemJson.put("description", this.description);
if (this.equip_effect != null) {
- Map equipEffectJson = new HashMap();
+ Map equipEffectJson = new LinkedHashMap();
itemJson.put("equipEffect", equipEffectJson);
if (this.equip_effect.damage_boost_min != null || this.equip_effect.damage_boost_max != null) {
- Map damageJson = new HashMap();
+ Map damageJson = new LinkedHashMap();
equipEffectJson.put("increaseAttackDamage", damageJson);
if (this.equip_effect.damage_boost_min != null) damageJson.put("min", this.equip_effect.damage_boost_min);
else damageJson.put("min", 0);
@@ -532,7 +532,7 @@ public class Item extends JSONElement {
List conditionsJson = new ArrayList();
equipEffectJson.put("addedConditions", conditionsJson);
for (ConditionEffect condition : this.equip_effect.conditions) {
- Map conditionJson = new HashMap();
+ Map conditionJson = new LinkedHashMap();
conditionsJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);
@@ -544,10 +544,10 @@ public class Item extends JSONElement {
}
}
if (this.hit_effect != null) {
- Map hitEffectJson = new HashMap();
+ Map hitEffectJson = new LinkedHashMap();
itemJson.put("hitEffect", hitEffectJson);
if (this.hit_effect.hp_boost_min != null || this.hit_effect.hp_boost_max != null) {
- Map hpJson = new HashMap();
+ Map hpJson = new LinkedHashMap();
hitEffectJson.put("increaseCurrentHP", hpJson);
if (this.hit_effect.hp_boost_min != null) hpJson.put("min", this.hit_effect.hp_boost_min);
else hpJson.put("min", 0);
@@ -555,7 +555,7 @@ public class Item extends JSONElement {
else hpJson.put("max", 0);
}
if (this.hit_effect.ap_boost_min != null || this.hit_effect.ap_boost_max != null) {
- Map apJson = new HashMap();
+ Map apJson = new LinkedHashMap();
hitEffectJson.put("increaseCurrentAP", apJson);
if (this.hit_effect.ap_boost_min != null) apJson.put("min", this.hit_effect.ap_boost_min);
else apJson.put("min", 0);
@@ -566,7 +566,7 @@ public class Item extends JSONElement {
List conditionsSourceJson = new ArrayList();
hitEffectJson.put("conditionsSource", conditionsSourceJson);
for (TimedConditionEffect condition : this.hit_effect.conditions_source) {
- Map conditionJson = new HashMap();
+ Map conditionJson = new LinkedHashMap();
conditionsSourceJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);
@@ -582,7 +582,7 @@ public class Item extends JSONElement {
List conditionsTargetJson = new ArrayList();
hitEffectJson.put("conditionsTarget", conditionsTargetJson);
for (TimedConditionEffect condition : this.hit_effect.conditions_target) {
- Map conditionJson = new HashMap();
+ Map conditionJson = new LinkedHashMap();
conditionsTargetJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);
@@ -596,14 +596,14 @@ public class Item extends JSONElement {
}
}
if (this.kill_effect != null) {
- Map killEffectJson = new HashMap();
+ Map killEffectJson = new LinkedHashMap();
if (this.category != null && this.category.action_type != null && this.category.action_type == ItemCategory.ActionType.equip) {
itemJson.put("killEffect", killEffectJson);
} else if (this.category != null && this.category.action_type != null && this.category.action_type == ItemCategory.ActionType.use) {
itemJson.put("useEffect", killEffectJson);
}
if (this.kill_effect.hp_boost_min != null || this.kill_effect.hp_boost_max != null) {
- Map hpJson = new HashMap();
+ Map hpJson = new LinkedHashMap();
killEffectJson.put("increaseCurrentHP", hpJson);
if (this.kill_effect.hp_boost_min != null) hpJson.put("min", this.kill_effect.hp_boost_min);
else hpJson.put("min", 0);
@@ -611,7 +611,7 @@ public class Item extends JSONElement {
else hpJson.put("min", 0);
}
if (this.kill_effect.ap_boost_min != null || this.kill_effect.ap_boost_max != null) {
- Map apJson = new HashMap();
+ Map apJson = new LinkedHashMap();
killEffectJson.put("increaseCurrentAP", apJson);
if (this.kill_effect.ap_boost_min != null) apJson.put("min", this.kill_effect.ap_boost_min);
else apJson.put("min", 0);
@@ -622,7 +622,7 @@ public class Item extends JSONElement {
List conditionsSourceJson = new ArrayList();
killEffectJson.put("conditionsSource", conditionsSourceJson);
for (TimedConditionEffect condition : this.kill_effect.conditions_source) {
- Map conditionJson = new HashMap();
+ Map conditionJson = new LinkedHashMap();
conditionsSourceJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/ItemCategory.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/ItemCategory.java
index 179082b..be957a3 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/ItemCategory.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/ItemCategory.java
@@ -5,7 +5,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -310,7 +310,7 @@ public class ItemCategory extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
- Map itemCatJson = new HashMap();
+ Map itemCatJson = new LinkedHashMap();
itemCatJson.put("id", this.id);
if (this.name != null) itemCatJson.put("name", this.name);
if (this.action_type != null) itemCatJson.put("actionType", this.action_type.toString());
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/NPC.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/NPC.java
index 68e5744..701a68d 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/NPC.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/NPC.java
@@ -5,8 +5,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.util.LinkedHashMap;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -386,7 +386,7 @@ public class NPC extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
- Map npcJson = new HashMap();
+ Map npcJson = new LinkedHashMap();
npcJson.put("id", this.id);
if (this.name != null) npcJson.put("name", this.name);
if (this.icon_id != null) npcJson.put("iconID", this.icon_id);
@@ -397,7 +397,7 @@ public class NPC extends JSONElement {
if (this.monster_class != null) npcJson.put("monsterClass", this.monster_class.toString());
if (this.movement_type != null) npcJson.put("movementAggressionType", this.movement_type.toString());
if (this.attack_damage_min != null || this.attack_damage_max != null) {
- Map adJson = new HashMap();
+ Map adJson = new LinkedHashMap();
npcJson.put("attackDamage", adJson);
if (this.attack_damage_min != null) adJson.put("min", this.attack_damage_min);
else adJson.put("min", 0);
@@ -423,10 +423,10 @@ public class NPC extends JSONElement {
if (this.block_chance != null) npcJson.put("blockChance", this.block_chance);
if (this.damage_resistance != null) npcJson.put("damageResistance", this.damage_resistance);
if (this.hit_effect != null) {
- Map hitEffectJson = new HashMap();
+ Map hitEffectJson = new LinkedHashMap();
npcJson.put("hitEffect", hitEffectJson);
if (this.hit_effect.hp_boost_min != null || this.hit_effect.hp_boost_max != null) {
- Map hpJson = new HashMap();
+ Map hpJson = new LinkedHashMap();
hitEffectJson.put("increaseCurrentHP", hpJson);
if (this.hit_effect.hp_boost_min != null) hpJson.put("min", this.hit_effect.hp_boost_min);
else hpJson.put("min", 0);
@@ -434,7 +434,7 @@ public class NPC extends JSONElement {
else hpJson.put("max", 0);
}
if (this.hit_effect.ap_boost_min != null || this.hit_effect.ap_boost_max != null) {
- Map apJson = new HashMap();
+ Map apJson = new LinkedHashMap();
hitEffectJson.put("increaseCurrentAP", apJson);
if (this.hit_effect.ap_boost_min != null) apJson.put("min", this.hit_effect.ap_boost_min);
else apJson.put("min", 0);
@@ -445,7 +445,7 @@ public class NPC extends JSONElement {
List conditionsSourceJson = new ArrayList();
hitEffectJson.put("conditionsSource", conditionsSourceJson);
for (TimedConditionEffect condition : this.hit_effect.conditions_source) {
- Map conditionJson = new HashMap();
+ Map conditionJson = new LinkedHashMap();
conditionsSourceJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);
@@ -461,7 +461,7 @@ public class NPC extends JSONElement {
List conditionsTargetJson = new ArrayList();
hitEffectJson.put("conditionsTarget", conditionsTargetJson);
for (TimedConditionEffect condition : this.hit_effect.conditions_target) {
- Map conditionJson = new HashMap();
+ Map conditionJson = new LinkedHashMap();
conditionsTargetJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Quest.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Quest.java
index a9a1ec2..1e03552 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Quest.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Quest.java
@@ -5,8 +5,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.util.LinkedHashMap;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -180,7 +180,7 @@ public class Quest extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
- Map questJson = new HashMap();
+ Map questJson = new LinkedHashMap();
questJson.put("id", this.id);
if (this.name != null) questJson.put("name", this.name);
if (this.visible_in_log != null) questJson.put("showInLog", this.visible_in_log);
@@ -188,7 +188,7 @@ public class Quest extends JSONElement {
List stagesJson = new ArrayList();
questJson.put("stages", stagesJson);
for (QuestStage stage : this.stages) {
- Map stageJson = new HashMap();
+ Map stageJson = new LinkedHashMap();
stagesJson.add(stageJson);
if (stage.progress != null) stageJson.put("progress", stage.progress);
if (stage.log_text != null) stageJson.put("logText", stage.log_text);
diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Requirement.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Requirement.java
index cb6fde7..89a6b8f 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Requirement.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Requirement.java
@@ -1,7 +1,7 @@
package com.gpl.rpg.atcontentstudio.model.gamedata;
+import java.util.LinkedHashMap;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -13,7 +13,7 @@ public class Requirement extends JSONElement {
private static final long serialVersionUID = 7295593297142310955L;
- private static Map> COMPATIBLE_TYPES = new HashMap>();
+ private static Map> COMPATIBLE_TYPES = new LinkedHashMap>();
static {
List questTypes = new ArrayList();
diff --git a/src/com/gpl/rpg/atcontentstudio/model/maps/ReplaceArea.java b/src/com/gpl/rpg/atcontentstudio/model/maps/ReplaceArea.java
index 3f39e0a..7da01b3 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/maps/ReplaceArea.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/maps/ReplaceArea.java
@@ -1,10 +1,8 @@
package com.gpl.rpg.atcontentstudio.model.maps;
import java.awt.Image;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.gamedata.Requirement;
@@ -47,7 +45,7 @@ public class ReplaceArea extends MapObject {
for (Object s : obj.getProperties().keySet()) {
- if (replacements == null) replacements = new LinkedList();
+ if (replacements == null) replacements = new ArrayList();
replacements.add(new Replacement(s.toString(), obj.getProperties().getProperty(s.toString())));
}
@@ -76,7 +74,7 @@ public class ReplaceArea extends MapObject {
}
public void addReplacement(ReplaceArea.Replacement repl) {
- if (replacements == null) replacements = new LinkedList();
+ if (replacements == null) replacements = new ArrayList();
replacements.add(repl);
}
diff --git a/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMap.java b/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMap.java
index b278bd7..feb9768 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMap.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMap.java
@@ -10,6 +10,7 @@ import java.io.StringReader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
+import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -21,10 +22,10 @@ import tiled.io.TMXMapWriter;
import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.GameSource;
-import com.gpl.rpg.atcontentstudio.model.SaveEvent;
import com.gpl.rpg.atcontentstudio.model.GameSource.Type;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
+import com.gpl.rpg.atcontentstudio.model.SaveEvent;
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
diff --git a/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMapSet.java b/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMapSet.java
index 2cce4ca..7cb453a 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMapSet.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMapSet.java
@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
+import java.util.ArrayList;
import java.util.List;
import javax.swing.tree.TreeNode;
@@ -13,11 +14,10 @@ import javax.swing.tree.TreeNode;
import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.model.GameSource;
import com.gpl.rpg.atcontentstudio.model.GameSource.Type;
-import com.gpl.rpg.atcontentstudio.model.Project.ResourceSet;
import com.gpl.rpg.atcontentstudio.model.Project;
+import com.gpl.rpg.atcontentstudio.model.Project.ResourceSet;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
-import com.gpl.rpg.atcontentstudio.model.gamedata.Item;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
public class TMXMapSet implements ProjectTreeNode {
diff --git a/src/com/gpl/rpg/atcontentstudio/model/maps/Worldmap.java b/src/com/gpl/rpg/atcontentstudio/model/maps/Worldmap.java
index c5b7da5..c05dd0e 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/maps/Worldmap.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/maps/Worldmap.java
@@ -10,8 +10,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
diff --git a/src/com/gpl/rpg/atcontentstudio/model/maps/WorldmapSegment.java b/src/com/gpl/rpg/atcontentstudio/model/maps/WorldmapSegment.java
index cdd00f9..95f14cd 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/maps/WorldmapSegment.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/maps/WorldmapSegment.java
@@ -3,11 +3,8 @@ package com.gpl.rpg.atcontentstudio.model.maps;
import java.awt.Image;
import java.awt.Point;
import java.io.ByteArrayOutputStream;
-import java.io.FileOutputStream;
-import java.io.StringWriter;
-import java.util.HashMap;
import java.util.LinkedHashMap;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -69,7 +66,7 @@ public class WorldmapSegment extends GameDataElement {
String area;
if ((area = mapNode.getAttribute("area")) != null && !"".equals(area)) {
if (labelledMaps.get(area) == null) {
- labelledMaps.put(area, new LinkedList());
+ labelledMaps.put(area, new ArrayList());
}
labelledMaps.get(area).add(mapNode.getAttribute("id"));
}
diff --git a/src/com/gpl/rpg/atcontentstudio/model/sprites/SpriteSheetSet.java b/src/com/gpl/rpg/atcontentstudio/model/sprites/SpriteSheetSet.java
index 9401cea..1de236e 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/sprites/SpriteSheetSet.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/sprites/SpriteSheetSet.java
@@ -5,6 +5,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.ArrayList;
import java.util.List;
import javax.swing.tree.TreeNode;
diff --git a/src/com/gpl/rpg/atcontentstudio/model/sprites/Spritesheet.java b/src/com/gpl/rpg/atcontentstudio/model/sprites/Spritesheet.java
index 0dad07d..bbe79fb 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/sprites/Spritesheet.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/sprites/Spritesheet.java
@@ -7,7 +7,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -43,8 +43,8 @@ public class Spritesheet extends GameDataElement {
//Lazy initialization.
public BufferedImage spritesheet = null;
- public Map cache_full_size = new HashMap();
- public Map cache_icon = new HashMap();
+ public Map cache_full_size = new LinkedHashMap();
+ public Map cache_icon = new LinkedHashMap();
public Spritesheet(SpriteSheetSet parent, File f) {
this.spritesheetFile = f;
diff --git a/src/com/gpl/rpg/atcontentstudio/model/tools/WriterModeData.java b/src/com/gpl/rpg/atcontentstudio/model/tools/writermode/WriterModeData.java
similarity index 85%
rename from src/com/gpl/rpg/atcontentstudio/model/tools/WriterModeData.java
rename to src/com/gpl/rpg/atcontentstudio/model/tools/writermode/WriterModeData.java
index 969314c..5fd5563 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/tools/WriterModeData.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/tools/writermode/WriterModeData.java
@@ -1,14 +1,13 @@
-package com.gpl.rpg.atcontentstudio.model.tools;
+package com.gpl.rpg.atcontentstudio.model.tools.writermode;
import java.awt.Image;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Collection;
import java.util.LinkedHashMap;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -19,6 +18,7 @@ import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.SaveEvent;
+import com.gpl.rpg.atcontentstudio.model.gamedata.Dialogue;
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
@@ -32,8 +32,8 @@ public class WriterModeData extends GameDataElement {
public String sketchName;
- public List rootsId = new LinkedList();
- public List roots = new LinkedList();
+ public List rootsId = new ArrayList();
+ public List roots = new ArrayList();
public WriterDialogue begin;
public Map nodesById = new LinkedHashMap();
@@ -76,8 +76,8 @@ public class WriterModeData extends GameDataElement {
public String id;
public String id_prefix;
public int index;
- public List replies = new LinkedList();
- public List parents = new LinkedList();
+ public List replies = new ArrayList();
+ public List parents = new ArrayList();
public WriterDialogue() {}
@@ -93,10 +93,14 @@ public class WriterModeData extends GameDataElement {
return "Dialogue "+id_prefix+index;
}
+ public String getID() {
+ return this.id != null ? this.id : this.id_prefix+this.index;
+ }
+
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
- Map dialogueJson = new HashMap();
+ Map dialogueJson = new LinkedHashMap();
dialogueJson.put("id", id);
dialogueJson.put("id_prefix", id_prefix);
dialogueJson.put("index", index);
@@ -130,6 +134,22 @@ public class WriterModeData extends GameDataElement {
public boolean isSpecial() {return false;}
+
+ public Dialogue toDialogue(Map visited){
+ if (visited.get(this) != null) return visited.get(this);
+ Dialogue dialogue = new Dialogue();
+ dialogue.state = GameDataElement.State.parsed;
+ visited.put(this, dialogue);
+ dialogue.id = getID();
+ dialogue.message = this.text;
+ if (this.replies != null && !this.replies.isEmpty()) {
+ dialogue.replies = new ArrayList();
+ for (WriterReply wReply : this.replies) {
+ dialogue.replies.add(wReply.toReply(visited));
+ }
+ }
+ return dialogue;
+ }
}
@@ -188,7 +208,7 @@ public class WriterModeData extends GameDataElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
- Map replyJson = new HashMap();
+ Map replyJson = new LinkedHashMap();
replyJson.put("text", text);
replyJson.put("special", isSpecial());
if (next_dialogue != null) {
@@ -198,6 +218,20 @@ public class WriterModeData extends GameDataElement {
}
public boolean isSpecial() {return false;}
+
+ public Dialogue.Reply toReply(Map visited) {
+ Dialogue.Reply reply = new Dialogue.Reply();
+ reply.text = this.text;
+ if (this.next_dialogue != null) {
+ this.next_dialogue.toDialogue(visited);
+ reply.next_phrase_id = this.next_dialogue.getID();
+ } else if (this.next_dialogue_id != null) {
+ reply.next_phrase_id = this.next_dialogue_id;
+ } else {
+ reply.next_phrase_id = "X";
+ }
+ return reply;
+ }
}
@@ -410,4 +444,10 @@ public class WriterModeData extends GameDataElement {
return null;
}
+ public Collection toDialogue(){
+ Map visited = new LinkedHashMap();
+ begin.toDialogue(visited);
+ return visited.values();
+ }
+
}
diff --git a/src/com/gpl/rpg/atcontentstudio/model/tools/WriterModeDataSet.java b/src/com/gpl/rpg/atcontentstudio/model/tools/writermode/WriterModeDataSet.java
similarity index 96%
rename from src/com/gpl/rpg/atcontentstudio/model/tools/WriterModeDataSet.java
rename to src/com/gpl/rpg/atcontentstudio/model/tools/writermode/WriterModeDataSet.java
index 6c32b82..761f5f8 100644
--- a/src/com/gpl/rpg/atcontentstudio/model/tools/WriterModeDataSet.java
+++ b/src/com/gpl/rpg/atcontentstudio/model/tools/writermode/WriterModeDataSet.java
@@ -1,4 +1,4 @@
-package com.gpl.rpg.atcontentstudio.model.tools;
+package com.gpl.rpg.atcontentstudio.model.tools.writermode;
import java.awt.Image;
import java.io.File;
@@ -11,7 +11,7 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -23,10 +23,10 @@ import org.json.simple.parser.ParseException;
import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.io.JsonPrettyWriter;
+import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.GameDataElement.State;
import com.gpl.rpg.atcontentstudio.model.GameSource;
import com.gpl.rpg.atcontentstudio.model.GameSource.Type;
-import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
import com.gpl.rpg.atcontentstudio.model.SaveEvent;
@@ -42,7 +42,7 @@ public class WriterModeDataSet implements ProjectTreeNode, Serializable {
public GameSource parent;
public File writerFile;
- List writerModeDataList = new LinkedList();
+ List writerModeDataList = new ArrayList();
public WriterModeDataSet(GameSource gameSource) {
this.parent = gameSource;
@@ -156,7 +156,7 @@ public class WriterModeDataSet implements ProjectTreeNode, Serializable {
@SuppressWarnings("rawtypes")
public void save(File jsonFile) {
- List