diff --git a/src/resources/client_info/ClientData.java b/src/resources/client_info/ClientData.java
new file mode 100644
index 000000000..bfd969cfe
--- /dev/null
+++ b/src/resources/client_info/ClientData.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2015 /// Project SWG /// www.projectswg.com
+ *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies.
+ * Our goal is to create an emulator which will provide a server for players to
+ * continue playing a game similar to the one they used to play. We are basing
+ * it on the final publish of the game prior to end-game events.
+ *
+ * This file is part of Holocore.
+ *
+ * --------------------------------------------------------------------------------
+ *
+ * Holocore is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Holocore is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Holocore. If not, see
+ ******************************************************************************/
+
+package resources.client_info;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Created by Waverunner on 6/9/2015
+ */
+public abstract class ClientData {
+ public abstract void parse(String node, ByteBuffer data, int size);
+}
diff --git a/src/resources/client_info/ClientFactory.java b/src/resources/client_info/ClientFactory.java
index 0f24c210b..3f75eb7d3 100644
--- a/src/resources/client_info/ClientFactory.java
+++ b/src/resources/client_info/ClientFactory.java
@@ -27,15 +27,9 @@
***********************************************************************************/
package resources.client_info;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import java.util.HashMap;
import java.util.Map;
-import resources.client_info.visitors.ClientData;
import resources.client_info.visitors.CrcStringTableData;
import resources.client_info.visitors.DatatableData;
import resources.client_info.visitors.ObjectData;
@@ -43,13 +37,10 @@ import resources.client_info.visitors.ProfTemplateData;
import resources.client_info.visitors.SlotArrangementData;
import resources.client_info.visitors.SlotDefinitionData;
import resources.client_info.visitors.SlotDescriptorData;
-import utilities.ByteUtilities;
-public class ClientFactory {
- private static ClientFactory instance;
-
- private Map dataMap = new HashMap();
- private Map typeMap = new HashMap();
+public class ClientFactory extends DataFactory {
+ private Map dataMap = new HashMap<>();
+ private Map typeMap = new HashMap<>();
/**
* Creates a new instance of ClientFactory.
@@ -58,7 +49,7 @@ public class ClientFactory {
* In order to add parsing for an IFF type which is not yet parsed:
*
* - Create a new class which extends {@link ClientData}.
- *
- Perform the parsing of each node within the handleData method using switch-case statements for different node names.
+ *
- Perform the parsing of each node within the parse method using switch-case statements for different node names.
*
- Add a new entry to the typeMap through populateTypeMap() method by adding in the name of the folder/node you're parsing
* as the Key and the name of the class that was just created as the Value.
*
- Add in a case statement in the createDataObject method returning a new instance of the class, the case being the Value
@@ -74,21 +65,15 @@ public class ClientFactory {
* stores the variables and is the returned type. Retrieving info from this file puts a reference of the returned
* {@link ClientData} into a {@link HashMap}. Future calls for this file will try and obtain this reference if it's not null to prevent
* the file from being parsed multiple times.
- * @param file The SWG file you wish to get information from which resides in the ./clientdata/ folder.
+ * @param file The SWG file you wish to get information from which resides in the ./DataObject/ folder.
* Example: creation/profession_defaults_combat_brawler.iff
- * @param saveInfo This will save the information into the map for future calls to get information from this file.
* @return Specific visitor type of {@link ClientData} relating to the chosen file. For example, loading the file
* creation/profession_defaults_combat_brawler.iff would return an instance of {@link ProfTemplateData} extended from {@link ClientData}.
* A null instance of {@link ClientData} means that parsing for the type of file is not done, or a file was entered that doesn't exist on the
* file system.
*/
- public synchronized static ClientData getInfoFromFile(String file, boolean saveInfo) {
- ClientFactory factory = ClientFactory.instance;
- if (factory == null) {
- ClientFactory.instance = new ClientFactory();
- factory = ClientFactory.instance;
- }
-
+ public synchronized static ClientData getInfoFromFile(String file) {
+ ClientFactory factory = (ClientFactory) ClientFactory.getInstance();
ClientData data = factory.dataMap.get(file);
if (data == null) {
@@ -96,8 +81,9 @@ public class ClientFactory {
if (data == null) {
return null;
}
-
- /*weak = new WeakReference(strong);
+ // I believe that this was commented out because it made the references go away while still being used.
+ // Look into this again further and see what is going wrong.
+ /*weak = new WeakReference(strong);
if (weak.get() != null) {
dataMap.put(file, weak);
@@ -106,11 +92,7 @@ public class ClientFactory {
return data;
}
-
- public synchronized static ClientData getInfoFromFile(String file) {
- return getInfoFromFile(file, true);
- }
-
+
public synchronized static String formatToSharedFile(String original) {
if (original.contains("shared_"))
return original;
@@ -118,70 +100,13 @@ public class ClientFactory {
int index = original.lastIndexOf("/");
return original.substring(0, index) + "/shared_" + original.substring(index+1);
}
-
- // readFile only called if dataMap doesn't contain the file as a key or it's value is null
- private ClientData readFile(String file) {
- FileInputStream stream = null;
- try {
- File f = new File("./clientdata/" + file);
- if (!f.exists()) {
- f = new File("./serverdata/" + file);
- if (!f.exists()) {
- System.out.println(file + " not found!");
- return null;
- }
- }
-
- stream = new FileInputStream(f);
- ByteBuffer bb = readIntoBuffer(stream);
-
- ClientData visitor = getFileType(bb);
- if (visitor == null) { // Visitor value will be null if parsing for a certain client file type doesn't exist yet.
- return null;
- }
-
- bb.position(8); // Skip first FORM, some forms only have a node and not a parent form
- parseData(bb, visitor);
- return visitor;
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- return null;
- }
-
- private ByteBuffer readIntoBuffer(FileInputStream stream) throws IOException {
- ByteBuffer bb = ByteBuffer.allocate(stream.available()).order(ByteOrder.LITTLE_ENDIAN);
- stream.read(bb.array());
- return bb;
- }
-
- private ClientData getFileType(ByteBuffer bb) {
- bb.position(8); // Skip the first FORM and data size
- String type = ByteUtilities.nextString(bb); // Get the specific form for this IFF so we know what visitor to use
- ClientData data = createDataObject(type);
-
- if (data == null) {
- System.err.println("Handling for " + type + " not implemented!");
- return null;
- }
-
- return data;
- }
-
- // Any time a new ClientData is coded for parsing a file, it will need to be added in populateTypeMap() along with a new return
+ // Any time a new DataObject is coded for parsing a file, it will need to be added in populateTypeMap() along with a new return
// of that instance so the file can be parsed. The type is the name of the folder/node which is then used to get the value associated
// with it in the typeMap (value being the name of the Class preferably). If populateTypeMap() does not contain that node, then null is returned
// and getFileType method will print out what the type is along with a "not implemented!" message.
- private ClientData createDataObject(String type) {
+ @Override
+ protected ClientData createDataObject(String type) {
String c = typeMap.get(type);
if (c == null) {
System.err.println("Don't know what class to use for " + type);
@@ -200,54 +125,9 @@ public class ClientFactory {
default: return null;
}
}
-
- private void parseData(ByteBuffer bb, ClientData visitor) throws Exception {
- String name = null;
- while (bb.hasRemaining()) {
- name = ByteUtilities.nextString(bb);
- if (name.contains("FORM")) {
- parseFolder(name, bb, visitor);
- } else {
- parseNode(name, bb, visitor);
- }
- }
-
- }
-
- private void parseNode(String name, ByteBuffer bb, ClientData visitor) throws Exception {
- int size = Integer.reverseBytes(bb.getInt()); // Size of this node/folder
-
- if (size == 0)
- return;
-
- // Create a new buffer for parsing data specific to this node (excluding name bytes)
- visitor.handleData(name, getData(bb, size), size);
-
- }
-
- private void parseFolder(String name, ByteBuffer bb, ClientData visitor) throws Exception {
- ByteBuffer data = getData(bb, Integer.reverseBytes(bb.getInt()));
-
- // Notify visitor of the Folder? May be needed at some point.
-
- parseData(data, visitor);
- }
- // Cut down a ByteBuffer from the current position so we are only working with a certain amount of bytes. Useful when we
- // call the ClientData.handleData method.
- private ByteBuffer getData(ByteBuffer source, int size) {
- ByteBuffer data = ByteBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN);
- int offset = source.position();
- data.put(source.array(), offset, size);
- source.position(offset+size);
- data.flip();
-
- return data;
- }
-
- // The typeMap is used for determining what ClientData class
+ // The typeMap is used for determining what DataObject class
private void populateTypeMap() {
-
typeMap.put("ARGDFORM", "SlotArrangementData");
typeMap.put("0006DATA", "SlotDefinitionData");
typeMap.put("CSTBFORM", "CrcStringTableData");
@@ -283,7 +163,10 @@ public class ClientFactory {
typeMap.put("SWAYFORM", "ObjectData"); // object/waypoint
typeMap.put("SWOTFORM", "ObjectData"); // object/weapon
//
-
}
+ @Override
+ protected String getFolder() {
+ return "./DataObject/";
+ }
}
diff --git a/src/resources/client_info/DataFactory.java b/src/resources/client_info/DataFactory.java
new file mode 100644
index 000000000..4e5e59827
--- /dev/null
+++ b/src/resources/client_info/DataFactory.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2015 /// Project SWG /// www.projectswg.com
+ *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies.
+ * Our goal is to create an emulator which will provide a server for players to
+ * continue playing a game similar to the one they used to play. We are basing
+ * it on the final publish of the game prior to end-game events.
+ *
+ * This file is part of Holocore.
+ *
+ * --------------------------------------------------------------------------------
+ *
+ * Holocore is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Holocore is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Holocore. If not, see
+ ******************************************************************************/
+
+package resources.client_info;
+
+import utilities.ByteUtilities;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * Created by Waverunner on 6/9/2015
+ */
+public abstract class DataFactory {
+ private static DataFactory instance;
+
+ public DataFactory() {
+ instance = this;
+ }
+
+ private ClientData getFileType(ByteBuffer bb) {
+ bb.position(8); // Skip the first FORM and data size
+ String type = ByteUtilities.nextString(bb); // Get the specific form for this IFF so we know what visitor to use
+
+ ClientData data = createDataObject(type);
+
+ return data;
+ }
+
+ // readFile only called if dataMap doesn't contain the file as a key or it's value is null
+ protected ClientData readFile(String file) {
+ FileInputStream stream = null;
+ try {
+ File f = new File(getFolder() + file);
+ if (!f.exists()) {
+ System.out.println(file + " not found!");
+ return null;
+ }
+
+ stream = new FileInputStream(f);
+ ByteBuffer bb = readIntoBuffer(stream);
+
+ ClientData visitor = getFileType(bb);
+ if (visitor == null)
+ return null;
+
+ bb.position(8); // Skip first FORM, some forms only have a node and not a parent form
+ parseData(bb, visitor);
+ return visitor;
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return null;
+ }
+
+ private void parseData(ByteBuffer bb, ClientData visitor) throws Exception {
+ String name;
+ while (bb.hasRemaining()) {
+ name = ByteUtilities.nextString(bb);
+ if (name.contains("FORM")) {
+ parseFolder(bb, visitor);
+ } else {
+ parseNode(name, bb, visitor);
+ }
+ }
+
+ }
+
+ private void parseNode(String name, ByteBuffer bb, ClientData visitor) throws Exception {
+ int size = Integer.reverseBytes(bb.getInt()); // Size of this node/folder
+
+ if (size == 0)
+ return;
+
+ // Create a new buffer for parsing data specific to this node (excluding name bytes)
+ visitor.parse(name, getData(bb, size), size);
+
+ }
+
+ private void parseFolder(ByteBuffer bb, ClientData visitor) throws Exception {
+ ByteBuffer data = getData(bb, Integer.reverseBytes(bb.getInt()));
+
+ // Notify visitor of the Folder? May be needed at some point.
+
+ parseData(data, visitor);
+ }
+
+ private ByteBuffer readIntoBuffer(FileInputStream stream) throws IOException {
+ ByteBuffer bb = ByteBuffer.allocate(stream.available()).order(ByteOrder.LITTLE_ENDIAN);
+ stream.read(bb.array());
+ return bb;
+ }
+
+ // Cut down a ByteBuffer from the current position so we are only working with a certain amount of bytes. Useful when we
+ // call the ClientData.parse method.
+ private ByteBuffer getData(ByteBuffer source, int size) {
+ ByteBuffer data = ByteBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN);
+ int offset = source.position();
+ data.put(source.array(), offset, size);
+ source.position(offset+size);
+ data.flip();
+
+ return data;
+ }
+
+ protected abstract ClientData createDataObject(String type);
+ protected abstract String getFolder();
+
+ protected static DataFactory getInstance() {
+ return instance;
+ }
+}
diff --git a/src/resources/client_info/IffNode.java b/src/resources/client_info/IffNode.java
new file mode 100644
index 000000000..604707d59
--- /dev/null
+++ b/src/resources/client_info/IffNode.java
@@ -0,0 +1,63 @@
+package resources.client_info;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by Waverunner on 6/7/2015
+ */
+public class IffNode {
+
+ private String tag;
+ private boolean isForm;
+ private List children;
+ private byte[] chunkData;
+
+ public IffNode(String tag, boolean isForm) {
+ this.tag = tag;
+ this.isForm = isForm;
+ }
+
+ public void addChild(IffNode child) {
+ if (children == null)
+ children = new ArrayList<>();
+ children.add(child);
+ }
+
+ public void setChunkData(ByteBuffer chunkData) {
+ this.chunkData = chunkData.array();
+ }
+
+ public byte[] getBytes() {
+ return isForm ? createForm() : createChunk();
+ }
+
+ private byte[] createForm() {
+ List childrenData = new ArrayList<>();
+ int size = 0;
+ for (IffNode child : children) {
+ byte[] subData = child.getBytes();
+ size += subData.length;
+ childrenData.add(subData);
+ }
+ ByteBuffer bb = ByteBuffer.allocate(size + 12).order(ByteOrder.LITTLE_ENDIAN);
+ bb.put("FORM".getBytes(Charset.forName("US-ASCII")));
+ bb.order(ByteOrder.BIG_ENDIAN).putInt(size + 4);
+ bb.put(tag.getBytes(Charset.forName("US-ASCII")));
+ for (byte[] bytes : childrenData) {
+ bb.put(bytes);
+ }
+ return bb.array();
+ }
+
+ private byte[] createChunk() {
+ ByteBuffer byteBuffer = ByteBuffer.allocate(8 + chunkData.length).order(ByteOrder.LITTLE_ENDIAN);
+ byteBuffer.put(tag.getBytes(Charset.forName("US-ASCII")));
+ byteBuffer.order(ByteOrder.BIG_ENDIAN).putInt(chunkData.length);
+ byteBuffer.put(chunkData);
+ return byteBuffer.array();
+ }
+}
\ No newline at end of file
diff --git a/src/resources/client_info/SWGFile.java b/src/resources/client_info/SWGFile.java
new file mode 100644
index 000000000..dd20320dd
--- /dev/null
+++ b/src/resources/client_info/SWGFile.java
@@ -0,0 +1,56 @@
+package resources.client_info;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * Created by Waverunner on 6/4/2015
+ */
+public class SWGFile {
+ private File file;
+ private IffNode master;
+ private IffNode currentForm;
+
+ public SWGFile(String type) {
+ this.master = new IffNode(type, true);
+ this.currentForm = master;
+ }
+
+ public SWGFile(File file, String type) {
+ this(type);
+ this.file = file;
+ }
+
+ public void save(File file) throws IOException {
+ FileOutputStream outputStream = new FileOutputStream(file, false);
+ outputStream.write(getData());
+ outputStream.close();
+ }
+
+ public void save() throws IOException {
+ save(file);
+ }
+
+ public void addForm(String tag) {
+ addForm(tag, true);
+ }
+
+ public void addForm(String tag, boolean enterForm) {
+ IffNode form = new IffNode(tag, true);
+ currentForm.addChild(form);
+
+ if (enterForm)
+ currentForm = form;
+ }
+
+ public IffNode addChunk(String tag) {
+ IffNode chunk = new IffNode(tag, false);
+ currentForm.addChild(chunk);
+ return chunk;
+ }
+
+ public byte[] getData() {
+ return master.getBytes();
+ }
+}
\ No newline at end of file
diff --git a/src/resources/client_info/ServerFactory.java b/src/resources/client_info/ServerFactory.java
new file mode 100644
index 000000000..d2ac2a4a9
--- /dev/null
+++ b/src/resources/client_info/ServerFactory.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2015 /// Project SWG /// www.projectswg.com
+ *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies.
+ * Our goal is to create an emulator which will provide a server for players to
+ * continue playing a game similar to the one they used to play. We are basing
+ * it on the final publish of the game prior to end-game events.
+ *
+ * This file is part of Holocore.
+ *
+ * --------------------------------------------------------------------------------
+ *
+ * Holocore is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Holocore is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Holocore. If not, see
+ ******************************************************************************/
+
+package resources.client_info;
+
+import resources.client_info.visitors.DatatableData;
+
+
+/**
+ * Created by Waverunner on 6/9/2015
+ */
+public final class ServerFactory extends DataFactory {
+
+ public static DatatableData getDatatable(String file) {
+ ClientData data = getInstance().readFile(file);
+ // Safe type conversion as ServerFactory can only create DatatableData ClientData objects
+ return (data != null ? (DatatableData) data : null);
+ }
+
+ @Override
+ protected ClientData createDataObject(String type) {
+ return (type.equals("DTIIFORM") ? new DatatableData() : null);
+ }
+
+ @Override
+ protected String getFolder() {
+ return "./serverdata/";
+ }
+}
diff --git a/src/resources/client_info/visitors/ClientData.java b/src/resources/client_info/visitors/ClientData.java
deleted file mode 100644
index 08f2d01ad..000000000
--- a/src/resources/client_info/visitors/ClientData.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/***********************************************************************************
-* Copyright (c) 2015 /// Project SWG /// www.projectswg.com *
-* *
-* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
-* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
-* Our goal is to create an emulator which will provide a server for players to *
-* continue playing a game similar to the one they used to play. We are basing *
-* it on the final publish of the game prior to end-game events. *
-* *
-* This file is part of Holocore. *
-* *
-* -------------------------------------------------------------------------------- *
-* *
-* Holocore is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Affero General Public License as *
-* published by the Free Software Foundation, either version 3 of the *
-* License, or (at your option) any later version. *
-* *
-* Holocore is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Affero General Public License for more details. *
-* *
-* You should have received a copy of the GNU Affero General Public License *
-* along with Holocore. If not, see . *
-* *
-***********************************************************************************/
-package resources.client_info.visitors;
-
-import java.nio.ByteBuffer;
-
-public abstract class ClientData {
-
- public abstract void handleData(String node, ByteBuffer data, int size);
-}
diff --git a/src/resources/client_info/visitors/CrcStringTableData.java b/src/resources/client_info/visitors/CrcStringTableData.java
index 9918b4ae2..36612db9a 100644
--- a/src/resources/client_info/visitors/CrcStringTableData.java
+++ b/src/resources/client_info/visitors/CrcStringTableData.java
@@ -32,6 +32,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import resources.client_info.ClientData;
import utilities.ByteUtilities;
public class CrcStringTableData extends ClientData {
@@ -43,7 +44,7 @@ public class CrcStringTableData extends ClientData {
private int count;
@Override
- public void handleData(String node, ByteBuffer data, int size) {
+ public void parse(String node, ByteBuffer data, int size) {
switch (node) {
case "0000DATA":
diff --git a/src/resources/client_info/visitors/DatatableData.java b/src/resources/client_info/visitors/DatatableData.java
index 7b3cdceb4..c172ffc9f 100644
--- a/src/resources/client_info/visitors/DatatableData.java
+++ b/src/resources/client_info/visitors/DatatableData.java
@@ -29,6 +29,7 @@ package resources.client_info.visitors;
import java.nio.ByteBuffer;
+import resources.client_info.ClientData;
import utilities.ByteUtilities;
public class DatatableData extends ClientData {
@@ -39,7 +40,7 @@ public class DatatableData extends ClientData {
//private Map enums;
@Override
- public void handleData(String node, ByteBuffer data, int size) {
+ public void parse(String node, ByteBuffer data, int size) {
switch(node) {
diff --git a/src/resources/client_info/visitors/ObjectData.java b/src/resources/client_info/visitors/ObjectData.java
index 7993f35c1..0c5782fc0 100644
--- a/src/resources/client_info/visitors/ObjectData.java
+++ b/src/resources/client_info/visitors/ObjectData.java
@@ -34,6 +34,7 @@ import java.util.List;
import java.util.Map;
import resources.client_info.ClientFactory;
+import resources.client_info.ClientData;
import utilities.ByteUtilities;
public class ObjectData extends ClientData {
@@ -53,7 +54,7 @@ public class ObjectData extends ClientData {
public ObjectData() {}
@Override
- public void handleData(String node, ByteBuffer data, int size) {
+ public void parse(String node, ByteBuffer data, int size) {
switch(node) {
case "DERVXXXX": // Extended attributes
diff --git a/src/resources/client_info/visitors/ProfTemplateData.java b/src/resources/client_info/visitors/ProfTemplateData.java
index 36e178a25..aafaa2620 100644
--- a/src/resources/client_info/visitors/ProfTemplateData.java
+++ b/src/resources/client_info/visitors/ProfTemplateData.java
@@ -31,6 +31,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import resources.client_info.ClientData;
import utilities.ByteUtilities;
public class ProfTemplateData extends ClientData {
@@ -57,7 +58,7 @@ public class ProfTemplateData extends ClientData {
}
@Override
- public void handleData(String node, ByteBuffer data, int size) {
+ public void parse(String node, ByteBuffer data, int size) {
switch(node) {
case "PTMPNAME":
diff --git a/src/resources/client_info/visitors/SlotArrangementData.java b/src/resources/client_info/visitors/SlotArrangementData.java
index 2c7cd970a..349b9d828 100644
--- a/src/resources/client_info/visitors/SlotArrangementData.java
+++ b/src/resources/client_info/visitors/SlotArrangementData.java
@@ -31,6 +31,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import resources.client_info.ClientData;
import utilities.ByteUtilities;
public class SlotArrangementData extends ClientData {
@@ -38,7 +39,7 @@ public class SlotArrangementData extends ClientData {
private List
> occupiedSlots = new ArrayList>();
@Override
- public void handleData(String node, ByteBuffer data, int size) {
+ public void parse(String node, ByteBuffer data, int size) {
ArrayList slots = new ArrayList();
diff --git a/src/resources/client_info/visitors/SlotDefinitionData.java b/src/resources/client_info/visitors/SlotDefinitionData.java
index 56ebda9b5..5ac939521 100644
--- a/src/resources/client_info/visitors/SlotDefinitionData.java
+++ b/src/resources/client_info/visitors/SlotDefinitionData.java
@@ -30,6 +30,7 @@ package resources.client_info.visitors;
import java.nio.ByteBuffer;
import java.util.HashMap;
+import resources.client_info.ClientData;
import utilities.ByteUtilities;
public class SlotDefinitionData extends ClientData {
@@ -47,7 +48,7 @@ public class SlotDefinitionData extends ClientData {
}
@Override
- public void handleData(String node, ByteBuffer data, int size) {
+ public void parse(String node, ByteBuffer data, int size) {
while (data.hasRemaining()) {
SlotDefinition def = new SlotDefinition();
diff --git a/src/resources/client_info/visitors/SlotDescriptorData.java b/src/resources/client_info/visitors/SlotDescriptorData.java
index 039392fed..e991693b1 100644
--- a/src/resources/client_info/visitors/SlotDescriptorData.java
+++ b/src/resources/client_info/visitors/SlotDescriptorData.java
@@ -31,6 +31,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import resources.client_info.ClientData;
import utilities.ByteUtilities;
public class SlotDescriptorData extends ClientData {
@@ -38,7 +39,7 @@ public class SlotDescriptorData extends ClientData {
private List slots = new ArrayList();
@Override
- public void handleData(String node, ByteBuffer data, int size) {
+ public void parse(String node, ByteBuffer data, int size) {
if (!node.equals("0000DATA"))
return;
diff --git a/src/resources/client_info/visitors/WorldSnapshotData.java b/src/resources/client_info/visitors/WorldSnapshotData.java
index dceb09536..92aabf84c 100644
--- a/src/resources/client_info/visitors/WorldSnapshotData.java
+++ b/src/resources/client_info/visitors/WorldSnapshotData.java
@@ -28,6 +28,7 @@
package resources.client_info.visitors;
import resources.Location;
+import resources.client_info.ClientData;
import utilities.ByteUtilities;
import java.nio.ByteBuffer;
@@ -41,7 +42,7 @@ public class WorldSnapshotData extends ClientData {
private List chunks = new ArrayList<>();
@Override
- public void handleData(String node, ByteBuffer data, int size) {
+ public void parse(String node, ByteBuffer data, int size) {
switch (node) {
case "OTNL":
// Object Template Name Table
diff --git a/src/services/map/MapService.java b/src/services/map/MapService.java
index 0c0aef138..d47affac4 100644
--- a/src/services/map/MapService.java
+++ b/src/services/map/MapService.java
@@ -27,12 +27,14 @@
package services.map;
+import com.sun.corba.se.spi.activation.Server;
import intents.network.GalacticPacketIntent;
import network.packets.Packet;
import network.packets.swg.SWGPacket;
import network.packets.swg.zone.spatial.GetMapLocationsMessage;
import network.packets.swg.zone.spatial.GetMapLocationsResponseMessage;
import resources.client_info.ClientFactory;
+import resources.client_info.ServerFactory;
import resources.client_info.visitors.DatatableData;
import resources.control.Intent;
import resources.control.Service;
@@ -129,7 +131,7 @@ public class MapService extends Service {
}
private void loadMapCategories() {
- DatatableData table = (DatatableData) ClientFactory.getInfoFromFile("datatables/player/planet_map_cat.iff");
+ DatatableData table = ServerFactory.getDatatable("datatables/player/planet_map_cat.iff");
for (int row = 0; row < table.getRowCount(); row++) {
MapCategory category = new MapCategory();
category.setName(table.getCell(row, 0).toString());
@@ -144,7 +146,7 @@ public class MapService extends Service {
}
private void loadMappingTemplates() {
- DatatableData table = (DatatableData) ClientFactory.getInfoFromFile("map_locations.iff");
+ DatatableData table = ServerFactory.getDatatable("map_locations.iff");
for (int row = 0; row < table.getRowCount(); row++) {
MappingTemplate template = new MappingTemplate();
template.setTemplate(ClientFactory.formatToSharedFile(table.getCell(row, 0).toString()));