Move MapleCashVegaChecker to main module

This commit is contained in:
P0nk
2021-07-10 20:02:26 +02:00
parent 5b4815f173
commit e93db8b48f
2 changed files with 46 additions and 76 deletions

View File

@@ -1,30 +1,9 @@
/* package tools.mapletools;
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify import provider.wz.WZFiles;
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful, import java.io.*;
but WITHOUT ANY WARRANTY; without even the implied warranty of import java.nio.charset.StandardCharsets;
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package maplecashvegachecker;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@@ -32,25 +11,21 @@ import java.util.Set;
* *
* @author RonanLana * @author RonanLana
* *
This application main objective is to read Vega-related information from This application main objective is to read Vega-related information from
the item's description report back missing nodes for these items. the item's description report back missing nodes for these items.
Estimated parse time: 10 seconds Estimated parse time: 10 seconds
*/ */
public class MapleCashVegaChecker { public class CashVegaChecker {
private static final File OUTPUT_FILE = ToolConstants.getOutputFile("vega_checker_report.txt");
private static final int INITIAL_STRING_LENGTH = 1000;
private static final Set<Integer> vegaItems = new HashSet<>();
private static String wzPath = "../../wz"; private static PrintWriter printWriter = null;
private static InputStreamReader fileReader = null;
static PrintWriter printWriter = null; private static BufferedReader bufferedReader = null;
static InputStreamReader fileReader = null; private static int currentItem;
static BufferedReader bufferedReader = null; private static byte status = 0;
static int initialStringLength = 1000;
static int currentItem;
static byte status = 0;
static Set<Integer> vegaItems = new HashSet<>();
private static String getName(String token) { private static String getName(String token) {
int i, j; int i, j;
@@ -61,7 +36,7 @@ public class MapleCashVegaChecker {
i = token.indexOf("\"", i) + 1; //lower bound of the string i = token.indexOf("\"", i) + 1; //lower bound of the string
j = token.indexOf("\"", i); //upper bound j = token.indexOf("\"", i); //upper bound
dest = new char[initialStringLength]; dest = new char[INITIAL_STRING_LENGTH];
token.getChars(i, j, dest, 0); token.getChars(i, j, dest, 0);
d = new String(dest); d = new String(dest);
@@ -77,7 +52,7 @@ public class MapleCashVegaChecker {
i = token.indexOf("\"", i) + 1; //lower bound of the string i = token.indexOf("\"", i) + 1; //lower bound of the string
j = token.indexOf("\"", i); //upper bound j = token.indexOf("\"", i); //upper bound
dest = new char[initialStringLength]; dest = new char[INITIAL_STRING_LENGTH];
token.getChars(i, j, dest, 0); token.getChars(i, j, dest, 0);
d = new String(dest); d = new String(dest);
@@ -114,7 +89,7 @@ public class MapleCashVegaChecker {
status += 1; status += 1;
if (status == 2) { if (status == 2) {
currentItem = Integer.valueOf(getName(token)); currentItem = Integer.parseInt(getName(token));
} }
} else { } else {
if (status == 2) { if (status == 2) {
@@ -143,7 +118,7 @@ public class MapleCashVegaChecker {
private static void readItemDescriptionFile(File f) { private static void readItemDescriptionFile(File f) {
System.out.print("Reading String.wz... "); System.out.print("Reading String.wz... ");
try { try {
fileReader = new InputStreamReader(new FileInputStream(f), "UTF-8"); fileReader = new InputStreamReader(new FileInputStream(f), StandardCharsets.UTF_8);
bufferedReader = new BufferedReader(fileReader); bufferedReader = new BufferedReader(fileReader);
String line; String line;
@@ -162,7 +137,7 @@ public class MapleCashVegaChecker {
private static void readVegaDescriptionFile(File f) { private static void readVegaDescriptionFile(File f) {
System.out.println("Reading Etc.wz..."); System.out.println("Reading Etc.wz...");
try { try {
fileReader = new InputStreamReader(new FileInputStream(f), "UTF-8"); fileReader = new InputStreamReader(new FileInputStream(f), StandardCharsets.UTF_8);
bufferedReader = new BufferedReader(fileReader); bufferedReader = new BufferedReader(fileReader);
String line; String line;
@@ -187,7 +162,7 @@ public class MapleCashVegaChecker {
System.out.println("Reporting results ..."); System.out.println("Reporting results ...");
try { try {
printWriter = new PrintWriter("lib/result.txt", "UTF-8"); printWriter = new PrintWriter(OUTPUT_FILE, StandardCharsets.UTF_8);
printReportFileHeader(); printReportFileHeader();
@@ -204,8 +179,8 @@ public class MapleCashVegaChecker {
public static void main(String[] args) { public static void main(String[] args) {
readItemDescriptionFile(new File(wzPath + "/String.wz/Consume.img.xml")); readItemDescriptionFile(new File(WZFiles.STRING.getFilePath() + "/Consume.img.xml"));
readVegaDescriptionFile(new File(wzPath + "/Etc.wz/VegaSpell.img.xml")); readVegaDescriptionFile(new File(WZFiles.ETC.getFilePath() + "/VegaSpell.img.xml"));
reportMissingVegaItems(); reportMissingVegaItems();
} }

View File

@@ -1,5 +0,0 @@
# Report File autogenerated from the MapleCashVegaChecker feature by Ronan Lana.
# Generated data takes into account several data info from the server-side WZ.xmls.
2040759
2040760