diff options
author | Jared Adams <jaxad0127@gmail.com> | 2008-11-11 14:39:23 +0000 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2008-11-11 14:39:23 +0000 |
commit | 515f38e52100eac09275f0821e93e0eaf3e2cc3c (patch) | |
tree | 135d7d54c114e8a4e9c2c6882f72206819bf747e /tools/tmwcon/src/Converter.java | |
parent | c38bbf027133f6e50947a7405b3a64dcbca3b0b9 (diff) | |
download | serverdata-515f38e52100eac09275f0821e93e0eaf3e2cc3c.tar.gz serverdata-515f38e52100eac09275f0821e93e0eaf3e2cc3c.tar.bz2 serverdata-515f38e52100eac09275f0821e93e0eaf3e2cc3c.tar.xz serverdata-515f38e52100eac09275f0821e93e0eaf3e2cc3c.zip |
Add a tool to convert from TMWServ format
This tool will convert warps and monster spawns from TMWServ format (tmx
files) into eAthena format. It will also generate the wlk files needed
by eAthena.
Diffstat (limited to 'tools/tmwcon/src/Converter.java')
-rw-r--r-- | tools/tmwcon/src/Converter.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/tmwcon/src/Converter.java b/tools/tmwcon/src/Converter.java new file mode 100644 index 00000000..546d5e7b --- /dev/null +++ b/tools/tmwcon/src/Converter.java @@ -0,0 +1,51 @@ +// + +import java.io.*; +import java.lang.reflect.*; +import java.net.*; +import java.util.*; + +public abstract class Converter { + static String[] tiledJars = {"tile-core.jar", "tiled.jar"}; + static String[] wlkJars = {"plugins/tmw.jar", "tmw.jar"}; + + public static void main(String[] args) throws Exception { + List<URL> urls = new ArrayList<URL>(); + + File tiled = null; + for (String s : tiledJars) { + tiled = new File(s); + if (tiled.exists()) break; + } + if (tiled == null || !tiled.exists()) { + System.err.println("Unable to find a Tiled jar file! Exiting."); + System.exit(-5); + } + urls.add(tiled.toURI().toURL()); + + File wlkWriter = null; + for (String s : wlkJars) { + wlkWriter = new File(s); + if (wlkWriter.exists()) break; + } + if (wlkWriter == null || !wlkWriter.exists()) { + System.err.println("Unable to find the tmw plugin for Tiled! No wlk files will be made!"); + } else { + urls.add(wlkWriter.toURI().toURL()); + } + + File self = new File("converter.jar"); + if (!self.exists()) { + System.err.println("Unable to find a the converter jar! Exiting."); + System.exit(-5); + } + urls.add(self.toURI().toURL()); + + URLClassLoader loader = new URLClassLoader(urls.toArray(new URL[0])); + Class c = loader.loadClass("converter.Main"); + Method m = c.getMethod("run", String[].class, Integer.TYPE); + System.out.println("Starting"); + + m.invoke(null, args, 0); + } +} |