Return map & MaplePacketEncoder & Quest status patch
Fixed null pointer issue when trying to use return scroll on maps such as Mu Lung. Fixed a critical deadlock issue with MaplePacketEncoder. Fixed a critical DB leak regarding player's quest status.
This commit is contained in:
155
scripts/event/MahaBattle.js
Normal file
155
scripts/event/MahaBattle.js
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
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: Vs Uncontrollable Maha
|
||||
*/
|
||||
|
||||
var entryMap = 914020000;
|
||||
var exitMap = 140000000;
|
||||
var recruitMap = 140000000;
|
||||
var clearMap = 140000000;
|
||||
|
||||
var minMapId = 914020000;
|
||||
var maxMapId = 914020000;
|
||||
|
||||
var eventTime = 10; // 10 minutes
|
||||
|
||||
var lobbyRange = [0, 0];
|
||||
|
||||
function init() {}
|
||||
|
||||
function setup(level, lobbyid) {
|
||||
var eim = em.newInstance("Maha" + lobbyid);
|
||||
eim.setProperty("level", level);
|
||||
eim.setProperty("boss", "0");
|
||||
|
||||
var mapObj = eim.getInstanceMap(entryMap);
|
||||
mapObj.resetPQ(level);
|
||||
mapObj.instanceMapForceRespawn();
|
||||
|
||||
respawnStages(eim);
|
||||
eim.startEventTimer(eventTime * 60000);
|
||||
return eim;
|
||||
}
|
||||
|
||||
function afterSetup(eim) {}
|
||||
|
||||
function respawnStages(eim) {}
|
||||
|
||||
function playerEntry(eim, player) {
|
||||
var map = eim.getMapInstance(entryMap);
|
||||
player.changeMap(map, map.getPortal(0));
|
||||
}
|
||||
|
||||
function scheduledTimeout(eim) {
|
||||
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) {}
|
||||
|
||||
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) {}
|
||||
|
||||
function disbandParty(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 isMaha(mob) {
|
||||
var mobid = mob.getId();
|
||||
return mobid == 9001014;
|
||||
}
|
||||
|
||||
function monsterKilled(mob, eim) {
|
||||
if(isMaha(mob)) {
|
||||
eim.clearPQ();
|
||||
}
|
||||
}
|
||||
|
||||
function allMonstersDead(eim) {}
|
||||
|
||||
function cancelSchedule() {}
|
||||
|
||||
function dispose(eim) {}
|
||||
|
||||
@@ -22,11 +22,15 @@
|
||||
//carta
|
||||
function start(){
|
||||
if(cm.isQuestStarted(6301)) {
|
||||
if (cm.haveItem(4000175))
|
||||
if (cm.haveItem(4000175)) {
|
||||
cm.gainItem(4000175, -1);
|
||||
cm.warp(923000000, 0);
|
||||
else
|
||||
} else {
|
||||
cm.sendOk("In order to open the crack of dimension you will have to posess one piece of Miniature Pianus. Those could be gained by defeating a Pianus.");
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
cm.sendOk("I'm #bCarta the sea-witch.#k Don't fool around with me, as I'm known for my habit of turning people into worms.");
|
||||
}
|
||||
|
||||
cm.dispose();
|
||||
}
|
||||
@@ -24,9 +24,11 @@ function start(mode, type, selection) {
|
||||
} else if (status == 4) {
|
||||
qm.startQuest();
|
||||
|
||||
var map = qm.getClient().getChannelServer().getMapFactory().getMap(914020000);
|
||||
spawnMob(-365, 86, 9001014, map);
|
||||
qm.warp(914020000, 0);
|
||||
var mb = qm.getEventManager("MahaBattle");
|
||||
mb.newInstance("MahaBattle");
|
||||
mb.setProperty("player", qm.getPlayer().getName());
|
||||
mb.startInstance(qm.getPlayer());
|
||||
|
||||
qm.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user