PlayerNPC patch + Wedding ring effects + Bypassable PIN/PIC + SP cap

Fixed an issue with delayed item pickups.
Fixed ClearSlot command not removing rechargeables from inventory.
Fixed Resurrection and Hyper Body animation effect not working for other players.
Implemented bypassable PIN/PIC, applied on accounts after a successful authentication, remaining active while activity is detected for that account.
Fixed anti-multiclient system not properly registering players logged in via all-chars-view.
Fixed cases where players still could gain EXP from much higher-leveled mobs if they were on an event instance.
Optimized scroll result method performance.
Added a server flag for SP cap limit on the player's current job (missing amount are reobtained after changing jobs).
PlayerNPCs now have overridable scripts.
Fixed some mapobject issues with PlayerNPCs, potencially leading to disappearing from maps in certain circumstances.
Fixed SpawnAllPnpcs command not properly spawning all PlayersNPCs.
Added extra info on Abdula, now stating whether a book can be obtained from questline or not.
Fixed marriage ring effects.
Fixed some cases where marriage rings were being able to be sent out from the character owner.
Fixed Duey allowing send untradeable items.
New tool: MapleWorldmapChecker. It reads Map.wz XMLs, fetching mapids not properly referenced on the worldmap nodes.
This commit is contained in:
ronancpl
2018-10-25 07:09:35 -03:00
parent 17d3ffe1c3
commit 8f8cd815aa
87 changed files with 2040 additions and 271 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="MapleWorldmapChecker" default="default" basedir=".">
<description>Builds, tests, and runs the project MapleWorldmapChecker.</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="MapleWorldmapChecker-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,76 @@
# Report File autogenerated from the MapleWorldmapChecker feature by Ronan Lana.
# Generated data takes into account several data info from the server-side WZ.xmls.
Missing mapid references in top hierarchy:
'WorldMap000.img.xml':
1020000:WorldMap.img.xml
'WorldMap010.img.xml':
101000400:WorldMap.img.xml
105040306:WorldMap.img.xml
105050500:WorldMap.img.xml
193000000:WorldMap.img.xml
680000100:WorldMap.img.xml
680000110:WorldMap.img.xml
680000200:WorldMap.img.xml
680000210:WorldMap.img.xml
680000300:WorldMap.img.xml
680000400:WorldMap.img.xml
680000401:WorldMap.img.xml
680010000:WorldMap.img.xml
680010100:WorldMap.img.xml
'WorldMap012.img.xml':
107000500:WorldMap010.img.xml
'WorldMap014.img.xml':
106021401:WorldMap010.img.xml
106021402:WorldMap010.img.xml
106021800:WorldMap010.img.xml
'WorldMap020.img.xml':
200080101:WorldMap.img.xml
200082301:WorldMap.img.xml
211040401:WorldMap.img.xml
'WorldMap021.img.xml':
280030000:WorldMap020.img.xml
'WorldMap030.img.xml':
220010001:WorldMap.img.xml
220011001:WorldMap.img.xml
221022100:WorldMap.img.xml
221022200:WorldMap.img.xml
222010310:WorldMap.img.xml
'WorldMap050.img.xml':
240040201:WorldMap.img.xml
240040301:WorldMap.img.xml
'WorldMap060.img.xml':
251000100:WorldMap.img.xml
251010404:WorldMap.img.xml
'WorldMap100.img.xml':
140020110:WorldMap.img.xml
'WorldMap142.img.xml':
600010002:WorldMap.img.xml
'WorldMap211.img.xml':
801040100:WorldMap210.img.xml
801040101:WorldMap210.img.xml

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,316 @@
/*
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 mapleworldmapchecker;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
*
* @author RonanLana
This application parses the Map.wz file inputted and reports areas (mapids) that are supposed to be referenced
throughout the map tree (area map -> continent map -> world map) but are currently missing.
*/
public class MapleWorldmapChecker {
static String newFile = "lib/Report.txt";
static PrintWriter printWriter = null;
static InputStreamReader fileReader = null;
static BufferedReader bufferedReader = null;
static String worldmapPath = "../../wz/Map.wz/WorldMap";
static int initialStringLength = 50;
static Map<String, Set<Integer>> worldMapids = new HashMap<>();
static Map<String, String> parentWorldmaps = new HashMap<>();
static Set<String> rootWorldmaps = new HashSet<>();
//static String rootWorldmap = "";
static Set<Integer> currentWorldMapids;
static String currentParent;
static byte status = 0;
static boolean isInfo;
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 translateToken(String token) {
String d;
if(token.contains("/imgdir")) {
status -= 1;
}
else if(token.contains("imgdir")) {
status += 1;
if (status == 2) {
d = getName(token);
switch (d) {
case "MapList":
isInfo = false;
break;
case "info":
isInfo = true;
break;
default:
forwardCursor(status);
}
} else if (status == 4) {
d = getName(token);
if (!d.contentEquals("mapNo")) {
forwardCursor(status);
}
}
}
else {
if (status == 4) {
currentWorldMapids.add(Integer.valueOf(getValue(token)));
} else if (status == 2 && isInfo) {
try {
d = getName(token);
if (d.contentEquals("parentMap")) {
currentParent = (getValue(token) + ".img.xml");
} else {
forwardCursor(status);
}
} catch (Exception e) {
System.out.println("failed '" + token + "'");
}
}
}
}
private static void parseWorldmapFile(File worldmapFile) throws IOException {
String line;
fileReader = new InputStreamReader(new FileInputStream(worldmapFile), "UTF-8");
bufferedReader = new BufferedReader(fileReader);
currentParent = "";
status = 0;
currentWorldMapids = new HashSet<>();
while((line = bufferedReader.readLine()) != null) {
translateToken(line);
}
String worldmapName = worldmapFile.getName();
worldMapids.put(worldmapName, currentWorldMapids);
if (!currentParent.isEmpty()) parentWorldmaps.put(worldmapName, currentParent);
else rootWorldmaps.add(worldmapName);
bufferedReader.close();
fileReader.close();
}
private static void parseWorldmapDirectory() {
System.out.println("Parsing directory '" + worldmapPath + "'");
File folder = new File(worldmapPath);
for (File file : folder.listFiles()) {
if (file.isFile()) {
try {
parseWorldmapFile(file);
}
catch(FileNotFoundException ex) {
System.out.println("Unable to open worldmap file " + file.getAbsolutePath() + ".");
}
catch(IOException ex) {
System.out.println("Error reading worldmap file " + file.getAbsolutePath() + ".");
}
catch(Exception e) {
e.printStackTrace();
}
}
}
}
private static void printReportFileHeader() {
printWriter.println(" # Report File autogenerated from the MapleWorldmapChecker feature by Ronan Lana.");
printWriter.println(" # Generated data takes into account several data info from the server-side WZ.xmls.");
printWriter.println();
}
private static void printReportFileResults(List<Pair<String, List<Pair<Integer, String>>>> results) {
printWriter.println("Missing mapid references in top hierarchy:\n");
for (Pair<String, List<Pair<Integer, String>>> res : results) {
printWriter.println("'" + res.getLeft() + "':");
for (Pair<Integer, String> i : res.getRight()) {
printWriter.println(" " + i);
}
printWriter.println("\n");
}
}
private static void verifyWorldmapTreeMapids() {
try {
printWriter = new PrintWriter(newFile, "UTF-8");
printReportFileHeader();
if (rootWorldmaps.size() > 1) {
printWriter.println("[WARNING] Detected several root worldmaps: " + rootWorldmaps + "\n");
}
Set<String> worldmaps = new HashSet<>(parentWorldmaps.keySet());
worldmaps.addAll(rootWorldmaps);
Map<String, Set<Integer>> tempMapids = new HashMap<>(worldMapids.size());
for (Entry<String, Set<Integer>> e : worldMapids.entrySet()) {
tempMapids.put(e.getKey(), new HashSet<>(e.getValue()));
}
Map<String, List<Pair<Integer, String>>> unreferencedMapids = new HashMap<>();
for (String s : worldmaps) {
List<Pair<Integer, String>> currentUnreferencedMapids = new ArrayList<>();
for (Integer i : tempMapids.get(s)) {
String parent = parentWorldmaps.get(s);
while (parent != null) {
Set<Integer> mapids = worldMapids.get(parent);
if (!mapids.contains(i)) {
currentUnreferencedMapids.add(new Pair<>(i, parent));
break;
} else {
tempMapids.get(parent).remove(i);
}
parent = parentWorldmaps.get(parent);
}
}
if (!currentUnreferencedMapids.isEmpty()) {
unreferencedMapids.put(s, currentUnreferencedMapids);
}
}
if (!unreferencedMapids.isEmpty()) {
List<Pair<String, List<Pair<Integer, String>>>> unreferencedEntries = new ArrayList<>(20);
for (Entry<String, List<Pair<Integer, String>>> e : unreferencedMapids.entrySet()) {
List<Pair<Integer, String>> list = new ArrayList<>(e.getValue());
Collections.sort(list, new Comparator<Pair<Integer, String>>() {
@Override
public int compare(Pair<Integer, String> o1, Pair<Integer, String> o2) {
return o1.getLeft().compareTo(o2.getLeft());
}
});
unreferencedEntries.add(new Pair<>(e.getKey(), list));
}
Collections.sort(unreferencedEntries, new Comparator<Pair<String, List<Pair<Integer, String>>>>() {
@Override
public int compare(Pair<String, List<Pair<Integer, String>>> o1, Pair<String, List<Pair<Integer, String>>> o2) {
return o1.getLeft().compareTo(o2.getLeft());
}
});
printReportFileResults(unreferencedEntries);
}
printWriter.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
parseWorldmapDirectory();
verifyWorldmapTreeMapids();
}
}

View File

@@ -0,0 +1,121 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 ~ 2010 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License 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 mapleworldmapchecker;
/**
* Represents a pair of values.
*
* @author Frz
* @since Revision 333
* @version 1.0
*
* @param <E> The type of the left value.
* @param <F> The type of the right value.
*/
public class Pair<E, F> {
public E left;
public F right;
/**
* Class constructor - pairs two objects together.
*
* @param left The left object.
* @param right The right object.
*/
public Pair(E left, F right) {
this.left = left;
this.right = right;
}
/**
* Gets the left value.
*
* @return The left value.
*/
public E getLeft() {
return left;
}
/**
* Gets the right value.
*
* @return The right value.
*/
public F getRight() {
return right;
}
/**
* Turns the pair into a string.
*
* @return Each value of the pair as a string joined by a colon.
*/
@Override
public String toString() {
return left.toString() + ":" + right.toString();
}
/**
* Gets the hash code of this pair.
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((left == null) ? 0 : left.hashCode());
result = prime * result + ((right == null) ? 0 : right.hashCode());
return result;
}
/**
* Checks to see if two pairs are equal.
*/
@SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Pair other = (Pair) obj;
if (left == null) {
if (other.left != null) {
return false;
}
} else if (!left.equals(other.left)) {
return false;
}
if (right == null) {
if (other.right != null) {
return false;
}
} else if (!right.equals(other.right)) {
return false;
}
return true;
}
}