Files
sweetgum-server/scripts/event/KerningTrain.js
ronancpl fca7b2adaa Implemented Kites, PlayerNPCs and C. Shop Surprise & Tweaked login
Added code support for Kites.
Reviewed concurrent access issues with pet autopot.
Addressed PlayerStorage issue where characters would not be properly deregistered from channel PlayerStorage in certain situations.
Implemented harp quest (questid 3314) because of reasons.
Added SFX to signalize KC/NLC subway departing/approaching.
Changed traveling time values to work similarly to GMS.
Properly developed the PlayerNPC feature in the source.
Added autodeployable PlayerNPC system and Hall of Fame.
Solved a glitch with NLC mayor's quiz questline that would allow a player to restart the quiz as many times one would see fit.
Added a custom server flag that allows overwriting the ToT 999 mobs to a new value (technically it doesn't overwrite, rather sets the player at quest start with 999 - n credited mobs).
Fixed permanent pets expiring after a while.
Added code support for Cash Shop Surprise item.
Reviewed login handler system as a whole, protecting many exposed flaws.
Solved a bug with ULTRA_THREE_SNAILS sometimes taking wrong etc shell from inventory.
2018-05-19 14:28:06 -03:00

67 lines
1.7 KiB
JavaScript

importPackage(Packages.tools);
var returnTo = new Array(103000100, 103000310);
var rideTo = new Array(103000310, 103000100);
var trainRide = new Array(103000301, 103000302);
var myRide;
var returnMap;
var exitMap;
var map;
var onRide;
//Time Setting is in millisecond
var rideTime = 10 * 1000;
function init() {}
function setup() {
var eim = em.newInstance("KerningTrain_" + em.getProperty("player"));
return eim;
}
function afterSetup(eim) {}
function playerEntry(eim, player) {
if (player.getMapId() == returnTo[0]) {
myRide = 0;
} else {
myRide = 1;
}
exitMap = eim.getEm().getChannelServer().getMapFactory().getMap(rideTo[myRide]);
returnMap = eim.getMapFactory().getMap(returnTo[myRide]);
onRide = eim.getMapFactory().getMap(trainRide[myRide]);
player.changeMap(onRide, onRide.getPortal(0));
player.getClient().getSession().write(MaplePacketCreator.getClock(rideTime / 1000));
player.getClient().getSession().write(MaplePacketCreator.earnTitleMessage("The next stop is at Kerning " + (myRide == 0 ? "Square" : "Subway") + " Station. The exit is to your left."));
eim.schedule("timeOut", rideTime);
}
function timeOut(eim) {
end(eim);
}
function playerUnregistered(eim, player) {}
function playerExit(eim, player, success) {
eim.unregisterPlayer(player);
player.changeMap(success ? exitMap.getId() : returnMap.getId(), 0);
}
function end(eim) {
var party = eim.getPlayers();
for (var i = 0; i < party.size(); i++) {
playerExit(eim, party.get(i), true);
}
eim.dispose();
}
function playerDisconnected(eim, player) {
playerExit(eim, player, false);
}
function cancelSchedule() {}
function dispose(eim) {}