Files
sweetgum-server/scripts/npc/2094001.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

121 lines
6.5 KiB
JavaScript

/*
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/>.
*/
var status = -1;
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(cm.getMapId() == 925100500) {
if (status == 0) {
if(cm.isLeader()) {
cm.sendOk("I have been saved thanks to your efforts! Thank you, guys!");
}
else {
cm.sendOk("I have been saved thanks to your efforts! Thank you, guys! Let your party leader talk to me first before I give you your rewards...");
cm.dispose();
}
}
else {
cm.getEventInstance().clearPQ();
cm.dispose();
}
}
else {
if (status == 0) {
cm.sendSimple("Thank you for saving me! How can I help you?\r\n#b#L0#Get me out of here.\r\n#L1#Give me Pirate Hat.");
} else if (status == 1) {
if (selection == 0) {
if (!cm.canHold(4001129, 1)) {
cm.sendOk("Please make room in ETC.");
cm.dispose();
return;
}
cm.gainItem(4001129, 1);
cm.warp(251010404,0);
} else {
if (cm.haveItem(1003267, 1)) {
cm.sendOk("You have the best hat.");
} else if (cm.haveItem(1002573, 1)) {
if (cm.haveItem(4001129, 20)) {
if (cm.canHold(1003267,1)) {
cm.gainItem(1002573, -1);
cm.gainItem(4001129, -20);
cm.gainItem(1003267,1);
cm.sendOk("I have given you the hat.");
} else {
cm.sendOk("Please make room in your EQUIP inventory before receiving the hat.");
}
} else {
cm.sendOk("You need 20 #t4001129# to get the next hat.");
}
} else if (cm.haveItem(1002572, 1)) {
if (cm.haveItem(4001129, 20)) {
if (cm.canHold(1002573,1)) {
cm.gainItem(1002572, -1);
cm.gainItem(4001129, -20);
cm.gainItem(1002573,1);
cm.sendOk("I have given you the hat.");
} else {
cm.sendOk("Please make room in your EQUIP inventory before receiving the hat.");
}
} else {
cm.sendOk("You need 20 #t4001129# to get the next hat.");
}
} else {
if (cm.haveItem(4001129, 20)) {
if (cm.canHold(1002572,1)) {
cm.gainItem(4001129, -20);
cm.gainItem(1002572,1);
cm.sendOk("I have given you the hat.");
} else {
cm.sendOk("Please make room in your EQUIP inventory before receiving the hat.");
}
} else {
cm.sendOk("You need 20 #t4001129# to get the next hat.");
}
}
}
cm.dispose();
}
}
}
}