Search in sources :

Example 6 with NpcDefinition

use of net.runelite.cache.definitions.NpcDefinition in project runelite by runelite.

the class NpcManager method dump.

public void dump(File out) throws IOException {
    out.mkdirs();
    for (NpcDefinition def : npcs) {
        NpcExporter exporter = new NpcExporter(def);
        File targ = new File(out, def.id + ".json");
        exporter.exportTo(targ);
    }
}
Also used : NpcDefinition(net.runelite.cache.definitions.NpcDefinition) NpcExporter(net.runelite.cache.definitions.exporters.NpcExporter) File(java.io.File) FSFile(net.runelite.cache.fs.FSFile)

Example 7 with NpcDefinition

use of net.runelite.cache.definitions.NpcDefinition in project runelite by runelite.

the class NpcManager method java.

public void java(File java) throws IOException {
    System.setProperty("line.separator", "\n");
    java.mkdirs();
    File targ = new File(java, "NpcID.java");
    try (PrintWriter fw = new PrintWriter(targ)) {
        fw.println("/* This file is automatically generated. Do not edit. */");
        fw.println("package net.runelite.api;");
        fw.println("");
        fw.println("public final class NpcID");
        fw.println("{");
        for (NpcDefinition def : npcs) {
            if (def.name.equalsIgnoreCase("NULL")) {
                continue;
            }
            String name = namer.name(def.name, def.id);
            if (name == null) {
                continue;
            }
            fw.println("	public static final int " + name + " = " + def.id + ";");
        }
        fw.println("}");
    }
}
Also used : NpcDefinition(net.runelite.cache.definitions.NpcDefinition) File(java.io.File) FSFile(net.runelite.cache.fs.FSFile) PrintWriter(java.io.PrintWriter)

Aggregations

NpcDefinition (net.runelite.cache.definitions.NpcDefinition)7 FSFile (net.runelite.cache.fs.FSFile)4 File (java.io.File)2 IOException (java.io.IOException)2 NpcLoader (net.runelite.cache.definitions.loaders.NpcLoader)2 ArchiveFiles (net.runelite.cache.fs.ArchiveFiles)2 Gson (com.google.gson.Gson)1 Color (java.awt.Color)1 BufferedImage (java.awt.image.BufferedImage)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 FileWriter (java.io.FileWriter)1 InputStreamReader (java.io.InputStreamReader)1 PrintWriter (java.io.PrintWriter)1 Writer (java.io.Writer)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 List (java.util.List)1