Fixing indents !

This commit is contained in:
Đạt Nhân Trương
2022-08-02 23:14:17 +07:00
parent 4496e0854f
commit d9a86d6d75
32 changed files with 691 additions and 703 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,7 +3,8 @@ package tools.mapletools;
import provider.wz.WZFiles;
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.PreparedStatement;
import java.sql.SQLException;
@@ -16,8 +17,8 @@ import java.sql.SQLException;
* a SQL table that the server will make use.
*/
public class CouponInstaller {
private static final File COUPON_INPUT_FILE_1 = new File(WZFiles.ITEM.getFilePath(), "/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_1 = WZFiles.ITEM.getFile().resolve("Cash/0521.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 BufferedReader bufferedReader = null;
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
String line = null;
try {
InputStreamReader fileReader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8);
bufferedReader = new BufferedReader(fileReader);
try (BufferedReader br = Files.newBufferedReader(file)) {
bufferedReader = br;
while ((line = bufferedReader.readLine()) != null) {
translateToken(line);
}
bufferedReader.close();
fileReader.close();
} catch (FileNotFoundException ex) {
System.out.println("Unable to open file '" + file + "'");
} catch (IOException ex) {

View File

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

View File

@@ -3,7 +3,6 @@ package tools.mapletools;
import provider.wz.WZFiles;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -358,41 +357,40 @@ public class EquipmentOmniLeveller {
}
private static void copyCashItemData(Path file, String curPath) throws IOException {
try(PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_DIRECTORY.resolve(curPath).resolve(file.getFileName())));
BufferedReader br = Files.newBufferedReader(file);) {
printWriter = pw;
bufferedReader = br;
String line;
try (PrintWriter pw = new PrintWriter(
Files.newOutputStream(OUTPUT_DIRECTORY.resolve(curPath).resolve(file.getFileName())));
BufferedReader br = Files.newBufferedReader(file);) {
printWriter = pw;
bufferedReader = br;
String line;
while ((line = bufferedReader.readLine()) != null) {
printWriter.println(line);
}
}
}
}
private static void parseEquipData(Path file, String curPath) throws IOException {
try(PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_DIRECTORY.resolve(curPath).resolve(file.getFileName())));
BufferedReader br = Files.newBufferedReader(file);) {
printWriter = pw;
bufferedReader = br;
status = 0;
try (PrintWriter pw = new PrintWriter(
Files.newOutputStream(OUTPUT_DIRECTORY.resolve(curPath).resolve(file.getFileName())));
BufferedReader br = Files.newBufferedReader(file);) {
printWriter = pw;
bufferedReader = br;
status = 0;
upgradeable = false;
cash = false;
String line;
while ((line = bufferedReader.readLine()) != null) {
if (translateToken(line)) {
infoTagState = status; // status: 2
infoTagState = status; // status: 2
translateInfoTag(status);
infoTagState = -1;
}
}
printFileFooter();
} catch (RuntimeException e) {
} catch (RuntimeException e) {
copyCashItemData(file, curPath);
}
}
private static void printFileFooter() {
@@ -403,48 +401,48 @@ public class EquipmentOmniLeveller {
}
private static void parseDirectoryEquipData(String curPath) {
Path folder = OUTPUT_DIRECTORY.resolve(curPath);
if (!Files.exists(folder)) {
try {
Files.createDirectory(folder);
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("Unable to create folder " + folder.toAbsolutePath() + ".");
e.printStackTrace();
}
}
Path folder = OUTPUT_DIRECTORY.resolve(curPath);
if (!Files.exists(folder)) {
try {
Files.createDirectory(folder);
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("Unable to create folder " + folder.toAbsolutePath() + ".");
e.printStackTrace();
}
}
System.out.println("Parsing directory '" + curPath + "'");
folder = INPUT_DIRECTORY.resolve(curPath);
try (DirectoryStream<Path> stream = Files.newDirectoryStream(folder)) {
for (Path path : stream) {
if (Files.isRegularFile(path)) {
try {
parseEquipData(path, curPath);
} catch (FileNotFoundException ex) {
System.out.println("Unable to open dojo file " + path.toAbsolutePath() + ".");
} catch (IOException ex) {
System.out.println("Error reading dojo file " + path.toAbsolutePath() + ".");
} catch (Exception e) {
e.printStackTrace();
}
} else {
parseDirectoryEquipData(curPath + path.getFileName() + "/");
}
}
} catch (IOException e1) {
System.out.println("Unable to read folder " + folder.toAbsolutePath() + ".");
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
System.out.println("Parsing directory '" + curPath + "'");
folder = INPUT_DIRECTORY.resolve(curPath);
try (DirectoryStream<Path> stream = Files.newDirectoryStream(folder)) {
for (Path path : stream) {
if (Files.isRegularFile(path)) {
try {
parseEquipData(path, curPath);
} catch (FileNotFoundException ex) {
System.out.println("Unable to open dojo file " + path.toAbsolutePath() + ".");
} catch (IOException ex) {
System.out.println("Error reading dojo file " + path.toAbsolutePath() + ".");
} catch (Exception e) {
e.printStackTrace();
}
} else {
parseDirectoryEquipData(curPath + path.getFileName() + "/");
}
}
} catch (IOException e1) {
System.out.println("Unable to read folder " + folder.toAbsolutePath() + ".");
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
public static void main(String[] args) {
Instant instantStarted = Instant.now();
Instant instantStarted = Instant.now();
parseDirectoryEquipData("");
Instant instantStopped = Instant.now();
Duration durationBetween = Duration.between(instantStarted, instantStopped);
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;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.sql.Connection;
@@ -248,73 +247,73 @@ public class GachaponItemIdRetriever {
}
private static void fetchDataOnMapleHandbook() throws SQLException {
String line;
try (BufferedReader bufferedReader = Files.newBufferedReader(INPUT_FILE)) {
int skip = 0;
boolean lineHeader = false;
while ((line = bufferedReader.readLine()) != null) {
if (skip > 0) {
skip--;
String line;
try (BufferedReader bufferedReader = Files.newBufferedReader(INPUT_FILE)) {
int skip = 0;
boolean lineHeader = false;
while ((line = bufferedReader.readLine()) != null) {
if (skip > 0) {
skip--;
if (lineHeader) {
if (!line.isEmpty()) {
lineHeader = false;
printWriter.println();
printWriter.println(line + ":");
}
}
} else if (line.isEmpty()) {
printWriter.println("");
if (lineHeader) {
if (!line.isEmpty()) {
lineHeader = false;
printWriter.println();
printWriter.println(line + ":");
}
}
} else if (line.isEmpty()) {
printWriter.println("");
} else if (line.startsWith("Gachapon ")) {
String[] s = line.split("<EFBFBD> ");
String gachaponName = s[s.length - 1];
gachaponName = gachaponName.replace(" ", "_");
gachaponName = gachaponName.toLowerCase();
String[] s = line.split("<EFBFBD> ");
String gachaponName = s[s.length - 1];
gachaponName = gachaponName.replace(" ", "_");
gachaponName = gachaponName.toLowerCase();
if (printWriter != null) {
printWriter.close();
}
Path outputFile = OUTPUT_DIRECTORY.resolve(gachaponName + ".txt");
setupDirectories(outputFile);
if (printWriter != null) {
printWriter.close();
}
Path outputFile = OUTPUT_DIRECTORY.resolve(gachaponName + ".txt");
setupDirectories(outputFile);
printWriter = new PrintWriter(Files.newOutputStream(outputFile));
printWriter = new PrintWriter(Files.newOutputStream(outputFile));
skip = 2;
lineHeader = true;
} else if (line.startsWith(".")) {
skip = 1;
lineHeader = true;
} else {
line = line.replace("<EFBFBD>", "'");
skip = 2;
lineHeader = true;
} else if (line.startsWith(".")) {
skip = 1;
lineHeader = true;
} else {
line = line.replace("<EFBFBD>", "'");
for (String item : line.split("\\s\\|\\s")) {
item = item.trim();
if (!item.contentEquals("n/a")) {
String[] itemInfo = item.split(" - ");
fetchLineOnMapleHandbook(itemInfo[0], itemInfo.length > 1 ? itemInfo[1] : null);
}
}
}
}
} catch (IOException ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
}
}
item = item.trim();
if (!item.contentEquals("n/a")) {
String[] itemInfo = item.split(" - ");
fetchLineOnMapleHandbook(itemInfo[0], itemInfo.length > 1 ? itemInfo[1] : null);
}
}
}
}
} catch (IOException ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
}
}
private static void setupDirectories(Path file) {
if(!Files.exists(file.getParent())) {
try {
Files.createDirectories(file.getParent());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (!Files.exists(file.getParent())) {
try {
Files.createDirectories(file.getParent());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public static void main(String[] args) {
try(con) {
loadHandbookUseNames();
try (con) {
loadHandbookUseNames();
fetchDataOnMapleHandbook();
} catch (SQLException e) {
System.out.println("Error: invalid SQL syntax");

View File

@@ -136,11 +136,11 @@ public class IdRetriever {
}
private static void fetchDataOnMapleHandbook() throws SQLException {
try (BufferedReader br = Files.newBufferedReader(INPUT_FILE);
PrintWriter printWriter = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));) {
bufferedReader = br;
String line;
while ((line = bufferedReader.readLine()) != null) {
try (BufferedReader br = Files.newBufferedReader(INPUT_FILE);
PrintWriter printWriter = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));) {
bufferedReader = br;
String line;
while ((line = bufferedReader.readLine()) != null) {
if (line.isEmpty()) {
printWriter.println("");
continue;
@@ -164,13 +164,13 @@ public class IdRetriever {
printWriter.println(str);
}
} catch (IOException ex) {
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
}
public static void main(String[] args) {
Instant instantStarted = Instant.now();
Instant instantStarted = Instant.now();
try (con) {
if (INSTALL_SQLTABLE) {
parseMapleHandbook();
@@ -184,7 +184,7 @@ public class IdRetriever {
Instant instantStopped = Instant.now();
Duration durationBetween = Duration.between(instantStarted, instantStopped);
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 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;
/**
@@ -72,17 +74,17 @@ public class MapFieldLimitChecker {
}
}
private static void listFiles(String directoryName, ArrayList<File> files) {
File directory = new File(directoryName);
// get all the files from a directory
File[] fList = directory.listFiles();
for (File file : fList) {
if (file.isFile()) {
files.add(file);
} else if (file.isDirectory()) {
listFiles(file.getAbsolutePath(), files);
private static void listFiles(Path directory, ArrayList<Path> files) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory)) {
for (Path path : stream) {
if (Files.isRegularFile(path)) {
files.add(path);
} else if (Files.isDirectory(path)) {
listFiles(path, files);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
@@ -134,18 +136,17 @@ public class MapFieldLimitChecker {
private static void loadMapWz() throws IOException {
System.out.println("Reading Map.wz ...");
ArrayList<File> files = new ArrayList<>();
listFiles(WZFiles.MAP.getFilePath() + "/Map", files);
ArrayList<Path> files = new ArrayList<>();
listFiles(WZFiles.MAP.getFile().resolve("Map"), files);
for (File f : files) {
InputStreamReader fileReader = new InputStreamReader(new FileInputStream(f), StandardCharsets.UTF_8);
bufferedReader = new BufferedReader(fileReader);
for (Path f : files) {
try (BufferedReader br = Files.newBufferedReader(f)) {
bufferedReader = br;
mapid = getMapIdFromFilename(f.getName());
inspectMapEntry();
mapid = getMapIdFromFilename(f.getFileName().toString());
inspectMapEntry();
bufferedReader.close();
fileReader.close();
}
}
}

View File

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

View File

@@ -3,9 +3,7 @@ package tools.mapletools;
import server.life.MonsterStats;
import tools.Pair;
import java.io.File;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.sql.Connection;
@@ -128,7 +126,7 @@ public class MesoFetcher {
ResultSet rs = ps.executeQuery();) {
List<Integer> existingMobs = new ArrayList<>(200);
if (rs.isBeforeFirst()) {
while (rs.next()) {
int mobid = rs.getInt(1);
@@ -140,9 +138,9 @@ public class MesoFetcher {
if (!existingMobs.isEmpty()) {
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
printWriter = pw;
printSqlHeader();
printWriter = pw;
printSqlHeader();
for (int i = 0; i < existingMobs.size() - 1; i++) {
printSqlMobMesoRange(existingMobs.get(i));
@@ -159,9 +157,9 @@ public class MesoFetcher {
} else {
throw new Exception("ALREADY UPDATED");
}
System.out.println("done!");
} catch (Exception e) {
if (e.getMessage() != null && e.getMessage().equals("ALREADY UPDATED")) {
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 java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.sql.Connection;
@@ -144,29 +143,29 @@ public class MobBookUpdate {
}
private static void updateFromDropData() {
try (con;
PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));
BufferedReader br = Files.newBufferedReader(INPUT_FILE);) {
printWriter = pw;
bufferedReader = br;
private static void updateFromDropData() {
try (con;
PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE));
BufferedReader br = Files.newBufferedReader(INPUT_FILE);) {
printWriter = pw;
bufferedReader = br;
String line = null;
String line = null;
while ((line = bufferedReader.readLine()) != null) {
translateToken(line);
}
} catch (FileNotFoundException ex) {
System.out.println("Unable to open file '" + INPUT_FILE + "'");
} catch (IOException ex) {
System.out.println("Error reading file '" + INPUT_FILE + "'");
} catch (SQLException e) {
System.out.println("Warning: Could not establish connection to database to change card chance rate.");
System.out.println(e.getMessage());
} catch (Exception e) {
e.printStackTrace();
}
}
while ((line = bufferedReader.readLine()) != null) {
translateToken(line);
}
} catch (FileNotFoundException ex) {
System.out.println("Unable to open file '" + INPUT_FILE + "'");
} catch (IOException ex) {
System.out.println("Error reading file '" + INPUT_FILE + "'");
} catch (SQLException e) {
System.out.println("Warning: Could not establish connection to database to change card chance rate.");
System.out.println(e.getMessage());
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
updateFromDropData();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -291,33 +291,33 @@ public class QuestlineFetcher {
}
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))) {
System.out.println("Reading quest scripts...");
instantiateQuestScriptFiles(ToolConstants.SCRIPTS_PATH + "/quest");
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
System.out.println("Reading quest scripts...");
instantiateQuestScriptFiles(ToolConstants.SCRIPTS_PATH + "/quest");
System.out.println("Reading WZs...");
readQuestsWithSkillReward();
readQuestsWithMissingScripts();
System.out.println("Reading WZs...");
readQuestsWithSkillReward();
readQuestsWithMissingScripts();
System.out.println("Calculating skill related quests...");
calculateSkillRelatedMissingQuestScripts();
System.out.println("Calculating skill related quests...");
calculateSkillRelatedMissingQuestScripts();
System.out.println("Reporting results...");
printWriter = pw;
System.out.println("Reporting results...");
printWriter = pw;
printReportFileHeader();
printReportFileResults();
printReportFileHeader();
printReportFileResults();
System.out.println("Done!");
} catch (FileNotFoundException ex) {
System.out.println("Unable to open quest file.");
} catch (IOException ex) {
System.out.println("Error reading quest file.");
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Done!");
} catch (FileNotFoundException ex) {
System.out.println("Unable to open quest file.");
} catch (IOException ex) {
System.out.println("Error reading quest file.");
} catch (Exception e) {
e.printStackTrace();
}
}
/*

View File

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

View File

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

View File

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

View File

@@ -3,10 +3,8 @@ package tools.mapletools;
import server.life.MonsterStats;
import tools.Pair;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
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");
}
private static void generateSkillbookChanceUpdateFile() {
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
printWriter = pw;
private static void generateSkillbookChanceUpdateFile() {
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(OUTPUT_FILE))) {
printWriter = pw;
printSkillbookChanceUpdateSqlHeader();
printSkillbookChanceUpdateSqlHeader();
List<Map.Entry<Pair<Integer, Integer>, Integer>> skillbookChancesList = sortedSkillbookChances();
for (Map.Entry<Pair<Integer, Integer>, Integer> e : skillbookChancesList) {
printWriter.println("(" + e.getKey().getLeft() + ", " + e.getKey().getRight() + ", 1, 1, 0, "
+ e.getValue() + "),");
}
List<Map.Entry<Pair<Integer, Integer>, Integer>> skillbookChancesList = sortedSkillbookChances();
for (Map.Entry<Pair<Integer, Integer>, Integer> e : skillbookChancesList) {
printWriter.println("(" + e.getKey().getLeft() + ", " + e.getKey().getRight() + ", 1, 1, 0, "
+ e.getValue() + "),");
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
public static void main(String[] args) {
// load mob stats from WZ

View File

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