Password on minigames + Broadcast diseases + Missing reactor scripts

Added script for several uncoded reactors with drop data on DB.
Improved quest status updates on the DB, now using a common "characterid" column.
Fixed several disease status not appearing for other players.
Fixed MapleTV item being taken twice per operation.
Implemented password system for minirooms such as omok/match cards. Passwords as player names will suggest to the system that player is being "invited" to the private game.
This commit is contained in:
ronancpl
2018-05-01 02:26:55 -03:00
parent 61292f5c9b
commit 7d0f1cb311
33 changed files with 806 additions and 81 deletions

View 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="MapleReactorDropFetcher" default="default" basedir=".">
<description>Builds, tests, and runs the project MapleReactorDropFetcher.</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="MapleReactorDropFetcher-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>

View File

@@ -0,0 +1,20 @@
# Report File autogenerated from the MapleReactorDropFetcher feature by Ronan Lana.
# Generated data takes into account several data info from the underlying DB and the server-side files.
MISSING REACTOR DROP SCRIPTS
200000
200001
200002
200003
200004
200005
200006
200007
200008
200009
1022001
1032000
2052001
2112015

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

View File

@@ -0,0 +1,170 @@
/*
This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
Copyleft (L) 2017 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package maplereactordropfetcher;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
import java.io.File;
/**
*
* @author RonanLana
This application reports in reactor ids that have drops on the SQL table but are
not yet coded.
*/
public class MapleReactorDropFetcher {
static String host = "jdbc:mysql://localhost:3306/heavenms";
static String driver = "com.mysql.jdbc.Driver";
static String username = "root";
static String password = "";
static String reactorScriptPath = "../../scripts/reactor";
static String directoryName = "../..";
static String newFile = "lib/ReactorDropReport.txt";
static Connection con = null;
static PrintWriter printWriter = null;
static InputStreamReader fileReader = null;
static BufferedReader bufferedReader = null;
static Set<Integer> reactors = new HashSet<>();
private static void printReportFileHeader() {
printWriter.println(" # Report File autogenerated from the MapleReactorDropFetcher feature by Ronan Lana.");
printWriter.println(" # Generated data takes into account several data info from the underlying DB and the server-side files.");
printWriter.println();
}
private static int getReactorIdFromFilename(String name) {
try {
return Integer.valueOf(name.substring(0, name.indexOf('.')));
} catch(Exception e) {
return -1;
}
}
private static void removeScriptedReactorids(String directoryName) {
File directory = new File(directoryName);
// get all the files from a directory
File[] fList = directory.listFiles();
for (File file : fList) {
if (file.isFile()) {
reactors.remove(getReactorIdFromFilename(file.getName()));
}
}
}
private static void loadReactoridsOnDB() throws SQLException {
PreparedStatement ps = con.prepareStatement("SELECT DISTINCT reactorid FROM reactordrops;");
ResultSet rs = ps.executeQuery();
while(rs.next()) {
reactors.add(rs.getInt("reactorid"));
}
rs.close();
ps.close();
}
private static List<Integer> getSortedReactorids() {
List<Integer> sortedReactors = new ArrayList<>(reactors);
Collections.sort(sortedReactors);
return sortedReactors;
}
private static void fetchMissingReactorDrops() throws SQLException {
loadReactoridsOnDB();
removeScriptedReactorids(reactorScriptPath);
}
private static void reportMissingReactorDrops() throws SQLException {
if(!reactors.isEmpty()) {
printWriter.println("MISSING REACTOR DROP SCRIPTS");
for(Integer reactorid : getSortedReactorids()) {
printWriter.println(" " + reactorid);
}
printWriter.println("\n");
}
}
private static void ReportMissingReactors() {
try {
Class.forName(driver).newInstance();
// filter reactorids on DB
con = DriverManager.getConnection(host, username, password);
System.out.println("Fetching reactors from DB...");
fetchMissingReactorDrops();
con.close();
printWriter = new PrintWriter(newFile, "UTF-8");
// report suspects of missing quest drop data, as well as those drop data that may have incorrect questids.
System.out.println("Reporting results...");
printReportFileHeader();
reportMissingReactorDrops();
printWriter.close();
System.out.println("Done!");
}
catch(SQLException e) {
System.out.println("Warning: Could not establish connection to database to report quest data.");
System.out.println(e.getMessage());
}
catch(ClassNotFoundException e) {
System.out.println("Error: could not find class");
System.out.println(e.getMessage());
}
catch(InstantiationException e) {
System.out.println("Error: instantiation failure");
System.out.println(e.getMessage());
}
catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
ReportMissingReactors();
}
}