Files
sweetgum-server/scripts/npc/1052007.js
ronancpl 7f178a3d80 Multi World NPCs + patch on Player interactions
Made NPCs now work properly on multiworld system. Solved multiple issues
regarding Player Shops not giving back items properly when owner exits.
Added restriction on changing channels at FM rooms, preventing shop
owner entering Cash Shop.
2017-05-28 22:11:39 -03:00

92 lines
3.4 KiB
JavaScript

var status = 0;
var ticketSelection = -1;
var text = "Here's the ticket reader.";
var hasTicket = false;
var NLC = false;
var em;
function start() {
cm.sendSimple("Pick your destination.\n\r\n#L0##bKerning City Subway#l\r\n#L1##bKerning square Shopping Center (Get on the subway)#l\n\n\r\n#L2#Enter Contruction Site#l\r\n#L3#New Leaf City#l");
}
function action(mode, type, selection) {
em = cm.getEventManager("Subway");
if (mode == -1) {
cm.dispose();
return;
} else if (mode == 0) {
cm.dispose();
return;
} else {
status++;
}
if (status == 1) {
if (selection == 0) {
cm.warp(103000101);
cm.dispose();
return;
} else if (selection == 1) {
var train = cm.getEventManager("KerningTrain");
train.newInstance("KerningTrain");
train.setProperty("player", cm.getPlayer().getName());
train.startInstance(cm.getPlayer());
cm.dispose();
return;
} else if (selection == 2) {
if (cm.haveItem(4031036) || cm.haveItem(4031037) || cm.haveItem(4031038)) {
text += " You will be brought in immediately. Which ticket you would like to use?#b";
for (var i = 0; i < 3; i++) {
if (cm.haveItem(4031036 + i)) {
text += "\r\n#b#L" + (i + 1) + "##t" + (4031036 + i) +"#";
}
}
cm.sendSimple(text);
hasTicket = true;
} else {
cm.sendOk("It seems as though you don't have a ticket!");
cm.dispose();
return;
}
} else if (selection == 3) {
if (!cm.haveItem(4031711) && cm.getPlayer().getMapId() == 103000100) {
cm.sendOk("It seems you don't have a ticket! You can buy one from Bell.");
cm.dispose();
return;
}
if (em.getProperty("entry") == "true") {
cm.sendYesNo("It looks like there's plenty of room for this ride. Please have your ticket ready so I can let you in. The ride will be long, but you'll get to your destination just fine. What do you think? Do you want to get on this ride?");
} else {
cm.sendNext("We will begin boarding 1 minute before the takeoff. Please be patient and wait for a few minutes. Be aware that the subway will take off right on time, and we stop receiving tickets 1 minute before that, so please make sure to be here on time.");
cm.dispose();
return;
}
}
} else if (status == 2) {
if (hasTicket) {
ticketSelection = selection;
if (ticketSelection > -1) {
cm.gainItem(4031035 + ticketSelection, -1);
cm.warp(103000897 + (ticketSelection * 3));
hasTicket = false;
cm.dispose();
return;
}
}
if (cm.haveItem(4031711)) {
if(em.getProperty("entry") == "false") {
cm.sendNext("We will begin boarding 1 minute before the takeoff. Please be patient and wait for a few minutes. Be aware that the subway will take off right on time, and we stop receiving tickets 1 minute before that, so please make sure to be here on time.");
}
else {
cm.gainItem(4031711, -1);
cm.warp(600010004);
}
cm.dispose();
return;
}
}
}