ariantpq + correct use catch item

This commit is contained in:
Diego Armando de Freitas Matos
2019-03-20 19:51:45 -03:00
parent 0a8efa4238
commit 0d7e8daf8e
36 changed files with 2399 additions and 2444 deletions

3
launch_server_linux.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
export CLASSPATH=".:dist/*"
java -Xmx3000m -Dwzpath=wz/ net.server.Server

View File

@@ -54,43 +54,7 @@ is divided into following sections:
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<j2seproject1:property name="platform.home" value="platforms.${platform.active}.home"/>
<j2seproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/>
<j2seproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/>
<j2seproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/>
<condition property="platform.javac" value="${platform.home}/bin/javac">
<equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/>
</condition>
<property name="platform.javac" value="${platform.javac.tmp}"/>
<j2seproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/>
<condition property="platform.java" value="${platform.home}/bin/java">
<equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/>
</condition>
<property name="platform.java" value="${platform.java.tmp}"/>
<j2seproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/>
<condition property="platform.javadoc" value="${platform.home}/bin/javadoc">
<equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/>
</condition>
<property name="platform.javadoc" value="${platform.javadoc.tmp}"/>
<condition property="platform.invalid" value="true">
<or>
<contains string="${platform.javac}" substring="$${platforms."/>
<contains string="${platform.java}" substring="$${platforms."/>
<contains string="${platform.javadoc}" substring="$${platforms."/>
</or>
</condition>
<fail unless="platform.home">Must set platform.home</fail>
<fail unless="platform.bootcp">Must set platform.bootcp</fail>
<fail unless="platform.java">Must set platform.java</fail>
<fail unless="platform.javac">Must set platform.javac</fail>
<fail if="platform.invalid">
The J2SE Platform is not correctly set up.
Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files.
Either open the project in the IDE and setup the Platform with the same name or add it manually.
For example like this:
ant -Duser.properties.file=&lt;path_to_property_file&gt; jar (where you put the property "platforms.${platform.active}.home" in a .properties file)
or ant -Dplatforms.${platform.active}.home=&lt;path_to_JDK_home&gt; jar (where no properties file is used)
</fail>
<property name="platform.java" value="${java.home}/bin/java"/>
<available file="${manifest.file}" property="manifest.available"/>
<condition property="splashscreen.available">
<and>
@@ -157,7 +121,9 @@ is divided into following sections:
</and>
</condition>
<condition property="have.tests">
<or/>
<or>
<available file="${test.scripts.dir}"/>
</or>
</condition>
<condition property="have.sources">
<or>
@@ -217,6 +183,15 @@ is divided into following sections:
<condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}">
<isset property="profile.available"/>
</condition>
<condition else="false" property="jdkBug6558476">
<and>
<matches pattern="1\.[56]" string="${java.specification.version}"/>
<not>
<os family="unix"/>
</not>
</and>
</condition>
<property name="javac.fork" value="${jdkBug6558476}"/>
<property name="jar.index" value="false"/>
<property name="jar.index.metainf" value="${jar.index}"/>
<property name="copylibs.rebase" value="true"/>
@@ -249,6 +224,7 @@ is divided into following sections:
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.dir">Must set src.dir</fail>
<fail unless="test.scripts.dir">Must set test.scripts.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
@@ -284,7 +260,7 @@ is divided into following sections:
<property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/>
<mkdir dir="@{apgeneratedsrcdir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
<src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/>
@@ -324,7 +300,7 @@ is divided into following sections:
<sequential>
<property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
<src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/>
@@ -405,7 +381,7 @@ is divided into following sections:
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
@@ -428,8 +404,11 @@ is divided into following sections:
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.scripts.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
<fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
<filename name="${test.binarytestincludes}"/>
</fileset>
@@ -458,9 +437,13 @@ is divided into following sections:
<condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
<isset property="test.method"/>
</condition>
<union id="test.set"/>
<union id="test.set">
<fileset dir="${test.scripts.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</union>
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
<testng classfilesetref="test.set" failureProperty="tests.failed" jvm="${platform.java}" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="HeavenMS" testname="TestNG tests" workingDir="${work.dir}">
<testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="HeavenMS" testname="TestNG tests" workingDir="${work.dir}">
<xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
<propertyset>
<propertyref prefix="test-sys-prop."/>
@@ -540,7 +523,7 @@ is divided into following sections:
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
@@ -565,8 +548,11 @@ is divided into following sections:
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.scripts.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
<fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
<filename name="${test.binarytestincludes}"/>
</fileset>
@@ -742,9 +728,6 @@ is divided into following sections:
<classpath>
<path path="@{classpath}"/>
</classpath>
<bootclasspath>
<path path="${platform.bootcp}"/>
</bootclasspath>
</nbjpdastart>
</sequential>
</macrodef>
@@ -760,9 +743,7 @@ is divided into following sections:
</macrodef>
</target>
<target name="-init-debug-args">
<exec executable="${platform.java}" outputproperty="version-output">
<arg value="-version"/>
</exec>
<property name="version-output" value="java version &quot;${ant.java.version}"/>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
@@ -787,7 +768,7 @@ is divided into following sections:
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
@@ -814,7 +795,7 @@ is divided into following sections:
<attribute default="jvm" name="jvm"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
@@ -1012,7 +993,7 @@ is divided into following sections:
<j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
<echo level="info">To run this application from the command line without Ant, try:</echo>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<echo level="info">${platform.java} -jar "${dist.jar.resolved}"</echo>
<echo level="info">java -jar "${dist.jar.resolved}"</echo>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist">
<j2seproject1:jar manifest="${tmp.manifest.file}"/>
@@ -1221,13 +1202,10 @@ is divided into following sections:
</not>
</and>
</condition>
<exec executable="${platform.java}" failonerror="false" outputproperty="platform.version.output">
<arg value="-version"/>
</exec>
<condition else="" property="bug5101868workaround" value="*.java">
<matches multiline="true" pattern="1\.[56](\..*)?" string="${platform.version.output}"/>
<matches pattern="1\.[56](\..*)?" string="${java.version}"/>
</condition>
<javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}"/>
</classpath>
@@ -1266,11 +1244,13 @@ is divided into following sections:
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-test-depend">
<j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir=""/>
<j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.scripts.dir}"/>
</target>
<target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir=""/>
<copy todir="${build.test.classes.dir}"/>
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.scripts.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.scripts.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
<!-- Empty placeholder for easier customization. -->
@@ -1284,8 +1264,10 @@ is divided into following sections:
<target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="" srcdir=""/>
<copy todir="${build.test.classes.dir}"/>
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.scripts.dir}" srcdir="${test.scripts.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.scripts.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test-single">
<!-- Empty placeholder for easier customization. -->

View File

@@ -1,8 +1,8 @@
build.xml.data.CRC32=92113194
build.xml.data.CRC32=d58eb2a3
build.xml.script.CRC32=ff13faf5
build.xml.stylesheet.CRC32=8064a381@1.75.2.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=92113194
nbproject/build-impl.xml.script.CRC32=cef58264
nbproject/build-impl.xml.data.CRC32=d58eb2a3
nbproject/build-impl.xml.script.CRC32=17919f88
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48

View File

@@ -3,4 +3,4 @@ do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
user.properties.file=C:\\Users\\RonanLana\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties
user.properties.file=C:\\Users\\diego.matos\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties

View File

@@ -2,6 +2,12 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="2"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
<group>
<file>file:/C:/Users/diego.matos/Documents/MS/servergit/HeavenMS/HeavenMS/scripts/npc/2103013.js</file>
<file>file:/C:/Users/diego.matos/Documents/MS/servergit/HeavenMS/HeavenMS/src/scripting/npc/NPCConversationManager.java</file>
<file>file:/C:/Users/diego.matos/Documents/MS/servergit/HeavenMS/HeavenMS/scripts/npc/2101015.js</file>
<file>file:/C:/Users/diego.matos/Documents/MS/servergit/HeavenMS/HeavenMS/scripts/npc/2101017.js</file>
<file>file:/C:/Users/diego.matos/Documents/MS/servergit/HeavenMS/HeavenMS/scripts/npc/2101016.js</file>
</group>
</open-files>
</project-private>

View File

@@ -84,7 +84,7 @@ manifest.custom.permissions=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=JDK_1.7
platform.active=default_platform
project.license=gpl30_msv2
project.licensePath=./nbproject/licenseheader.txt
run.classpath=\
@@ -97,5 +97,6 @@ run.jvmargs=-Xmx2048m -Dwzpath=wz/
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
source.encoding=ISO-8859-1
src.dir=${file.reference.MapleSolaxia-src}
test.scripts.dir=scripts

View File

@@ -4,11 +4,12 @@
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>HeavenMS</name>
<explicit-platform explicit-source-supported="true"/>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots/>
<test-roots>
<root id="test.scripts.dir"/>
</test-roots>
</data>
</configuration>
</project>

View File

@@ -15,7 +15,7 @@ var rideTime = 1 * 60 * 1000; //The time that require move to destination
function init() {
closeTime = em.getTransportationTime(closeTime);
beginTime = em.getTransportationTime(beginTime);
rideTime = em.getTransportationTime(rideTime);
rideTime = em.getTransportationTime(rideTime);
KC_bfd = em.getChannelServer().getMapFactory().getMap(540010100);
CBD_bfd = em.getChannelServer().getMapFactory().getMap(540010001);

View File

@@ -1,291 +0,0 @@
/*
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/>.
*/
/**
* @author: Ronan
* @event: Amoria PQ
*/
var isPq = true;
var onlyMarriedPlayers = true;
var minPlayers = 6, maxPlayers = 6;
var minLevel = 40, maxLevel = 255;
var entryMap = 670010200;
var exitMap = 670011000;
var recruitMap = 670010100;
var clearMap = 670010800;
var minMapId = 670010200;
var maxMapId = 670010800;
var eventTime = 75; // 75 minutes
var lobbyRange = [0, 0];
function init() {
setEventRequirements();
}
function setLobbyRange() {
return lobbyRange;
}
function setEventRequirements() {
var reqStr = "";
reqStr += "\r\n Number of players: ";
if(maxPlayers - minPlayers >= 1) reqStr += minPlayers + " ~ " + maxPlayers;
else reqStr += minPlayers;
reqStr += "\r\n Level range: ";
if(maxLevel - minLevel >= 1) reqStr += minLevel + " ~ " + maxLevel;
else reqStr += minLevel;
reqStr += "\r\n At least 1 of both genders";
if(onlyMarriedPlayers) reqStr += "\r\n All married";
reqStr += "\r\n Time limit: ";
reqStr += eventTime + " minutes";
em.setProperty("party", reqStr);
}
function setEventExclusives(eim) {
var itemSet = [4031594, 4031595, 4031596, 4031597];
eim.setExclusiveItems(itemSet);
}
function setEventRewards(eim) {
var itemSet, itemQty, evLevel, expStages;
evLevel = 1; //Rewards at clear PQ
itemSet = [];
itemQty = [];
eim.setEventRewards(evLevel, itemSet, itemQty);
expStages = [2000, 4000, 6000, 8000, 9000, 11000]; //bonus exp given on CLEAR stage signal
eim.setEventClearStageExp(expStages);
}
function getEligibleParty(party) { //selects, from the given party, the team that is allowed to attempt this event
var eligible = [];
var hasLeader = false, hasNotMarried = false;
var mask = 0;
if(party.size() > 0) {
var partyList = party.toArray();
for(var i = 0; i < party.size(); i++) {
var ch = partyList[i];
if(ch.getMapId() == recruitMap && ch.getLevel() >= minLevel && ch.getLevel() <= maxLevel) {
if(ch.isLeader()) hasLeader = true;
if(!ch.getPlayer().isMarried()) hasNotMarried = true;
eligible.push(ch);
mask |= (1 << ch.getPlayer().getGender());
}
}
}
if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers && mask == 3)) eligible = [];
if(onlyMarriedPlayers && hasNotMarried) eligible = [];
return eligible;
}
function setup(level, lobbyid) {
var eim = em.newInstance("Amoria" + lobbyid);
eim.setProperty("level", level);
eim.setProperty("marriedGroup", 0);
eim.setProperty("missCount", 0);
eim.setProperty("statusStg1", -1);
eim.setProperty("statusStg2", -1);
eim.setProperty("statusStg3", -1);
eim.setProperty("statusStg4", -1);
eim.setProperty("statusStg5", -1);
eim.setProperty("statusStg6", -1);
eim.setProperty("statusStgBonus", 0);
eim.getInstanceMap(670010200).resetPQ(level);
eim.getInstanceMap(670010300).resetPQ(level);
eim.getInstanceMap(670010301).resetPQ(level);
eim.getInstanceMap(670010302).resetPQ(level);
eim.getInstanceMap(670010400).resetPQ(level);
eim.getInstanceMap(670010500).resetPQ(level);
eim.getInstanceMap(670010600).resetPQ(level);
eim.getInstanceMap(670010700).resetPQ(level);
eim.getInstanceMap(670010750).resetPQ(level);
eim.getInstanceMap(670010800).resetPQ(level);
eim.getInstanceMap(670010200).toggleDrops();
eim.getInstanceMap(670010300).toggleDrops();
eim.getInstanceMap(670010301).toggleDrops();
eim.getInstanceMap(670010302).toggleDrops();
eim.getInstanceMap(670010200).instanceMapForceRespawn();
eim.getInstanceMap(670010500).instanceMapForceRespawn();
eim.getInstanceMap(670010750).shuffleReactors();
eim.getInstanceMap(670010800).shuffleReactors();
var mapObj = eim.getInstanceMap(670010700);
var mobObj = Packages.server.life.MapleLifeFactory.getMonster(9400536);
mapObj.spawnMonsterOnGroundBelow(mobObj, new Packages.java.awt.Point(942, 478));
respawnStages(eim);
eim.startEventTimer(eventTime * 60000);
setEventRewards(eim);
setEventExclusives(eim);
return eim;
}
function isTeamAllCouple(eim) { // everyone partner of someone on the team
var eventPlayers = eim.getPlayers();
for (var iterator = eventPlayers.iterator(); iterator.hasNext();) {
var chr = iterator.next();
var pid = chr.getPartnerId();
if(pid <= 0 || eim.getPlayerById(pid) == null) {
return false;
}
}
return true;
}
function afterSetup(eim) {
if(isTeamAllCouple(eim)) {
eim.setIntProperty("marriedGroup", 1);
}
}
function respawnStages(eim) {}
function playerEntry(eim, player) {
var map = eim.getMapInstance(entryMap);
player.changeMap(map, map.getPortal(0));
}
function scheduledTimeout(eim) {
if(eim.getIntProperty("statusStg6") == 1) {
eim.warpEventTeam(exitMap);
}
else {
end(eim);
}
}
function playerUnregistered(eim, player) {}
function playerExit(eim, player) {
eim.unregisterPlayer(player);
player.changeMap(exitMap, 0);
}
function playerLeft(eim, player) {
if(!eim.isEventCleared()) {
playerExit(eim, player);
}
}
function changedMap(eim, player, mapid) {
if (mapid < minMapId || mapid > maxMapId) {
if (eim.isEventTeamLackingNow(true, minPlayers, player)) {
eim.unregisterPlayer(player);
end(eim);
}
else
eim.unregisterPlayer(player);
}
}
function changedLeader(eim, leader) {
var mapid = leader.getMapId();
if (!eim.isEventCleared() && (mapid < minMapId || mapid > maxMapId)) {
end(eim);
}
}
function playerDead(eim, player) {}
function playerRevive(eim, player) { // player presses ok on the death pop up.
if (eim.isEventTeamLackingNow(true, minPlayers, player)) {
eim.unregisterPlayer(player);
end(eim);
}
else
eim.unregisterPlayer(player);
}
function playerDisconnected(eim, player) {
if (eim.isEventTeamLackingNow(true, minPlayers, player)) {
eim.unregisterPlayer(player);
end(eim);
}
else
eim.unregisterPlayer(player);
}
function leftParty(eim, player) {
if (eim.isEventTeamLackingNow(false, minPlayers, player)) {
end(eim);
}
else
playerLeft(eim, player);
}
function disbandParty(eim) {
if (!eim.isEventCleared()) {
end(eim);
}
}
function monsterValue(eim, mobId) {
return 1;
}
function end(eim) {
var party = eim.getPlayers();
for (var i = 0; i < party.size(); i++) {
playerExit(eim, party.get(i));
}
eim.dispose();
}
function giveRandomEventReward(eim, player) {
eim.giveEventReward(player);
}
function clearPQ(eim) {
eim.stopEventTimer();
eim.setEventCleared();
}
function monsterKilled(mob, eim) {}
function allMonstersDead(eim) {}
function cancelSchedule() {}
function dispose(eim) {}

View File

@@ -1,108 +1,114 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
/*2101014.js - Lobby and Entrance
* @author Jvlaple
* For Jvlaple's AriantPQ
*/
importPackage(java.lang);
importPackage(Packages.server.expeditions);
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/>.
*/
/*
NPC NAME: Cesar (2)
NPC ID: 2101014
Author: Vcoc
Function: AriantPQ
*/
status = -1;
var sel;
empty = [false, false, false];
var status = 0;
var toBan = -1;
var choice;
var arena;
var arenaName;
var type;
var map;
var exped = MapleExpeditionType.ARIANT;
var exped1 = MapleExpeditionType.ARIANT1;
var exped2 = MapleExpeditionType.ARIANT2;
function start() {
if((cm.getPlayer().getLevel() < 19 || cm.getPlayer().getLevel() > 30) && !cm.getPlayer().isGM()){
cm.sendNext("You're not between level 20 and 30. Sorry, you may not participate.");
cm.dispose();
return;
}
var text = "What do you want?#b";
for(var i = 0; i < 3; i += 1)
if (cm.getPlayerCount(980010100 + (i * 100)) > 0)
if(cm.getPlayerCount(980010101 + (i * 100)) > 0)
continue;
else
text += "\r\n#L" + i + "# Battle Arena " + (i + 1) + "([" + cm.getPlayerCount(980010100 + (i * 100)) + "/" + cm.getPlayer().getAriantSlotsRoom(i) + "] users: " + cm.getPlayer().getAriantRoomLeaderName(i) + ")#l";
else{
empty[i] = true;
text += "\r\n#L" + i + "# Battle Arena " + (i + 1) + "( Empty )#l";
if(cm.getPlayer().getAriantRoomLeaderName(i) != "")
cm.getPlayer().removeAriantRoom(i);
}
cm.sendSimple(text + "\r\n#L3# I'd like to know more about the competition.#l");
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection){
status++;
if(mode != 1){
if(mode == 0 && type == 0)
status -= 2;
else{
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0) {
cm.dispose();
return;
}
if (mode == 1) {
status++;
} else {
status--;
}
if (cm.getPlayer().getMapId() == 980010000) {
var expedicao = cm.getExpedition(exped);
var expedicao1 = cm.getExpedition(exped1);
var expedicao2 = cm.getExpedition(exped2);
if (status == 0) {
var toSnd = "Você gostaria de participar do Desafio #eAriant Coliseu#n?\r\n\r\n#e#r (Escolha uma arena)#n#k\r\n#b";
if (cm.getClient().getChannelServer().getMapFactory().getMap(980010100).getCharacters().size() == 0 && expedicao == null) {
toSnd += "#L0#Comece Ariant Coliseu (1)#l\r\n";
} else if (expedicao != null && cm.getClient().getChannelServer().getMapFactory().getMap(980010101).getCharacters().size() == 0) {
toSnd += "#L0#Junte-se ao Ariant Coliseu (1) Dono (" + expedicao.getLeader().getName() + ")" + " Membros Atuais: " + cm.getNomeDosMembrosExpedition(exped) + "\r\n";
}
if (cm.getClient().getChannelServer().getMapFactory().getMap(980010200).getCharacters().size() == 0 && expedicao1 == null) {
toSnd += "#L1#Comece Ariant Coliseu (2)#l\r\n";
} else if (expedicao1 != null && cm.getClient().getChannelServer().getMapFactory().getMap(980010201).getCharacters().size() == 0) {
toSnd += "#L1#Junte-se ao Ariant Coliseu (2) Dono (" + expedicao1.getLeader().getName() + ")" + " Membros Atuais: " + cm.getNomeDosMembrosExpedition(exped1) + "\r\n";
}
if (cm.getClient().getChannelServer().getMapFactory().getMap(980010300).getCharacters().size() == 0 && expedicao2 == null) {
toSnd += "#L2#Comece Ariant Coliseu (3)#l\r\n";
} else if (expedicao2 != null && cm.getClient().getChannelServer().getMapFactory().getMap(980010301).getCharacters().size() == 0) {
toSnd += "#L2#Junte-se ao Ariant Coliseu (3) Dono (" + expedicao2.getLeader().getName() + ")" + " Membros Atuais: " + cm.getNomeDosMembrosExpedition(exped2) + "\r\n";
}
if (toSnd.equals("Você gostaria de participar do Desafio #eAriant Coliseu#n?\r\n\r\n#e#r (Escolha uma arena)#n#k\r\n#b")) {
cm.sendOk("Todas as arenas esta ocupadas agora. Eu sugiro que você volte mais tarde ou mudar de canal.");
cm.dispose();
} else {
cm.sendSimple(toSnd);
}
} else if (status == 1) {
switch (selection) {
case 0 :
exped = MapleExpeditionType.ARIANT;
expedicao = cm.getExpedition(exped);
map = 980010100;
break;
case 1 :
exped = MapleExpeditionType.ARIANT1;
expedicao = cm.getExpedition(exped);
map = 980010200;
break;
case 2 :
exped = MapleExpeditionType.ARIANT2;
expedicao = cm.getExpedition(exped);
map = 980010300;
break;
default :
exped = null;
map = 0;
return;
break;
}
if (expedicao == null) {
cm.createExpedition(exped);
cm.warp(map, 0);
cm.getPlayer().dropMessage("Sua Arena foi criada. Aguarde as pessoas entrarem agora!");
cm.dispose();
} else {
var playerAdd = expedicao.addMemberInt(cm.getPlayer());
if (playerAdd == 3) {
cm.sendOk("Desculpe, a Lobby esta cheia agora.");
cm.dispose();
} else {
if (playerAdd == 0) {
cm.warp(map, 0);
cm.dispose();
} else if (playerAdd == 2) {
cm.sendOk("Desculpe, mas o líder pediu para nao ser autorizado a entrar.");
cm.dispose();
} else {
cm.sendOk("erro.");
cm.dispose();
}
}
}
}
}
}
if (status == 0){
if(sel == undefined)
sel = selection;
if(sel == 3)
cm.sendNext("What do you need to do? You must be new to this. Allow me explain in detail.");
else{
if(cm.getPlayer().getAriantRoomLeaderName(sel) != "" && empty[sel])
empty[sel] = false;
else if(cm.getPlayer().getAriantRoomLeaderName(sel) != ""){
cm.warp(980010100 + (sel * 100));
cm.dispose();
return;
}
if(!empty[sel]){
cm.sendNext("Another combatant has created the battle arena first. I advise you to either set up a new one, or join the battle arena that's already been set up.");
cm.dispose();
return;
}
cm.sendGetNumber("Up to how many participants can join in this match? (2~6 ppl)", 0, 2, 6);
}
}else if (status == 1){
if(sel == 3)
cm.sendNextPrev("It's really simple, actually. You'll receive #b#t2270002##k from me, and your task is to eliminate a set amount of HP from the monster, then use #b#t2270002##k to absorb its monstrous power.");
else{
if(cm.getPlayer().getAriantRoomLeaderName(sel) != "" && empty[sel])
empty[sel] = false;
if(!empty[sel]){
cm.sendNext("Another combatant has created the battle arena first. I advise you to either set up a new one, or join the battle arena that's already been set up.");
cm.dispose();
return;
}
cm.getPlayer().setAriantRoomLeader(sel, cm.getPlayer().getName());
cm.getPlayer().setAriantSlotRoom(sel, selection);
cm.warp(980010100 + (sel * 100));
cm.dispose();
}
}else if (status == 2)
cm.sendNextPrev("It's simple. If you absorb the power of the monster #b#t2270002##k, then you'll make #b#t4031868##k, which is something Queen Areda loves. The combatant with the most jewels wins the match. It's actually a smart idea to prevent others from absorbing in order to win.");
else if (status == 3)
cm.sendNextPrev("One thing. Using #b#t2100067##k, you can steal #b#t4031868##k from your enemies. Warning: #rYou may not use pets for this.#k Understood?!");
else if (status == 4)
cm.dispose();
}
}

37
scripts/npc/2101015.js Normal file
View File

@@ -0,0 +1,37 @@
var status = 0;
importPackage(Packages.client);
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && status == 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
apqpontos = cm.getPlayer().getAriantPontos();
if (apqpontos < 100) {
cm.sendOk("A sua Pontuação de Arena de Batalha é #b" + apqpontos + "#k Pontos. Você precisa ultrapassar os #b100 Pontos#k para que eu possa lhe dar a #bCadeira de Praia com Palmeira#k.Estou ocupado, então fale comigo quando você tiver pontos suficientes e fale comigo novamente.")
cm.dispose();
}
if (apqpontos > 99) {
cm.sendNext("Uaaal, parece que você conseguiu os #b100 Pontos#k necessários para troca, vamos lá?!");
}
} else if (status == 1) {
cm.getPlayer().gainAriantPontos(-100);
cm.gainItem(3010018, 1);
cm.dispose();
}
}
}

40
scripts/npc/2101016.js Normal file
View File

@@ -0,0 +1,40 @@
var status = 0;
importPackage(Packages.client);
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && status == 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
copns = cm.getPlayer().countItem(4031868);
if (copns < 1) {
cm.sendOk("Que pena, você nao conseguiu nenhuma jóia!")
cm.dispose();
}
if (copns > 0 || !cm.getPlayer().isGM()) {
cm.sendNext("Ok, vamos ver...Você foi muito bem, e você trouxe #b" + copns + "#k jóias que eu adoro. Como você completou a partida, vou recompensá-lo com a pontuação da Arena de Batalhas de #b5 Pontos#k. Se você quiser saber mais sobre a pontuação de Arena de Batalha, então fale com #b#p2101015##k.");
}
} else if (status == 1) {
//cm.warp(980010020, 0);
cm.removeAll(4031868);
cm.getPlayer().gainExp(92.7 * cm.getPlayer().getExpRate() * copns, true, true);
cm.getPlayer().gainAriantPontos(3);
cm.dispose();
}
}
}

View File

@@ -1,150 +1,142 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
/*2101017.js
*Cesar
*@author Jvlaple
*/
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.
importPackage(java.lang);
importPackage(Packages.server.expeditions);
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/>.
*/
/*
NPC NAME: Cesar (3)
NPC ID: 2101017
Author: Vcoc
Function: AriantPQ
*/
importPackage(Packages.tools);
importPackage(Packages.client);
status = -1;
var sel;
var status = 0;
var toBan = -1;
var choice;
var arena;
var arenaName;
var type;
var map;
var exped = MapleExpeditionType.ARIANT;
var exped1 = MapleExpeditionType.ARIANT1;
var exped2 = MapleExpeditionType.ARIANT2;
var expedicao;
var expedMembers;
function start() {
if((cm.getPlayer().getLevel() < 19 || cm.getPlayer().getLevel() > 30) && !cm.getPlayer().isGM()){
cm.sendNext("You're not between level 20 and 30. Sorry, you may not participate.");
cm.dispose();
return;
}
if(cm.getPlayer().getMapId() % 10 == 1)
cm.sendSimple("Do you have a request for me?\r\n#b#L0# Give me #t2270002# and #t2100067#.#l\r\n#L1# What should I do?#l\r\n#L2# Get me out of here.#l");
else
cm.sendSimple(cm.getPlayer().getAriantRoomLeaderName(((cm.getPlayer().getMapId() / 100) % 10) - 1) == cm.getPlayer().getName() ? "Would you like to start the match?#b\r\n#b#L3# Ready to enter the Battle Arena!!#l\r\n#L1# I'd like to kick another character.#l\r\n#L2# Get me out of here.#l" : "What do you want?#b\r\n#L2# Get me out of here.#l");
action(1, 0, 0);
}
function action(mode, type, selection){
status++;
if(mode != 1){
if(mode == 0 && type == 0)
status -= 2;
else{
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0) {
cm.dispose();
return;
}
}
if(cm.getPlayer().getMapId() % 10 == 1){
if (status == 0){
if (sel == undefined)
sel = selection;
if(sel == 0){
if(cm.haveItem(2270002))
cm.sendNext("You already have #b#t2270002##k.");
else if(cm.canHold(2270002) && cm.canHold(2100067)){
if(cm.haveItem(2100067))
cm.removeAll(2100067);
cm.gainItem(2270002, 50);
cm.gainItem(2100067, 5);
cm.sendNext("Now lower the HP of the monsters, and use #b#t2270002##k to absorb their power!");
}else
cm.sendNext("Check and see if your Use inventory is full or not");
cm.dispose();
}else if(sel == 1)
cm.sendNext("What do you need to do? You must be new to this. Allow me explain in detail.");
else
cm.sendYesNo("Are you sure you want to leave?"); //No GMS like.
} else if (status == 1){
if(type == 1){
cm.removeAll(4031868);
cm.removeAll(2270002);
cm.removeAll(2100067);
cm.warp(980010020);
cm.dispose();
return;
if (cm.getPlayer().getMapId() == 980010100 || cm.getPlayer().getMapId() == 980010200 || cm.getPlayer().getMapId() == 980010300) {
if (cm.getPlayer().getMapId() == 980010100) {
exped = MapleExpeditionType.ARIANT;
expedicao = cm.getExpedition(exped);
} else if (cm.getPlayer().getMapId() == 980010200) {
exped = MapleExpeditionType.ARIANT1;
expedicao = cm.getExpedition(exped);
} else {
exped = MapleExpeditionType.ARIANT2;
expedicao = cm.getExpedition(exped);
}
cm.sendNextPrev("It's really simple, actually. You'll receive #b#t2270002##k from me, and your task is to eliminate a set amount of HP from the monster, then use #b#t2270002##k to absorb its monstrous power.");
} else if (status == 2)
cm.sendNextPrev("It's simple. If you absorb the power of the monster #b#t2270002##k, then you'll make #b#t4031868##k, which is something Queen Areda loves. The combatant with the most jewels wins the match. It's actually a smart idea to prevent others from absorbing in order to win.");
else if (status == 3)
cm.sendNextPrev("One thing. Using #b#t2100067##k, you can steal #b#t4031868##k from your enemies. Warning: #rYou may not use pets for this.#k Understood?!");
else if (status == 4)
cm.dispose();
}else{
var nextchar = cm.getMap(cm.getPlayer().getMapId()).getCharacters().iterator();
if(status == 0){
if (sel == undefined)
sel = selection;
if(sel == 1)
if(cm.getPlayerCount(cm.getPlayer().getMapId()) > 1){
var text = "Who would you like to kick from room?"; //Not GMS like text
var name;
for(var i = 0; nextchar.hasNext(); i++){
name = nextchar.next().getName();
if(!cm.getPlayer().getAriantRoomLeaderName(((cm.getPlayer().getMapId() / 100) % 10) - 1).equals(name))
text += "\r\n#b#L" + i + "#" + name + "#l";
expedMembers = expedicao.getMemberList();
if (status == 0) {
if (cm.getIsLeaderExpedition(exped)) {
cm.sendSimple("O que voce gostaria de fazer?#b\r\n\r\n#L1#Ver registro atual da arena!#l\r\n#L2#Banir player!#l\r\n#L3#Comece a luta!#l\r\n#L4#Sair desta arena!#l");
status = 1;
} else {
var toSend = "Voce tem atualmente essas pessoas em sua arena :\r\n#b";
toSend += cm.getNomeDosMembrosExpedition(exped);
cm.sendOk(toSend);
cm.dispose();
}
} else if (status == 1) {
if (selection == 1) {
var toSend = "Voce tem atualmente essas pessoas em sua arena :\r\n#b";
toSend += cm.getNomeDosMembrosExpedition(exped);
cm.sendOk(toSend);
cm.dispose();
} else if (selection == 2) {
var size = expedMembers.size();
if (size == 1) {
cm.sendOk("You are the only member of the expedition.");
cm.dispose();
return;
}
var text = "The following members make up your expedition (Click on them to expel them):\r\n";
text += "\r\n\t\t1." + expedicao.getLeader().getName();
for (var i = 1; i < size; i++) {
text += "\r\n#b#L" + (i + 1) + "#" + (i + 1) + ". " + expedMembers.get(i).getValue() + "#l\n";
}
cm.sendSimple(text);
}else{
cm.sendNext("There's no character that can be kicked right now.");
status = 6;
} else if (selection == 3) {
if (expedicao.getMembers().size() < 1) {
cm.sendOk("Você precisa de mais que 2 jogadores para iniciar.");
cm.dispose();
} else {
if (cm.getParty() != null) {
cm.sendOk("Você não pode entrar na batalha em um grupo.");
cm.dispose();
}
if (cm.getPlayer().getMapId() == 980010100) {
cm.warpExpedition(980010101, exped);
} else if (cm.getPlayer().getMapId() == 980010200) {
cm.warpExpedition(980010201, exped);
} else {
cm.warpExpedition(980010301, exped);
}
cm.dispose();
}
} else if (selection == 4) {
cm.mapMessage(5, "O lider da Arena saiu.");
cm.warpExpedition(980010000, null);
cm.endExpedition(expedicao);
cm.dispose();
}
else if(sel == 2){
if(cm.getPlayer().getAriantRoomLeaderName(((cm.getPlayer().getMapId() / 100) % 10) - 1) == cm.getPlayer().getName())
cm.sendYesNo("Are you sure you want to leave? You're the leader of the Arena, so if you leave, the whole Battle Arena will close.");
else
cm.sendYesNo("Are you sure you want to leave?"); //No GMS like.
}else if(sel == 3)
if(cm.getPlayerCount(cm.getPlayer().getMapId()) > 1)
cm.sendYesNo("The room is all set, and no other character may join this Battle Arena. Do you want to start the game right now?");
else{
cm.sendNext("You'll need at least 2 participants inside in order to start the match.");
} else if (status == 6) {
if (selection > 0) {
var banned = expedMembers.get(selection - 1);
expedicao.ban(banned);
cm.sendOk("You have banned " + banned.getValue() + " from the expedition.");
cm.dispose();
} else {
cm.sendSimple(list);
status = 2;
}
}
} else if (cm.getPlayer().getMapId() == 980010101 || cm.getPlayer().getMapId() == 980010201 || cm.getPlayer().getMapId() == 980010301) {
if (cm.getPlayer().getMapId() == 980010100) {
exped = MapleExpeditionType.ARIANT;
expedicao = cm.getExpedition(exped);
} else if (cm.getPlayer().getMapId() == 980010200) {
exped = MapleExpeditionType.ARIANT1;
expedicao = cm.getExpedition(exped);
} else {
exped = MapleExpeditionType.ARIANT2;
expedicao = cm.getExpedition(exped);
}
if (status == 0) {
var gotTheBombs = expedicao.getProperty("gotBomb" + cm.getChar().getId());
if (gotTheBombs != null) {
cm.sendOk("Eu ja lhe dei as bombas, por favor, mate os #eEscorpioes#n para conseguir mais na proxima!");
cm.dispose();
} else {
cm.sendOk("Eu lhe dei (5) #b#eBombas#k#n e (50) #b#eRochas Elementais#k#n.\r\nUse as rochas elementais para capturar os escorpioes para Sra.#r#eSpirit Jewels#k#n!");
expedicao.setProperty("gotBomb" + cm.getChar().getId(), "got");
cm.gainItem(2270002, 50);
cm.gainItem(2100067, 5);
cm.dispose();
}
}else if (status == 1){
if(sel == 1){
for(var i = 0; nextchar.hasNext(); i++)
if(i == selection){
nextchar.next().changeMap(cm.getMap(980010000));
break;
}else
nextchar.next();
cm.sendNext("Player have been kicked out of the Arena."); //Not GMS like
}else if(sel == 2){
if(cm.getPlayer().getAriantRoomLeaderName(((cm.getPlayer().getMapId() / 100) % 10) - 1) != cm.getPlayer().getName())
cm.warp(980010000);
else{
cm.getPlayer().removeAriantRoom((cm.getPlayer().getMapId() / 100) % 10);
cm.mapMessage(6, cm.getPlayer().getName() + " has left the Arena, so the Arena will now close.");
cm.warpMap(980010000);
}
}else{
cm.warpMap(cm.getPlayer().getMapId() + 1);
//}
//cm.getPlayer().getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(cm.getPlayer().getName(), 0, true));
}
cm.dispose();
}
}
}

View File

@@ -47,6 +47,7 @@ public enum MapleBuffStat {
GHOST_MORPH(0x20000L),
AURA(0x40000L),
CONFUSE(0x80000L),
ARIANT_PQ_SHIELD(0x40000L),
// ------ COUPON feature ------

View File

@@ -1,25 +1,3 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 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 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 otheer version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; witout 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 client;
import java.awt.Point;
@@ -126,7 +104,6 @@ import client.newyear.NewYearCardRecord;
import constants.ExpTable;
import constants.GameConstants;
import constants.ItemConstants;
import constants.LinguaConstants;
import constants.ServerConstants;
import constants.skills.Aran;
import constants.skills.Beginner;
@@ -320,7 +297,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
private int banishSp = -1;
private long banishTime = 0;
private long lastExpGainTime;
public ScheduledFuture<?> pqMapleMap;
public ScheduledFuture<?> ariantScore;
private MapleCharacter() {
super.setListener(new AbstractCharacterListener() {
@Override
@@ -1944,12 +1923,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
this.getMonsterBook().addCard(client, mItem.getItemId());
}
} else if (MapleInventoryManipulator.addFromDrop(client, mItem, true)) {
} else if (mItem.getItemId() == 4031868) {
this.getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), this.getItemQuantity(4031868, false), false));
} else {
client.announce(MaplePacketCreator.enableActions());
return;
}
if (mItem.getItemId() == 4031868) {
updateAriantScore();
getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), this.getItemQuantity(4031868, false), false));
}
this.getMap().pickItemDrop(pickupPacket, mapitem);
} else if (!hasSpaceInventory) {
@@ -5780,6 +5761,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
if (hpDecreaseTask != null) {
hpDecreaseTask.cancel(false);
}
cancelPqMapleMap();
cancelAriantScore();
}
public void cancelPqMapleMap() {
if (pqMapleMap != null) {
pqMapleMap.cancel(true);
pqMapleMap = null;
}
}
public void cancelAriantScore() {
if (ariantScore != null) {
ariantScore.cancel(true);
ariantScore = null;
}
}
private int getChangedJobSp(MapleJob newJob) {
@@ -7007,12 +7004,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
private void playerDead() {
if (this.getMap().isCPQMap()) {
int lost = getCP();
if (lost > 6) {
lost = 6;
int losing = getMap().getDeathCP();
if (getCP() < losing) {
losing = getCP();
}
getMap().broadcastMessage(MaplePacketCreator.playerDiedMessage(getName(), lost, getTeam()));
gainCP(-lost);
getMap().broadcastMessage(MaplePacketCreator.playerDiedMessage(getName(), losing, getTeam()));
gainCP(-losing);
return;
}
cancelAllBuffs(false);
@@ -10226,4 +10223,41 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
getClient().getAbstractPlayerInteraction().gainItem(item.getItemId(), item.getQuantity());
}
}
public int getAriantScore() {
return this.countItem(4031868);
}
public void updateAriantScore() {
this.getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), getAriantScore(), false));
}
public void disease(int type, int level) {
if (MapleDisease.getBySkill(type) == null) {
return;
}
giveDebuff(MapleDisease.getBySkill(type), MobSkillFactory.getMobSkill(type, level));
}
public void shield() {
List<Pair<MapleBuffStat, Integer>> ldsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.ARIANT_PQ_SHIELD, 1));
getMap().broadcastMessage(this, MaplePacketCreator.giveForeignBuff(id, ldsstat), false);
}
public ScheduledFuture<?> getPqMapleMap() {
return pqMapleMap;
}
public void setPqMapleMap(ScheduledFuture<?> pqMapleMap) {
this.pqMapleMap = pqMapleMap;
}
public ScheduledFuture<?> getAriantScoreBord() {
return ariantScore;
}
public void setAriantScore(ScheduledFuture<?> ariantScore) {
this.ariantScore = ariantScore;
}
}

View File

@@ -81,6 +81,8 @@ import server.quest.MapleQuest;
import net.server.audit.locks.MonitoredLockType;
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
import net.server.coordinator.MapleLoginBypassCoordinator;
import server.expeditions.MapleExpedition;
import server.expeditions.MapleExpeditionType;
public class MapleClient {
@@ -767,7 +769,7 @@ public class MapleClient {
try {
Connection con = DatabaseConnection.getConnection();
try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET loggedin = ?, lastlogin = ? WHERE id = ?")) {
// using sql currenttime here could potentially break the login, thanks Arnah for pointing this out
// using sql currenttime here could potentially break the login, thanks Arnah for pointing this out
ps.setInt(1, newstate);
ps.setTimestamp(2, new java.sql.Timestamp(Server.getInstance().getCurrentTime()));
@@ -884,6 +886,9 @@ public class MapleClient {
if (player.getMonsterCarnival() != null) {
player.getMonsterCarnival().playerDisconnected(getPlayer().getId());
}
cancelarAriantPQ();
}
if (player.getMap() != null) {
@@ -899,6 +904,20 @@ public class MapleClient {
}
}
public void cancelarAriantPQ() {
MapleExpedition exp = null;
if (player.getMapId() == 980010101) {
exp = player.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT);
} else if (player.getMapId() == 980010201) {
exp = player.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT1);
} else {
exp = player.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT2);
}
if (exp != null && (player.getMapId() == 980010101 || player.getMapId() == 980010201 || player.getMapId() == 980010301) && player.getMap().getAllPlayer().size() == 1) {
getAbstractPlayerInteraction().endExpedition(exp);
}
}
public final void disconnect(final boolean shutdown, final boolean cashshop) {
if (canDisconnect()) {
ThreadManager.getInstance().newTask(new Runnable() {
@@ -985,7 +1004,7 @@ public class MapleClient {
chrg.setCharacter(null);
}
wserv.removePlayer(player);
//getChannelServer().removePlayer(player); already being done
//getChannelServer().removePlayer(player); already being done
player.saveCooldowns();
player.cancelAllDebuffs();
@@ -1448,7 +1467,7 @@ public class MapleClient {
player.cancelDiseaseExpireTask();
player.cancelSkillCooldownTask();
player.cancelQuestExpirationTask();
//Cancelling magicdoor? Nope
//Cancelling magicdoor? Nope
//Cancelling mounts? Noty
player.getInventory(MapleInventoryType.EQUIPPED).checked(false); //test

View File

@@ -29,7 +29,7 @@ public enum MapleDisease {
SEDUCE(0x80, 128),
FISHABLE(0x100),
ZOMBIFY(0x4000),
CONFUSE(0x80000),
CONFUSE(0x80000, 132),
STUN(0x2000000000000L, 123),
POISON(0x4000000000000L, 125),
SEAL(0x8000000000000L, 120),

View File

@@ -20,6 +20,7 @@ import server.quest.MapleQuest;
public class GameConstants {
public static String[] WORLD_NAMES = {"Scania", "Bera", "Broa", "Windia", "Khaini", "Bellocan", "Mardia", "Kradia", "Yellonde", "Demethos", "Galicia", "El Nido", "Zenith", "Arcenia", "Kastia", "Judis", "Plana", "Kalluna", "Stius", "Croa", "Medere"};
public static final int[] OWL_DATA = new int[]{1082002, 2070005, 2070006, 1022047, 1102041, 2044705, 2340000, 2040017, 1092030, 2040804};
public static final String[] stats = {"tuc", "reqLevel", "reqJob", "reqSTR", "reqDEX", "reqINT", "reqLUK", "reqPOP", "cash", "cursed", "success", "setItemID", "equipTradeBlock", "durability", "randOption", "randStat", "masterLevel", "reqSkillLevel", "elemDefault", "incRMAS", "incRMAF", "incRMAI", "incRMAL", "canLevel", "skill", "charmEXP"};
public static final int[] CASH_DATA = new int[]{50200004, 50200069, 50200117, 50100008, 50000047};
// Ronan's rates upgrade system

View File

@@ -88,6 +88,7 @@ import constants.ServerConstants;
import java.util.TimeZone;
import net.server.coordinator.MapleSessionCoordinator;
import server.CashShop.CashItemFactory;
import server.MapleItemInformationProvider;
import server.MapleSkillbookInformationProvider;
import server.ThreadManager;
import server.TimerManager;
@@ -924,6 +925,7 @@ public class Server {
//MapleItemInformationProvider.getInstance().getAllItems(); //unused, rofl
CashItemFactory.getSpecialCashItems();
MapleItemInformationProvider.getInstance().getAllItems();
System.out.println("Items loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds");
timeToTake = System.currentTimeMillis();

View File

@@ -34,7 +34,6 @@ import constants.GameConstants;
import constants.ItemConstants;
import constants.ServerConstants;
import constants.skills.Aran;
import constants.skills.Corsair;
import java.awt.Point;
import java.util.Collections;
@@ -44,6 +43,7 @@ import java.util.List;
import net.AbstractMaplePacketHandler;
import client.inventory.manipulator.MapleInventoryManipulator;
import server.MapleStatEffect;
import server.life.MapleLifeFactory;
import server.life.MapleLifeFactory.loseItem;
import server.life.MapleMonster;
import server.life.MobAttackInfo;
@@ -87,15 +87,19 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
}
}
if (attacker != null) {
if (attacker != null || monsteridfrom == 9300166) {
List<loseItem> loseItems;
if (attacker.isBuffed(MonsterStatus.NEUTRALISE)) {
if (monsteridfrom != 9300166 && attacker.isBuffed(MonsterStatus.NEUTRALISE)) {
return;
}
if (damage > 0) {
MapleMonster assaulter = map.getMonsterById(monsteridfrom);
if (monsteridfrom == 9300166) {
assaulter = MapleLifeFactory.getMonster(monsteridfrom);
}
if(assaulter != null) {
loseItems = assaulter.getStats().loseItem();
if (loseItems != null) {
@@ -106,8 +110,14 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
for (loseItem loseItem : loseItems) {
type = ItemConstants.getInventoryType(loseItem.getId());
for (byte b = 0; b < loseItem.getX(); b++) {//LOL?
boolean buffAtivo = false;
if (Randomizer.nextInt(100) < loseItem.getChance()) {
if (chr.haveItem(loseItem.getId())) {
for (Integer inteiro : chr.getAvailableBuffs()) {
if (inteiro == -2022269) {
buffAtivo = true;
}
}
if (chr.haveItem(loseItem.getId()) && !buffAtivo) {
pos.x = (int) (playerpos + ((d % 2 == 0) ? (25 * (d + 1) / 2) : -(25 * (d / 2))));
MapleInventoryManipulator.removeById(c, type, loseItem.getId(), 1, false, false);
map.spawnItemDrop(chr, chr, new Item(loseItem.getId(), (short) 0, (short) 1), map.calcDropPos(pos, chr.getPosition()), true, true);
@@ -118,7 +128,9 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
}
}
}
map.removeMapObject(attacker);
if(monsteridfrom != 9300166) {
map.removeMapObject(attacker);
}
}
}
}

View File

@@ -1,24 +1,24 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 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 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 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.
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/>.
*/
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 net.server.channel.handlers;
import client.MapleCharacter;
@@ -29,6 +29,7 @@ import constants.ItemConstants;
import net.AbstractMaplePacketHandler;
import net.server.Server;
import client.inventory.manipulator.MapleInventoryManipulator;
import server.MapleItemInformationProvider;
import server.life.MapleMonster;
import tools.MaplePacketCreator;
import tools.data.input.SeekableLittleEndianAccessor;
@@ -38,6 +39,7 @@ import tools.data.input.SeekableLittleEndianAccessor;
* @author kevintjuh93
*/
public final class UseCatchItemHandler extends AbstractMaplePacketHandler {
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
MapleCharacter chr = c.getPlayer();
@@ -48,140 +50,37 @@ public final class UseCatchItemHandler extends AbstractMaplePacketHandler {
int itemId = slea.readInt();
int monsterid = slea.readInt();
int itemGanho = MapleItemInformationProvider.getInstance().getCreatItem(itemId);
int mobItem = MapleItemInformationProvider.getInstance().getMobItem(itemId);
int timeCatch = MapleItemInformationProvider.getInstance().getUseDelay(itemId);
int mobHp = MapleItemInformationProvider.getInstance().getMobHP(itemId);
MapleMonster mob = chr.getMap().getMonsterByOid(monsterid);
if (chr.getInventory(ItemConstants.getInventoryType(itemId)).countById(itemId) <= 0) {
return;
return;
}
if (mob == null) {
return;
return;
}
switch (itemId) {
case 2270000:
if (mob.getId() == 9300101) {
if (itemGanho != 0 && mobItem == mob.getId()) {
if (timeCatch != 0 && (abm.getLastSpam(10) + timeCatch) < currentServerTime()) {
if (mobHp != 0 && mob.getHp() < ((mob.getMaxHp() / 100) * mobHp)) {
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 1902000, (short) 1, "", -1);
}
c.announce(MaplePacketCreator.enableActions());
break;
case 2270001:
if (mob.getId() == 9500197) {
if ((abm.getLastSpam(10) + 1000) < currentServerTime()) {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 4031830, (short) 1, "", -1);
} else {
abm.spam(10);
c.announce(MaplePacketCreator.catchMessage(0));
}
MapleInventoryManipulator.addById(c, itemGanho, (short) 1, "", -1);
if (itemGanho == 4031868) {
chr.updateAriantScore();
}
c.announce(MaplePacketCreator.enableActions());
}
break;
case 2270002:
if (mob.getId() == 9300157) {
if ((abm.getLastSpam(10) + 800) < currentServerTime()) {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
if (Math.random() < 0.5) { // 50% chance
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 4031868, (short) 1, "", -1);
} else {
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 0));
}
abm.spam(10);
} else {
c.announce(MaplePacketCreator.catchMessage(0));
}
}
c.announce(MaplePacketCreator.enableActions());
}
break;
case 2270003:
if (mob.getId() == 9500320) {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 4031887, (short) 1, "", -1);
} else {
c.announce(MaplePacketCreator.catchMessage(0));
}
}
c.announce(MaplePacketCreator.enableActions());
break;
case 2270005:
if (mob.getId() == 9300187) {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 2109001, (short) 1, "", -1);
} else {
c.announce(MaplePacketCreator.catchMessage(0));
}
}
c.announce(MaplePacketCreator.enableActions());
break;
case 2270006:
if (mob.getId() == 9300189) {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 2109002, (short) 1, "", -1);
} else {
c.announce(MaplePacketCreator.catchMessage(0));
}
}
c.announce(MaplePacketCreator.enableActions());
break;
case 2270007:
if (mob.getId() == 9300191) {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 2109003, (short) 1, "", -1);
} else {
c.announce(MaplePacketCreator.catchMessage(0));
}
}
c.announce(MaplePacketCreator.enableActions());
break;
case 2270004:
if (mob.getId() == 9300175) {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 4001169, (short) 1, "", -1);
} else {
} else if (mobHp != 0 && mob.getId() != 9500336) {
abm.spam(10);
c.announce(MaplePacketCreator.catchMessage(0));
}
} else if (mob.getId() == 9500336) {
chr.message("You cannot use the Fishing Net yet.");
}
c.announce(MaplePacketCreator.enableActions());
break;
case 2270008:
if (mob.getId() == 9500336) {
if ((abm.getLastSpam(10) + 3000) < currentServerTime()) {
abm.spam(10);
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 2022323, (short) 1, "", -1);
} else {
chr.message("You cannot use the Fishing Net yet.");
}
c.announce(MaplePacketCreator.enableActions());
}
break;
default:
// System.out.println("UseCatchItemHandler: \r\n" + slea.toString());
}
}
c.announce(MaplePacketCreator.enableActions());
}
}

View File

@@ -72,6 +72,25 @@ public class MapleDataTool {
return getInt(data);
}
}
public static int getIntConvert(MapleData d, int def) {
if (d == null) {
return def;
}
if (d.getType() == MapleDataType.STRING) {
String dd = getString(d);
if (dd.endsWith("%")) {
dd = dd.substring(0, dd.length() - 1);
}
try {
return Integer.parseInt(dd);
} catch (NumberFormatException nfe) {
return def;
}
} else {
return getInt(d, def);
}
}
public static int getIntConvert(String path, MapleData data) {
MapleData d = data.getChildByPath(path);

View File

@@ -55,7 +55,6 @@ import tools.MaplePacketCreator;
import client.MapleCharacter;
import client.MapleClient;
import client.MapleQuestStatus;
import client.MapleStat;
import client.SkillFactory;
import client.inventory.Equip;
import client.inventory.Item;
@@ -331,7 +330,7 @@ public class AbstractPlayerInteraction {
return true;
}
//---- \/ \/ \/ \/ \/ \/ \/ NOT TESTED \/ \/ \/ \/ \/ \/ \/ \/ \/ ----
//---- \/ \/ \/ \/ \/ \/ \/ NOT TESTED \/ \/ \/ \/ \/ \/ \/ \/ \/ ----
public final MapleQuestStatus getQuestRecord(final int id) {
return c.getPlayer().getQuestNAdd(MapleQuest.getInstance(id));
}
@@ -340,7 +339,7 @@ public class AbstractPlayerInteraction {
return c.getPlayer().getQuestNoAdd(MapleQuest.getInstance(id));
}
//---- /\ /\ /\ /\ /\ /\ /\ NOT TESTED /\ /\ /\ /\ /\ /\ /\ /\ /\ ----
//---- /\ /\ /\ /\ /\ /\ /\ NOT TESTED /\ /\ /\ /\ /\ /\ /\ /\ /\ ----
public void openNpc(int npcid) {
openNpc(npcid, null);
}
@@ -745,7 +744,7 @@ public class AbstractPlayerInteraction {
}
public void givePartyExp(String PQ, boolean instance) {
//1 player = +0% bonus (100)
//1 player = +0% bonus (100)
//2 players = +0% bonus (100)
//3 players = +0% bonus (100)
//4 players = +10% bonus (110)
@@ -1025,6 +1024,33 @@ public class AbstractPlayerInteraction {
return null;
}
public String getNomeDosMembrosExpedition(MapleExpeditionType tipo) {
String membros = "";
MapleExpedition expedicao = getExpedition(tipo);
for (String memberName : expedicao.getMembers().values()) {
membros += "" + memberName + ", ";
}
return membros;
}
public boolean getIsLeaderExpedition(MapleExpeditionType tipo) {
MapleExpedition expedicao = getExpedition(tipo);
return expedicao.isLeader(getPlayer());
}
public void warpExpedition(int mapId, MapleExpeditionType tipo) {
if (tipo != null ) {
MapleExpedition expedicao = getExpedition(tipo);
for (MapleCharacter chr : expedicao.getActiveMembers()) {
chr.changeMap(mapId);
}
} else {
for (MapleCharacter chr : getMap().getAllPlayers()) {
chr.changeMap(mapId);
}
}
}
public long getJailTimeLeft() {
return getPlayer().getJailExpirationTimeLeft();
}

File diff suppressed because it is too large Load Diff

View File

@@ -116,6 +116,10 @@ public class MapleItemInformationProvider {
protected Map<Integer, Boolean> karmaCache = new HashMap<>();
protected Map<Integer, Integer> triggerItemCache = new HashMap<>();
protected Map<Integer, Integer> expCache = new HashMap<>();
protected Map<Integer, Integer> createItem = new HashMap<>();
protected Map<Integer, Integer> mobItem = new HashMap<>();
protected Map<Integer, Integer> useDelay = new HashMap<>();
protected Map<Integer, Integer> mobHP = new HashMap<>();
protected Map<Integer, Integer> levelCache = new HashMap<>();
protected Map<Integer, Pair<Integer, List<RewardItem>>> rewardCache = new HashMap<>();
protected List<Pair<Integer, String>> itemNameCache = new ArrayList<>();
@@ -150,40 +154,6 @@ public class MapleItemInformationProvider {
isPartyQuestItemCache.put(0, false);
}
// public MapleInventoryType getInventoryType(int itemId) {
// if (inventoryTypeCache.containsKey(itemId)) {
// return inventoryTypeCache.get(itemId);
// }
// MapleInventoryType ret;
// String idStr = "0" + String.valueOf(itemId);
// MapleDataDirectoryEntry root = itemData.getRoot();
// for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
// for (MapleDataFileEntry iFile : topDir.getFiles()) {
// if (iFile.getName().equals(idStr.substring(0, 4) + ".img")) {
// ret = MapleInventoryType.getByWZName(topDir.getName());
// inventoryTypeCache.put(itemId, ret);
// return ret;
// } else if (iFile.getName().equals(idStr.substring(1) + ".img")) {
// ret = MapleInventoryType.getByWZName(topDir.getName());
// inventoryTypeCache.put(itemId, ret);
// return ret;
// }
// }
// }
// root = equipData.getRoot();
// for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
// for (MapleDataFileEntry iFile : topDir.getFiles()) {
// if (iFile.getName().equals(idStr + ".img")) {
// ret = MapleInventoryType.EQUIP;
// inventoryTypeCache.put(itemId, ret);
// return ret;
// }
// }
// }
// ret = MapleInventoryType.UNDEFINED;
// inventoryTypeCache.put(itemId, ret);
// return ret;
// }
public List<Pair<Integer, String>> getAllItems() {
if (!itemNameCache.isEmpty()) {
@@ -1176,7 +1146,10 @@ public class MapleItemInformationProvider {
if (item == null) {
return null;
}
MapleData spec = item.getChildByPath("spec");
MapleData spec = item.getChildByPath("specEx");
if (spec == null) {
spec = item.getChildByPath("spec");
}
ret = MapleStatEffect.loadItemEffectFromData(spec, itemId);
itemEffects.put(Integer.valueOf(itemId), ret);
}
@@ -1479,6 +1452,46 @@ public class MapleItemInformationProvider {
return triggerItem;
}
}
public int getCreatItem(int itemId) {
if (createItem.containsKey(itemId)) {
return createItem.get(itemId);
} else {
int itemFrom = MapleDataTool.getIntConvert("info/create", getItemData(itemId), 0);
createItem.put(itemId, itemFrom);
return itemFrom;
}
}
public int getMobItem(int itemId) {
if (mobItem.containsKey(itemId)) {
return mobItem.get(itemId);
} else {
int mobItemCatch = MapleDataTool.getIntConvert("info/mob", getItemData(itemId), 0);
mobItem.put(itemId, mobItemCatch);
return mobItemCatch;
}
}
public int getUseDelay(int itemId) {
if (useDelay.containsKey(itemId)) {
return useDelay.get(itemId);
} else {
int mobUseDelay = MapleDataTool.getIntConvert("info/useDelay", getItemData(itemId), 0);
useDelay.put(itemId, mobUseDelay);
return mobUseDelay;
}
}
public int getMobHP(int itemId) {
if (mobHP.containsKey(itemId)) {
return mobHP.get(itemId);
} else {
int mobHPItem = MapleDataTool.getIntConvert("info/mobHP", getItemData(itemId), 0);
mobHP.put(itemId, mobHPItem);
return mobHPItem;
}
}
public int getExpById(int itemId) {
if (expCache.containsKey(itemId)) {

View File

@@ -125,10 +125,10 @@ public class MapleStatEffect {
private short watk, matk, wdef, mdef, acc, avoid, speed, jump;
private short hp, mp;
private double hpR, mpR;
private short mhpRRate, mmpRRate;
private short mhpRRate, mmpRRate, mobSkill, mobSkillLevel;
private byte mhpR, mmpR;
private short mpCon, hpCon;
private int duration;
private int duration, target, barrier, mob;
private boolean overTime, repeatEffect;
private int sourceid;
private int moveTo;
@@ -208,6 +208,24 @@ public class MapleStatEffect {
ret.fatigue = MapleDataTool.getInt("incFatigue", source, 0);
ret.repeatEffect = MapleDataTool.getInt("repeatEffect", source, 0) > 0;
MapleData mdd = source.getChildByPath("0");
if (mdd != null && mdd.getChildren().size() > 0) {
ret.mobSkill = (short) MapleDataTool.getInt("mobSkill", mdd, 0);
ret.mobSkillLevel = (short) MapleDataTool.getInt("level", mdd, 0);
ret.target = MapleDataTool.getInt("target", mdd, 0);
} else {
ret.mobSkill = 0;
ret.mobSkillLevel = 0;
ret.target = 0;
}
ret.barrier = MapleDataTool.getInt("barrier", source, 0);
MapleData mdds = source.getChildByPath("mob");
if (mdds != null) {
if (mdds.getChildren()!= null && mdds.getChildren().size() > 0) {
ret.mob = MapleDataTool.getInt("mob", mdds, 0);
}
}
ret.sourceid = sourceid;
ret.skill = skill;
if (!ret.skill && ret.duration > -1) {
@@ -228,8 +246,15 @@ public class MapleStatEffect {
ret.speed = (short) MapleDataTool.getInt("speed", source, 0);
ret.jump = (short) MapleDataTool.getInt("jump", source, 0);
if (MapleDataTool.getInt("barrier", source, 0) > 0) {
ret.barrier = MapleDataTool.getInt("barrier", source, 0);
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.ARIANT_PQ_SHIELD, Integer.valueOf(1));
}
ret.mapProtection = mapProtection(sourceid);
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_PROTECTION, Integer.valueOf(ret.mapProtection));
if (ret.overTime && ret.getSummonMovementType() == null) {
if (!skill) {
@@ -974,8 +999,19 @@ public class MapleStatEffect {
applyfrom.dispelDebuff(debuff);
}
}
} else if (mobSkill > 0 && mobSkillLevel > 0) {
if (target > 0) {
for (MapleCharacter chr : applyto.getMap().getAllPlayers()) {
if (chr.getId() != applyto.getId()) {
chr.disease(mobSkill, mobSkillLevel);
}
}
} else {
applyto.disease(mobSkill, mobSkillLevel);
}
} else if (barrier > 0) {
applyto.shield();
}
return true;
}
@@ -1195,7 +1231,6 @@ public class MapleStatEffect {
localstatups = statups;
}
buff = MaplePacketCreator.giveBuff(localsourceid, localDuration, localstatups);
mbuff = MaplePacketCreator.showMonsterRiding(applyto.getId(), givemount);
localDuration = duration;

View File

@@ -1,25 +1,3 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 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 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 server.expeditions;
import java.text.SimpleDateFormat;
@@ -41,6 +19,10 @@ import server.maps.MapleMap;
import tools.LogHelper;
import tools.MaplePacketCreator;
import client.MapleCharacter;
import java.util.Properties;
import net.server.audit.locks.MonitoredLockType;
import net.server.audit.locks.MonitoredReentrantLock;
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
/**
*
@@ -48,236 +30,307 @@ import client.MapleCharacter;
*/
public class MapleExpedition {
private static final int [] EXPEDITION_BOSSES = {
8800000,// - Zakum's first body
8800001,// - Zakum's second body
8800002,// - Zakum's third body
8800003,// - Zakum's Arm 1
8800004,// - Zakum's Arm 2
8800005,// - Zakum's Arm 3
8800006,// - Zakum's Arm 4
8800007,// - Zakum's Arm 5
8800008,// - Zakum's Arm 6
8800009,// - Zakum's Arm 7
8800010,// - Zakum's Arm 8
8810000,// - Horntail's Left Head
8810001,// - Horntail's Right Head
8810002,// - Horntail's Head A
8810003,// - Horntail's Head B
8810004,// - Horntail's Head C
8810005,// - Horntail's Left Hand
8810006,// - Horntail's Right Hand
8810007,// - Horntail's Wings
8810008,// - Horntail's Legs
8810009,// - Horntail's Tails
9420546,// - Scarlion Boss
9420547,// - Scarlion Boss
9420548,// - Angry Scarlion Boss
9420549,// - Furious Scarlion Boss
9420541,// - Targa
9420542,// - Targa
9420543,// - Angry Targa
9420544,// - Furious Targa
};
private MapleCharacter leader;
private MapleExpeditionType type;
private boolean registering;
private MapleMap startMap;
private List<String> bossLogs;
private ScheduledFuture<?> schedule;
private Map<Integer, String> members = new ConcurrentHashMap<>();
private List<Integer> banned = new CopyOnWriteArrayList<>();
private long startTime;
private static final int[] EXPEDITION_BOSSES = {
8800000,// - Zakum's first body
8800001,// - Zakum's second body
8800002,// - Zakum's third body
8800003,// - Zakum's Arm 1
8800004,// - Zakum's Arm 2
8800005,// - Zakum's Arm 3
8800006,// - Zakum's Arm 4
8800007,// - Zakum's Arm 5
8800008,// - Zakum's Arm 6
8800009,// - Zakum's Arm 7
8800010,// - Zakum's Arm 8
8810000,// - Horntail's Left Head
8810001,// - Horntail's Right Head
8810002,// - Horntail's Head A
8810003,// - Horntail's Head B
8810004,// - Horntail's Head C
8810005,// - Horntail's Left Hand
8810006,// - Horntail's Right Hand
8810007,// - Horntail's Wings
8810008,// - Horntail's Legs
8810009,// - Horntail's Tails
9420546,// - Scarlion Boss
9420547,// - Scarlion Boss
9420548,// - Angry Scarlion Boss
9420549,// - Furious Scarlion Boss
9420541,// - Targa
9420542,// - Targa
9420543,// - Angry Targa
9420544,// - Furious Targa
};
public MapleExpedition(MapleCharacter player, MapleExpeditionType met) {
leader = player;
members.put(player.getId(), player.getName());
startMap = player.getMap();
type = met;
bossLogs = new CopyOnWriteArrayList<>();
beginRegistration();
}
private MapleCharacter leader;
private MapleExpeditionType type;
private boolean registering;
private MapleMap startMap;
private List<String> bossLogs;
private ScheduledFuture<?> schedule;
private Map<Integer, String> members = new ConcurrentHashMap<>();
private List<Integer> banned = new CopyOnWriteArrayList<>();
private long startTime;
private Properties props = new Properties();
private MonitoredReentrantLock pL = MonitoredReentrantLockFactory.createLock(MonitoredLockType.EIM_PARTY, true);
private void beginRegistration() {
registering = true;
leader.announce(MaplePacketCreator.getClock(type.getRegistrationTime() * 60));
startMap.broadcastMessage(leader, MaplePacketCreator.serverNotice(6, "[Expedition] " + leader.getName() + " has been declared the expedition captain. Please register for the expedition."), false);
leader.announce(MaplePacketCreator.serverNotice(6, "[Expedition] You have become the expedition captain. Gather enough people for your team then talk to the NPC to start."));
scheduleRegistrationEnd();
}
public MapleExpedition(MapleCharacter player, MapleExpeditionType met) {
leader = player;
members.put(player.getId(), player.getName());
startMap = player.getMap();
type = met;
bossLogs = new CopyOnWriteArrayList<>();
beginRegistration();
}
private void scheduleRegistrationEnd() {
final MapleExpedition exped = this;
startTime = System.currentTimeMillis() + type.getRegistrationTime() * 60 * 1000;
schedule = TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (registering){
startMap.getChannelServer().getExpeditions().remove(exped);
startMap.broadcastMessage(MaplePacketCreator.serverNotice(6, "[Expedition] The time limit has been reached. Expedition has been disbanded."));
dispose(false);
}
}
}, type.getRegistrationTime() * 60 * 1000);
}
private void beginRegistration() {
registering = true;
leader.announce(MaplePacketCreator.getClock(type.getRegistrationTime() * 60));
startMap.broadcastMessage(leader, MaplePacketCreator.serverNotice(6, "[Expedition] " + leader.getName() + " has been declared the expedition captain. Please register for the expedition."), false);
leader.announce(MaplePacketCreator.serverNotice(6, "[Expedition] You have become the expedition captain. Gather enough people for your team then talk to the NPC to start."));
public void dispose(boolean log){
broadcastExped(MaplePacketCreator.removeClock());
if (schedule != null){
schedule.cancel(false);
}
if (log && !registering){
LogHelper.logExpedition(this);
}
}
if (!MapleExpeditionType.ARIANT.equals(type) && !MapleExpeditionType.ARIANT1.equals(type) && !MapleExpeditionType.ARIANT2.equals(type)) {
scheduleRegistrationEnd();
}
}
public void start(){
registering = false;
broadcastExped(MaplePacketCreator.removeClock());
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] The expedition has started! Good luck, brave heroes!"));
startTime = System.currentTimeMillis();
Server.getInstance().broadcastGMMessage(startMap.getWorld(), MaplePacketCreator.serverNotice(6, "[Expedition] " + type.toString() + " Expedition started with leader: " + leader.getName()));
}
private void scheduleRegistrationEnd() {
final MapleExpedition exped = this;
startTime = System.currentTimeMillis() + type.getRegistrationTime() * 60 * 1000;
public String addMember(MapleCharacter player) {
if (!registering){
return "Sorry, this expedition is already underway. Registration is closed!";
}
if (banned.contains(player.getId())){
return "Sorry, you've been banned from this expedition by #b" + leader.getName() + "#k.";
}
if (members.size() >= type.getMaxSize()){ //Would be a miracle if anybody ever saw this
return "Sorry, this expedition is full!";
}
members.put(player.getId(), player.getName());
player.announce(MaplePacketCreator.getClock((int)(startTime - System.currentTimeMillis()) / 1000));
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + player.getName() + " has joined the expedition!"));
return "You have registered for the expedition successfully!";
}
schedule = TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (registering) {
startMap.getChannelServer().getExpeditions().remove(exped);
startMap.broadcastMessage(MaplePacketCreator.serverNotice(6, "[Expedition] The time limit has been reached. Expedition has been disbanded."));
private void broadcastExped(byte[] packet){
for (MapleCharacter chr : getActiveMembers()){
chr.announce(packet);
}
}
public boolean removeMember(MapleCharacter chr) {
if(members.remove(chr.getId()) != null) {
chr.announce(MaplePacketCreator.removeClock());
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + chr.getName() + " has left the expedition."));
chr.dropMessage(6, "[Expedition] You have left this expedition.");
return true;
dispose(false);
}
return false;
}
}
}, type.getRegistrationTime() * 60 * 1000);
}
public MapleExpeditionType getType() {
return type;
}
public List<MapleCharacter> getActiveMembers() { // thanks MedicOP for figuring out an issue with broadcasting packets to offline members
PlayerStorage ps = startMap.getWorldServer().getPlayerStorage();
List<MapleCharacter> activeMembers = new LinkedList<>();
for (Integer chrid : getMembers().keySet()){
MapleCharacter chr = ps.getCharacterById(chrid);
if (chr != null && chr.isLoggedinWorld()) {
activeMembers.add(chr);
}
}
return activeMembers;
public void dispose(boolean log) {
broadcastExped(MaplePacketCreator.removeClock());
if (schedule != null) {
schedule.cancel(false);
}
public Map<Integer, String> getMembers() {
return new HashMap<>(members);
}
public List<Entry<Integer, String>> getMemberList() {
List<Entry<Integer, String>> memberList = new LinkedList<>();
Entry<Integer, String> leaderEntry = null;
for (Entry<Integer, String> e : getMembers().entrySet()) {
if (!isLeader(e.getKey())) {
memberList.add(e);
} else {
leaderEntry = e;
}
}
if (leaderEntry != null) {
memberList.add(0, leaderEntry);
}
return memberList;
}
props.clear();
if (log && !registering) {
LogHelper.logExpedition(this);
}
}
public MapleCharacter getLeader(){
return leader;
}
public MapleMap getRecruitingMap() {
return startMap;
public void start() {
if (MapleExpeditionType.ARIANT.equals(type) || MapleExpeditionType.ARIANT1.equals(type) || MapleExpeditionType.ARIANT2.equals(type)) {
startTime = System.currentTimeMillis() + type.getRegistrationTime() * 60 * 1000;
}
registering = false;
broadcastExped(MaplePacketCreator.removeClock());
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] The expedition has started! Good luck, brave heroes!"));
broadcastExped(MaplePacketCreator.getClock((int) (startTime - System.currentTimeMillis()) / 1000));
Server.getInstance().broadcastGMMessage(startMap.getWorld(), MaplePacketCreator.serverNotice(6, "[Expedition] " + type.toString() + " Expedition started with leader: " + leader.getName()));
}
public String addMember(MapleCharacter player) {
if (!registering) {
return "Sorry, this expedition is already underway. Registration is closed!";
}
if (banned.contains(player.getId())) {
return "Sorry, you've been banned from this expedition by #b" + leader.getName() + "#k.";
}
if (members.size() >= type.getMaxSize()) { //Would be a miracle if anybody ever saw this
return "Sorry, this expedition is full!";
}
public boolean contains(MapleCharacter player) {
return members.containsKey(player.getId()) || isLeader(player);
}
members.put(player.getId(), player.getName());
player.announce(MaplePacketCreator.getClock((int) (startTime - System.currentTimeMillis()) / 1000));
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + player.getName() + " has joined the expedition!"));
return "You have registered for the expedition successfully!";
}
public boolean isLeader(MapleCharacter player) {
return isLeader(player.getId());
}
public boolean isLeader(int playerid) {
return leader.getId() == playerid;
}
public int addMemberInt(MapleCharacter player) {
if (!registering) {
return 1; //"Sorry, this expedition is already underway. Registration is closed!";
}
if (banned.contains(player.getId())) {
return 2; //"Sorry, you've been banned from this expedition by #b" + leader.getName() + "#k.";
}
if (members.size() >= type.getMaxSize()) { //Would be a miracle if anybody ever saw this
return 3; //"Sorry, this expedition is full!";
}
public boolean isRegistering(){
return registering;
}
members.put(player.getId(), player.getName());
player.announce(MaplePacketCreator.getClock((int) (startTime - System.currentTimeMillis()) / 1000));
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + player.getName() + " has joined the expedition!"));
return 0; //"You have registered for the expedition successfully!";
}
public boolean isInProgress(){
return !registering;
}
private void broadcastExped(byte[] packet) {
for (MapleCharacter chr : getActiveMembers()) {
chr.announce(packet);
}
}
public void ban(Entry<Integer, String> chr) {
int cid = chr.getKey();
if (!banned.contains(cid)) {
banned.add(cid);
members.remove(cid);
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + chr.getValue() + " has been banned from the expedition."));
MapleCharacter player = startMap.getWorldServer().getPlayerStorage().getCharacterById(cid);
if (player != null && player.isLoggedinWorld()) {
player.announce(MaplePacketCreator.removeClock());
player.dropMessage(6, "[Expedition] You have been banned from this expedition.");
}
}
}
public boolean removeMember(MapleCharacter chr) {
if (members.remove(chr.getId()) != null) {
chr.announce(MaplePacketCreator.removeClock());
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + chr.getName() + " has left the expedition."));
chr.dropMessage(6, "[Expedition] You have left this expedition.");
return true;
}
public long getStartTime(){
return startTime;
}
public List<String> getBossLogs(){
return bossLogs;
}
public void monsterKilled(MapleCharacter chr, MapleMonster mob) {
for (int i = 0; i < EXPEDITION_BOSSES.length; i++){
if (mob.getId() == EXPEDITION_BOSSES[i]){ //If the monster killed was a boss
String timeStamp = new SimpleDateFormat("HH:mm:ss").format(new Date());
bossLogs.add(">" + mob.getName() + " was killed after " + LogHelper.getTimeString(startTime) + " - " + timeStamp + "\r\n");
return;
}
}
}
return false;
}
public MapleExpeditionType getType() {
return type;
}
public List<MapleCharacter> getActiveMembers() { // thanks MedicOP for figuring out an issue with broadcasting packets to offline members
PlayerStorage ps = startMap.getWorldServer().getPlayerStorage();
List<MapleCharacter> activeMembers = new LinkedList<>();
for (Integer chrid : getMembers().keySet()) {
MapleCharacter chr = ps.getCharacterById(chrid);
if (chr != null && chr.isLoggedinWorld()) {
activeMembers.add(chr);
}
}
return activeMembers;
}
public Map<Integer, String> getMembers() {
return new HashMap<>(members);
}
public List<Entry<Integer, String>> getMemberList() {
List<Entry<Integer, String>> memberList = new LinkedList<>();
Entry<Integer, String> leaderEntry = null;
for (Entry<Integer, String> e : getMembers().entrySet()) {
if (!isLeader(e.getKey())) {
memberList.add(e);
} else {
leaderEntry = e;
}
}
if (leaderEntry != null) {
memberList.add(0, leaderEntry);
}
return memberList;
}
public void ban(Entry<Integer, String> chr) {
int cid = chr.getKey();
if (!banned.contains(cid)) {
banned.add(cid);
members.remove(cid);
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + chr.getValue() + " has been banned from the expedition."));
MapleCharacter player = startMap.getWorldServer().getPlayerStorage().getCharacterById(cid);
if (player != null && player.isLoggedinWorld()) {
player.announce(MaplePacketCreator.removeClock());
player.dropMessage(6, "[Expedition] You have been banned from this expedition.");
if (MapleExpeditionType.ARIANT.equals(type) || MapleExpeditionType.ARIANT1.equals(type) || MapleExpeditionType.ARIANT2.equals(type)) {
player.changeMap(980010000);
}
}
}
}
public void monsterKilled(MapleCharacter chr, MapleMonster mob) {
for (int i = 0; i < EXPEDITION_BOSSES.length; i++) {
if (mob.getId() == EXPEDITION_BOSSES[i]) { //If the monster killed was a boss
String timeStamp = new SimpleDateFormat("HH:mm:ss").format(new Date());
bossLogs.add(">" + mob.getName() + " was killed after " + LogHelper.getTimeString(startTime) + " - " + timeStamp + "\r\n");
return;
}
}
}
public void setProperty(String key, String value) {
pL.lock();
try {
props.setProperty(key, value);
} finally {
pL.unlock();
}
}
public String getProperty(String key) {
pL.lock();
try {
return props.getProperty(key);
} finally {
pL.unlock();
}
}
public MapleCharacter getLeader() {
return leader;
}
public MapleMap getRecruitingMap() {
return startMap;
}
public boolean contains(MapleCharacter player) {
return members.containsKey(player.getId()) || isLeader(player);
}
public boolean isLeader(MapleCharacter player) {
return isLeader(player.getId());
}
public boolean isLeader(int playerid) {
return leader.getId() == playerid;
}
public boolean isRegistering() {
return registering;
}
public boolean isInProgress() {
return !registering;
}
public long getStartTime() {
return startTime;
}
public List<String> getBossLogs() {
return bossLogs;
}
public MapleMap getStartMap() {
return startMap;
}
public void setStartMap(MapleMap startMap) {
this.startMap = startMap;
}
public ScheduledFuture<?> getSchedule() {
return schedule;
}
public void setSchedule(ScheduledFuture<?> schedule) {
this.schedule = schedule;
}
public List<Integer> getBanned() {
return banned;
}
public void setBanned(List<Integer> banned) {
this.banned = banned;
}
}

View File

@@ -39,6 +39,9 @@ public enum MapleExpeditionType {
HORNTAIL(6, 30, 100, 255, 5),
CHAOS_ZAKUM(6, 30, 120, 255, 5),
CHAOS_HORNTAIL(6, 30, 120, 255, 5),
ARIANT(2, 4, 20, 30, 5),
ARIANT1(2, 4, 20, 30, 5),
ARIANT2(2, 4, 20, 30, 5),
PINKBEAN(6, 30, 120, 255, 5),
CWKPQ(6, 30, 90, 255, 5); // CWKPQ min-level 90, found thanks to Cato

View File

@@ -22,8 +22,23 @@
package server.life;
public enum Element {
NEUTRAL, FIRE, ICE, LIGHTING, POISON, HOLY, DARK;
NEUTRAL(0), PHYSICAL(1), FIRE(2, true), ICE(3, true), LIGHTING(4), POISON(5), HOLY(6, true), DARKNESS(7);
private int value;
private boolean special = false;
private Element(int v) {
this.value = v;
}
private Element(int v, boolean special) {
this.value = v;
this.special = special;
}
public boolean isSpecial() {
return special;
}
public static Element getFromChar(char c) {
switch (Character.toUpperCase(c)) {
case 'F':
@@ -37,10 +52,14 @@ public enum Element {
case 'H':
return HOLY;
case 'D':
return DARK;
return DARKNESS;
case 'P':
return NEUTRAL;
}
throw new IllegalArgumentException("unknown elemnt char " + c);
}
public int getValue() {
return value;
}
}

View File

@@ -299,7 +299,7 @@ public class MapleLifeFactory {
private int id;
private byte chance, x;
private loseItem(int id, byte chance, byte x) {
public loseItem(int id, byte chance, byte x) {
this.id = id;
this.chance = chance;
this.x = x;

View File

@@ -186,7 +186,12 @@ public class MapleMonsterInformationProvider {
if (monsterId >= 9300127 && monsterId <= 9300136 || monsterId >= 9300315 && monsterId <= 9300324) {
int dropArray[] = {2022157, 2022158, 2022159, 2022160, 2022161, 2022162, 2022163, 2022164, 2022165, 2022166, 2022167, 2022168, 2022169, 2022170, 2022171, 2022172, 2022173, 2022174, 2022175, 2022176, 2022177, 2022178, 4001129}; //These are the drops, -1 means meso :D
for (int id : dropArray) {
ret.add(new MonsterDropEntry(id, 2000, 1, 1, (short) 0));
ret.add(new MonsterDropEntry(id, 20000, 1, 1, (short) 0));
}
} else if (monsterId == 9300157) {
int dropArray[] = {2022266, 2022267, 2022268, 2022269}; //These are the drops, -1 means meso :D
for (int id : dropArray) {
ret.add(new MonsterDropEntry(id, 20000, 1, 1, (short) 0));
}
} else {
PreparedStatement ps = null;

View File

@@ -1,24 +1,3 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 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 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 server.maps;
import client.MapleBuffStat;
@@ -84,9 +63,9 @@ import server.life.MonsterDropEntry;
import server.life.MonsterGlobalDropEntry;
import server.life.SpawnPoint;
import scripting.event.EventInstanceManager;
import server.expeditions.MapleExpedition;
import server.expeditions.MapleExpeditionType;
import server.life.MaplePlayerNPC;
import server.life.MobSkill;
import server.life.MobSkillFactory;
import server.life.MonsterListener;
import server.partyquest.GuardianSpawnPoint;
import server.partyquest.MapleCarnivalFactory;
@@ -162,6 +141,13 @@ public class MapleMap {
private MapleSnowball snowball0 = null;
private MapleSnowball snowball1 = null;
private MapleCoconut coconut;
//CPQ
private int maxMobs;
private int maxReactors;
private int deathCP;
private int timeDefault;
private int timeExpand;
//locks
private ReadLock chrRLock;
@@ -2499,6 +2485,42 @@ public class MapleMap {
if (mmd != null) {
mmd.registerPlayer(chr);
}
} else if (mapid == 980010101 || mapid == 980010201 || mapid == 980010301) { // AriantPQ
int pqTimer = (10 * 60 * 1000);
int pqTimerBord = (9 * 60 * 1000) + 50 * 1000;
chr.announce(MaplePacketCreator.getClock(pqTimer / 1000));
chr.setAriantScore(TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (chr.getMapId() == 980010101 || chr.getMapId() == 980010201 || chr.getMapId() == 980010301) {
broadcastMessage(MaplePacketCreator.showAriantScoreBoard());
killAllMonsters();
}
}
}, pqTimerBord));
chr.setPqMapleMap(TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (chr.getMapId() == 980010101 || chr.getMapId() == 980010201 || chr.getMapId() == 980010301) {
MapleExpedition exp = null;
if (chr.getMapId() == 980010101) {
exp = chr.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT);
} else if (chr.getMapId() == 980010201) {
exp = chr.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT1);
} else {
exp = chr.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT2);
}
chr.changeMap(980010010, 0);
chr.cancelPqMapleMap();
if (exp != null) {
chr.getClient().getAbstractPlayerInteraction().endExpedition(exp);
}
}
}
}, pqTimer));
}
MaplePet[] pets = chr.getPets();
@@ -4350,7 +4372,7 @@ public class MapleMap {
public final List<Pair<Integer, Integer>> getMobsToSpawn() {
return mobsToSpawn;
}
public boolean isCPQWinnerMap() {
switch (this.getId()) {
case 980000103:
@@ -4382,4 +4404,44 @@ public class MapleMap {
}
return false;
}
public int getMaxMobs() {
return maxMobs;
}
public void setMaxMobs(int maxMobs) {
this.maxMobs = maxMobs;
}
public int getMaxReactors() {
return maxReactors;
}
public void setMaxReactors(int maxReactors) {
this.maxReactors = maxReactors;
}
public int getDeathCP() {
return deathCP;
}
public void setDeathCP(int deathCP) {
this.deathCP = deathCP;
}
public int getTimeDefault() {
return timeDefault;
}
public void setTimeDefault(int timeDefault) {
this.timeDefault = timeDefault;
}
public int getTimeExpand() {
return timeExpand;
}
public void setTimeExpand(int timeExpand) {
this.timeExpand = timeExpand;
}
}

View File

@@ -94,12 +94,12 @@ public class MapleMapFactory {
String type = MapleDataTool.getString(life.getChildByPath("type"));
int team = MapleDataTool.getInt("team", life, -1);
if (map.isCPQMap2() && type.equals("m")) {
if((Integer.parseInt(life.getName()) % 2) == 0) {
if ((Integer.parseInt(life.getName()) % 2) == 0) {
team = 0;
} else {
team = 1;
}
}
}
int cy = MapleDataTool.getInt(life.getChildByPath("cy"));
MapleData dF = life.getChildByPath("f");
int f = (dF != null) ? MapleDataTool.getInt(dF) : 0;
@@ -313,6 +313,11 @@ public class MapleMapFactory {
if (map.isCPQMap()) {
MapleData mcData = mapData.getChildByPath("monsterCarnival");
if (mcData != null) {
map.setDeathCP(MapleDataTool.getIntConvert("deathCP", mcData, 0));
map.setMaxMobs(MapleDataTool.getIntConvert("mobGenMax", mcData, 0));
map.setTimeDefault(MapleDataTool.getIntConvert("timeDefault", mcData, 0));
map.setTimeExpand(MapleDataTool.getIntConvert("timeExpand", mcData, 0));
map.setMaxReactors(MapleDataTool.getIntConvert("guardianGenMax", mcData, 0));
MapleData guardianGenData = mcData.getChildByPath("guardianGenPos");
for (MapleData node : guardianGenData.getChildren()) {
GuardianSpawnPoint pt = new GuardianSpawnPoint(new Point(MapleDataTool.getIntConvert("x", node), MapleDataTool.getIntConvert("y", node)));
@@ -320,18 +325,19 @@ public class MapleMapFactory {
pt.setTaken(false);
map.addGuardianSpawnPoint(pt);
}
}
if (mcData.getChildByPath("skill") != null) {
for (MapleData area : mcData.getChildByPath("skill")) {
map.addSkillId(MapleDataTool.getInt(area));
}
}
if (mcData.getChildByPath("mob") != null) {
for (MapleData area : mcData.getChildByPath("mob")) {
map.addMobSpawn(MapleDataTool.getInt(area.getChildByPath("id")), MapleDataTool.getInt(area.getChildByPath("spendCP")));
if (mcData.getChildByPath("skill") != null) {
for (MapleData area : mcData.getChildByPath("skill")) {
map.addSkillId(MapleDataTool.getInt(area));
}
}
if (mcData.getChildByPath("mob") != null) {
for (MapleData area : mcData.getChildByPath("mob")) {
map.addMobSpawn(MapleDataTool.getInt(area.getChildByPath("id")), MapleDataTool.getInt(area.getChildByPath("spendCP")));
}
}
}
}
if (mapData.getChildByPath("reactor") != null) {

View File

@@ -14,7 +14,6 @@ import tools.MaplePacketCreator;
/**
* @author Drago/Dragohe4rt
*/
public class MonsterCarnival {
public static int D = 3;
@@ -36,6 +35,8 @@ public class MonsterCarnival {
this.cpq1 = cpq1;
this.p1 = p1;
this.p2 = p2;
setSummons(map.getMaxMobs());
setSummonss(map.getMaxMobs());
Channel cs = Server.getInstance().getWorld(p2.getLeader().getWorld()).getChannel(p2.getLeader().getChannel());
p1.setEnemy(p2);
p2.setEnemy(p1);
@@ -91,17 +92,17 @@ public class MonsterCarnival {
public void run() {
timeUp();
}
}, 10 * 60 * 1000);
}, (map.getTimeDefault() - 10) * 1000);
effectTimer = TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
complete();
}
}, 10 * 60 * 1000 - 10 * 1000);
}, (map.getTimeDefault() - 10) * 1000 - 10 * 1000);
TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
map.addClock(60 * 10);
map.addClock(map.getTimeDefault() - 10);
}
}, 2000);
} catch (Exception e) {
@@ -321,13 +322,13 @@ public class MonsterCarnival {
public void run() {
timeUp();
}
}, 3 * 60 * 1000);
}, map.getTimeExpand() * 1000);
effectTimer = TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
complete();
}
}, 3 * 60 * 1000 - 10);
}, map.getTimeExpand() * 1000 - 10);
}
public void complete() {
@@ -486,4 +487,20 @@ public class MonsterCarnival {
this.blueCP = CP;
}
}
public int getSummons() {
return summons;
}
public void setSummons(int summons) {
this.summons = summons;
}
public int getSummonss() {
return summonss;
}
public void setSummonss(int summonss) {
this.summonss = summonss;
}
}

View File

@@ -1,125 +0,0 @@
package server.partyquest;
import client.MapleCharacter;
import java.util.LinkedList;
import java.util.List;
import server.maps.MapleMap;
import tools.MaplePacketCreator;
/**
* @author Rob
*/
public class MonsterCarnivalParty {
private List<MapleCharacter> members = new LinkedList<>();
private MapleCharacter leader;
private byte team;
private short availableCP = 0, totalCP = 0;
private int summons = 7;
private boolean winner = false;
public MonsterCarnivalParty(final MapleCharacter owner, final List<MapleCharacter> members1, final byte team1) {
leader = owner;
members = members1;
team = team1;
for (final MapleCharacter chr : members) {
chr.setCarnivalParty(this);
chr.setTeam(team);
}
}
public final MapleCharacter getLeader() {
return leader;
}
public void addCP(MapleCharacter player, int ammount) {
totalCP += ammount;
availableCP += ammount;
player.addCP(ammount);
}
public int getTotalCP() {
return totalCP;
}
public int getAvailableCP() {
return availableCP;
}
public void useCP(MapleCharacter player, int ammount) {
availableCP -= ammount;
player.useCP(ammount);
}
public List<MapleCharacter> getMembers() {
return members;
}
public int getTeam() {
return team;
}
public void warpOut(final int map) {
for (MapleCharacter chr : members) {
chr.changeMap(map, 0);
chr.setCarnivalParty(null);
chr.setCarnival(null);
}
members.clear();
}
public void warp(final MapleMap map, final int portalid) {
for (MapleCharacter chr : members) {
chr.changeMap(map, map.getPortal(portalid));
}
}
public void warpOut() {
if (winner == true)
warpOut(980000003 + (leader.getCarnival().getRoom() * 100));
else
warpOut(980000004 + (leader.getCarnival().getRoom() * 100));
}
public boolean allInMap(MapleMap map) {
boolean status = true;
for (MapleCharacter chr : members) {
if (chr.getMap() != map) {
status = false;
}
}
return status;
}
public void removeMember(MapleCharacter chr) {
members.remove(chr);
chr.changeMap(980000010);
chr.setCarnivalParty(null);
chr.setCarnival(null);
}
public boolean isWinner() {
return winner;
}
public void setWinner(boolean status) {
winner = status;
}
public void displayMatchResult() {
final String effect = winner ? "quest/carnival/win" : "quest/carnival/lose";
for (final MapleCharacter chr : members) {
chr.announce(MaplePacketCreator.showEffect(effect));
}
}
public void summon() {
this.summons--;
}
public boolean canSummon() {
return this.summons > 0;
}
}

View File

@@ -4988,7 +4988,7 @@ public class MaplePacketCreator {
public static byte[] updateAriantPQRanking(String name, int score, boolean empty) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.ARIANT_SCORE.getValue());
mplew.writeShort(SendOpcode.ARIANT_ARENA_USER_SCORE.getValue());
mplew.write(empty ? 0 : 1);
if (!empty) {
mplew.writeMapleAsciiString(name);
@@ -4996,6 +4996,12 @@ public class MaplePacketCreator {
}
return mplew.getPacket();
}
public static byte[] showAriantScoreBoard() {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.ARIANT_ARENA_SHOW_RESULT.getValue());
return mplew.getPacket();
}
public static byte[] catchMessage(int message) { // not done, I guess
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();