PNPC & Pmob + Events Wheel & P. Leave patch + Proper cash use deplete

Reworked cash item consume. It now depletes from the selected slot rather than from the first slot it appears on inventory.
Implemented PNPC and PMOB commands.
Solved an issue with some events finishing abruptly when players quit a party.
Added missing mandatory script functions to the event scripts.
Solved an interaction issue with Wheel of Destiny activation in event instances.
Added interaction with NPC Mom & Dad in the Engagement prequest.
Solved an issue with event maps being disposed while reactor's spray items activity is still in effect.
Fixed modifier scrolls such as Spikes on Shoes depleting a upgrade slot.
Added a server flag for avoiding compulsory consuming by pet autopot.
Added a cache for fetching mob names.
Implemented boss drop rate.
Smart protected commands system against command requests in burst by the same user.
Revised login handler, bringing disconnection checks before checking login state and preventing new client reattribution to already logged-in character objects.
Botched login handler sessions now properly gets closed.
This commit is contained in:
ronancpl
2019-01-16 14:46:28 -02:00
parent 132a4ee989
commit 0203d45901
107 changed files with 2740 additions and 473 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="MapleEventMethodFiller" default="default" basedir=".">
<description>Builds, tests, and runs the project MapleEventMethodFiller.</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="MapleEventMethodFiller-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>

Binary file not shown.

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,126 @@
/*
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 mapleeventmethodfiller;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils;
/**
*
* @author RonanLana
*
This application objective is to read all scripts from the event folder
and fill empty functions for every function name not yet present in the
script.
Estimated parse time:
*/
public class MapleEventMethodFiller {
private static boolean foundMatchingDataOnFile(String fileContent, Pattern pattern) {
Matcher matcher = pattern.matcher(fileContent);
return matcher.find();
}
private static void fileSearchMatchingData(File file, Map<Pattern, String> functions) {
try {
String fileContent = FileUtils.readFileToString(file, "UTF-8");
List<String> fillFunctions = new LinkedList<>();
for(Entry<Pattern, String> f : functions.entrySet()) {
if(!foundMatchingDataOnFile(fileContent, f.getKey())) {
fillFunctions.add(f.getValue());
}
}
if (!fillFunctions.isEmpty()) {
System.out.println("Filling out " + file.getName() + "...");
FileWriter fileWriter = new FileWriter(file, true);
PrintWriter printWriter = new PrintWriter(fileWriter);
printWriter.println();
printWriter.println();
printWriter.println("// ---------- FILLER FUNCTIONS ----------");
printWriter.println();
for (String s : fillFunctions) {
printWriter.println(s);
printWriter.println();
}
printWriter.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
private static void filterDirectorySearchMatchingData(String directoryPath, Map<Pattern, String> functions) {
Iterator iter = FileUtils.iterateFiles(new File(directoryPath), new String[]{"sql", "js", "txt","java"}, true);
while(iter.hasNext()) {
File file = (File) iter.next();
fileSearchMatchingData(file, functions);
}
}
private static String jsFunction = "function(\\s)+";
private static Pattern compileJsFunctionPattern(String function) {
return Pattern.compile(jsFunction + function);
}
public static final Map<Pattern, String> functions = new HashMap<Pattern, String>(17) {{
put(compileJsFunctionPattern("playerEntry"), "function playerEntry(eim, player) {}");
put(compileJsFunctionPattern("playerExit"), "function playerExit(eim, player) {}");
put(compileJsFunctionPattern("scheduledTimeout"), "function scheduledTimeout(eim) {}");
put(compileJsFunctionPattern("playerUnregistered"), "function playerUnregistered(eim, player) {}");
put(compileJsFunctionPattern("changedLeader"), "function changedLeader(eim, leader) {}");
put(compileJsFunctionPattern("monsterKilled"), "function monsterKilled(mob, eim) {}");
put(compileJsFunctionPattern("allMonstersDead"), "function allMonstersDead(eim) {}");
put(compileJsFunctionPattern("playerDisconnected"), "function playerDisconnected(eim, player) {}");
put(compileJsFunctionPattern("monsterValue"), "function monsterValue(eim, mobid) {return 0;}");
put(compileJsFunctionPattern("dispose"), "function dispose() {}");
put(compileJsFunctionPattern("leftParty"), "function leftParty(eim, player) {}");
put(compileJsFunctionPattern("disbandParty"), "function disbandParty(eim, player) {}");
put(compileJsFunctionPattern("clearPQ"), "function clearPQ(eim) {}");
put(compileJsFunctionPattern("afterSetup"), "function afterSetup(eim) {}");
put(compileJsFunctionPattern("cancelSchedule"), "function cancelSchedule() {}");
put(compileJsFunctionPattern("setup"), "function setup(eim, leaderid) {}");
//put(compileJsFunctionPattern("getEligibleParty"), "function getEligibleParty(party) {}"); not really needed
}};
public static void main(String[] args) {
filterDirectorySearchMatchingData("../../scripts/event", functions);
}
}