Move MapleCashVegaChecker to main module
This commit is contained in:
@@ -1,57 +1,32 @@
|
|||||||
/*
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @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 String wzPath = "../../wz";
|
private static final int INITIAL_STRING_LENGTH = 1000;
|
||||||
|
private static final Set<Integer> vegaItems = new HashSet<>();
|
||||||
static PrintWriter printWriter = null;
|
|
||||||
static InputStreamReader fileReader = null;
|
private static PrintWriter printWriter = null;
|
||||||
static BufferedReader bufferedReader = null;
|
private static InputStreamReader fileReader = null;
|
||||||
|
private static BufferedReader bufferedReader = null;
|
||||||
static int initialStringLength = 1000;
|
private static int currentItem;
|
||||||
static int currentItem;
|
private static byte status = 0;
|
||||||
|
|
||||||
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;
|
||||||
char[] dest;
|
char[] dest;
|
||||||
@@ -61,13 +36,13 @@ 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);
|
||||||
return(d.trim());
|
return(d.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getValue(String token) {
|
private static String getValue(String token) {
|
||||||
int i, j;
|
int i, j;
|
||||||
char[] dest;
|
char[] dest;
|
||||||
@@ -77,13 +52,13 @@ 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);
|
||||||
return(d.trim());
|
return(d.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void forwardCursor(int st) {
|
private static void forwardCursor(int st) {
|
||||||
String line = null;
|
String line = null;
|
||||||
|
|
||||||
@@ -105,16 +80,16 @@ public class MapleCashVegaChecker {
|
|||||||
status += 1;
|
status += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void translateItemToken(String token) {
|
private static void translateItemToken(String token) {
|
||||||
if(token.contains("/imgdir")) {
|
if(token.contains("/imgdir")) {
|
||||||
status -= 1;
|
status -= 1;
|
||||||
}
|
}
|
||||||
else if(token.contains("imgdir")) {
|
else if(token.contains("imgdir")) {
|
||||||
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) {
|
||||||
@@ -124,7 +99,7 @@ public class MapleCashVegaChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void translateVegaToken(String token) {
|
private static void translateVegaToken(String token) {
|
||||||
if(token.contains("/imgdir")) {
|
if(token.contains("/imgdir")) {
|
||||||
status -= 1;
|
status -= 1;
|
||||||
@@ -139,11 +114,11 @@ 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;
|
||||||
@@ -158,11 +133,11 @@ public class MapleCashVegaChecker {
|
|||||||
}
|
}
|
||||||
System.out.println(vegaItems.size() + " Vega Scroll items found");
|
System.out.println(vegaItems.size() + " Vega Scroll items found");
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
@@ -176,38 +151,38 @@ public class MapleCashVegaChecker {
|
|||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void printReportFileHeader() {
|
private static void printReportFileHeader() {
|
||||||
printWriter.println(" # Report File autogenerated from the MapleCashVegaChecker feature by Ronan Lana.");
|
printWriter.println(" # Report File autogenerated from the MapleCashVegaChecker feature by Ronan Lana.");
|
||||||
printWriter.println(" # Generated data takes into account several data info from the server-side WZ.xmls.");
|
printWriter.println(" # Generated data takes into account several data info from the server-side WZ.xmls.");
|
||||||
printWriter.println();
|
printWriter.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void reportMissingVegaItems() {
|
private static void reportMissingVegaItems() {
|
||||||
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();
|
||||||
|
|
||||||
for (Integer itemid : vegaItems) {
|
for (Integer itemid : vegaItems) {
|
||||||
printWriter.println(" " + itemid);
|
printWriter.println(" " + itemid);
|
||||||
}
|
}
|
||||||
|
|
||||||
printWriter.close();
|
printWriter.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user