mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Remove redundant note information and binary note information updater, ItemDefinition already manages this.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,61 +0,0 @@
|
||||
package org.apollo.tools;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apollo.fs.IndexedFileSystem;
|
||||
import org.apollo.fs.decoder.ItemDefinitionDecoder;
|
||||
import org.apollo.game.model.def.ItemDefinition;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
/**
|
||||
* A tool for updating the note data.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public final class NoteUpdater {
|
||||
|
||||
/**
|
||||
* The entry point of the application.
|
||||
*
|
||||
* @param args The command line arguments.
|
||||
* @throws Exception If an error occurs.
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
Preconditions.checkArgument(args.length == 1, "Usage:\njava -cp ... org.apollo.tools.NoteUpdater [release].");
|
||||
String release = args[0];
|
||||
|
||||
try (DataOutputStream os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("data/note-" + release
|
||||
+ ".dat")));
|
||||
IndexedFileSystem fs = new IndexedFileSystem(Paths.get("data/fs/", release), true)) {
|
||||
ItemDefinitionDecoder decoder = new ItemDefinitionDecoder(fs);
|
||||
ItemDefinition[] defs = decoder.decode();
|
||||
ItemDefinition.init(defs);
|
||||
|
||||
os.writeShort(defs.length);
|
||||
Map<Integer, Integer> itemToNote = new HashMap<>();
|
||||
|
||||
for (int id = 0; id < defs.length; id++) {
|
||||
ItemDefinition def = ItemDefinition.lookup(id);
|
||||
if (def.isNote()) {
|
||||
itemToNote.put(def.getNoteInfoId(), def.getId());
|
||||
}
|
||||
}
|
||||
|
||||
for (int id = 0; id < defs.length; id++) {
|
||||
if (itemToNote.containsKey(id)) {
|
||||
os.writeBoolean(true); // notable
|
||||
os.writeShort(itemToNote.get(id));
|
||||
} else {
|
||||
os.writeBoolean(false); // not notable
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user