Merge branch 'master' of https://github.com/ronancpl/HeavenMS into credits_update
This commit is contained in:
@@ -445,7 +445,7 @@ public class MapleNoItemNameFetcher {
|
||||
|
||||
private static String getMissingEquipDesc(int itemid) {
|
||||
String s = descContentCache.get(itemid);
|
||||
if (s == null) {
|
||||
if (s == null && itemid >= 2000000) { // thanks Halcyon for noticing "missing info" on equips
|
||||
s = "MISSING INFO " + itemid;
|
||||
}
|
||||
|
||||
|
||||
73
tools/MapleMapFieldLimitChecker/build.xml
Normal file
73
tools/MapleMapFieldLimitChecker/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="MapleMapFieldLimitChecker" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project MapleMapFieldLimitChecker.</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="MapleMapFieldLimitChecker-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>
|
||||
149
tools/MapleMapFieldLimitChecker/lib/Report.txt
Normal file
149
tools/MapleMapFieldLimitChecker/lib/Report.txt
Normal file
@@ -0,0 +1,149 @@
|
||||
# Report File autogenerated from the MapleEmptyItemWzChecker feature by Ronan Lana.
|
||||
# Generated data takes into account several data info from the server-side WZ.xmls.
|
||||
|
||||
String.wz NAMES with no Item.wz node, 130 entries:
|
||||
20816 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Face\
|
||||
20817 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Face\
|
||||
21817 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Face\
|
||||
21820 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Face\
|
||||
1002655 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Cap\
|
||||
1002657 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Cap\
|
||||
1002658 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Cap\
|
||||
1003028 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Cap\
|
||||
1003029 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Cap\
|
||||
1003030 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Cap\
|
||||
1003043 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Cap\
|
||||
1022096 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Accessory\
|
||||
1042180 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Coat\
|
||||
1052226 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Longcoat\
|
||||
1060115 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Pants\
|
||||
1060138 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Pants\
|
||||
1061125 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Pants\
|
||||
1061160 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Pants\
|
||||
1062036 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Pants\
|
||||
1062037 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Pants\
|
||||
1072248 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Shoes\
|
||||
1072249 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Shoes\
|
||||
1072418 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Shoes\
|
||||
1072425 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Shoes\
|
||||
1080002 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Glove\
|
||||
1082217 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Glove\
|
||||
1082221 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Glove\
|
||||
1082261 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Glove\
|
||||
1142152 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Accessory\
|
||||
1142155 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Accessory\
|
||||
1302032 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
1302069 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
1322030 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
1322034 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
1332058 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
1382013 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
1452047 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
1462020 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
1462042 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
1472057 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
1702113 ../../wz/String.wz/Eqp.img.xml -> Eqp.img\Eqp\Weapon\
|
||||
2002012 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2002013 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2002014 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2012004 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2022034 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2022036 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2022046 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2022114 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2070014 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2083000 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2084000 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2101016 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2101017 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2101018 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2101019 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2101022 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2101058 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2210023 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2210024 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240004 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240005 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240006 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240007 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240008 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240009 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240010 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240011 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240012 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240013 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240014 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2240015 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2290109 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
2390000 ../../wz/String.wz/Consume.img.xml -> Consume.img\
|
||||
3010044 ../../wz/String.wz/Ins.img.xml -> Ins.img\
|
||||
3994016 ../../wz/String.wz/Ins.img.xml -> Ins.img\
|
||||
4000275 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4001150 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031294 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031627 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031628 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031629 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031630 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031631 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031632 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031633 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031634 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031635 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031636 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031637 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031638 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031639 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031640 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031641 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031642 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031643 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031644 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031645 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031646 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031647 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031648 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031795 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4031867 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
4032526 ../../wz/String.wz/Etc.img.xml -> Etc.img\Etc\
|
||||
5000040 ../../wz/String.wz/Pet.img.xml -> Pet.img\
|
||||
5000043 ../../wz/String.wz/Pet.img.xml -> Pet.img\
|
||||
5000046 ../../wz/String.wz/Pet.img.xml -> Pet.img\
|
||||
5201000 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5201001 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5210000 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5210001 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5210002 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5210003 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5210004 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5210005 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5211001 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5211002 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5211003 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5211047 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5240016 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5240019 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5251004 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5251005 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5251006 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5360009 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5360010 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5360011 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5360012 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5360013 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
5360014 ../../wz/String.wz/Cash.img.xml -> Cash.img\
|
||||
|
||||
Item.wz ITEMS with no String.wz node, 12 entries:
|
||||
1942000 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01942000.img.xml -> NOT FOUND
|
||||
1942001 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01942001.img.xml -> NOT FOUND
|
||||
1942002 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01942002.img.xml -> NOT FOUND
|
||||
1952000 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01952000.img.xml -> NOT FOUND
|
||||
1952001 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01952001.img.xml -> NOT FOUND
|
||||
1952002 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01952002.img.xml -> NOT FOUND
|
||||
1962000 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01962000.img.xml -> NOT FOUND
|
||||
1962001 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01962001.img.xml -> NOT FOUND
|
||||
1962002 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01962002.img.xml -> NOT FOUND
|
||||
1972000 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01972000.img.xml -> NOT FOUND
|
||||
1972001 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01972001.img.xml -> NOT FOUND
|
||||
1972002 C:\Nexon\HeavenMS\wz\Character.wz\Dragon\01972002.img.xml -> NOT FOUND
|
||||
|
||||
3
tools/MapleMapFieldLimitChecker/manifest.mf
Normal file
3
tools/MapleMapFieldLimitChecker/manifest.mf
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 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 maplemapfieldlimitchecker;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*
|
||||
This application seeks from the XMLs all mapid entries that holds the specified
|
||||
fieldLimit.
|
||||
*/
|
||||
public class MapleMapFieldLimitChecker {
|
||||
|
||||
static String newFile = "lib/Report.txt";
|
||||
static String outputWzPath = "lib";
|
||||
static PrintWriter printWriter = null;
|
||||
static InputStreamReader fileReader = null;
|
||||
static BufferedReader bufferedReader = null;
|
||||
|
||||
static String wzPath = "../../wz";
|
||||
static int initialStringLength = 50;
|
||||
static int itemFileNameSize = 13;
|
||||
|
||||
static int fieldLimit = 0x400000;
|
||||
|
||||
static byte status = 0;
|
||||
static int mapid = 0;
|
||||
|
||||
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[initialStringLength];
|
||||
token.getChars(i, j, dest, 0);
|
||||
|
||||
d = new String(dest);
|
||||
return(d.trim());
|
||||
}
|
||||
|
||||
private static String getValue(String token) {
|
||||
int i, j;
|
||||
char[] dest;
|
||||
String d;
|
||||
|
||||
i = token.lastIndexOf("value");
|
||||
i = token.indexOf("\"", i) + 1; //lower bound of the string
|
||||
j = token.indexOf("\"", i); //upper bound
|
||||
|
||||
dest = new char[initialStringLength];
|
||||
token.getChars(i, j, dest, 0);
|
||||
|
||||
d = new String(dest);
|
||||
return(d.trim());
|
||||
}
|
||||
|
||||
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 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 int getMapIdFromFilename(String name) {
|
||||
try {
|
||||
return Integer.valueOf(name.substring(0, name.indexOf('.')));
|
||||
} catch(Exception e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
private static void translateToken(String token) {
|
||||
if(token.contains("/imgdir")) {
|
||||
status -= 1;
|
||||
}
|
||||
else if(token.contains("imgdir")) {
|
||||
status += 1;
|
||||
|
||||
if (status == 2) {
|
||||
String d = getName(token);
|
||||
if (!d.contentEquals("info")) {
|
||||
forwardCursor(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (status == 2) {
|
||||
String d = getName(token);
|
||||
|
||||
if (d.contentEquals("fieldLimit")) {
|
||||
int value = Integer.valueOf(getValue(token));
|
||||
if ((value & fieldLimit) == fieldLimit) {
|
||||
System.out.println(mapid + " " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void inspectMapEntry() {
|
||||
String line = null;
|
||||
|
||||
try {
|
||||
while((line = bufferedReader.readLine()) != null) {
|
||||
translateToken(line);
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadMapWz() throws IOException {
|
||||
System.out.println("Reading Map.wz ...");
|
||||
ArrayList<File> files = new ArrayList<>();
|
||||
listFiles(wzPath + "/Map.wz/Map", files);
|
||||
|
||||
for(File f : files) {
|
||||
fileReader = new InputStreamReader(new FileInputStream(f), "UTF-8");
|
||||
bufferedReader = new BufferedReader(fileReader);
|
||||
|
||||
mapid = getMapIdFromFilename(f.getName());
|
||||
inspectMapEntry();
|
||||
|
||||
bufferedReader.close();
|
||||
fileReader.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
loadMapWz();
|
||||
System.out.println("Done!");
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,6 +62,8 @@ INSERT IGNORE INTO `makercreatedata` (`id`, `itemid`, `req_level`, `req_maker_le
|
||||
(0, 4032312, 70, 1, 0, 0, 0, 0, 1, 0),
|
||||
(0, 2041058, 50, 1, 55000, 0, 1122013, 0, 1, 0),
|
||||
(0, 2040727, 50, 1, 55000, 0, 1122013, 0, 1, 0),
|
||||
(0, 4260007, 105, 3, 2200000, 4001126, 0, 0, 5, 0),
|
||||
(0, 4260008, 105, 3, 5500000, 4001126, 0, 0, 10, 0),
|
||||
(1, 1002028, 45, 1, 55000, 0, 0, 4130018, 1, 1),
|
||||
(1, 1002085, 45, 1, 50000, 0, 0, 4130018, 1, 1),
|
||||
(1, 1002086, 45, 1, 41000, 0, 0, 4130018, 1, 1),
|
||||
@@ -945,6 +947,10 @@ INSERT IGNORE INTO `makerrecipedata` (`itemid`, `req_item`, `count`) VALUES
|
||||
(2041058, 4000299, 10),
|
||||
(2040727, 4000159, 50),
|
||||
(2040727, 4000299, 10),
|
||||
(4260007, 4260006, 100),
|
||||
(4260007, 4001126, 5),
|
||||
(4260008, 4260007, 50),
|
||||
(4260008, 4001126, 5),
|
||||
(1002028, 4007001, 5),
|
||||
(1002028, 4260000, 5),
|
||||
(1002085, 4007002, 5),
|
||||
@@ -1790,7 +1796,7 @@ INSERT IGNORE INTO `makerrecipedata` (`itemid`, `req_item`, `count`) VALUES
|
||||
(1372016, 4011002, 3),
|
||||
(1372016, 4260003, 26),
|
||||
(1382008, 4011002, 3),
|
||||
(1382008, 4260003, 26),
|
||||
(1382008, 4260004, 26),
|
||||
(1372009, 4011002, 4),
|
||||
(1372009, 4260004, 28),
|
||||
(1382035, 4011002, 4),
|
||||
@@ -2432,7 +2438,7 @@ INSERT IGNORE INTO `makerrecipedata` (`itemid`, `req_item`, `count`) VALUES
|
||||
(1072194, 4260004, 9),
|
||||
(1072195, 4007006, 9),
|
||||
(1072195, 4260004, 9),
|
||||
(1072213, 4007001, 10),
|
||||
(1072213, 4007003, 10),
|
||||
(1072213, 4260005, 10),
|
||||
(1072214, 4007002, 10),
|
||||
(1072214, 4260005, 10),
|
||||
|
||||
@@ -1,447 +0,0 @@
|
||||
# SQL File autogenerated from the MapleMesoFetcher feature by Ronan Lana.
|
||||
# Generated data takes into account mob stats such as level and boss for the meso ranges.
|
||||
# Only mobs with 4 or more items with no meso entry on the DB it was compiled are presented here.
|
||||
|
||||
INSERT IGNORE INTO drop_data (`dropperid`, `itemid`, `minimum_quantity`, `maximum_quantity`, `questid`, `chance`) VALUES
|
||||
(100122, 0, 35, 52, 0, 400000),
|
||||
(100123, 0, 38, 55, 0, 400000),
|
||||
(100124, 0, 40, 59, 0, 400000),
|
||||
(100130, 0, 31, 45, 0, 400000),
|
||||
(100131, 0, 33, 49, 0, 400000),
|
||||
(100132, 0, 35, 52, 0, 400000),
|
||||
(100133, 0, 38, 55, 0, 400000),
|
||||
(100134, 0, 40, 59, 0, 400000),
|
||||
(1110130, 0, 49, 72, 0, 400000),
|
||||
(1140130, 0, 56, 83, 0, 400000),
|
||||
(2100100, 0, 58, 85, 0, 400000),
|
||||
(2100101, 0, 60, 88, 0, 400000),
|
||||
(2100106, 0, 66, 97, 0, 400000),
|
||||
(2100107, 0, 73, 108, 0, 400000),
|
||||
(2100108, 0, 78, 115, 0, 400000),
|
||||
(2110300, 0, 66, 97, 0, 400000),
|
||||
(2110301, 0, 78, 115, 0, 400000),
|
||||
(2230105, 0, 64, 94, 0, 400000),
|
||||
(2230107, 0, 66, 97, 0, 400000),
|
||||
(2230110, 0, 64, 94, 0, 400000),
|
||||
(2230111, 0, 66, 97, 0, 400000),
|
||||
(2230131, 0, 66, 97, 0, 400000),
|
||||
(3000005, 0, 81, 119, 0, 400000),
|
||||
(3100101, 0, 86, 127, 0, 400000),
|
||||
(3100102, 0, 81, 119, 0, 400000),
|
||||
(3110301, 0, 86, 127, 0, 400000),
|
||||
(3110302, 0, 95, 140, 0, 400000),
|
||||
(3110303, 0, 105, 155, 0, 400000),
|
||||
(3220000, 0, 285, 1400, 0, 400000),
|
||||
(3220001, 0, 315, 1550, 0, 400000),
|
||||
(3300000, 0, 81, 119, 0, 400000),
|
||||
(3300001, 0, 81, 119, 0, 400000),
|
||||
(3300002, 0, 83, 123, 0, 400000),
|
||||
(3300003, 0, 86, 127, 0, 400000),
|
||||
(3300004, 0, 89, 131, 0, 400000),
|
||||
(3300005, 0, 95, 140, 0, 400000),
|
||||
(3300006, 0, 95, 140, 0, 400000),
|
||||
(3300007, 0, 95, 140, 0, 400000),
|
||||
(3300008, 0, 315, 1550, 0, 400000),
|
||||
(4110300, 0, 120, 177, 0, 400000),
|
||||
(4110301, 0, 132, 195, 0, 400000),
|
||||
(4130103, 0, 423, 2080, 0, 400000),
|
||||
(4220000, 0, 396, 1950, 0, 400000),
|
||||
(4230122, 0, 120, 177, 0, 400000),
|
||||
(4230125, 0, 128, 189, 0, 400000),
|
||||
(4230400, 0, 132, 195, 0, 400000),
|
||||
(4230502, 0, 124, 182, 0, 400000),
|
||||
(4230503, 0, 132, 195, 0, 400000),
|
||||
(4230504, 0, 132, 195, 0, 400000),
|
||||
(4230600, 0, 112, 165, 0, 400000),
|
||||
(4240000, 0, 151, 222, 0, 400000),
|
||||
(4250000, 0, 120, 177, 0, 400000),
|
||||
(4250001, 0, 137, 201, 0, 400000),
|
||||
(5110300, 0, 156, 230, 0, 400000),
|
||||
(5120500, 0, 190, 280, 0, 400000),
|
||||
(5120501, 0, 172, 254, 0, 400000),
|
||||
(5120502, 0, 178, 262, 0, 400000),
|
||||
(5120505, 0, 203, 299, 0, 400000),
|
||||
(5120506, 0, 184, 271, 0, 400000),
|
||||
(5130105, 0, 190, 280, 0, 400000),
|
||||
(5130108, 0, 196, 289, 0, 400000),
|
||||
(5220000, 0, 552, 2710, 0, 400000),
|
||||
(5220002, 0, 468, 2300, 0, 400000),
|
||||
(5220003, 0, 630, 3090, 0, 400000),
|
||||
(5220004, 0, 468, 2300, 0, 400000),
|
||||
(5250000, 0, 184, 271, 0, 400000),
|
||||
(5250001, 0, 161, 237, 0, 400000),
|
||||
(5250002, 0, 196, 289, 0, 400000),
|
||||
(6110300, 0, 255, 377, 0, 400000),
|
||||
(6130102, 0, 217, 320, 0, 400000),
|
||||
(6130103, 0, 217, 320, 0, 400000),
|
||||
(6130203, 0, 217, 320, 0, 400000),
|
||||
(6130207, 0, 231, 341, 0, 400000),
|
||||
(6130209, 0, 264, 389, 0, 400000),
|
||||
(6220000, 0, 765, 3770, 0, 400000),
|
||||
(6220001, 0, 765, 3770, 0, 400000),
|
||||
(6230100, 0, 231, 341, 0, 400000),
|
||||
(6230401, 0, 239, 353, 0, 400000),
|
||||
(6300005, 0, 765, 3770, 0, 400000),
|
||||
(6400006, 0, 384, 1890, 0, 400000),
|
||||
(6400008, 0, 552, 2710, 0, 400000),
|
||||
(6400009, 0, 552, 2710, 0, 400000),
|
||||
(7110300, 0, 355, 524, 0, 400000),
|
||||
(7110301, 0, 332, 490, 0, 400000),
|
||||
(7120103, 0, 301, 444, 0, 400000),
|
||||
(7120104, 0, 311, 459, 0, 400000),
|
||||
(7120106, 0, 355, 524, 0, 400000),
|
||||
(7120107, 0, 355, 524, 0, 400000),
|
||||
(7120108, 0, 379, 559, 0, 400000),
|
||||
(7120109, 0, 405, 597, 0, 400000),
|
||||
(7130000, 0, 332, 490, 0, 400000),
|
||||
(7130002, 0, 321, 474, 0, 400000),
|
||||
(7130003, 0, 367, 541, 0, 400000),
|
||||
(7130004, 0, 391, 578, 0, 400000),
|
||||
(7130102, 0, 391, 578, 0, 400000),
|
||||
(7130103, 0, 332, 490, 0, 400000),
|
||||
(7130400, 0, 903, 4440, 0, 400000),
|
||||
(7130401, 0, 903, 4440, 0, 400000),
|
||||
(7130402, 0, 903, 4440, 0, 400000),
|
||||
(7130601, 0, 367, 541, 0, 400000),
|
||||
(7220000, 0, 933, 4590, 0, 400000),
|
||||
(7220001, 0, 903, 4440, 0, 400000),
|
||||
(7220002, 0, 1137, 5590, 0, 400000),
|
||||
(8110300, 0, 418, 617, 0, 400000),
|
||||
(8120102, 0, 446, 659, 0, 400000),
|
||||
(8120103, 0, 477, 704, 0, 400000),
|
||||
(8120104, 0, 509, 752, 0, 400000),
|
||||
(8120105, 0, 544, 803, 0, 400000),
|
||||
(8120106, 0, 562, 830, 0, 400000),
|
||||
(8120107, 0, 562, 830, 0, 400000),
|
||||
(8140000, 0, 418, 617, 0, 400000),
|
||||
(8140100, 0, 446, 659, 0, 400000),
|
||||
(8140511, 0, 581, 871, 0, 400000),
|
||||
(8140512, 0, 608, 908, 0, 400000),
|
||||
(8140600, 0, 594, 889, 0, 400000),
|
||||
(8140702, 0, 637, 946, 0, 400000),
|
||||
(8140703, 0, 666, 986, 0, 400000),
|
||||
(8141300, 0, 622, 927, 0, 400000),
|
||||
(8150000, 0, 2142, 10490, 0, 400000),
|
||||
(8150100, 0, 714, 1049, 0, 400000),
|
||||
(8150101, 0, 747, 1093, 0, 400000),
|
||||
(8150200, 0, 714, 1049, 0, 400000),
|
||||
(8150201, 0, 800, 1162, 0, 400000),
|
||||
(8150300, 0, 666, 986, 0, 400000),
|
||||
(8150301, 0, 730, 1070, 0, 400000),
|
||||
(8150302, 0, 764, 1115, 0, 400000),
|
||||
(8190001, 0, 800, 1162, 0, 400000),
|
||||
(8220003, 0, 3381, 15830, 0, 400000),
|
||||
(8220005, 0, 4350, 19860, 0, 400000),
|
||||
(8220006, 0, 5466, 24400, 0, 400000),
|
||||
(8220007, 0, 1704, 8530, 0, 400000),
|
||||
(8220009, 0, 1479, 7280, 0, 400000),
|
||||
(8830000, 0, 2400, 11620, 0, 400000),
|
||||
(9001009, 0, 1254, 6170, 0, 400000),
|
||||
(9001011, 0, 95, 140, 0, 400000),
|
||||
(9200016, 0, 81, 119, 0, 400000),
|
||||
(9200019, 0, 203, 299, 0, 400000),
|
||||
(9300011, 0, 109, 160, 0, 400000),
|
||||
(9300058, 0, 38, 55, 0, 400000),
|
||||
(9300059, 0, 42, 61, 0, 400000),
|
||||
(9300060, 0, 120, 177, 0, 400000),
|
||||
(9300078, 0, 800, 1162, 0, 400000),
|
||||
(9300080, 0, 282, 416, 0, 400000),
|
||||
(9300096, 0, 544, 803, 0, 400000),
|
||||
(9300105, 0, 717, 3530, 0, 400000),
|
||||
(9300106, 0, 846, 4160, 0, 400000),
|
||||
(9300127, 0, 81, 119, 0, 400000),
|
||||
(9300129, 0, 81, 119, 0, 400000),
|
||||
(9300131, 0, 109, 160, 0, 400000),
|
||||
(9300132, 0, 81, 119, 0, 400000),
|
||||
(9300133, 0, 81, 119, 0, 400000),
|
||||
(9300134, 0, 81, 119, 0, 400000),
|
||||
(9300136, 0, 243, 1190, 0, 400000),
|
||||
(9300139, 0, 1296, 6380, 0, 400000),
|
||||
(9300155, 0, 38, 55, 0, 400000),
|
||||
(9300160, 0, 396, 1950, 0, 400000),
|
||||
(9300161, 0, 396, 1950, 0, 400000),
|
||||
(9300163, 0, 1127, 1583, 0, 400000),
|
||||
(9300164, 0, 1127, 1583, 0, 400000),
|
||||
(9300165, 0, 1127, 1583, 0, 400000),
|
||||
(9300182, 0, 1479, 7280, 0, 400000),
|
||||
(9300184, 0, 174, 850, 0, 400000),
|
||||
(9300185, 0, 285, 1400, 0, 400000),
|
||||
(9300186, 0, 315, 1550, 0, 400000),
|
||||
(9300187, 0, 336, 1650, 0, 400000),
|
||||
(9300188, 0, 468, 2300, 0, 400000),
|
||||
(9300189, 0, 468, 2300, 0, 400000),
|
||||
(9300190, 0, 552, 2710, 0, 400000),
|
||||
(9300191, 0, 651, 3200, 0, 400000),
|
||||
(9300192, 0, 570, 2800, 0, 400000),
|
||||
(9300193, 0, 630, 3090, 0, 400000),
|
||||
(9300194, 0, 765, 3770, 0, 400000),
|
||||
(9300195, 0, 765, 3770, 0, 400000),
|
||||
(9300196, 0, 765, 3770, 0, 400000),
|
||||
(9300197, 0, 765, 3770, 0, 400000),
|
||||
(9300198, 0, 651, 3200, 0, 400000),
|
||||
(9300199, 0, 903, 4440, 0, 400000),
|
||||
(9300200, 0, 933, 4590, 0, 400000),
|
||||
(9300201, 0, 1479, 7280, 0, 400000),
|
||||
(9300202, 0, 1137, 5590, 0, 400000),
|
||||
(9300203, 0, 1254, 6170, 0, 400000),
|
||||
(9300204, 0, 1383, 6810, 0, 400000),
|
||||
(9300205, 0, 1296, 6380, 0, 400000),
|
||||
(9300206, 0, 1479, 7280, 0, 400000),
|
||||
(9300207, 0, 1479, 7280, 0, 400000),
|
||||
(9300208, 0, 1704, 8530, 0, 400000),
|
||||
(9300209, 0, 1704, 8530, 0, 400000),
|
||||
(9300210, 0, 2142, 10490, 0, 400000),
|
||||
(9300211, 0, 2400, 11620, 0, 400000),
|
||||
(9300212, 0, 2400, 11620, 0, 400000),
|
||||
(9300213, 0, 3381, 15830, 0, 400000),
|
||||
(9300214, 0, 3792, 17550, 0, 400000),
|
||||
(9300215, 0, 6714, 29370, 0, 400000),
|
||||
(9300217, 0, 32, 47, 0, 400000),
|
||||
(9300218, 0, 34, 50, 0, 400000),
|
||||
(9300219, 0, 34, 50, 0, 400000),
|
||||
(9300220, 0, 52, 77, 0, 400000),
|
||||
(9300221, 0, 68, 101, 0, 400000),
|
||||
(9300222, 0, 75, 111, 0, 400000),
|
||||
(9300223, 0, 36, 54, 0, 400000),
|
||||
(9300224, 0, 102, 150, 0, 400000),
|
||||
(9300225, 0, 102, 150, 0, 400000),
|
||||
(9300226, 0, 112, 165, 0, 400000),
|
||||
(9300227, 0, 102, 150, 0, 400000),
|
||||
(9300228, 0, 146, 215, 0, 400000),
|
||||
(9300229, 0, 39, 57, 0, 400000),
|
||||
(9300230, 0, 116, 171, 0, 400000),
|
||||
(9300231, 0, 137, 201, 0, 400000),
|
||||
(9300232, 0, 92, 136, 0, 400000),
|
||||
(9300233, 0, 112, 165, 0, 400000),
|
||||
(9300234, 0, 86, 127, 0, 400000),
|
||||
(9300235, 0, 167, 245, 0, 400000),
|
||||
(9300236, 0, 190, 280, 0, 400000),
|
||||
(9300237, 0, 210, 309, 0, 400000),
|
||||
(9300238, 0, 66, 97, 0, 400000),
|
||||
(9300239, 0, 120, 177, 0, 400000),
|
||||
(9300240, 0, 132, 195, 0, 400000),
|
||||
(9300241, 0, 282, 416, 0, 400000),
|
||||
(9300242, 0, 301, 444, 0, 400000),
|
||||
(9300243, 0, 190, 280, 0, 400000),
|
||||
(9300244, 0, 190, 280, 0, 400000),
|
||||
(9300245, 0, 217, 320, 0, 400000),
|
||||
(9300246, 0, 231, 341, 0, 400000),
|
||||
(9300247, 0, 255, 377, 0, 400000),
|
||||
(9300248, 0, 264, 389, 0, 400000),
|
||||
(9300249, 0, 301, 444, 0, 400000),
|
||||
(9300250, 0, 355, 524, 0, 400000),
|
||||
(9300251, 0, 332, 490, 0, 400000),
|
||||
(9300252, 0, 132, 195, 0, 400000),
|
||||
(9300253, 0, 156, 230, 0, 400000),
|
||||
(9300254, 0, 332, 490, 0, 400000),
|
||||
(9300255, 0, 141, 208, 0, 400000),
|
||||
(9300256, 0, 217, 320, 0, 400000),
|
||||
(9300257, 0, 217, 320, 0, 400000),
|
||||
(9300258, 0, 255, 377, 0, 400000),
|
||||
(9300259, 0, 58, 85, 0, 400000),
|
||||
(9300260, 0, 418, 617, 0, 400000),
|
||||
(9300261, 0, 544, 803, 0, 400000),
|
||||
(9300262, 0, 544, 803, 0, 400000),
|
||||
(9300263, 0, 544, 803, 0, 400000),
|
||||
(9300264, 0, 764, 1115, 0, 400000),
|
||||
(9300265, 0, 730, 1070, 0, 400000),
|
||||
(9300266, 0, 933, 4590, 0, 400000),
|
||||
(9300267, 0, 1254, 6170, 0, 400000),
|
||||
(9300268, 0, 933, 4590, 0, 400000),
|
||||
(9300269, 0, 174, 850, 0, 400000),
|
||||
(9300270, 0, 418, 617, 0, 400000),
|
||||
(9300274, 0, 39, 57, 0, 400000),
|
||||
(9300289, 0, 1704, 8530, 0, 400000),
|
||||
(9300294, 0, 2142, 10490, 0, 400000),
|
||||
(9300315, 0, 483, 2370, 0, 400000),
|
||||
(9300316, 0, 516, 2540, 0, 400000),
|
||||
(9300317, 0, 552, 2710, 0, 400000),
|
||||
(9300318, 0, 588, 2890, 0, 400000),
|
||||
(9300319, 0, 630, 3090, 0, 400000),
|
||||
(9300320, 0, 672, 3300, 0, 400000),
|
||||
(9300321, 0, 717, 3530, 0, 400000),
|
||||
(9300322, 0, 765, 3770, 0, 400000),
|
||||
(9300332, 0, 112, 165, 0, 400000),
|
||||
(9300334, 0, 151, 222, 0, 400000),
|
||||
(9300335, 0, 116, 171, 0, 400000),
|
||||
(9300336, 0, 137, 201, 0, 400000),
|
||||
(9300337, 0, 137, 201, 0, 400000),
|
||||
(9300367, 0, 126, 610, 0, 400000),
|
||||
(9300368, 0, 174, 850, 0, 400000),
|
||||
(9300369, 0, 243, 1190, 0, 400000),
|
||||
(9300370, 0, 336, 1650, 0, 400000),
|
||||
(9300371, 0, 468, 2300, 0, 400000),
|
||||
(9300372, 0, 651, 3200, 0, 400000),
|
||||
(9300373, 0, 903, 4440, 0, 400000),
|
||||
(9300374, 0, 1254, 6170, 0, 400000),
|
||||
(9300375, 0, 1704, 8530, 0, 400000),
|
||||
(9300376, 0, 1704, 8530, 0, 400000),
|
||||
(9300377, 0, 2691, 12890, 0, 400000),
|
||||
(9303000, 0, 42, 61, 0, 400000),
|
||||
(9303001, 0, 42, 61, 0, 400000),
|
||||
(9303003, 0, 42, 61, 0, 400000),
|
||||
(9303004, 0, 42, 61, 0, 400000),
|
||||
(9303005, 0, 71, 104, 0, 400000),
|
||||
(9303006, 0, 71, 104, 0, 400000),
|
||||
(9303007, 0, 71, 104, 0, 400000),
|
||||
(9303008, 0, 71, 104, 0, 400000),
|
||||
(9303009, 0, 161, 237, 0, 400000),
|
||||
(9303010, 0, 161, 237, 0, 400000),
|
||||
(9303011, 0, 161, 237, 0, 400000),
|
||||
(9303013, 0, 432, 638, 0, 400000),
|
||||
(9303014, 0, 432, 638, 0, 400000),
|
||||
(9303016, 0, 432, 638, 0, 400000),
|
||||
(9400009, 0, 7014, 8225, 0, 400000),
|
||||
(9400012, 0, 217, 320, 0, 400000),
|
||||
(9400120, 0, 1911, 9460, 0, 400000),
|
||||
(9400122, 0, 1911, 9460, 0, 400000),
|
||||
(9400200, 0, 184, 271, 0, 400000),
|
||||
(9400203, 0, 112, 165, 0, 400000),
|
||||
(9400205, 0, 1704, 8530, 0, 400000),
|
||||
(9400238, 0, 81, 119, 0, 400000),
|
||||
(9400239, 0, 66, 97, 0, 400000),
|
||||
(9400241, 0, 38, 55, 0, 400000),
|
||||
(9400242, 0, 42, 61, 0, 400000),
|
||||
(9400243, 0, 184, 271, 0, 400000),
|
||||
(9400244, 0, 210, 309, 0, 400000),
|
||||
(9400245, 0, 66, 97, 0, 400000),
|
||||
(9400246, 0, 62, 91, 0, 400000),
|
||||
(9400247, 0, 81, 119, 0, 400000),
|
||||
(9400248, 0, 66, 97, 0, 400000),
|
||||
(9400500, 0, 93, 450, 0, 400000),
|
||||
(9400501, 0, 35, 52, 0, 400000),
|
||||
(9400502, 0, 105, 520, 0, 400000),
|
||||
(9400503, 0, 105, 520, 0, 400000),
|
||||
(9400504, 0, 31, 45, 0, 400000),
|
||||
(9400538, 0, 56, 83, 0, 400000),
|
||||
(9400539, 0, 60, 88, 0, 400000),
|
||||
(9400540, 0, 68, 101, 0, 400000),
|
||||
(9400541, 0, 68, 101, 0, 400000),
|
||||
(9400542, 0, 98, 145, 0, 400000),
|
||||
(9400543, 0, 116, 171, 0, 400000),
|
||||
(9400544, 0, 156, 230, 0, 400000),
|
||||
(9400546, 0, 128, 189, 0, 400000),
|
||||
(9400547, 0, 73, 108, 0, 400000),
|
||||
(9400548, 0, 81, 119, 0, 400000),
|
||||
(9400550, 0, 73, 108, 0, 400000),
|
||||
(9400556, 0, 60, 88, 0, 400000),
|
||||
(9400558, 0, 81, 119, 0, 400000),
|
||||
(9400560, 0, 156, 230, 0, 400000),
|
||||
(9400561, 0, 217, 320, 0, 400000),
|
||||
(9400562, 0, 217, 320, 0, 400000),
|
||||
(9400563, 0, 112, 165, 0, 400000),
|
||||
(9400565, 0, 60, 88, 0, 400000),
|
||||
(9400570, 0, 49, 72, 0, 400000),
|
||||
(9400571, 0, 468, 2300, 0, 400000),
|
||||
(9400573, 0, 112, 165, 0, 400000),
|
||||
(9400574, 0, 714, 1049, 0, 400000),
|
||||
(9400576, 0, 301, 444, 0, 400000),
|
||||
(9400578, 0, 568, 853, 0, 400000),
|
||||
(9400579, 0, 714, 1049, 0, 400000),
|
||||
(9400580, 0, 637, 946, 0, 400000),
|
||||
(9400581, 0, 418, 617, 0, 400000),
|
||||
(9400582, 0, 1127, 1583, 0, 400000),
|
||||
(9400609, 0, 204, 1010, 0, 400000),
|
||||
(9400612, 0, 204, 1010, 0, 400000),
|
||||
(9400633, 0, 258, 1270, 0, 400000),
|
||||
(9400644, 0, 42, 61, 0, 400000),
|
||||
(9410014, 0, 493, 728, 0, 400000),
|
||||
(9410015, 0, 1479, 7280, 0, 400000),
|
||||
(9420507, 0, 146, 215, 0, 400000),
|
||||
(9420527, 0, 132, 195, 0, 400000),
|
||||
(9420528, 0, 141, 208, 0, 400000),
|
||||
(9420529, 0, 167, 245, 0, 400000),
|
||||
(9420530, 0, 190, 280, 0, 400000),
|
||||
(9420531, 0, 210, 309, 0, 400000),
|
||||
(9420532, 0, 210, 309, 0, 400000),
|
||||
(9420533, 0, 224, 330, 0, 400000),
|
||||
(9420534, 0, 255, 377, 0, 400000),
|
||||
(9420535, 0, 282, 416, 0, 400000),
|
||||
(9420536, 0, 321, 474, 0, 400000),
|
||||
(9420537, 0, 355, 524, 0, 400000),
|
||||
(9420538, 0, 446, 659, 0, 400000),
|
||||
(9420539, 0, 526, 777, 0, 400000),
|
||||
(9420545, 0, 210, 309, 0, 400000),
|
||||
(9420550, 0, 210, 309, 0, 400000),
|
||||
(9500101, 0, 38, 55, 0, 400000),
|
||||
(9500102, 0, 39, 57, 0, 400000),
|
||||
(9500103, 0, 49, 72, 0, 400000),
|
||||
(9500104, 0, 44, 65, 0, 400000),
|
||||
(9500105, 0, 49, 72, 0, 400000),
|
||||
(9500106, 0, 62, 91, 0, 400000),
|
||||
(9500107, 0, 81, 119, 0, 400000),
|
||||
(9500108, 0, 86, 127, 0, 400000),
|
||||
(9500109, 0, 86, 127, 0, 400000),
|
||||
(9500110, 0, 95, 140, 0, 400000),
|
||||
(9500111, 0, 95, 140, 0, 400000),
|
||||
(9500112, 0, 95, 140, 0, 400000),
|
||||
(9500113, 0, 98, 145, 0, 400000),
|
||||
(9500115, 0, 102, 150, 0, 400000),
|
||||
(9500116, 0, 112, 165, 0, 400000),
|
||||
(9500117, 0, 98, 145, 0, 400000),
|
||||
(9500118, 0, 109, 160, 0, 400000),
|
||||
(9500119, 0, 109, 160, 0, 400000),
|
||||
(9500120, 0, 132, 195, 0, 400000),
|
||||
(9500121, 0, 146, 215, 0, 400000),
|
||||
(9500122, 0, 151, 222, 0, 400000),
|
||||
(9500123, 0, 210, 309, 0, 400000),
|
||||
(9500124, 0, 651, 3200, 0, 400000),
|
||||
(9500125, 0, 217, 320, 0, 400000),
|
||||
(9500126, 0, 247, 365, 0, 400000),
|
||||
(9500127, 0, 273, 402, 0, 400000),
|
||||
(9500128, 0, 282, 416, 0, 400000),
|
||||
(9500129, 0, 301, 444, 0, 400000),
|
||||
(9500130, 0, 903, 4440, 0, 400000),
|
||||
(9500131, 0, 332, 490, 0, 400000),
|
||||
(9500132, 0, 355, 524, 0, 400000),
|
||||
(9500134, 0, 418, 617, 0, 400000),
|
||||
(9500135, 0, 493, 728, 0, 400000),
|
||||
(9500136, 0, 682, 1006, 0, 400000),
|
||||
(9500137, 0, 637, 946, 0, 400000),
|
||||
(9500138, 0, 568, 853, 0, 400000),
|
||||
(9500139, 0, 1254, 6170, 0, 400000),
|
||||
(9500140, 0, 2142, 10490, 0, 400000),
|
||||
(9500156, 0, 146, 215, 0, 400000),
|
||||
(9500157, 0, 95, 140, 0, 400000),
|
||||
(9500158, 0, 903, 4440, 0, 400000),
|
||||
(9500159, 0, 903, 4440, 0, 400000),
|
||||
(9500160, 0, 903, 4440, 0, 400000),
|
||||
(9500161, 0, 418, 617, 0, 400000),
|
||||
(9500162, 0, 418, 617, 0, 400000),
|
||||
(9500163, 0, 461, 681, 0, 400000),
|
||||
(9500164, 0, 544, 803, 0, 400000),
|
||||
(9500165, 0, 544, 803, 0, 400000),
|
||||
(9500166, 0, 544, 803, 0, 400000),
|
||||
(9500178, 0, 112, 165, 0, 400000),
|
||||
(9500180, 0, 1704, 8530, 0, 400000),
|
||||
(9500181, 0, 1704, 8530, 0, 400000),
|
||||
(9500306, 0, 174, 850, 0, 400000),
|
||||
(9500307, 0, 285, 1400, 0, 400000),
|
||||
(9500308, 0, 468, 2300, 0, 400000),
|
||||
(9500309, 0, 552, 2710, 0, 400000),
|
||||
(9500310, 0, 630, 3090, 0, 400000),
|
||||
(9500311, 0, 765, 3770, 0, 400000),
|
||||
(9500312, 0, 903, 4440, 0, 400000),
|
||||
(9500313, 0, 933, 4590, 0, 400000),
|
||||
(9500314, 0, 1137, 5590, 0, 400000),
|
||||
(9500317, 0, 126, 610, 0, 400000),
|
||||
(9500318, 0, 336, 1650, 0, 400000),
|
||||
(9500319, 0, 903, 4440, 0, 400000),
|
||||
(9500321, 0, 42, 61, 0, 400000),
|
||||
(9500326, 0, 396, 1950, 0, 400000),
|
||||
(9500327, 0, 243, 1190, 0, 400000),
|
||||
(9500328, 0, 285, 1400, 0, 400000),
|
||||
(9500331, 0, 552, 2710, 0, 400000),
|
||||
(9500332, 0, 396, 1950, 0, 400000),
|
||||
(9500333, 0, 468, 2300, 0, 400000),
|
||||
(9500334, 0, 552, 2710, 0, 400000),
|
||||
(9500335, 0, 468, 2300, 0, 400000),
|
||||
(9500366, 0, 49, 72, 0, 400000),
|
||||
(9500367, 0, 49, 72, 0, 400000),
|
||||
(9500368, 0, 49, 72, 0, 400000),
|
||||
(9500369, 0, 49, 72, 0, 400000),
|
||||
(9500370, 0, 49, 72, 0, 400000),
|
||||
(9500371, 0, 49, 72, 0, 400000),
|
||||
(9500372, 0, 49, 72, 0, 400000);
|
||||
|
||||
DELETE FROM drop_data WHERE dropperid >= 9300184 AND dropperid <= 9300215 AND itemid = 0;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -93,7 +93,7 @@ public class MapleSkillbookChanceFetcher {
|
||||
int mobid = rs.getInt("dropperid");
|
||||
int itemid = rs.getInt("itemid");
|
||||
|
||||
int expectedChance = 1000;
|
||||
int expectedChance = 250;
|
||||
|
||||
if (mobStats.get(mobid) != null) {
|
||||
int level = mobStats.get(mobid).getLevel();
|
||||
|
||||
238
tools/ScriptQuestReleaseTracker/hashset.c
Normal file
238
tools/ScriptQuestReleaseTracker/hashset.c
Normal file
@@ -0,0 +1,238 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
//NOTE: should the HASH_MAXITEM or HASH_NUMBUCK value be too small, program will crash by SIG_SEGV
|
||||
#define HASH_MAXITEM 4000
|
||||
#define HASH_NUMBUCK 1340
|
||||
#define HASH_HIVALUE 2147483647 //32-BIT integer
|
||||
|
||||
#define HASH_REHTHRE 3.5
|
||||
#define HASH_REHRATE 5
|
||||
|
||||
typedef struct {
|
||||
int list[HASH_MAXITEM];
|
||||
int first;
|
||||
|
||||
unsigned int count;
|
||||
} HastSetIndex;
|
||||
|
||||
typedef struct {
|
||||
HastSetIndex **table;
|
||||
int *list;
|
||||
|
||||
unsigned int threshold;
|
||||
unsigned int length;
|
||||
unsigned int count;
|
||||
} HashSet;
|
||||
|
||||
void hashset_create_table(HashSet *hs) {
|
||||
hs->table = (HastSetIndex **)malloc(hs->length * sizeof(HastSetIndex *));
|
||||
hs->threshold = (unsigned int)(HASH_REHTHRE * hs->length);
|
||||
|
||||
unsigned int i;
|
||||
for(i = 0; i < hs->length; i++) {
|
||||
hs->table[i] = (HastSetIndex *)malloc(sizeof(HastSetIndex));
|
||||
hs->table[i]->count = 0;
|
||||
hs->table[i]->first = HASH_HIVALUE;
|
||||
}
|
||||
}
|
||||
|
||||
HashSet* hashset_create() {
|
||||
HashSet *hs = (HashSet *)malloc(sizeof(HashSet));
|
||||
hs->count = 0;
|
||||
hs->length = HASH_NUMBUCK;
|
||||
hs->list = NULL;
|
||||
|
||||
hashset_create_table(hs);
|
||||
return(hs);
|
||||
}
|
||||
|
||||
void hashset_destroy(HashSet *hs) {
|
||||
if(hs->list != NULL) {
|
||||
free(hs->list);
|
||||
}
|
||||
|
||||
unsigned int i;
|
||||
for(i = 0; i < hs->length; i++)
|
||||
free(hs->table[i]);
|
||||
|
||||
free(hs->table);
|
||||
free(hs);
|
||||
}
|
||||
|
||||
unsigned int hashset_maptable(HashSet *hs, int item) {
|
||||
return(item % hs->length);
|
||||
}
|
||||
|
||||
unsigned int hashset_slot(HashSet *hs, int item, unsigned int *bucket) {
|
||||
*bucket = hashset_maptable(hs, item);
|
||||
|
||||
unsigned int i;
|
||||
for(i = 0; i < hs->table[*bucket]->count; i++) {
|
||||
if(hs->table[*bucket]->list[i] == item)
|
||||
return(i);
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
short hashset_contains(HashSet *hs, int item, unsigned int *bucket) {
|
||||
return(hashset_slot(hs, item, bucket) != -1);
|
||||
}
|
||||
|
||||
short hashset_insertinto(HashSet *hs, int item) {
|
||||
unsigned int bucket;
|
||||
|
||||
if(!hashset_contains(hs, item, &bucket)) {
|
||||
if(hs->table[bucket]->first > item)
|
||||
hs->table[bucket]->first = item;
|
||||
|
||||
hs->table[bucket]->list[hs->table[bucket]->count] = item;
|
||||
|
||||
(hs->count)++;
|
||||
(hs->table[bucket]->count)++;
|
||||
if(hs->table[bucket]->count > hs->threshold) return(1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
void hashset_rehash(HashSet *hs) {
|
||||
int *temp = (int *)malloc(hs->count * sizeof(int));
|
||||
unsigned int temp_cursor = 0, i, j;
|
||||
|
||||
for(i = 0; i < hs->length; i++) {
|
||||
for(j = 0; j < hs->table[i]->count; j++) {
|
||||
temp[temp_cursor] = hs->table[i]->list[j];
|
||||
temp_cursor++;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < hs->length; i++)
|
||||
free(hs->table[i]);
|
||||
free(hs->table);
|
||||
|
||||
hs->count = 0;
|
||||
hs->length *= HASH_REHRATE;
|
||||
hashset_create_table(hs);
|
||||
|
||||
for(i = 0; i < temp_cursor; i++)
|
||||
hashset_insertinto(hs, temp[i]);
|
||||
|
||||
free(temp);
|
||||
}
|
||||
|
||||
void hashset_insert(HashSet *hs, int item) {
|
||||
if(hashset_insertinto(hs, item)) {
|
||||
hashset_rehash(hs);
|
||||
}
|
||||
}
|
||||
|
||||
int hashset_recalc_first(HashSet *hs, int bucket) {
|
||||
int i, val = HASH_HIVALUE;
|
||||
for(i = 0; i < hs->table[bucket]->count; i++) {
|
||||
if(val > hs->table[bucket]->list[i])
|
||||
val = hs->table[bucket]->list[i];
|
||||
}
|
||||
|
||||
return(val);
|
||||
}
|
||||
|
||||
void hashset_remove(HashSet *hs, int item) {
|
||||
unsigned int bucket;
|
||||
unsigned int slot = hashset_slot(hs, item, &bucket);
|
||||
|
||||
if(slot != -1) {
|
||||
(hs->count)--;
|
||||
(hs->table[bucket]->count)--;
|
||||
hs->table[bucket]->list[slot] = hs->table[bucket]->list[hs->table[bucket]->count];
|
||||
|
||||
if(item == hs->table[bucket]->first)
|
||||
hs->table[bucket]->first = hashset_recalc_first(hs, bucket);
|
||||
}
|
||||
}
|
||||
|
||||
short hashset_is_empty(HashSet *hs) {
|
||||
return(hs->count == 0);
|
||||
}
|
||||
|
||||
void hashset_make_empty(HashSet *hs) {
|
||||
unsigned int i;
|
||||
for(i = 0; i < hs->length; i++) {
|
||||
hs->table[i]->first = HASH_HIVALUE;
|
||||
hs->table[i]->count = 0;
|
||||
}
|
||||
|
||||
hs->count = 0;
|
||||
}
|
||||
|
||||
int hashset_remove_first(HashSet *hs) {
|
||||
int i, take = HASH_HIVALUE;
|
||||
for(i = 0; i < hs->length; i++) {
|
||||
if(take > hs->table[i]->first)
|
||||
take = hs->table[i]->first;
|
||||
}
|
||||
|
||||
hashset_remove(hs, take);
|
||||
return(take);
|
||||
}
|
||||
|
||||
void hashset_merge(HashSet *hs1, HashSet *hs2) {
|
||||
//add values from hs2 to hs1
|
||||
|
||||
unsigned int i, j;
|
||||
for(i = 0; i < hs2->length; i++) {
|
||||
for(j = 0; j < hs2->table[i]->count; j++) {
|
||||
hashset_insert(hs1, hs2->table[i]->list[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hashset_dump(HashSet *hs) {
|
||||
printf("HASHSET v1.0 -- count: %d, buckets: %d, threshold: %d\n", hs->count, hs->length, hs->threshold);
|
||||
|
||||
unsigned int i, j;
|
||||
for(i = 0; i < hs->length; i++) {
|
||||
printf("\n%d -> ", i);
|
||||
for(j = 0; j < hs->table[i]->count; j++) {
|
||||
printf("%d ", hs->table[i]->list[j]);
|
||||
}
|
||||
printf("$");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int* hashset_list(HashSet *hs) {
|
||||
int *list = hs->list;
|
||||
if(list != NULL) {
|
||||
free(list);
|
||||
}
|
||||
|
||||
list = (int *)malloc(hs->count * sizeof(int));
|
||||
|
||||
unsigned int i, j, k = 0;
|
||||
for(i = 0; i < hs->length; i++) {
|
||||
for(j = 0; j < hs->table[i]->count; j++) {
|
||||
list[k] = hs->table[i]->list[j];
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
HASHSET:
|
||||
|
||||
HashSet* hashset_create();
|
||||
void hashset_destroy(HashSet *hs);
|
||||
short hashset_contains(HashSet *hs, int item, unsigned int *bucket);
|
||||
void hashset_insert(HashSet *hs, int item);
|
||||
void hashset_remove(HashSet *hs, int item);
|
||||
short hashset_is_empty(HashSet *hs);
|
||||
void hashset_make_empty(HashSet *hs);
|
||||
int hashset_remove_first(HashSet *hs);
|
||||
void hashset_merge(HashSet *hs1, HashSet *hs2);
|
||||
void hashset_dump(HashSet *hs);
|
||||
*/
|
||||
BIN
tools/ScriptQuestReleaseTracker/pcre3.dll
Normal file
BIN
tools/ScriptQuestReleaseTracker/pcre3.dll
Normal file
Binary file not shown.
85
tools/ScriptQuestReleaseTracker/quest_diff.c
Normal file
85
tools/ScriptQuestReleaseTracker/quest_diff.c
Normal file
@@ -0,0 +1,85 @@
|
||||
#include <limits.h>
|
||||
|
||||
// string hash version by chqrlie - https://stackoverflow.com/questions/20462826/hash-function-for-strings-in-c
|
||||
unsigned int strhash(const char *word) {
|
||||
unsigned int hash = 0, c;
|
||||
|
||||
size_t i = 0;
|
||||
for (i = 0; word[i] != '\0'; i++) {
|
||||
c = (unsigned char)word[i];
|
||||
hash = (hash << 3) + (hash >> (sizeof(hash) * CHAR_BIT - 3)) + c;
|
||||
}
|
||||
return hash % UINT_MAX;
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include "strmap.h"
|
||||
#include "hashset.c"
|
||||
|
||||
void performQuestDiff(ScriptedQuestList *quests_then, ScriptedQuestList *quests_curr) {
|
||||
char buf[100], bufhash[100];
|
||||
HashSet *script_quests = hashset_create();
|
||||
|
||||
// bookkeep quest-script hash
|
||||
StrMap *sm = sm_new(2000);
|
||||
|
||||
// insert ongoing scripts
|
||||
resetScriptedQuestCursor(quests_curr);
|
||||
while(true) {
|
||||
ScriptedQuest *method = readScriptedQuest(quests_curr);
|
||||
if (method == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
int hash_quest = strhash(method->name);
|
||||
sprintf(bufhash, "%d", hash_quest);
|
||||
|
||||
sm_put(sm, bufhash, method->name);
|
||||
hashset_insert(script_quests, hash_quest);
|
||||
}
|
||||
|
||||
// remove initial scripts
|
||||
resetScriptedQuestCursor(quests_then);
|
||||
while(true) {
|
||||
ScriptedQuest *method = readScriptedQuest(quests_then);
|
||||
if (method == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
int hash_quest = strhash(method->name);
|
||||
hashset_remove(script_quests, hash_quest);
|
||||
}
|
||||
|
||||
int *list = hashset_list(script_quests);
|
||||
int i;
|
||||
for (i = 0; i < script_quests->count; i++) {
|
||||
int hash_quest = list[i];
|
||||
sprintf(bufhash, "%d", hash_quest);
|
||||
|
||||
// dump ongoing script releases
|
||||
sm_get(sm, bufhash, buf, sizeof(buf));
|
||||
printf("%s\n", buf);
|
||||
}
|
||||
|
||||
sm_delete(sm);
|
||||
hashset_destroy(script_quests);
|
||||
}
|
||||
28
tools/ScriptQuestReleaseTracker/quest_diff.h
Normal file
28
tools/ScriptQuestReleaseTracker/quest_diff.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef QUEST_DIFF_H_
|
||||
#define QUEST_DIFF_H_
|
||||
|
||||
void performQuestDiff(ScriptedQuestList *quests_then, ScriptedQuestList *quests_curr);
|
||||
|
||||
#include "quest_diff.c"
|
||||
|
||||
#endif /* QUEST_DIFF_H_ */
|
||||
85
tools/ScriptQuestReleaseTracker/quest_list.c
Normal file
85
tools/ScriptQuestReleaseTracker/quest_list.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
ScriptedQuest* createScriptedQuest(const char *name) {
|
||||
ScriptedQuest* method = (ScriptedQuest *)malloc(sizeof(ScriptedQuest));
|
||||
method->name = (char *)malloc((strlen(name) + 1) * sizeof(char));
|
||||
strcpy(method->name, name);
|
||||
return method;
|
||||
}
|
||||
|
||||
void freeScriptedQuest(ScriptedQuest *method) {
|
||||
free(method->name);
|
||||
free(method);
|
||||
}
|
||||
|
||||
ScriptedQuestList createScriptedQuestList() {
|
||||
ScriptedQuestList list;
|
||||
list.size = 0;
|
||||
|
||||
ScriptedQuestListItem *item = (ScriptedQuestListItem *)malloc(sizeof(ScriptedQuestListItem));
|
||||
item->prox = NULL;
|
||||
|
||||
list.last = item;
|
||||
list.first = list.last;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void insertScriptedQuest(ScriptedQuestList *list, ScriptedQuest *method) {
|
||||
ScriptedQuestListItem *item = (ScriptedQuestListItem *)malloc(sizeof(ScriptedQuestListItem));
|
||||
item->prox = NULL;
|
||||
|
||||
list->last->method = method;
|
||||
list->last->prox = item;
|
||||
|
||||
list->last = item;
|
||||
list->size++;
|
||||
}
|
||||
|
||||
void freeScriptedQuestList(ScriptedQuestList *list) {
|
||||
ScriptedQuestListItem *aux = list->first;
|
||||
|
||||
list->first = list->last;
|
||||
list->size = 0;
|
||||
|
||||
while (aux->prox != NULL) {
|
||||
ScriptedQuestListItem *aux2 = aux;
|
||||
aux = aux->prox;
|
||||
|
||||
freeScriptedQuest(aux2->method);
|
||||
free(aux2);
|
||||
}
|
||||
free(aux);
|
||||
}
|
||||
|
||||
void resetScriptedQuestCursor(ScriptedQuestList *list) {
|
||||
list->cursor = list->first;
|
||||
}
|
||||
|
||||
ScriptedQuest* readScriptedQuest(ScriptedQuestList *list) {
|
||||
ScriptedQuestListItem *aux = list->cursor;
|
||||
if (aux->prox == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
list->cursor = aux->prox;
|
||||
return aux->method;
|
||||
}
|
||||
43
tools/ScriptQuestReleaseTracker/quest_list.h
Normal file
43
tools/ScriptQuestReleaseTracker/quest_list.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef QUEST_LIST_H_
|
||||
#define QUEST_LIST_H_
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
} ScriptedQuest;
|
||||
|
||||
typedef struct ScriptedQuestListItem {
|
||||
ScriptedQuest *method;
|
||||
struct ScriptedQuestListItem *prox;
|
||||
} ScriptedQuestListItem;
|
||||
|
||||
typedef struct {
|
||||
ScriptedQuestListItem *first;
|
||||
ScriptedQuestListItem *last;
|
||||
ScriptedQuestListItem *cursor;
|
||||
|
||||
int size;
|
||||
} ScriptedQuestList;
|
||||
|
||||
#include "quest_list.c"
|
||||
|
||||
#endif /* QUEST_LIST_H_ */
|
||||
159
tools/ScriptQuestReleaseTracker/script_tracker.c
Normal file
159
tools/ScriptQuestReleaseTracker/script_tracker.c
Normal file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <pcre.h>
|
||||
|
||||
#include "strmap.c"
|
||||
#include "quest_list.h"
|
||||
#include "quest_diff.h"
|
||||
|
||||
ScriptedQuestList getBestSubstringsFromStringList(char *aStrRegex, ScriptedQuestList *lines, int lines_size) {
|
||||
ScriptedQuestList ret = createScriptedQuestList();
|
||||
|
||||
// ------------ an adaptation from Mitch Richling's https://www.mitchr.me/SS/exampleCode/AUPG/pcre_example.c.html -----------
|
||||
|
||||
int subStrVec[30];
|
||||
int subStrVecLength = 30;
|
||||
const char *pcreErrorStr;
|
||||
int pcreErrorOffset;
|
||||
|
||||
pcre *reCompiled = pcre_compile(aStrRegex, 0, &pcreErrorStr, &pcreErrorOffset, NULL);
|
||||
if(reCompiled == NULL) {
|
||||
printf("ERROR: Could not compile '%s': %s\n", aStrRegex, pcreErrorStr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pcre_extra *pcreExtra = pcre_study(reCompiled, 0, &pcreErrorStr);
|
||||
if(pcreErrorStr != NULL) {
|
||||
printf("ERROR: Could not study '%s': %s\n", aStrRegex, pcreErrorStr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < lines_size; i++) {
|
||||
ScriptedQuestList list = lines[i];
|
||||
|
||||
resetScriptedQuestCursor(&list);
|
||||
while(true) {
|
||||
ScriptedQuest *method = readScriptedQuest(&list);
|
||||
if (method == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
char *str = method->name;
|
||||
int st = 0, en = strlen(str);
|
||||
while(st < en) {
|
||||
int pcreExecRet = pcre_exec(reCompiled, pcreExtra, str, en, st, 0, subStrVec, subStrVecLength);
|
||||
if(pcreExecRet < 0) {
|
||||
switch(pcreExecRet) {
|
||||
//case PCRE_ERROR_NOMATCH : printf("String did not match the pattern\n"); break;
|
||||
case PCRE_ERROR_NULL : printf("Something was null\n"); break;
|
||||
case PCRE_ERROR_BADOPTION : printf("A bad option was passed\n"); break;
|
||||
case PCRE_ERROR_BADMAGIC : printf("Magic number bad (compiled re corrupt?)\n"); break;
|
||||
case PCRE_ERROR_UNKNOWN_NODE : printf("Something kooky in the compiled re\n"); break;
|
||||
case PCRE_ERROR_NOMEMORY : printf("Ran out of memory\n"); break;
|
||||
//default : printf("Unknown error\n"); break;
|
||||
}
|
||||
|
||||
break;
|
||||
} else {
|
||||
if(pcreExecRet == 0) {
|
||||
printf("But too many substrings were found to fit in subStrVec!\n");
|
||||
// Set rc to the max number of substring matches possible.
|
||||
pcreExecRet = 30 / 3;
|
||||
}
|
||||
|
||||
const char *psubStrMatchStr;
|
||||
pcre_get_substring(str, subStrVec, pcreExecRet, 1, &(psubStrMatchStr));
|
||||
|
||||
insertScriptedQuest(&ret, createScriptedQuest(psubStrMatchStr));
|
||||
pcre_free_substring(psubStrMatchStr);
|
||||
|
||||
st = subStrVec[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pcre_free(reCompiled);
|
||||
|
||||
if(pcreExtra != NULL) {
|
||||
pcre_free(pcreExtra);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *getContentFromFile(FILE *f) {
|
||||
fseek(f, 0, SEEK_END); // implemented by user529758 @ StackOverflow
|
||||
long fsize = ftell(f);
|
||||
fseek(f, 0, SEEK_SET); /* same as rewind(f); */
|
||||
|
||||
char *string = malloc(fsize + 1);
|
||||
fread(string, 1, fsize, f);
|
||||
|
||||
string[fsize] = 0;
|
||||
return string;
|
||||
}
|
||||
|
||||
ScriptedQuestList readQuestXml(char *file_path) {
|
||||
ScriptedQuestList *file_content = (ScriptedQuestList *)malloc(sizeof(ScriptedQuestList));
|
||||
file_content[0] = createScriptedQuestList();
|
||||
|
||||
FILE *f = fopen(file_path, "r+t");
|
||||
char *content = getContentFromFile(f);
|
||||
|
||||
char *tok = strtok(content, "\n");
|
||||
int i = 0;
|
||||
while (tok != NULL) {
|
||||
insertScriptedQuest(&(file_content[0]), createScriptedQuest(tok));
|
||||
tok = strtok(NULL, "\n");
|
||||
i++;
|
||||
}
|
||||
|
||||
free(content);
|
||||
fclose(f);
|
||||
|
||||
ScriptedQuestList ret = getBestSubstringsFromStringList("script\" value=\"(.+)\"", file_content, 1);
|
||||
|
||||
freeScriptedQuestList(&file_content[0]);
|
||||
free(file_content);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void trackScriptQuestReleases() {
|
||||
ScriptedQuestList quests_then = readQuestXml("Check2.img.xml");
|
||||
ScriptedQuestList quests_curr = readQuestXml("Check.img.xml");
|
||||
|
||||
performQuestDiff(&quests_then, &quests_curr);
|
||||
|
||||
freeScriptedQuestList(&quests_curr);
|
||||
freeScriptedQuestList(&quests_then);
|
||||
}
|
||||
|
||||
int main() {
|
||||
trackScriptQuestReleases();
|
||||
return 0;
|
||||
}
|
||||
515
tools/ScriptQuestReleaseTracker/strmap.c
Normal file
515
tools/ScriptQuestReleaseTracker/strmap.c
Normal file
@@ -0,0 +1,515 @@
|
||||
/*
|
||||
* strmap version 2.0.1
|
||||
*
|
||||
* ANSI C hash table for strings.
|
||||
*
|
||||
* Version history:
|
||||
* 1.0.0 - initial release
|
||||
* 2.0.0 - changed function prefix from strmap to sm to ensure
|
||||
* ANSI C compatibility
|
||||
* 2.0.1 - improved documentation
|
||||
*
|
||||
* strmap.c
|
||||
*
|
||||
* Copyright (c) 2009, 2011, 2013 Per Ola Kristensson.
|
||||
*
|
||||
* Per Ola Kristensson <pok21@cam.ac.uk>
|
||||
* Inference Group, Department of Physics
|
||||
* University of Cambridge
|
||||
* Cavendish Laboratory
|
||||
* JJ Thomson Avenue
|
||||
* CB3 0HE Cambridge
|
||||
* United Kingdom
|
||||
*
|
||||
* strmap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* strmap 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with strmap. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "strmap.h"
|
||||
|
||||
typedef struct Pair Pair;
|
||||
|
||||
typedef struct Bucket Bucket;
|
||||
|
||||
struct Pair {
|
||||
char *key;
|
||||
char *value;
|
||||
};
|
||||
|
||||
struct Bucket {
|
||||
unsigned int count;
|
||||
Pair *pairs;
|
||||
};
|
||||
|
||||
struct StrMap {
|
||||
unsigned int count;
|
||||
Bucket *buckets;
|
||||
};
|
||||
|
||||
static Pair * get_pair(Bucket *bucket, const char *key);
|
||||
static unsigned long hash(const char *str);
|
||||
|
||||
StrMap * sm_new(unsigned int capacity)
|
||||
{
|
||||
StrMap *map;
|
||||
|
||||
map = malloc(sizeof(StrMap));
|
||||
if (map == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
map->count = capacity;
|
||||
map->buckets = malloc(map->count * sizeof(Bucket));
|
||||
if (map->buckets == NULL) {
|
||||
free(map);
|
||||
return NULL;
|
||||
}
|
||||
memset(map->buckets, 0, map->count * sizeof(Bucket));
|
||||
return map;
|
||||
}
|
||||
|
||||
void sm_delete(StrMap *map)
|
||||
{
|
||||
unsigned int i, j, n, m;
|
||||
Bucket *bucket;
|
||||
Pair *pair;
|
||||
|
||||
if (map == NULL) {
|
||||
return;
|
||||
}
|
||||
n = map->count;
|
||||
bucket = map->buckets;
|
||||
i = 0;
|
||||
while (i < n) {
|
||||
m = bucket->count;
|
||||
pair = bucket->pairs;
|
||||
j = 0;
|
||||
while(j < m) {
|
||||
free(pair->key);
|
||||
free(pair->value);
|
||||
pair++;
|
||||
j++;
|
||||
}
|
||||
free(bucket->pairs);
|
||||
bucket++;
|
||||
i++;
|
||||
}
|
||||
free(map->buckets);
|
||||
free(map);
|
||||
}
|
||||
|
||||
int sm_get(const StrMap *map, const char *key, char *out_buf, unsigned int n_out_buf)
|
||||
{
|
||||
unsigned int index;
|
||||
Bucket *bucket;
|
||||
Pair *pair;
|
||||
|
||||
if (map == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (key == NULL) {
|
||||
return 0;
|
||||
}
|
||||
index = hash(key) % map->count;
|
||||
bucket = &(map->buckets[index]);
|
||||
pair = get_pair(bucket, key);
|
||||
if (pair == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (out_buf == NULL && n_out_buf == 0) {
|
||||
return strlen(pair->value) + 1;
|
||||
}
|
||||
if (out_buf == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (strlen(pair->value) >= n_out_buf) {
|
||||
return 0;
|
||||
}
|
||||
strcpy(out_buf, pair->value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sm_exists(const StrMap *map, const char *key)
|
||||
{
|
||||
unsigned int index;
|
||||
Bucket *bucket;
|
||||
Pair *pair;
|
||||
|
||||
if (map == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (key == NULL) {
|
||||
return 0;
|
||||
}
|
||||
index = hash(key) % map->count;
|
||||
bucket = &(map->buckets[index]);
|
||||
pair = get_pair(bucket, key);
|
||||
if (pair == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sm_put(StrMap *map, const char *key, const char *value)
|
||||
{
|
||||
unsigned int key_len, value_len, index;
|
||||
Bucket *bucket;
|
||||
Pair *tmp_pairs, *pair;
|
||||
char *tmp_value;
|
||||
char *new_key, *new_value;
|
||||
|
||||
if (map == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (key == NULL || value == NULL) {
|
||||
return 0;
|
||||
}
|
||||
key_len = strlen(key);
|
||||
value_len = strlen(value);
|
||||
/* Get a pointer to the bucket the key string hashes to */
|
||||
index = hash(key) % map->count;
|
||||
bucket = &(map->buckets[index]);
|
||||
/* Check if we can handle insertion by simply replacing
|
||||
* an existing value in a key-value pair in the bucket.
|
||||
*/
|
||||
if ((pair = get_pair(bucket, key)) != NULL) {
|
||||
/* The bucket contains a pair that matches the provided key,
|
||||
* change the value for that pair to the new value.
|
||||
*/
|
||||
if (strlen(pair->value) < value_len) {
|
||||
/* If the new value is larger than the old value, re-allocate
|
||||
* space for the new larger value.
|
||||
*/
|
||||
tmp_value = realloc(pair->value, (value_len + 1) * sizeof(char));
|
||||
if (tmp_value == NULL) {
|
||||
return 0;
|
||||
}
|
||||
pair->value = tmp_value;
|
||||
}
|
||||
/* Copy the new value into the pair that matches the key */
|
||||
strcpy(pair->value, value);
|
||||
return 1;
|
||||
}
|
||||
/* Allocate space for a new key and value */
|
||||
new_key = malloc((key_len + 1) * sizeof(char));
|
||||
if (new_key == NULL) {
|
||||
return 0;
|
||||
}
|
||||
new_value = malloc((value_len + 1) * sizeof(char));
|
||||
if (new_value == NULL) {
|
||||
free(new_key);
|
||||
return 0;
|
||||
}
|
||||
/* Create a key-value pair */
|
||||
if (bucket->count == 0) {
|
||||
/* The bucket is empty, lazily allocate space for a single
|
||||
* key-value pair.
|
||||
*/
|
||||
bucket->pairs = malloc(sizeof(Pair));
|
||||
if (bucket->pairs == NULL) {
|
||||
free(new_key);
|
||||
free(new_value);
|
||||
return 0;
|
||||
}
|
||||
bucket->count = 1;
|
||||
}
|
||||
else {
|
||||
/* The bucket wasn't empty but no pair existed that matches the provided
|
||||
* key, so create a new key-value pair.
|
||||
*/
|
||||
tmp_pairs = realloc(bucket->pairs, (bucket->count + 1) * sizeof(Pair));
|
||||
if (tmp_pairs == NULL) {
|
||||
free(new_key);
|
||||
free(new_value);
|
||||
return 0;
|
||||
}
|
||||
bucket->pairs = tmp_pairs;
|
||||
bucket->count++;
|
||||
}
|
||||
/* Get the last pair in the chain for the bucket */
|
||||
pair = &(bucket->pairs[bucket->count - 1]);
|
||||
pair->key = new_key;
|
||||
pair->value = new_value;
|
||||
/* Copy the key and its value into the key-value pair */
|
||||
strcpy(pair->key, key);
|
||||
strcpy(pair->value, value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sm_get_count(const StrMap *map)
|
||||
{
|
||||
unsigned int i, j, n, m;
|
||||
unsigned int count;
|
||||
Bucket *bucket;
|
||||
Pair *pair;
|
||||
|
||||
if (map == NULL) {
|
||||
return 0;
|
||||
}
|
||||
bucket = map->buckets;
|
||||
n = map->count;
|
||||
i = 0;
|
||||
count = 0;
|
||||
while (i < n) {
|
||||
pair = bucket->pairs;
|
||||
m = bucket->count;
|
||||
j = 0;
|
||||
while (j < m) {
|
||||
count++;
|
||||
pair++;
|
||||
j++;
|
||||
}
|
||||
bucket++;
|
||||
i++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
int sm_enum(const StrMap *map, sm_enum_func enum_func, const void *obj)
|
||||
{
|
||||
unsigned int i, j, n, m;
|
||||
Bucket *bucket;
|
||||
Pair *pair;
|
||||
|
||||
if (map == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (enum_func == NULL) {
|
||||
return 0;
|
||||
}
|
||||
bucket = map->buckets;
|
||||
n = map->count;
|
||||
i = 0;
|
||||
while (i < n) {
|
||||
pair = bucket->pairs;
|
||||
m = bucket->count;
|
||||
j = 0;
|
||||
while (j < m) {
|
||||
enum_func(pair->key, pair->value, obj);
|
||||
pair++;
|
||||
j++;
|
||||
}
|
||||
bucket++;
|
||||
i++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a pair from the bucket that matches the provided key,
|
||||
* or null if no such pair exist.
|
||||
*/
|
||||
static Pair * get_pair(Bucket *bucket, const char *key)
|
||||
{
|
||||
unsigned int i, n;
|
||||
Pair *pair;
|
||||
|
||||
n = bucket->count;
|
||||
if (n == 0) {
|
||||
return NULL;
|
||||
}
|
||||
pair = bucket->pairs;
|
||||
i = 0;
|
||||
while (i < n) {
|
||||
if (pair->key != NULL && pair->value != NULL) {
|
||||
if (strcmp(pair->key, key) == 0) {
|
||||
return pair;
|
||||
}
|
||||
}
|
||||
pair++;
|
||||
i++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a hash code for the provided string.
|
||||
*/
|
||||
static unsigned long hash(const char *str)
|
||||
{
|
||||
unsigned long hash = 5381;
|
||||
int c;
|
||||
|
||||
while (c = *str++) {
|
||||
hash = ((hash << 5) + hash) + c;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
||||
*/
|
||||
356
tools/ScriptQuestReleaseTracker/strmap.h
Normal file
356
tools/ScriptQuestReleaseTracker/strmap.h
Normal file
@@ -0,0 +1,356 @@
|
||||
/*
|
||||
* strmap version 2.0.1
|
||||
*
|
||||
* ANSI C hash table for strings.
|
||||
*
|
||||
* Version history:
|
||||
* 1.0.0 - initial release
|
||||
* 2.0.0 - changed function prefix from strmap to sm to ensure
|
||||
* ANSI C compatibility
|
||||
* 2.0.1 - improved documentation
|
||||
*
|
||||
* strmap.h
|
||||
*
|
||||
* Copyright (c) 2009, 2011, 2013 Per Ola Kristensson.
|
||||
*
|
||||
* Per Ola Kristensson <pok21@cam.ac.uk>
|
||||
* Inference Group, Department of Physics
|
||||
* University of Cambridge
|
||||
* Cavendish Laboratory
|
||||
* JJ Thomson Avenue
|
||||
* CB3 0HE Cambridge
|
||||
* United Kingdom
|
||||
*
|
||||
* strmap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* strmap 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with strmap. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _STRMAP_H_
|
||||
#define _STRMAP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct StrMap StrMap;
|
||||
|
||||
/*
|
||||
* This callback function is called once per key-value when iterating over
|
||||
* all keys associated to values.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* key: A pointer to a null-terminated C string. The string must not
|
||||
* be modified by the client.
|
||||
*
|
||||
* value: A pointer to a null-terminated C string. The string must
|
||||
* not be modified by the client.
|
||||
*
|
||||
* obj: A pointer to a client-specific object. This parameter may be
|
||||
* null.
|
||||
*
|
||||
* Return value: None.
|
||||
*/
|
||||
typedef void(*sm_enum_func)(const char *key, const char *value, const void *obj);
|
||||
|
||||
/*
|
||||
* Creates a string map.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* capacity: The number of top-level slots this string map
|
||||
* should allocate. This parameter must be > 0.
|
||||
*
|
||||
* Return value: A pointer to a string map object,
|
||||
* or null if a new string map could not be allocated.
|
||||
*/
|
||||
StrMap * sm_new(unsigned int capacity);
|
||||
|
||||
/*
|
||||
* Releases all memory held by a string map object.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* map: A pointer to a string map. This parameter cannot be null.
|
||||
* If the supplied string map has been previously released, the
|
||||
* behaviour of this function is undefined.
|
||||
*
|
||||
* Return value: None.
|
||||
*/
|
||||
void sm_delete(StrMap *map);
|
||||
|
||||
/*
|
||||
* Returns the value associated with the supplied key.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* map: A pointer to a string map. This parameter cannot be null.
|
||||
*
|
||||
* key: A pointer to a null-terminated C string. This parameter cannot
|
||||
* be null.
|
||||
*
|
||||
* out_buf: A pointer to an output buffer which will contain the value,
|
||||
* if it exists and fits into the buffer.
|
||||
*
|
||||
* n_out_buf: The size of the output buffer in bytes.
|
||||
*
|
||||
* Return value: If out_buf is set to null and n_out_buf is set to 0 the return
|
||||
* value will be the number of bytes required to store the value (if it exists)
|
||||
* and its null-terminator. For all other parameter configurations the return value
|
||||
* is 1 if an associated value was found and completely copied into the output buffer,
|
||||
* 0 otherwise.
|
||||
*/
|
||||
int sm_get(const StrMap *map, const char *key, char *out_buf, unsigned int n_out_buf);
|
||||
|
||||
/*
|
||||
* Queries the existence of a key.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* map: A pointer to a string map. This parameter cannot be null.
|
||||
*
|
||||
* key: A pointer to a null-terminated C string. This parameter cannot
|
||||
* be null.
|
||||
*
|
||||
* Return value: 1 if the key exists, 0 otherwise.
|
||||
*/
|
||||
int sm_exists(const StrMap *map, const char *key);
|
||||
|
||||
/*
|
||||
* Associates a value with the supplied key. If the key is already
|
||||
* associated with a value, the previous value is replaced.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* map: A pointer to a string map. This parameter cannot be null.
|
||||
*
|
||||
* key: A pointer to a null-terminated C string. This parameter
|
||||
* cannot be null. The string must have a string length > 0. The
|
||||
* string will be copied.
|
||||
*
|
||||
* value: A pointer to a null-terminated C string. This parameter
|
||||
* cannot be null. The string must have a string length > 0. The
|
||||
* string will be copied.
|
||||
*
|
||||
* Return value: 1 if the association succeeded, 0 otherwise.
|
||||
*/
|
||||
int sm_put(StrMap *map, const char *key, const char *value);
|
||||
|
||||
/*
|
||||
* Returns the number of associations between keys and values.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* map: A pointer to a string map. This parameter cannot be null.
|
||||
*
|
||||
* Return value: The number of associations between keys and values.
|
||||
*/
|
||||
int sm_get_count(const StrMap *map);
|
||||
|
||||
/*
|
||||
* An enumerator over all associations between keys and values.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* map: A pointer to a string map. This parameter cannot be null.
|
||||
*
|
||||
* enum_func: A pointer to a callback function that will be
|
||||
* called by this procedure once for every key associated
|
||||
* with a value. This parameter cannot be null.
|
||||
*
|
||||
* obj: A pointer to a client-specific object. This parameter will be
|
||||
* passed back to the client's callback function. This parameter can
|
||||
* be null.
|
||||
*
|
||||
* Return value: 1 if enumeration completed, 0 otherwise.
|
||||
*/
|
||||
int sm_enum(const StrMap *map, sm_enum_func enum_func, const void *obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
||||
*/
|
||||
85
tools/ScriptStaticMethodTracker/method_list.c
Normal file
85
tools/ScriptStaticMethodTracker/method_list.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
JavaMethod* createJavaMethod(const char *name) {
|
||||
JavaMethod* method = (JavaMethod *)malloc(sizeof(JavaMethod));
|
||||
method->name = (char *)malloc((strlen(name) + 1) * sizeof(char));
|
||||
strcpy(method->name, name);
|
||||
return method;
|
||||
}
|
||||
|
||||
void freeJavaMethod(JavaMethod *method) {
|
||||
free(method->name);
|
||||
free(method);
|
||||
}
|
||||
|
||||
JavaMethodList createJavaMethodList() {
|
||||
JavaMethodList list;
|
||||
list.size = 0;
|
||||
|
||||
JavaMethodListItem *item = (JavaMethodListItem *)malloc(sizeof(JavaMethodListItem));
|
||||
item->prox = NULL;
|
||||
|
||||
list.last = item;
|
||||
list.first = list.last;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void insertJavaMethod(JavaMethodList *list, JavaMethod *method) {
|
||||
JavaMethodListItem *item = (JavaMethodListItem *)malloc(sizeof(JavaMethodListItem));
|
||||
item->prox = NULL;
|
||||
|
||||
list->last->method = method;
|
||||
list->last->prox = item;
|
||||
|
||||
list->last = item;
|
||||
list->size++;
|
||||
}
|
||||
|
||||
void freeJavaMethodList(JavaMethodList *list) {
|
||||
JavaMethodListItem *aux = list->first;
|
||||
|
||||
list->first = list->last;
|
||||
list->size = 0;
|
||||
|
||||
while (aux->prox != NULL) {
|
||||
JavaMethodListItem *aux2 = aux;
|
||||
aux = aux->prox;
|
||||
|
||||
freeJavaMethod(aux2->method);
|
||||
free(aux2);
|
||||
}
|
||||
free(aux);
|
||||
}
|
||||
|
||||
void resetJavaMethodCursor(JavaMethodList *list) {
|
||||
list->cursor = list->first;
|
||||
}
|
||||
|
||||
JavaMethod* readJavaMethod(JavaMethodList *list) {
|
||||
JavaMethodListItem *aux = list->cursor;
|
||||
if (aux->prox == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
list->cursor = aux->prox;
|
||||
return aux->method;
|
||||
}
|
||||
43
tools/ScriptStaticMethodTracker/method_list.h
Normal file
43
tools/ScriptStaticMethodTracker/method_list.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef METHOD_LIST_H_
|
||||
#define METHOD_LIST_H_
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
} JavaMethod;
|
||||
|
||||
typedef struct JavaMethodListItem {
|
||||
JavaMethod *method;
|
||||
struct JavaMethodListItem *prox;
|
||||
} JavaMethodListItem;
|
||||
|
||||
typedef struct {
|
||||
JavaMethodListItem *first;
|
||||
JavaMethodListItem *last;
|
||||
JavaMethodListItem *cursor;
|
||||
|
||||
int size;
|
||||
} JavaMethodList;
|
||||
|
||||
#include "method_list.c"
|
||||
|
||||
#endif /* METHOD_LIST_H_ */
|
||||
349
tools/ScriptStaticMethodTracker/method_tracker.c
Normal file
349
tools/ScriptStaticMethodTracker/method_tracker.c
Normal file
@@ -0,0 +1,349 @@
|
||||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <pcre.h>
|
||||
|
||||
#include "method_list.h"
|
||||
#include "script_path.h"
|
||||
|
||||
JavaMethodList getBestSubstringsFromStringList(char *aStrRegex, JavaMethodList *lines, int lines_size) {
|
||||
JavaMethodList ret = createJavaMethodList();
|
||||
|
||||
// ------------ an adaptation from Mitch Richling's https://www.mitchr.me/SS/exampleCode/AUPG/pcre_example.c.html -----------
|
||||
|
||||
int subStrVec[30];
|
||||
int subStrVecLength = 30;
|
||||
const char *pcreErrorStr;
|
||||
int pcreErrorOffset;
|
||||
|
||||
pcre *reCompiled = pcre_compile(aStrRegex, 0, &pcreErrorStr, &pcreErrorOffset, NULL);
|
||||
if(reCompiled == NULL) {
|
||||
printf("ERROR: Could not compile '%s': %s\n", aStrRegex, pcreErrorStr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pcre_extra *pcreExtra = pcre_study(reCompiled, 0, &pcreErrorStr);
|
||||
if(pcreErrorStr != NULL) {
|
||||
printf("ERROR: Could not study '%s': %s\n", aStrRegex, pcreErrorStr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < lines_size; i++) {
|
||||
JavaMethodList list = lines[i];
|
||||
|
||||
resetJavaMethodCursor(&list);
|
||||
while(true) {
|
||||
JavaMethod *method = readJavaMethod(&list);
|
||||
if (method == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
char *str = method->name;
|
||||
int st = 0, en = strlen(str);
|
||||
while (st < en) {
|
||||
int pcreExecRet = pcre_exec(reCompiled, pcreExtra, str, en, st, 0, subStrVec, subStrVecLength);
|
||||
if(pcreExecRet < 0) {
|
||||
switch(pcreExecRet) {
|
||||
//case PCRE_ERROR_NOMATCH : printf("String did not match the pattern\n"); break;
|
||||
case PCRE_ERROR_NULL : printf("Something was null\n"); break;
|
||||
case PCRE_ERROR_BADOPTION : printf("A bad option was passed\n"); break;
|
||||
case PCRE_ERROR_BADMAGIC : printf("Magic number bad (compiled re corrupt?)\n"); break;
|
||||
case PCRE_ERROR_UNKNOWN_NODE : printf("Something kooky in the compiled re\n"); break;
|
||||
case PCRE_ERROR_NOMEMORY : printf("Ran out of memory\n"); break;
|
||||
//default : printf("Unknown error\n"); break;
|
||||
}
|
||||
|
||||
break; // no more matches found
|
||||
} else {
|
||||
if(pcreExecRet == 0) {
|
||||
printf("But too many substrings were found to fit in subStrVec!\n");
|
||||
// Set rc to the max number of substring matches possible.
|
||||
pcreExecRet = 30 / 3;
|
||||
}
|
||||
|
||||
const char *psubStrMatchStr;
|
||||
pcre_get_substring(str, subStrVec, pcreExecRet, 0, &(psubStrMatchStr));
|
||||
|
||||
insertJavaMethod(&ret, createJavaMethod(psubStrMatchStr));
|
||||
pcre_free_substring(psubStrMatchStr);
|
||||
|
||||
st = subStrVec[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pcre_free(reCompiled);
|
||||
|
||||
if(pcreExtra != NULL) {
|
||||
pcre_free(pcreExtra);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char* extractStaticMethodName(const char *method_line) {
|
||||
char *aStrRegex = "([A-Za-z0-9])+(\\s)*\\(";
|
||||
|
||||
int lines_size = 1;
|
||||
JavaMethodList *lines = (JavaMethodList *)malloc(lines_size * sizeof(JavaMethodList));
|
||||
|
||||
int i;
|
||||
for (i = 0; i < lines_size; i++) {
|
||||
lines[i] = createJavaMethodList();
|
||||
insertJavaMethod(&(lines[i]), createJavaMethod(method_line));
|
||||
}
|
||||
|
||||
JavaMethodList subs = getBestSubstringsFromStringList(aStrRegex, lines, lines_size);
|
||||
|
||||
char *ret;
|
||||
if (subs.size > 0) {
|
||||
resetJavaMethodCursor(&subs);
|
||||
JavaMethod *method = readJavaMethod(&subs);
|
||||
|
||||
char *method_scoop = method->name;
|
||||
int i;
|
||||
for (i = 0; i < strlen(method_scoop) - 1; i++) {
|
||||
char ch = method_scoop[i];
|
||||
if (ch == '(' || ch == ' ' || ch == '\t') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
method->name[i] = 0;
|
||||
|
||||
ret = (char *)malloc((strlen(method->name) + 1) * sizeof(char));
|
||||
strcpy(ret, method->name);
|
||||
} else {
|
||||
ret = NULL;
|
||||
}
|
||||
|
||||
freeJavaMethodList(&subs);
|
||||
|
||||
for (i = 0; i < lines_size; i++) {
|
||||
freeJavaMethodList(&(lines[i]));
|
||||
}
|
||||
|
||||
free(lines);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
JavaMethodList getStaticJavaMethodNames(char *aStrRegex, JavaMethodList *lines, int lines_size) {
|
||||
JavaMethodList subs = getBestSubstringsFromStringList(aStrRegex, lines, lines_size);
|
||||
JavaMethodList ret = createJavaMethodList();
|
||||
|
||||
resetJavaMethodCursor(&subs);
|
||||
while (true) {
|
||||
JavaMethod *method = readJavaMethod(&subs);
|
||||
if (method == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
char *method_name = extractStaticMethodName(method->name);
|
||||
if (method_name != NULL) {
|
||||
insertJavaMethod(&ret, createJavaMethod(method_name));
|
||||
free(method_name);
|
||||
}
|
||||
}
|
||||
|
||||
freeJavaMethodList(&subs);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool isIgnoreMethod(char *method_name) {
|
||||
const char * ignoreMethods[] = {"getInstance", "toString", NULL};
|
||||
|
||||
int i = 0;
|
||||
while(true) {
|
||||
const char *ign = ignoreMethods[i];
|
||||
if (ign == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!strcmp(method_name, ign)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
JavaMethodList trackerFindSourceStaticMethods(JavaMethodList *lines, int lines_size) {
|
||||
char *aStrRegex = "(public static\\s).*([A-Za-z0-9])+(\\s)*\\(.*\\{";
|
||||
JavaMethodList ret = createJavaMethodList();
|
||||
|
||||
JavaMethodList list = getStaticJavaMethodNames(aStrRegex, lines, lines_size);
|
||||
resetJavaMethodCursor(&list);
|
||||
while(true) {
|
||||
JavaMethod *method = readJavaMethod(&list);
|
||||
if (method == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (isIgnoreMethod(method->name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
insertJavaMethod(&ret, createJavaMethod(method->name));
|
||||
}
|
||||
|
||||
freeJavaMethodList(&list);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *getContentFromFile(FILE *f) {
|
||||
fseek(f, 0, SEEK_END); // implemented by user529758 @ StackOverflow
|
||||
long fsize = ftell(f);
|
||||
fseek(f, 0, SEEK_SET); /* same as rewind(f); */
|
||||
|
||||
char *string = malloc(fsize + 1);
|
||||
fread(string, 1, fsize, f);
|
||||
|
||||
string[fsize] = 0;
|
||||
return string;
|
||||
}
|
||||
|
||||
bool locateMethodCall(const char *method_name, char *file_path) {
|
||||
FILE *f = fopen(file_path, "r+t");
|
||||
|
||||
char aStrRegex[1000];
|
||||
strcpy(aStrRegex, method_name);
|
||||
strcat(aStrRegex, "(\\s)*\\(");
|
||||
|
||||
JavaMethodList *file_content = (JavaMethodList *)malloc(sizeof(JavaMethodList));
|
||||
file_content[0] = createJavaMethodList();
|
||||
|
||||
char *content = getContentFromFile(f);
|
||||
|
||||
JavaMethod *method = createJavaMethod(content);
|
||||
insertJavaMethod(&(file_content[0]), method);
|
||||
free(content);
|
||||
|
||||
JavaMethodList list = getBestSubstringsFromStringList(aStrRegex, file_content, 1);
|
||||
bool found = (list.size > 0);
|
||||
|
||||
freeJavaMethodList(&(file_content[0]));
|
||||
free(file_content);
|
||||
fclose(f);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
void locateMethodCalls(const char *method_name, char **file_paths, int file_paths_size) {
|
||||
int i;
|
||||
for (i = 0; i < file_paths_size; i++) {
|
||||
char *path = file_paths[i];
|
||||
if (locateMethodCall(method_name, path)) {
|
||||
printf(" %s : \'%s\'\n", path, method_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int trackerLocateScriptsStaticCalls(JavaMethodList method_names) {
|
||||
ScriptFiles *files = createScriptFiles("../../scripts");
|
||||
if (files == NULL) {
|
||||
printf("ERROR: Could not initialize script files.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
resetJavaMethodCursor(&method_names);
|
||||
while (true) {
|
||||
JavaMethod *method = readJavaMethod(&method_names);
|
||||
if (method == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
locateMethodCalls(method->name, files->file_paths, files->file_paths_size);
|
||||
}
|
||||
|
||||
freeScriptFiles(files);
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
JavaMethodList *file_content;
|
||||
int size;
|
||||
} SourceFilesContent;
|
||||
|
||||
SourceFilesContent* readSourceFileContents() {
|
||||
ScriptFiles *srcFilePaths = createScriptFiles("../../src");
|
||||
|
||||
SourceFilesContent *files = (SourceFilesContent *)malloc(sizeof(SourceFilesContent));
|
||||
files->file_content = (JavaMethodList *)malloc(srcFilePaths->file_paths_size * sizeof(JavaMethodList));
|
||||
files->size = srcFilePaths->file_paths_size;
|
||||
|
||||
//int max_len = 0;
|
||||
int i;
|
||||
for (i = 0; i < srcFilePaths->file_paths_size; i++) {
|
||||
files->file_content[i] = createJavaMethodList();
|
||||
|
||||
FILE *f = fopen(srcFilePaths->file_paths[i], "r+t");
|
||||
char *content = getContentFromFile(f);
|
||||
|
||||
//int this_len = strlen(content);
|
||||
//if (max_len < this_len) max_len = this_len;
|
||||
|
||||
fclose(f);
|
||||
|
||||
insertJavaMethod(&(files->file_content[i]), createJavaMethod(content));
|
||||
}
|
||||
|
||||
freeScriptFiles(srcFilePaths);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
void freeSourceFileContents(SourceFilesContent *files) {
|
||||
int i;
|
||||
for (i = 0; i < files->size; i++) {
|
||||
freeJavaMethodList(&(files->file_content[i]));
|
||||
}
|
||||
|
||||
free(files->file_content);
|
||||
free(files);
|
||||
}
|
||||
|
||||
int main() {
|
||||
printf("Loading source files...\n");
|
||||
SourceFilesContent *src_contents = readSourceFileContents();
|
||||
|
||||
int lines_size = src_contents->size;
|
||||
JavaMethodList *lines = src_contents->file_content;
|
||||
|
||||
printf("Tracking static methods on source...\n");
|
||||
JavaMethodList method_names = trackerFindSourceStaticMethods(lines, lines_size);
|
||||
printf("Finding static methods calls on scripts...\n");
|
||||
trackerLocateScriptsStaticCalls(method_names);
|
||||
printf("Track complete!\n");
|
||||
|
||||
freeSourceFileContents(src_contents);
|
||||
freeJavaMethodList(&method_names);
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
tools/ScriptStaticMethodTracker/pcre3.dll
Normal file
BIN
tools/ScriptStaticMethodTracker/pcre3.dll
Normal file
Binary file not shown.
72
tools/ScriptStaticMethodTracker/script_path.c
Normal file
72
tools/ScriptStaticMethodTracker/script_path.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void fetchScriptFilesFromDirectory(ScriptFiles *files, char *root_dir) {
|
||||
struct dirent *de;
|
||||
struct stat info;
|
||||
DIR *dir = opendir(root_dir);
|
||||
if (dir != NULL) {
|
||||
de = readdir(dir); // skip .
|
||||
de = readdir(dir); // skip ..
|
||||
|
||||
while ((de = readdir(dir)) != NULL) {
|
||||
char file_path[SCRIPT_FILES_MAX_PATH_SIZE];
|
||||
strcpy(file_path, root_dir);
|
||||
strcat(file_path, "/");
|
||||
strcat(file_path, de->d_name);
|
||||
|
||||
stat(file_path, &info);
|
||||
if (S_ISREG(info.st_mode)) {
|
||||
files->file_paths[files->file_paths_size] = (char *)malloc(SCRIPT_FILES_MAX_PATH_SIZE * sizeof(char));
|
||||
strcpy(files->file_paths[files->file_paths_size], file_path);
|
||||
files->file_paths_size++;
|
||||
} else {
|
||||
fetchScriptFilesFromDirectory(files, file_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScriptFiles* createScriptFiles(char *root_dir) {
|
||||
ScriptFiles *files = (ScriptFiles *)malloc(sizeof(ScriptFiles));
|
||||
|
||||
files->file_paths = (char **)malloc(SCRIPT_FILES_MAX_COUNT * sizeof(char *));
|
||||
files->file_paths_size = 0;
|
||||
|
||||
fetchScriptFilesFromDirectory(files, root_dir);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
void freeScriptFiles(ScriptFiles *files) {
|
||||
int i;
|
||||
for (i = 0; i < files->file_paths_size; i++) {
|
||||
free(files->file_paths[i]);
|
||||
}
|
||||
|
||||
free(files->file_paths);
|
||||
free(files);
|
||||
}
|
||||
34
tools/ScriptStaticMethodTracker/script_path.h
Normal file
34
tools/ScriptStaticMethodTracker/script_path.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef SCRIPT_PATH_H_
|
||||
#define SCRIPT_PATH_H_
|
||||
|
||||
#define SCRIPT_FILES_MAX_COUNT 70000
|
||||
#define SCRIPT_FILES_MAX_PATH_SIZE 40000
|
||||
|
||||
typedef struct {
|
||||
char **file_paths;
|
||||
int file_paths_size;
|
||||
} ScriptFiles;
|
||||
|
||||
#include "script_path.c"
|
||||
|
||||
#endif /* SCRIPT_PATH_H_ */
|
||||
Reference in New Issue
Block a user