Jump to content

The RuneLocus forum has been archived and does not accept new registrations.
Click here for more information, and click here to join the community on Discord.

Matrix Spawn Dump - Converter


bobismyname
 Share

Recommended Posts

This snippet is for MGI/Cjay's npc spawn dumper which can be found here: 

 

Wrote this a couple days ago when I was testing out the npc spawn dumper with MGI and since it went public I figured this would be useful to many users. Anyways this uses the Matrix format of npc spawns, however if you have a different format you can easily adjust the one line of code that writes the format. This does not include the direction parameter given in the data because default Matrix doesn't come with reading for that, however if you follow the format it should be easy to add. Anyways, put the dump text in the /information/spawns.txt file, run the program in eclipse, and then the file will be updated with proper formatting as well as skipping duplicates that were dumped by using the index of the npc. Have fun everyone!

package net.nocturne.tools;


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;

/**
 * 
 * @author Miles Black (bobismyname)
 * @date Jan 24, 2017
 */

public class SpawnConverter {
    
    static BufferedReader reader;
    static BufferedWriter writer;
    static HashMap<Integer, String> spawns = new HashMap<Integer, String>();
    
    /**
     * Takes the dump logs from MGI/Cjay's npc spawn dump and converts it to Matrix format.
     * @param args
     */
    public static void main(String[] args) {
        try {
            File file = new File("./information/spawns.txt");
            reader = new BufferedReader(new FileReader(file));
            String line;
            while ((line = reader.readLine()) != null) {
                String[] data = line.split(",");
                if (spawns.containsKey(Integer.parseInt(data[0])))
                    continue;
                spawns.put(Integer.parseInt(data[0]), data[1] + " - " + data[2] + " " + data[3] + " " + data[4]);
            }
            writer = new BufferedWriter(new FileWriter(file));
            for (String info : spawns.values()) {
                writer.newLine();
                writer.append(info);
                writer.flush();
            }
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

 

Edited by bobismyname
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...