Mounts & map boundings fix + Quest rates + MapleInvalidItemIdFetcher
Fixed a critical bug that would sometimes default the written mount data on the DB, causing data loss. Removed all invalid itemids from the drop data. Added quest rates. Instead of using the player's rates, quest rates stacks up with the server's exp and drop rates when giving quest rewards, making the values the same for all. Adjusted map boundings to better suit the item drop positions inside the field. New tool: MapleInvalidItemIdFetcher. It reads all existing itemids from the wz and reports inexistent itemids on the DB's drop data.
This commit is contained in:
73
tools/MapleInvalidItemIdFetcher/build.xml
Normal file
73
tools/MapleInvalidItemIdFetcher/build.xml
Normal file
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="MapleInvalidItemIdFetcher" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project MapleInvalidItemIdFetcher.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="MapleInvalidItemIdFetcher-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
BIN
tools/MapleInvalidItemIdFetcher/lib/mysql-connector-java-bin.jar
Normal file
BIN
tools/MapleInvalidItemIdFetcher/lib/mysql-connector-java-bin.jar
Normal file
Binary file not shown.
0
tools/MapleInvalidItemIdFetcher/lib/result.txt
Normal file
0
tools/MapleInvalidItemIdFetcher/lib/result.txt
Normal file
3
tools/MapleInvalidItemIdFetcher/manifest.mf
Normal file
3
tools/MapleInvalidItemIdFetcher/manifest.mf
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
1448
tools/MapleInvalidItemIdFetcher/nbproject/build-impl.xml
Normal file
1448
tools/MapleInvalidItemIdFetcher/nbproject/build-impl.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=00ad4c76
|
||||
build.xml.script.CRC32=c56709d2
|
||||
build.xml.stylesheet.CRC32=8064a381@1.75.2.48
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=00ad4c76
|
||||
nbproject/build-impl.xml.script.CRC32=07c7055b
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
|
||||
77
tools/MapleInvalidItemIdFetcher/nbproject/project.properties
Normal file
77
tools/MapleInvalidItemIdFetcher/nbproject/project.properties
Normal file
@@ -0,0 +1,77 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
application.title=MapleInvalidItemIdFetcher
|
||||
application.vendor=RonanLana
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# Os arquivos em build.classes.dir que devem ser exclu\u00eddos do jar de distribui\u00e7\u00e3o
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/MapleInvalidItemIdFetcher.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.mysql-connector-java-bin.jar=lib/mysql-connector-java-bin.jar
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.mysql-connector-java-bin.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.7
|
||||
javac.target=1.7
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=maplenoitemidfetcher.MapleNoItemIdFetcher
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=JDK_1.7
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
16
tools/MapleInvalidItemIdFetcher/nbproject/project.xml
Normal file
16
tools/MapleInvalidItemIdFetcher/nbproject/project.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>MapleInvalidItemIdFetcher</name>
|
||||
<explicit-platform explicit-source-supported="true"/>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
|
||||
Copyleft (L) 2017 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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 maplenoitemidfetcher;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*
|
||||
* This application finds inexistent itemids within the drop data from
|
||||
* the Maplestory database specified by the URL below. This program
|
||||
* assumes all itemids haves at most 7 digits.
|
||||
*
|
||||
* A file is generated listing all the inexistent ids.
|
||||
*/
|
||||
public class MapleNoItemIdFetcher {
|
||||
static String host = "jdbc:mysql://localhost:3306/heavenms";
|
||||
static String driver = "com.mysql.jdbc.Driver";
|
||||
static String username = "root";
|
||||
static String password = "";
|
||||
|
||||
static String wzPath = "../../wz";
|
||||
static String newFile = "lib/result.txt";
|
||||
|
||||
static Connection con = null;
|
||||
static PrintWriter printWriter = null;
|
||||
static InputStreamReader fileReader = null;
|
||||
static BufferedReader bufferedReader = null;
|
||||
static byte status = 0;
|
||||
static int itemId = -1;
|
||||
|
||||
static Set<Integer> existingIds = new HashSet<>();
|
||||
static Set<Integer> nonExistingIds = new HashSet<>();
|
||||
|
||||
private static String getName(String token) {
|
||||
int i, j;
|
||||
char[] dest;
|
||||
String d;
|
||||
|
||||
i = token.lastIndexOf("name");
|
||||
i = token.indexOf("\"", i) + 1; //lower bound of the string
|
||||
j = token.indexOf("\"", i); //upper bound
|
||||
|
||||
dest = new char[100];
|
||||
token.getChars(i, j, dest, 0);
|
||||
|
||||
d = new String(dest);
|
||||
return(d);
|
||||
}
|
||||
|
||||
private static void forwardCursor(int st) {
|
||||
String line = null;
|
||||
|
||||
try {
|
||||
while(status >= st && (line = bufferedReader.readLine()) != null) {
|
||||
simpleToken(line);
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void simpleToken(String token) {
|
||||
if(token.contains("/imgdir")) {
|
||||
status -= 1;
|
||||
}
|
||||
else if(token.contains("imgdir")) {
|
||||
status += 1;
|
||||
}
|
||||
}
|
||||
|
||||
private static void translateToken(String token) {
|
||||
String d;
|
||||
|
||||
if(token.contains("/imgdir")) {
|
||||
status -= 1;
|
||||
}
|
||||
else if(token.contains("imgdir")) {
|
||||
if(status == 1) { //getting ItemId
|
||||
d = getName(token);
|
||||
itemId = Integer.parseInt(d.substring(1, 8));
|
||||
|
||||
existingIds.add(itemId);
|
||||
forwardCursor(status);
|
||||
}
|
||||
|
||||
status += 1;
|
||||
}
|
||||
}
|
||||
|
||||
private static void readItemDataFile(File file) {
|
||||
// This will reference one line at a time
|
||||
String line = null;
|
||||
|
||||
try {
|
||||
fileReader = new InputStreamReader(new FileInputStream(file), "UTF-8");
|
||||
bufferedReader = new BufferedReader(fileReader);
|
||||
|
||||
status = 0;
|
||||
try {
|
||||
while((line = bufferedReader.readLine()) != null) {
|
||||
translateToken(line);
|
||||
}
|
||||
} catch(NumberFormatException npe) {
|
||||
// second criteria, itemid is on the name of the file
|
||||
|
||||
try {
|
||||
itemId = Integer.parseInt(file.getName().substring(0, 7));
|
||||
existingIds.add(itemId);
|
||||
} catch(NumberFormatException npe2) {}
|
||||
}
|
||||
|
||||
bufferedReader.close();
|
||||
fileReader.close();
|
||||
}
|
||||
|
||||
catch(FileNotFoundException ex) {
|
||||
System.out.println("Unable to open file '" + file.getName() + "'");
|
||||
}
|
||||
catch(IOException ex) {
|
||||
System.out.println("Error reading file '" + file.getName() + "'");
|
||||
}
|
||||
}
|
||||
|
||||
private static void readEquipDataDirectory(String dirPath) {
|
||||
File[] folders = new File(dirPath).listFiles();
|
||||
//If this pathname does not denote a directory, then listFiles() returns null.
|
||||
|
||||
for (File folder : folders) { // enter all subfolders
|
||||
if (folder.isDirectory()) {
|
||||
System.out.println("Reading '" + dirPath + "/" + folder.getName() + "'...");
|
||||
|
||||
try {
|
||||
File[] files = folder.listFiles();
|
||||
|
||||
for (File file : files) { // enter all XML files under subfolders
|
||||
if (file.isFile()) {
|
||||
itemId = Integer.parseInt(file.getName().substring(0, 8));
|
||||
existingIds.add(itemId);
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException nfe) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void readItemDataDirectory(String dirPath) {
|
||||
File[] folders = new File(dirPath).listFiles();
|
||||
//If this pathname does not denote a directory, then listFiles() returns null.
|
||||
|
||||
for (File folder : folders) { // enter all subfolders
|
||||
if (folder.isDirectory()) {
|
||||
System.out.println("Reading '" + dirPath + "/" + folder.getName() + "'...");
|
||||
|
||||
File[] files = folder.listFiles();
|
||||
|
||||
for (File file : files) { // enter all XML files under subfolders
|
||||
if (file.isFile()) {
|
||||
readItemDataFile(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void evaluateDropsFromTable(String table) throws SQLException {
|
||||
PreparedStatement ps = con.prepareStatement("SELECT DISTINCT itemid FROM " + table + ";");
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
while(rs.next()) {
|
||||
if(!existingIds.contains(rs.getInt(1))) {
|
||||
nonExistingIds.add(rs.getInt(1));
|
||||
}
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ps.close();
|
||||
}
|
||||
|
||||
private static void evaluateDropsFromDb() {
|
||||
try {
|
||||
System.out.println("Evaluating item data on DB...");
|
||||
|
||||
Class.forName(driver).newInstance();
|
||||
con = DriverManager.getConnection(host, username, password);
|
||||
|
||||
evaluateDropsFromTable("drop_data");
|
||||
evaluateDropsFromTable("reactordrops");
|
||||
|
||||
if(!nonExistingIds.isEmpty()) {
|
||||
List<Integer> list = new ArrayList<>(nonExistingIds);
|
||||
Collections.sort(list);
|
||||
|
||||
for(Integer i : list) {
|
||||
printWriter.println(i);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Inexistent itemid count: " + nonExistingIds.size());
|
||||
System.out.println("Total itemid count: " + existingIds.size());
|
||||
|
||||
con.close();
|
||||
}
|
||||
|
||||
catch(ClassNotFoundException e) {
|
||||
System.out.println("Error: could not find class");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
catch(InstantiationException e) {
|
||||
System.out.println("Error: instantiation failure");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
catch(SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
printWriter = new PrintWriter(newFile, "UTF-8");
|
||||
|
||||
existingIds.add(0); // meso itemid
|
||||
readEquipDataDirectory(wzPath + "/Character.wz");
|
||||
readItemDataDirectory(wzPath + "/Item.wz");
|
||||
|
||||
evaluateDropsFromDb();
|
||||
|
||||
printWriter.close();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user