Merge pull request #3 from truongdatnhan/eclipse

Fixing indents !
This commit is contained in:
truongdatnhan
2022-08-02 23:15:15 +07:00
committed by GitHub
32 changed files with 691 additions and 703 deletions

View File

@@ -50,7 +50,11 @@ import server.maps.*;
import tools.PacketCreator; import tools.PacketCreator;
import tools.Pair; import tools.Pair;
import java.io.File; import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
@@ -448,8 +452,14 @@ public final class Channel {
private static String[] getEvents() { private static String[] getEvents() {
List<String> events = new ArrayList<>(); List<String> events = new ArrayList<>();
for (File file : new File("scripts/event").listFiles()) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get("scripts/event"))) {
events.add(file.getName().substring(0, file.getName().length() - 3)); for (Path path : stream) {
String fileName = path.getFileName().toString();
events.add(fileName.substring(0, fileName.length() - 3));
}
} catch (IOException e) {
log.warn("Unable to load events !");
e.printStackTrace();
} }
return events.toArray(new String[0]); return events.toArray(new String[0]);
} }

View File

@@ -28,7 +28,7 @@ public enum WZFiles {
} }
public Path getFile() { public Path getFile() {
return Paths.get(DIRECTORY).resolve(fileName); return Paths.get(DIRECTORY).resolve(fileName);
} }
public String getFilePath() { public String getFilePath() {
@@ -36,8 +36,7 @@ public enum WZFiles {
} }
private static String getWzDirectory() { private static String getWzDirectory() {
// Either provide a custom directory path through the "wz-path" property when launching the .jar, // Either provide a custom directory path through the "wz-path" property when launching the .jar, or don't provide one to use the default "wz" directory
// or don't provide one to use the default "wz" directory
String propertyPath = System.getProperty("wz-path"); String propertyPath = System.getProperty("wz-path");
if (propertyPath != null && new File(propertyPath).isDirectory()) { if (propertyPath != null && new File(propertyPath).isDirectory()) {
return propertyPath; return propertyPath;

View File

@@ -80,7 +80,8 @@ public class XMLDomMapleData implements Data {
boolean foundChild = false; boolean foundChild = false;
for (int i = 0; i < childNodes.getLength(); i++) { for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i); Node childNode = childNodes.item(i);
if (childNode.getNodeType() == Node.ELEMENT_NODE && childNode.getAttributes().getNamedItem("name").getNodeValue().equals(s)) { if (childNode.getNodeType() == Node.ELEMENT_NODE
&& childNode.getAttributes().getNamedItem("name").getNodeValue().equals(s)) {
myNode = childNode; myNode = childNode;
foundChild = true; foundChild = true;
break; break;
@@ -104,12 +105,12 @@ public class XMLDomMapleData implements Data {
for (int i = 0; i < childNodes.getLength(); i++) { for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i); Node childNode = childNodes.item(i);
if (childNode.getNodeType() == Node.ELEMENT_NODE) { if (childNode.getNodeType() == Node.ELEMENT_NODE) {
XMLDomMapleData child = new XMLDomMapleData(childNode); XMLDomMapleData child = new XMLDomMapleData(childNode);
child.imageDataDir = imageDataDir.resolve(getName().trim()); child.imageDataDir = imageDataDir.resolve(getName().trim());
ret.add(child); ret.add(child);
} }
} }
return ret; return ret;
} }

View File

@@ -38,50 +38,50 @@ import org.slf4j.LoggerFactory;
public class XMLWZFile implements DataProvider { public class XMLWZFile implements DataProvider {
private static final Logger log = LoggerFactory.getLogger(DataProvider.class); private static final Logger log = LoggerFactory.getLogger(DataProvider.class);
private final Path root; private final Path root;
private final WZDirectoryEntry rootForNavigation; private final WZDirectoryEntry rootForNavigation;
public XMLWZFile(Path fileIn) { public XMLWZFile(Path fileIn) {
root = fileIn; root = fileIn;
rootForNavigation = new WZDirectoryEntry(fileIn.getFileName().toString(), 0, 0, null); rootForNavigation = new WZDirectoryEntry(fileIn.getFileName().toString(), 0, 0, null);
fillMapleDataEntitys(root, rootForNavigation); fillMapleDataEntitys(root, rootForNavigation);
} }
private void fillMapleDataEntitys(Path lroot, WZDirectoryEntry wzdir) { private void fillMapleDataEntitys(Path lroot, WZDirectoryEntry wzdir) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(lroot)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(lroot)) {
for (Path path : stream) { for (Path path : stream) {
String fileName = path.getFileName().toString(); String fileName = path.getFileName().toString();
if (Files.isDirectory(path) && !fileName.endsWith(".img")) { if (Files.isDirectory(path) && !fileName.endsWith(".img")) {
WZDirectoryEntry newDir = new WZDirectoryEntry(fileName, 0, 0, wzdir); WZDirectoryEntry newDir = new WZDirectoryEntry(fileName, 0, 0, wzdir);
wzdir.addDirectory(newDir); wzdir.addDirectory(newDir);
fillMapleDataEntitys(path, newDir); fillMapleDataEntitys(path, newDir);
} else if (fileName.endsWith(".xml")) { } else if (fileName.endsWith(".xml")) {
wzdir.addFile(new WZFileEntry(fileName.substring(0, fileName.length() - 4), 0, 0, wzdir)); wzdir.addFile(new WZFileEntry(fileName.substring(0, fileName.length() - 4), 0, 0, wzdir));
} }
} }
} catch (IOException e) { } catch (IOException e) {
log.warn("Can not open file/directory at " + lroot); log.warn("Can not open file/directory at " + lroot);
} }
} }
@Override @Override
public synchronized Data getData(String path) { public synchronized Data getData(String path) {
Path dataFile = root.resolve(path + ".xml"); Path dataFile = root.resolve(path + ".xml");
Path imageDataDir = root.resolve(path); Path imageDataDir = root.resolve(path);
if (!Files.exists(dataFile)) { if (!Files.exists(dataFile)) {
return null;// bitches return null;// bitches
} }
final XMLDomMapleData domMapleData; final XMLDomMapleData domMapleData;
try (FileInputStream fis = new FileInputStream(dataFile.toString())) { try (FileInputStream fis = new FileInputStream(dataFile.toString())) {
domMapleData = new XMLDomMapleData(fis, imageDataDir.getParent()); domMapleData = new XMLDomMapleData(fis, imageDataDir.getParent());
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw new RuntimeException("Datafile " + path + " does not exist in " + root.toAbsolutePath()); throw new RuntimeException("Datafile " + path + " does not exist in " + root.toAbsolutePath());
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return domMapleData; return domMapleData;
} }
@Override @Override
public DataDirectoryEntry getRoot() { public DataDirectoryEntry getRoot() {

View File

@@ -191,24 +191,24 @@ public class SkillbookInformationProvider {
return loadedSkillbooks; return loadedSkillbooks;
} }
private static void listFiles(String directoryName, ArrayList<Path> files) { private static void listFiles(String directoryName, ArrayList<Path> files) {
Path directory = Paths.get(directoryName); Path directory = Paths.get(directoryName);
// get all the files from a directory // get all the files from a directory
try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory)) {
for (Path path : stream) { for (Path path : stream) {
if (Files.isRegularFile(path)) { if (Files.isRegularFile(path)) {
files.add(path); files.add(path);
} else if (Files.isDirectory(path)) { } else if (Files.isDirectory(path)) {
listFiles(path.toAbsolutePath().toString(), files); listFiles(path.toAbsolutePath().toString(), files);
} }
} }
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
private static List<Path> listFilesFromDirectoryRecursively(String directory) { private static List<Path> listFilesFromDirectoryRecursively(String directory) {
ArrayList<Path> files = new ArrayList<>(); ArrayList<Path> files = new ArrayList<>();
@@ -233,7 +233,7 @@ public class SkillbookInformationProvider {
private static String readFileToString(Path file, String encoding) throws IOException { private static String readFileToString(Path file, String encoding) throws IOException {
Scanner scanner = new Scanner(file, encoding); Scanner scanner = new Scanner(file, encoding);
String text = ""; String text = "";
try(scanner) { try (scanner) {
text = scanner.useDelimiter("\\A").next(); text = scanner.useDelimiter("\\A").next();

View File

@@ -23,7 +23,6 @@ import server.life.MonsterStats;
import tools.Pair; import tools.Pair;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@@ -214,7 +213,7 @@ public class ArrowFetcher {
} }
public static void main(String[] args) { public static void main(String[] args) {
Instant instantStarted = Instant.now(); Instant instantStarted = Instant.now();
// load mob stats from WZ // load mob stats from WZ
mobStats = MonsterStatFetcher.getAllMonsterStats(); mobStats = MonsterStatFetcher.getAllMonsterStats();

View File

@@ -3,7 +3,6 @@ package tools.mapletools;
import provider.wz.WZFiles; import provider.wz.WZFiles;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream; import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@@ -134,19 +133,19 @@ public class BossHpBarFetcher {
} }
private static void readBossHpBarData() throws IOException { private static void readBossHpBarData() throws IOException {
final Path mobDirectory = WZFiles.MOB.getFile(); final Path mobDirectory = WZFiles.MOB.getFile();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(mobDirectory)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(mobDirectory)) {
for (Path path : stream) { for (Path path : stream) {
if (Files.isRegularFile(path)) { if (Files.isRegularFile(path)) {
try (BufferedReader br = Files.newBufferedReader(path)) { try (BufferedReader br = Files.newBufferedReader(path)) {
bufferedReader = br; bufferedReader = br;
String line; String line;
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
translateToken(line); translateToken(line);
} }
} }
} }
} }
} }
} }
@@ -170,7 +169,6 @@ public class BossHpBarFetcher {
readBossHpBarData(); readBossHpBarData();
System.out.println("Reporting results..."); System.out.println("Reporting results...");
printReportFileHeader(printWriter); printReportFileHeader(printWriter);
printReportFileResults(printWriter); printReportFileResults(printWriter);

View File

@@ -615,49 +615,50 @@ public class CashCosmeticsChecker {
private static void reportCosmeticResults() throws IOException { private static void reportCosmeticResults() throws IOException {
System.out.println("Reporting results ..."); System.out.println("Reporting results ...");
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));) {
printWriter = pw; printWriter = pw;
printReportFileHeader(); printReportFileHeader();
if (!missingCosmeticsNpcTypes.isEmpty()) { if (!missingCosmeticsNpcTypes.isEmpty()) {
printWriter.println("Found " + missingCosmeticsNpcTypes.size() + " entries with missing cosmetic entries."); printWriter.println(
"Found " + missingCosmeticsNpcTypes.size() + " entries with missing cosmetic entries.");
for (Pair<Pair<Integer, String>, List<Integer>> mcn : getSortedMapEntries(missingCosmeticsNpcTypes)) {
printWriter.println(" NPC " + mcn.getLeft()); for (Pair<Pair<Integer, String>, List<Integer>> mcn : getSortedMapEntries(missingCosmeticsNpcTypes)) {
printWriter.println(" NPC " + mcn.getLeft());
Pair<List<Integer>, List<Integer>> genderItemids = getCosmeticReport(mcn.getRight());
reportNpcCosmetics(genderItemids.getLeft()); Pair<List<Integer>, List<Integer>> genderItemids = getCosmeticReport(mcn.getRight());
reportNpcCosmetics(genderItemids.getRight()); reportNpcCosmetics(genderItemids.getLeft());
printWriter.println(); reportNpcCosmetics(genderItemids.getRight());
} printWriter.println();
} }
}
if (!unusedCosmetics.isEmpty()) {
printWriter.println("Unused cosmetics: " + unusedCosmetics.size()); if (!unusedCosmetics.isEmpty()) {
printWriter.println("Unused cosmetics: " + unusedCosmetics.size());
List<Integer> list = new ArrayList<>(unusedCosmetics);
Collections.sort(list); List<Integer> list = new ArrayList<>(unusedCosmetics);
Collections.sort(list);
for (Integer i : list) {
printWriter.println(i + " " + cosmeticIdNames.get(i)); for (Integer i : list) {
} printWriter.println(i + " " + cosmeticIdNames.get(i));
}
printWriter.println();
} printWriter.println();
}
if (!missingCosmeticNames.isEmpty()) {
printWriter.println("Missing cosmetic itemids: " + missingCosmeticNames.size()); if (!missingCosmeticNames.isEmpty()) {
printWriter.println("Missing cosmetic itemids: " + missingCosmeticNames.size());
List<String> listString = new ArrayList<>(missingCosmeticNames);
Collections.sort(listString); List<String> listString = new ArrayList<>(missingCosmeticNames);
Collections.sort(listString);
for (String c : listString) {
printWriter.println(c); for (String c : listString) {
} printWriter.println(c);
}
printWriter.println();
} printWriter.println();
}
} }
} }

View File

@@ -1,12 +1,9 @@
package tools.mapletools; package tools.mapletools;
import provider.wz.WZDirectoryEntry;
import provider.wz.WZFileEntry;
import provider.wz.WZFiles; import provider.wz.WZFiles;
import tools.Pair; import tools.Pair;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream; import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@@ -182,18 +179,18 @@ public class CashDropFetcher {
private static void listFiles(Path directoryName, ArrayList<Path> files) { private static void listFiles(Path directoryName, ArrayList<Path> files) {
// get all the files from a directory // get all the files from a directory
try (DirectoryStream<Path> stream = Files.newDirectoryStream(directoryName)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(directoryName)) {
for (Path path : stream) { for (Path path : stream) {
if (Files.isRegularFile(path)) { if (Files.isRegularFile(path)) {
files.add(path); files.add(path);
} else if (Files.isDirectory(path)) { } else if (Files.isDirectory(path)) {
listFiles(path, files); listFiles(path, files);
} }
} }
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
private static int getItemIdFromFilename(String name) { private static int getItemIdFromFilename(String name) {
@@ -267,76 +264,75 @@ public class CashDropFetcher {
} }
private static void reportNxDropData() { private static void reportNxDropData() {
//NEED FUTURE UPDATE try (con; PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
try (con; PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { System.out.println("Reading Character.wz ...");
System.out.println("Reading Character.wz ..."); ArrayList<Path> files = new ArrayList<>();
ArrayList<Path> files = new ArrayList<>(); listFiles(WZFiles.CHARACTER.getFile(), files);
listFiles(WZFiles.CHARACTER.getFile(), files);
for (Path path : files) { for (Path path : files) {
// System.out.println("Parsing " + f.getAbsolutePath()); // System.out.println("Parsing " + f.getAbsolutePath());
int itemid = getItemIdFromFilename(path.getFileName().toString()); int itemid = getItemIdFromFilename(path.getFileName().toString());
if (itemid < 0) { if (itemid < 0) {
continue; continue;
} }
bufferedReader = Files.newBufferedReader(path); bufferedReader = Files.newBufferedReader(path);
currentItemid = itemid; currentItemid = itemid;
inspectEquipWzEntry(); inspectEquipWzEntry();
bufferedReader.close(); bufferedReader.close();
} }
System.out.println("Reading Item.wz ..."); System.out.println("Reading Item.wz ...");
files = new ArrayList<>(); files = new ArrayList<>();
listFiles(WZFiles.ITEM.getFile(), files); listFiles(WZFiles.ITEM.getFile(), files);
for (Path path : files) { for (Path path : files) {
// System.out.println("Parsing " + f.getAbsolutePath()); // System.out.println("Parsing " + f.getAbsolutePath());
bufferedReader = Files.newBufferedReader(path); bufferedReader = Files.newBufferedReader(path);
if (path.getFileName().toString().length() <= ITEM_FILE_NAME_SIZE) { if (path.getFileName().toString().length() <= ITEM_FILE_NAME_SIZE) {
inspectItemWzEntry(); inspectItemWzEntry();
} else { // pet file structure is similar to equips, maybe there are other item-types } else { // pet file structure is similar to equips, maybe there are other item-types
// following this behaviour? // following this behaviour?
int itemid = getItemIdFromFilename(path.getFileName().toString()); int itemid = getItemIdFromFilename(path.getFileName().toString());
if (itemid < 0) { if (itemid < 0) {
continue; continue;
} }
currentItemid = itemid; currentItemid = itemid;
inspectEquipWzEntry(); inspectEquipWzEntry();
} }
bufferedReader.close(); bufferedReader.close();
} }
System.out.println("Reporting results..."); System.out.println("Reporting results...");
// report suspects of missing quest drop data, as well as those drop data that // report suspects of missing quest drop data, as well as those drop data that
// may have incorrect questids. // may have incorrect questids.
printWriter = pw; printWriter = pw;
printReportFileHeader(); printReportFileHeader();
reportNxDropResults(true); reportNxDropResults(true);
reportNxDropResults(false); reportNxDropResults(false);
/* /*
* printWriter.println("NX LIST"); // list of all cash items found for(Integer * printWriter.println("NX LIST"); // list of all cash items found for(Integer
* nx : nxItems) { printWriter.println(nx); } * nx : nxItems) { printWriter.println(nx); }
*/ */
System.out.println("Done!"); System.out.println("Done!");
} catch (SQLException e) { } catch (SQLException e) {
System.out.println("Warning: Could not establish connection to database to report quest data."); System.out.println("Warning: Could not establish connection to database to report quest data.");
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
reportNxDropData(); reportNxDropData();
} }
} }

View File

@@ -156,7 +156,7 @@ public class CashVegaChecker {
} }
private static void reportMissingVegaItems() { private static void reportMissingVegaItems() {
System.out.println("Reporting results ..."); System.out.println("Reporting results ...");
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
printWriter = pw; printWriter = pw;

View File

@@ -3,7 +3,6 @@ package tools.mapletools;
import tools.Pair; import tools.Pair;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.sql.*; import java.sql.*;
@@ -315,34 +314,34 @@ public class CodeCouponGenerator {
} }
private static void generateCodeCoupons(Path file) throws IOException { private static void generateCodeCoupons(Path file) throws IOException {
try (BufferedReader br = Files.newBufferedReader(file); con;) { try (BufferedReader br = Files.newBufferedReader(file); con;) {
bufferedReader = br; bufferedReader = br;
resetCouponPackage(); resetCouponPackage();
status = 0; status = 0;
System.out.println("Reading XML coupon information..."); System.out.println("Reading XML coupon information...");
String line; String line;
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
translateToken(line); translateToken(line);
} }
System.out.println(); System.out.println();
System.out.println("Loading DB coupon codes..."); System.out.println("Loading DB coupon codes...");
loadUsedCouponCodes(); loadUsedCouponCodes();
System.out.println(); System.out.println();
System.out.println("Saving generated coupons..."); System.out.println("Saving generated coupons...");
currentTime = System.currentTimeMillis(); currentTime = System.currentTimeMillis();
for (CodeCouponDescriptor ccd : activeCoupons) { for (CodeCouponDescriptor ccd : activeCoupons) {
commitCodeCouponDescription(ccd); commitCodeCouponDescription(ccd);
} }
System.out.println(); System.out.println();
System.out.println("Done."); System.out.println("Done.");
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
try { try {

View File

@@ -3,7 +3,8 @@ package tools.mapletools;
import provider.wz.WZFiles; import provider.wz.WZFiles;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.file.Files;
import java.nio.file.Path;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
@@ -16,8 +17,8 @@ import java.sql.SQLException;
* a SQL table that the server will make use. * a SQL table that the server will make use.
*/ */
public class CouponInstaller { public class CouponInstaller {
private static final File COUPON_INPUT_FILE_1 = new File(WZFiles.ITEM.getFilePath(), "/Cash/0521.img.xml"); private static final Path COUPON_INPUT_FILE_1 = WZFiles.ITEM.getFile().resolve("Cash/0521.img.xml");
private static final File COUPON_INPUT_FILE_2 = new File(WZFiles.ITEM.getFilePath(), "/Cash/0536.img.xml"); private static final Path COUPON_INPUT_FILE_2 = WZFiles.ITEM.getFile().resolve("Cash/0536.img.xml");
private static final Connection con = SimpleDatabaseConnection.getConnection(); private static final Connection con = SimpleDatabaseConnection.getConnection();
private static BufferedReader bufferedReader = null; private static BufferedReader bufferedReader = null;
private static byte status = 0; private static byte status = 0;
@@ -192,20 +193,17 @@ public class CouponInstaller {
} }
} }
private static void installRateCoupons(File file) { private static void installRateCoupons(Path file) {
// This will reference one line at a time // This will reference one line at a time
String line = null; String line = null;
try { try (BufferedReader br = Files.newBufferedReader(file)) {
InputStreamReader fileReader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8); bufferedReader = br;
bufferedReader = new BufferedReader(fileReader);
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
translateToken(line); translateToken(line);
} }
bufferedReader.close();
fileReader.close();
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
System.out.println("Unable to open file '" + file + "'"); System.out.println("Unable to open file '" + file + "'");
} catch (IOException ex) { } catch (IOException ex) {

View File

@@ -126,8 +126,9 @@ public class DojoUpdate {
if (!isDojoMapid) { if (!isDojoMapid) {
return; return;
} }
try(PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_DIRECTORY.resolve(curPath).resolve(file.getFileName()))); try (PrintWriter pw = new PrintWriter(
BufferedReader br = Files.newBufferedReader(file);) { Files.newOutputStream(OUTPUT_DIRECTORY.resolve(curPath).resolve(file.getFileName())));
BufferedReader br = Files.newBufferedReader(file);) {
printWriter = pw; printWriter = pw;
bufferedReader = br; bufferedReader = br;
status = 0; status = 0;
@@ -136,7 +137,7 @@ public class DojoUpdate {
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
translateToken(line); translateToken(line);
} }
printFileFooter(); printFileFooter();
} }
} }
@@ -156,20 +157,20 @@ public class DojoUpdate {
Path folder = OUTPUT_DIRECTORY.resolve(curPath); Path folder = OUTPUT_DIRECTORY.resolve(curPath);
if (!Files.exists(folder)) { if (!Files.exists(folder)) {
try { try {
Files.createDirectory(folder); Files.createDirectory(folder);
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
System.out.println("Unable to create folder " + folder.toAbsolutePath() + "."); System.out.println("Unable to create folder " + folder.toAbsolutePath() + ".");
e.printStackTrace(); e.printStackTrace();
} }
} }
System.out.println("Parsing directory '" + curPath + "'"); System.out.println("Parsing directory '" + curPath + "'");
folder = INPUT_DIRECTORY.resolve(curPath); folder = INPUT_DIRECTORY.resolve(curPath);
try (DirectoryStream<Path> stream = Files.newDirectoryStream(folder)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(folder)) {
for (Path path : stream) { for (Path path : stream) {
if(Files.isRegularFile(path)) { if (Files.isRegularFile(path)) {
try { try {
parseDojoData(path, curPath); parseDojoData(path, curPath);
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
System.out.println("Unable to open dojo file " + path.toAbsolutePath() + "."); System.out.println("Unable to open dojo file " + path.toAbsolutePath() + ".");
@@ -178,24 +179,23 @@ public class DojoUpdate {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} else { } else {
parseDirectoryDojoData(curPath + path.getFileName() + "/"); parseDirectoryDojoData(curPath + path.getFileName() + "/");
} }
} }
} catch (IOException e1) { } catch (IOException e1) {
System.out.println("Unable to read folder " + folder.toAbsolutePath() + "."); System.out.println("Unable to read folder " + folder.toAbsolutePath() + ".");
// TODO Auto-generated catch block // TODO Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
Instant instantStarted = Instant.now(); Instant instantStarted = Instant.now();
parseDirectoryDojoData(""); parseDirectoryDojoData("");
Instant instantStopped = Instant.now(); Instant instantStopped = Instant.now();
Duration durationBetween = Duration.between(instantStarted, instantStopped); Duration durationBetween = Duration.between(instantStarted, instantStopped);
System.out.println("Get elapsed time in milliseconds: " + durationBetween.toMillis()); System.out.println("Get elapsed time in milliseconds: " + durationBetween.toMillis());
System.out.println("Get elapsed time in seconds: " + durationBetween.toSeconds()); System.out.println("Get elapsed time in seconds: " + durationBetween.toSeconds());
} }
} }

View File

@@ -409,7 +409,7 @@ public class EmptyItemWzChecker {
private static void generateStringWz() throws IOException { private static void generateStringWz() throws IOException {
System.out.println("Generating clean String.wz ..."); System.out.println("Generating clean String.wz ...");
String[][] stringWzFiles = {{"Cash", "Consume", "Ins", "Pet"}, {"Etc"}, {"Eqp"}}; String[][] stringWzFiles = { { "Cash", "Consume", "Ins", "Pet" }, { "Etc" }, { "Eqp" } };
String stringWzPath = "/String.wz/"; String stringWzPath = "/String.wz/";
File folder = new File(OUTPUT_PATH + "/String.wz/"); File folder = new File(OUTPUT_PATH + "/String.wz/");

View File

@@ -3,7 +3,6 @@ package tools.mapletools;
import provider.wz.WZFiles; import provider.wz.WZFiles;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream; import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@@ -358,41 +357,40 @@ public class EquipmentOmniLeveller {
} }
private static void copyCashItemData(Path file, String curPath) throws IOException { private static void copyCashItemData(Path file, String curPath) throws IOException {
try(PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_DIRECTORY.resolve(curPath).resolve(file.getFileName()))); try (PrintWriter pw = new PrintWriter(
BufferedReader br = Files.newBufferedReader(file);) { Files.newOutputStream(OUTPUT_DIRECTORY.resolve(curPath).resolve(file.getFileName())));
printWriter = pw; BufferedReader br = Files.newBufferedReader(file);) {
bufferedReader = br; printWriter = pw;
String line; bufferedReader = br;
String line;
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
printWriter.println(line); printWriter.println(line);
} }
} }
} }
private static void parseEquipData(Path file, String curPath) throws IOException { private static void parseEquipData(Path file, String curPath) throws IOException {
try (PrintWriter pw = new PrintWriter(
try(PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_DIRECTORY.resolve(curPath).resolve(file.getFileName()))); Files.newOutputStream(OUTPUT_DIRECTORY.resolve(curPath).resolve(file.getFileName())));
BufferedReader br = Files.newBufferedReader(file);) { BufferedReader br = Files.newBufferedReader(file);) {
printWriter = pw; printWriter = pw;
bufferedReader = br; bufferedReader = br;
status = 0; status = 0;
upgradeable = false; upgradeable = false;
cash = false; cash = false;
String line; String line;
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
if (translateToken(line)) { if (translateToken(line)) {
infoTagState = status; // status: 2 infoTagState = status; // status: 2
translateInfoTag(status); translateInfoTag(status);
infoTagState = -1; infoTagState = -1;
} }
} }
printFileFooter(); printFileFooter();
} catch (RuntimeException e) { } catch (RuntimeException e) {
copyCashItemData(file, curPath); copyCashItemData(file, curPath);
} }
} }
private static void printFileFooter() { private static void printFileFooter() {
@@ -403,48 +401,48 @@ public class EquipmentOmniLeveller {
} }
private static void parseDirectoryEquipData(String curPath) { private static void parseDirectoryEquipData(String curPath) {
Path folder = OUTPUT_DIRECTORY.resolve(curPath); Path folder = OUTPUT_DIRECTORY.resolve(curPath);
if (!Files.exists(folder)) { if (!Files.exists(folder)) {
try { try {
Files.createDirectory(folder); Files.createDirectory(folder);
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
System.out.println("Unable to create folder " + folder.toAbsolutePath() + "."); System.out.println("Unable to create folder " + folder.toAbsolutePath() + ".");
e.printStackTrace(); e.printStackTrace();
} }
} }
System.out.println("Parsing directory '" + curPath + "'"); System.out.println("Parsing directory '" + curPath + "'");
folder = INPUT_DIRECTORY.resolve(curPath); folder = INPUT_DIRECTORY.resolve(curPath);
try (DirectoryStream<Path> stream = Files.newDirectoryStream(folder)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(folder)) {
for (Path path : stream) { for (Path path : stream) {
if (Files.isRegularFile(path)) { if (Files.isRegularFile(path)) {
try { try {
parseEquipData(path, curPath); parseEquipData(path, curPath);
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
System.out.println("Unable to open dojo file " + path.toAbsolutePath() + "."); System.out.println("Unable to open dojo file " + path.toAbsolutePath() + ".");
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Error reading dojo file " + path.toAbsolutePath() + "."); System.out.println("Error reading dojo file " + path.toAbsolutePath() + ".");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} else { } else {
parseDirectoryEquipData(curPath + path.getFileName() + "/"); parseDirectoryEquipData(curPath + path.getFileName() + "/");
} }
} }
} catch (IOException e1) { } catch (IOException e1) {
System.out.println("Unable to read folder " + folder.toAbsolutePath() + "."); System.out.println("Unable to read folder " + folder.toAbsolutePath() + ".");
// TODO Auto-generated catch block // TODO Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
Instant instantStarted = Instant.now(); Instant instantStarted = Instant.now();
parseDirectoryEquipData(""); parseDirectoryEquipData("");
Instant instantStopped = Instant.now(); Instant instantStopped = Instant.now();
Duration durationBetween = Duration.between(instantStarted, instantStopped); Duration durationBetween = Duration.between(instantStarted, instantStopped);
System.out.println("Get elapsed time in milliseconds: " + durationBetween.toMillis()); System.out.println("Get elapsed time in milliseconds: " + durationBetween.toMillis());
System.out.println("Get elapsed time in seconds: " + durationBetween.toSeconds()); System.out.println("Get elapsed time in seconds: " + durationBetween.toSeconds());
} }
} }

View File

@@ -1,7 +1,6 @@
package tools.mapletools; package tools.mapletools;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.sql.Connection; import java.sql.Connection;
@@ -248,73 +247,73 @@ public class GachaponItemIdRetriever {
} }
private static void fetchDataOnMapleHandbook() throws SQLException { private static void fetchDataOnMapleHandbook() throws SQLException {
String line; String line;
try (BufferedReader bufferedReader = Files.newBufferedReader(INPUT_FILE)) { try (BufferedReader bufferedReader = Files.newBufferedReader(INPUT_FILE)) {
int skip = 0; int skip = 0;
boolean lineHeader = false; boolean lineHeader = false;
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
if (skip > 0) { if (skip > 0) {
skip--; skip--;
if (lineHeader) { if (lineHeader) {
if (!line.isEmpty()) { if (!line.isEmpty()) {
lineHeader = false; lineHeader = false;
printWriter.println(); printWriter.println();
printWriter.println(line + ":"); printWriter.println(line + ":");
} }
} }
} else if (line.isEmpty()) { } else if (line.isEmpty()) {
printWriter.println(""); printWriter.println("");
} else if (line.startsWith("Gachapon ")) { } else if (line.startsWith("Gachapon ")) {
String[] s = line.split("<EFBFBD> "); String[] s = line.split("<EFBFBD> ");
String gachaponName = s[s.length - 1]; String gachaponName = s[s.length - 1];
gachaponName = gachaponName.replace(" ", "_"); gachaponName = gachaponName.replace(" ", "_");
gachaponName = gachaponName.toLowerCase(); gachaponName = gachaponName.toLowerCase();
if (printWriter != null) { if (printWriter != null) {
printWriter.close(); printWriter.close();
} }
Path outputFile = OUTPUT_DIRECTORY.resolve(gachaponName + ".txt"); Path outputFile = OUTPUT_DIRECTORY.resolve(gachaponName + ".txt");
setupDirectories(outputFile); setupDirectories(outputFile);
printWriter = new PrintWriter(Files.newOutputStream(outputFile)); printWriter = new PrintWriter(Files.newOutputStream(outputFile));
skip = 2; skip = 2;
lineHeader = true; lineHeader = true;
} else if (line.startsWith(".")) { } else if (line.startsWith(".")) {
skip = 1; skip = 1;
lineHeader = true; lineHeader = true;
} else { } else {
line = line.replace("<EFBFBD>", "'"); line = line.replace("<EFBFBD>", "'");
for (String item : line.split("\\s\\|\\s")) { for (String item : line.split("\\s\\|\\s")) {
item = item.trim(); item = item.trim();
if (!item.contentEquals("n/a")) { if (!item.contentEquals("n/a")) {
String[] itemInfo = item.split(" - "); String[] itemInfo = item.split(" - ");
fetchLineOnMapleHandbook(itemInfo[0], itemInfo.length > 1 ? itemInfo[1] : null); fetchLineOnMapleHandbook(itemInfo[0], itemInfo.length > 1 ? itemInfo[1] : null);
} }
} }
} }
} }
} catch (IOException ex) { } catch (IOException ex) {
System.out.println(ex.getMessage()); System.out.println(ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
} }
} }
private static void setupDirectories(Path file) { private static void setupDirectories(Path file) {
if(!Files.exists(file.getParent())) { if (!Files.exists(file.getParent())) {
try { try {
Files.createDirectories(file.getParent()); Files.createDirectories(file.getParent());
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
try(con) { try (con) {
loadHandbookUseNames(); loadHandbookUseNames();
fetchDataOnMapleHandbook(); fetchDataOnMapleHandbook();
} catch (SQLException e) { } catch (SQLException e) {
System.out.println("Error: invalid SQL syntax"); System.out.println("Error: invalid SQL syntax");

View File

@@ -136,11 +136,11 @@ public class IdRetriever {
} }
private static void fetchDataOnMapleHandbook() throws SQLException { private static void fetchDataOnMapleHandbook() throws SQLException {
try (BufferedReader br = Files.newBufferedReader(INPUT_FILE); try (BufferedReader br = Files.newBufferedReader(INPUT_FILE);
PrintWriter printWriter = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));) { PrintWriter printWriter = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));) {
bufferedReader = br; bufferedReader = br;
String line; String line;
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
if (line.isEmpty()) { if (line.isEmpty()) {
printWriter.println(""); printWriter.println("");
continue; continue;
@@ -164,13 +164,13 @@ public class IdRetriever {
printWriter.println(str); printWriter.println(str);
} }
} catch (IOException ex) { } catch (IOException ex) {
System.out.println(ex.getMessage()); System.out.println(ex.getMessage());
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
Instant instantStarted = Instant.now(); Instant instantStarted = Instant.now();
try (con) { try (con) {
if (INSTALL_SQLTABLE) { if (INSTALL_SQLTABLE) {
parseMapleHandbook(); parseMapleHandbook();
@@ -184,7 +184,7 @@ public class IdRetriever {
Instant instantStopped = Instant.now(); Instant instantStopped = Instant.now();
Duration durationBetween = Duration.between(instantStarted, instantStopped); Duration durationBetween = Duration.between(instantStarted, instantStopped);
System.out.println("Get elapsed time in milliseconds: " + durationBetween.toMillis()); System.out.println("Get elapsed time in milliseconds: " + durationBetween.toMillis());
System.out.println("Get elapsed time in seconds: " + durationBetween.toSeconds()); System.out.println("Get elapsed time in seconds: " + durationBetween.toSeconds());
} }
} }

View File

@@ -3,7 +3,9 @@ package tools.mapletools;
import provider.wz.WZFiles; import provider.wz.WZFiles;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
@@ -72,17 +74,17 @@ public class MapFieldLimitChecker {
} }
} }
private static void listFiles(String directoryName, ArrayList<File> files) { private static void listFiles(Path directory, ArrayList<Path> files) {
File directory = new File(directoryName); try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory)) {
for (Path path : stream) {
// get all the files from a directory if (Files.isRegularFile(path)) {
File[] fList = directory.listFiles(); files.add(path);
for (File file : fList) { } else if (Files.isDirectory(path)) {
if (file.isFile()) { listFiles(path, files);
files.add(file); }
} else if (file.isDirectory()) {
listFiles(file.getAbsolutePath(), files);
} }
} catch (IOException e) {
e.printStackTrace();
} }
} }
@@ -134,18 +136,17 @@ public class MapFieldLimitChecker {
private static void loadMapWz() throws IOException { private static void loadMapWz() throws IOException {
System.out.println("Reading Map.wz ..."); System.out.println("Reading Map.wz ...");
ArrayList<File> files = new ArrayList<>(); ArrayList<Path> files = new ArrayList<>();
listFiles(WZFiles.MAP.getFilePath() + "/Map", files); listFiles(WZFiles.MAP.getFile().resolve("Map"), files);
for (File f : files) { for (Path f : files) {
InputStreamReader fileReader = new InputStreamReader(new FileInputStream(f), StandardCharsets.UTF_8); try (BufferedReader br = Files.newBufferedReader(f)) {
bufferedReader = new BufferedReader(fileReader); bufferedReader = br;
mapid = getMapIdFromFilename(f.getName()); mapid = getMapIdFromFilename(f.getFileName().toString());
inspectMapEntry(); inspectMapEntry();
bufferedReader.close(); }
fileReader.close();
} }
} }

View File

@@ -130,19 +130,19 @@ public class MapInfoRetriever {
} }
} }
private static void writeReport() { private static void writeReport() {
try (PrintWriter printWriter = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (PrintWriter printWriter = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
if (!missingInfo.isEmpty()) { if (!missingInfo.isEmpty()) {
for (Integer i : missingInfo) { for (Integer i : missingInfo) {
printWriter.println(i); printWriter.println(i);
} }
} else { } else {
printWriter.println("All map files contain 'info' node."); printWriter.println("All map files contain 'info' node.");
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
for (int i = 0; i <= 9; i++) { for (int i = 0; i <= 9; i++) {

View File

@@ -3,9 +3,7 @@ package tools.mapletools;
import server.life.MonsterStats; import server.life.MonsterStats;
import tools.Pair; import tools.Pair;
import java.io.File;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.sql.Connection; import java.sql.Connection;
@@ -128,7 +126,7 @@ public class MesoFetcher {
ResultSet rs = ps.executeQuery();) { ResultSet rs = ps.executeQuery();) {
List<Integer> existingMobs = new ArrayList<>(200); List<Integer> existingMobs = new ArrayList<>(200);
if (rs.isBeforeFirst()) { if (rs.isBeforeFirst()) {
while (rs.next()) { while (rs.next()) {
int mobid = rs.getInt(1); int mobid = rs.getInt(1);
@@ -140,9 +138,9 @@ public class MesoFetcher {
if (!existingMobs.isEmpty()) { if (!existingMobs.isEmpty()) {
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
printWriter = pw; printWriter = pw;
printSqlHeader(); printSqlHeader();
for (int i = 0; i < existingMobs.size() - 1; i++) { for (int i = 0; i < existingMobs.size() - 1; i++) {
printSqlMobMesoRange(existingMobs.get(i)); printSqlMobMesoRange(existingMobs.get(i));
@@ -159,9 +157,9 @@ public class MesoFetcher {
} else { } else {
throw new Exception("ALREADY UPDATED"); throw new Exception("ALREADY UPDATED");
} }
System.out.println("done!"); System.out.println("done!");
} catch (Exception e) { } catch (Exception e) {
if (e.getMessage() != null && e.getMessage().equals("ALREADY UPDATED")) { if (e.getMessage() != null && e.getMessage().equals("ALREADY UPDATED")) {
System.out.println("done! The DB is already up-to-date, no file generated."); System.out.println("done! The DB is already up-to-date, no file generated.");

View File

@@ -3,7 +3,6 @@ package tools.mapletools;
import provider.wz.WZFiles; import provider.wz.WZFiles;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.sql.Connection; import java.sql.Connection;
@@ -144,29 +143,29 @@ public class MobBookUpdate {
} }
private static void updateFromDropData() { private static void updateFromDropData() {
try (con; try (con;
PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE)); PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));
BufferedReader br = Files.newBufferedReader(INPUT_FILE);) { BufferedReader br = Files.newBufferedReader(INPUT_FILE);) {
printWriter = pw; printWriter = pw;
bufferedReader = br; bufferedReader = br;
String line = null; String line = null;
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
translateToken(line); translateToken(line);
} }
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
System.out.println("Unable to open file '" + INPUT_FILE + "'"); System.out.println("Unable to open file '" + INPUT_FILE + "'");
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Error reading file '" + INPUT_FILE + "'"); System.out.println("Error reading file '" + INPUT_FILE + "'");
} catch (SQLException e) { } catch (SQLException e) {
System.out.println("Warning: Could not establish connection to database to change card chance rate."); System.out.println("Warning: Could not establish connection to database to change card chance rate.");
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
updateFromDropData(); updateFromDropData();

View File

@@ -199,16 +199,16 @@ public class NoItemIdFetcher {
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
printWriter = pw; printWriter = pw;
existingIds.add(0); // meso itemid existingIds.add(0); // meso itemid
readEquipDataDirectory(WZFiles.CHARACTER.getFilePath()); readEquipDataDirectory(WZFiles.CHARACTER.getFilePath());
readItemDataDirectory(WZFiles.ITEM.getFilePath()); readItemDataDirectory(WZFiles.ITEM.getFilePath());
evaluateDropsFromDb(); evaluateDropsFromDb();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

View File

@@ -3,9 +3,7 @@ package tools.mapletools;
import provider.*; import provider.*;
import provider.wz.WZFiles; import provider.wz.WZFiles;
import java.io.File;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.*; import java.util.*;
@@ -435,41 +433,41 @@ public class NoItemNameFetcher {
} }
} }
private static void writeMissingStringWZNames(Map<String, List<Integer>> missingNames) throws Exception { private static void writeMissingStringWZNames(Map<String, List<Integer>> missingNames) throws Exception {
System.out.println("Writing remaining 'String.wz' names..."); System.out.println("Writing remaining 'String.wz' names...");
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_XML_FILE))) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_XML_FILE))) {
printWriter = pw; printWriter = pw;
printOutputFileHeader(); printOutputFileHeader();
String[] nodePaths = { "Cash.img", "Consume.img", "Eqp.img", "Etc.img", "Ins.img", "Pet.img" }; String[] nodePaths = { "Cash.img", "Consume.img", "Eqp.img", "Etc.img", "Ins.img", "Pet.img" };
for (int i = 0; i < nodePaths.length; i++) { for (int i = 0; i < nodePaths.length; i++) {
writeMissingStringWZNode(nodePaths[i], missingNames.get(nodePaths[i]), i == 2); writeMissingStringWZNode(nodePaths[i], missingNames.get(nodePaths[i]), i == 2);
} }
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
printWriter = pw; printWriter = pw;
curType = ItemType.EQP; curType = ItemType.EQP;
readEquipWZData(); readEquipWZData();
curType = ItemType.UNDEF; curType = ItemType.UNDEF;
readItemWZData(); readItemWZData();
readStringWZData(); // calculates the diff and effectively holds all items with no name property on the WZ readStringWZData(); // calculates the diff and effectively holds all items with no name property on the WZ
System.out.println("Reporting results..."); System.out.println("Reporting results...");
printReportFileHeader(); printReportFileHeader();
printReportFileResults(); printReportFileResults();
Map<String, List<Integer>> missingNames = filterMissingItemNames(); Map<String, List<Integer>> missingNames = filterMissingItemNames();
writeMissingStringWZNames(missingNames); writeMissingStringWZNames(missingNames);
System.out.println("Done!"); System.out.println("Done!");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

View File

@@ -240,28 +240,28 @@ public class QuestItemCountFetcher {
} }
} }
private static void reportQuestItemCountData() { private static void reportQuestItemCountData() {
// This will reference one line at a time // This will reference one line at a time
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
System.out.println("Reading WZs..."); System.out.println("Reading WZs...");
readQuestItemCountData(); readQuestItemCountData();
System.out.println("Reporting results..."); System.out.println("Reporting results...");
printWriter = pw; printWriter = pw;
printReportFileHeader(); printReportFileHeader();
printReportFileResults(); printReportFileResults();
System.out.println("Done!"); System.out.println("Done!");
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
System.out.println("Unable to open quest file."); System.out.println("Unable to open quest file.");
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Error reading quest file."); System.out.println("Error reading quest file.");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
reportQuestItemCountData(); reportQuestItemCountData();

View File

@@ -408,113 +408,113 @@ public class QuestItemFetcher {
return (!limitedQuestids.contains(questid) ? "" : " EXPIRED"); return (!limitedQuestids.contains(questid) ? "" : " EXPIRED");
} }
private static void reportQuestItemData() { private static void reportQuestItemData() {
// This will reference one line at a time // This will reference one line at a time
String line = null; String line = null;
Path file = null; Path file = null;
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
System.out.println("Reading WZs..."); System.out.println("Reading WZs...");
file = WZFiles.QUEST.getFile().resolve("Check.img.xml"); file = WZFiles.QUEST.getFile().resolve("Check.img.xml");
bufferedReader = Files.newBufferedReader(file); bufferedReader = Files.newBufferedReader(file);
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
translateCheckToken(line); // fetch expired quests through here as well translateCheckToken(line); // fetch expired quests through here as well
} }
bufferedReader.close(); bufferedReader.close();
file = WZFiles.QUEST.getFile().resolve("Act.img.xml"); file = WZFiles.QUEST.getFile().resolve("Act.img.xml");
bufferedReader = Files.newBufferedReader(file); bufferedReader = Files.newBufferedReader(file);
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
translateActToken(line); translateActToken(line);
} }
bufferedReader.close(); bufferedReader.close();
System.out.println("Calculating table diffs..."); System.out.println("Calculating table diffs...");
calculateQuestItemDiff(); calculateQuestItemDiff();
System.out.println("Filtering drops on DB..."); System.out.println("Filtering drops on DB...");
List<Pair<Integer, Integer>> itemsWithQuest = getPairsQuestItem(); List<Pair<Integer, Integer>> itemsWithQuest = getPairsQuestItem();
filterQuestDropsOnDB(itemsWithQuest); filterQuestDropsOnDB(itemsWithQuest);
con.close(); con.close();
System.out.println("Filtering drops on project files..."); System.out.println("Filtering drops on project files...");
// finally, filter whether this item is mentioned on the source code or not. // finally, filter whether this item is mentioned on the source code or not.
filterDirectorySearchMatchingData("scripts", itemsWithQuest); filterDirectorySearchMatchingData("scripts", itemsWithQuest);
filterDirectorySearchMatchingData("sql", itemsWithQuest); filterDirectorySearchMatchingData("sql", itemsWithQuest);
filterDirectorySearchMatchingData("src", itemsWithQuest); filterDirectorySearchMatchingData("src", itemsWithQuest);
System.out.println("Reporting results..."); System.out.println("Reporting results...");
// report suspects of missing quest drop data, as well as those drop data that // report suspects of missing quest drop data, as well as those drop data that
// may have incorrect questids. // may have incorrect questids.
printWriter = pw; printWriter = pw;
printReportFileHeader(); printReportFileHeader();
if (!mixedQuestidItems.isEmpty()) { if (!mixedQuestidItems.isEmpty()) {
printWriter.println("INCORRECT QUESTIDS ON DB"); printWriter.println("INCORRECT QUESTIDS ON DB");
for (Map.Entry<Integer, int[]> emqi : getSortedMapEntries1(mixedQuestidItems)) { for (Map.Entry<Integer, int[]> emqi : getSortedMapEntries1(mixedQuestidItems)) {
int[] mqi = emqi.getValue(); int[] mqi = emqi.getValue();
printWriter.println(mqi[0] + " : " + mqi[1] + " -> " + mqi[2] + getExpiredStringLabel(mqi[2])); printWriter.println(mqi[0] + " : " + mqi[1] + " -> " + mqi[2] + getExpiredStringLabel(mqi[2]));
} }
printWriter.println("\n\n\n\n\n"); printWriter.println("\n\n\n\n\n");
} }
if (!itemsWithQuest.isEmpty()) { if (!itemsWithQuest.isEmpty()) {
Map<Integer, Integer> mapIwq = new HashMap<>(itemsWithQuest.size()); Map<Integer, Integer> mapIwq = new HashMap<>(itemsWithQuest.size());
for (Pair<Integer, Integer> iwq : itemsWithQuest) { for (Pair<Integer, Integer> iwq : itemsWithQuest) {
mapIwq.put(iwq.getLeft(), iwq.getRight()); mapIwq.put(iwq.getLeft(), iwq.getRight());
} }
printWriter.println("ITEMS WITH NO QUEST DROP DATA ON DB"); printWriter.println("ITEMS WITH NO QUEST DROP DATA ON DB");
for (Map.Entry<Integer, Integer> iwq : getSortedMapEntries0(mapIwq)) { for (Map.Entry<Integer, Integer> iwq : getSortedMapEntries0(mapIwq)) {
printWriter.println(iwq.getKey() + " - " + iwq.getValue() + getExpiredStringLabel(iwq.getValue())); printWriter.println(iwq.getKey() + " - " + iwq.getValue() + getExpiredStringLabel(iwq.getValue()));
} }
printWriter.println("\n\n\n\n\n"); printWriter.println("\n\n\n\n\n");
} }
if (DISPLAY_EXTRA_INFO) { if (DISPLAY_EXTRA_INFO) {
if (!zeroedStartQuestItems.isEmpty()) { if (!zeroedStartQuestItems.isEmpty()) {
printWriter.println("START QUEST ITEMS WITH ZERO QUANTITY"); printWriter.println("START QUEST ITEMS WITH ZERO QUANTITY");
for (Pair<Integer, List<Integer>> iwq : getSortedMapEntries2(zeroedStartQuestItems)) { for (Pair<Integer, List<Integer>> iwq : getSortedMapEntries2(zeroedStartQuestItems)) {
printWriter.println(iwq.getLeft() + getExpiredStringLabel(iwq.getLeft()) + ":"); printWriter.println(iwq.getLeft() + getExpiredStringLabel(iwq.getLeft()) + ":");
for (Integer i : iwq.getRight()) { for (Integer i : iwq.getRight()) {
printWriter.println(" " + i); printWriter.println(" " + i);
} }
printWriter.println(); printWriter.println();
} }
printWriter.println("\n\n\n\n\n"); printWriter.println("\n\n\n\n\n");
} }
if (!zeroedCompleteQuestItems.isEmpty()) { if (!zeroedCompleteQuestItems.isEmpty()) {
printWriter.println("COMPLETE QUEST ITEMS WITH ZERO QUANTITY"); printWriter.println("COMPLETE QUEST ITEMS WITH ZERO QUANTITY");
for (Pair<Integer, List<Integer>> iwq : getSortedMapEntries2(zeroedCompleteQuestItems)) { for (Pair<Integer, List<Integer>> iwq : getSortedMapEntries2(zeroedCompleteQuestItems)) {
printWriter.println(iwq.getLeft() + getExpiredStringLabel(iwq.getLeft()) + ":"); printWriter.println(iwq.getLeft() + getExpiredStringLabel(iwq.getLeft()) + ":");
for (Integer i : iwq.getRight()) { for (Integer i : iwq.getRight()) {
printWriter.println(" " + i); printWriter.println(" " + i);
} }
printWriter.println(); printWriter.println();
} }
printWriter.println("\n\n\n\n\n"); printWriter.println("\n\n\n\n\n");
} }
} }
System.out.println("Done!"); System.out.println("Done!");
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
System.out.println("Unable to open file '" + file + "'"); System.out.println("Unable to open file '" + file + "'");
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Error reading file '" + file + "'"); System.out.println("Error reading file '" + file + "'");
} catch (SQLException e) { } catch (SQLException e) {
System.out.println("Warning: Could not establish connection to database to report quest data."); System.out.println("Warning: Could not establish connection to database to report quest data.");
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -3,7 +3,6 @@ package tools.mapletools;
import provider.wz.WZFiles; import provider.wz.WZFiles;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.*; import java.util.*;
@@ -228,29 +227,29 @@ public class QuestMesoFetcher {
} }
private static void reportQuestMesoData() { private static void reportQuestMesoData() {
// This will reference one line at a time // This will reference one line at a time
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
System.out.println("Reading WZs..."); System.out.println("Reading WZs...");
readQuestMesoData(); readQuestMesoData();
System.out.println("Reporting results..."); System.out.println("Reporting results...");
// report missing meso checks on quest completes // report missing meso checks on quest completes
printWriter = pw; printWriter = pw;
printReportFileHeader(); printReportFileHeader();
printReportFileResults(checkedMesoQuests, appliedMesoQuests, true); printReportFileResults(checkedMesoQuests, appliedMesoQuests, true);
printReportFileResults(appliedMesoQuests, checkedMesoQuests, false); printReportFileResults(appliedMesoQuests, checkedMesoQuests, false);
System.out.println("Done!"); System.out.println("Done!");
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
System.out.println("Unable to open quest file."); System.out.println("Unable to open quest file.");
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Error reading quest file."); System.out.println("Error reading quest file.");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -291,33 +291,33 @@ public class QuestlineFetcher {
} }
private static void reportQuestlineData() { private static void reportQuestlineData() {
// This will reference one line at a time // This will reference one line at a time
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
System.out.println("Reading quest scripts..."); System.out.println("Reading quest scripts...");
instantiateQuestScriptFiles(ToolConstants.SCRIPTS_PATH + "/quest"); instantiateQuestScriptFiles(ToolConstants.SCRIPTS_PATH + "/quest");
System.out.println("Reading WZs..."); System.out.println("Reading WZs...");
readQuestsWithSkillReward(); readQuestsWithSkillReward();
readQuestsWithMissingScripts(); readQuestsWithMissingScripts();
System.out.println("Calculating skill related quests..."); System.out.println("Calculating skill related quests...");
calculateSkillRelatedMissingQuestScripts(); calculateSkillRelatedMissingQuestScripts();
System.out.println("Reporting results..."); System.out.println("Reporting results...");
printWriter = pw; printWriter = pw;
printReportFileHeader(); printReportFileHeader();
printReportFileResults(); printReportFileResults();
System.out.println("Done!"); System.out.println("Done!");
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
System.out.println("Unable to open quest file."); System.out.println("Unable to open quest file.");
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Error reading quest file."); System.out.println("Error reading quest file.");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
/* /*

View File

@@ -1,10 +1,11 @@
package tools.mapletools; package tools.mapletools;
import java.io.File; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.nio.charset.StandardCharsets; import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -40,14 +41,14 @@ public class ReactorDropFetcher {
} }
private static void removeScriptedReactorids(String directoryName) { private static void removeScriptedReactorids(String directoryName) {
File directory = new File(directoryName); try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(directoryName))) {
for (Path path : stream) {
// get all the files from a directory if (Files.isRegularFile(path)) {
File[] fList = directory.listFiles(); reactors.remove(getReactorIdFromFilename(path.getFileName().toString()));
for (File file : fList) { }
if (file.isFile()) {
reactors.remove(getReactorIdFromFilename(file.getName()));
} }
} catch (IOException e) {
e.printStackTrace();
} }
} }
@@ -86,25 +87,25 @@ public class ReactorDropFetcher {
} }
private static void reportMissingReactors() { private static void reportMissingReactors() {
try (con; PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (con; PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
System.out.println("Fetching reactors from DB..."); System.out.println("Fetching reactors from DB...");
fetchMissingReactorDrops(); fetchMissingReactorDrops();
printWriter = pw; printWriter = pw;
// report suspects of missing quest drop data, as well as those drop data that // report suspects of missing quest drop data, as well as those drop data that
// may have incorrect questids. // may have incorrect questids.
System.out.println("Reporting results..."); System.out.println("Reporting results...");
printReportFileHeader(); printReportFileHeader();
reportMissingReactorDrops(); reportMissingReactorDrops();
System.out.println("Done!"); System.out.println("Done!");
} catch (SQLException e) { } catch (SQLException e) {
System.out.println("Warning: Could not establish connection to database to report quest data."); System.out.println("Warning: Could not establish connection to database to report quest data.");
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -5,7 +5,6 @@ import server.ItemInformationProvider;
import tools.DatabaseConnection; import tools.DatabaseConnection;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
@@ -303,28 +302,28 @@ public class SkillMakerFetcher {
private static void writeMakerTableData() { private static void writeMakerTableData() {
// This will reference one line at a time // This will reference one line at a time
String line = null; String line = null;
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE)); try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));
BufferedReader br = Files.newBufferedReader(INPUT_FILE);) { BufferedReader br = Files.newBufferedReader(INPUT_FILE);) {
printWriter = pw; printWriter = pw;
bufferedReader = br; bufferedReader = br;
resetMakerDataFields(); resetMakerDataFields();
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
translateToken(line); translateToken(line);
} }
WriteMakerTableFile(); WriteMakerTableFile();
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
System.out.println("Unable to open file '" + INPUT_FILE + "'"); System.out.println("Unable to open file '" + INPUT_FILE + "'");
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Error reading file '" + INPUT_FILE + "'"); System.out.println("Error reading file '" + INPUT_FILE + "'");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -4,7 +4,6 @@ import provider.wz.WZFiles;
import tools.Pair; import tools.Pair;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
@@ -150,29 +149,29 @@ public class SkillMakerReagentIndexer {
} }
private static void writeMakerReagentTableData() { private static void writeMakerReagentTableData() {
// This will reference one line at a time // This will reference one line at a time
String line = null; String line = null;
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE)); try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));
BufferedReader br = Files.newBufferedReader(INPUT_FILE);) { BufferedReader br = Files.newBufferedReader(INPUT_FILE);) {
bufferedReader = br; bufferedReader = br;
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
translateToken(line); translateToken(line);
} }
SortReagentList(); SortReagentList();
printWriter = pw; printWriter = pw;
WriteMakerReagentTableFile(); WriteMakerReagentTableFile();
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
System.out.println("Unable to open file '" + OUTPUT_FILE + "'"); System.out.println("Unable to open file '" + OUTPUT_FILE + "'");
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Error reading file '" + OUTPUT_FILE + "'"); System.out.println("Error reading file '" + OUTPUT_FILE + "'");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
writeMakerReagentTableData(); writeMakerReagentTableData();

View File

@@ -3,10 +3,8 @@ package tools.mapletools;
import server.life.MonsterStats; import server.life.MonsterStats;
import tools.Pair; import tools.Pair;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.sql.Connection; import java.sql.Connection;
@@ -103,22 +101,22 @@ public class SkillbookChanceFetcher {
printWriter.println(" REPLACE INTO drop_data (`dropperid`, `itemid`, `minimum_quantity`, `maximum_quantity`, `questid`, `chance`) VALUES"); printWriter.println(" REPLACE INTO drop_data (`dropperid`, `itemid`, `minimum_quantity`, `maximum_quantity`, `questid`, `chance`) VALUES");
} }
private static void generateSkillbookChanceUpdateFile() { private static void generateSkillbookChanceUpdateFile() {
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) { try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
printWriter = pw; printWriter = pw;
printSkillbookChanceUpdateSqlHeader(); printSkillbookChanceUpdateSqlHeader();
List<Map.Entry<Pair<Integer, Integer>, Integer>> skillbookChancesList = sortedSkillbookChances(); List<Map.Entry<Pair<Integer, Integer>, Integer>> skillbookChancesList = sortedSkillbookChances();
for (Map.Entry<Pair<Integer, Integer>, Integer> e : skillbookChancesList) { for (Map.Entry<Pair<Integer, Integer>, Integer> e : skillbookChancesList) {
printWriter.println("(" + e.getKey().getLeft() + ", " + e.getKey().getRight() + ", 1, 1, 0, " printWriter.println("(" + e.getKey().getLeft() + ", " + e.getKey().getRight() + ", 1, 1, 0, "
+ e.getValue() + "),"); + e.getValue() + "),");
} }
} catch (IOException ioe) { } catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
// load mob stats from WZ // load mob stats from WZ

View File

@@ -6,7 +6,6 @@ import java.io.*;
import java.nio.file.DirectoryStream; import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
@@ -151,7 +150,6 @@ public class SkillbookStackUpdate {
parseItemFile(path, outputDirectory.resolve(path.getFileName())); parseItemFile(path, outputDirectory.resolve(path.getFileName()));
} }
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }