sweetgum83/scripts/npc/2081000.js
2024-01-19 03:56:28 -05:00

69 lines
2.8 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 temp;
var cost;
var status = 0;
function start() {
cm.sendSimple("...Can I help you?\r\n#L0##bBuy the Magic Seed#k#l\r\n#L1##bDo something for Leafre#k#l");
}
function action(mode, type, selection) {
if (mode == -1 || (mode == 0 && status < 3)) {
cm.dispose();
return;
} else if (mode == 0) {
cm.sendOk("Please think carefully. Once you have made your decision, let me know.");
cm.dispose();
return;
}
status++;
if (status == 1) {
if (selection == 0) {
cm.sendSimple("You don't seem to be from out town. How can I help you?#L0##bI would like some #t4031346#.#k#l");
} else {
cm.sendNext("Under development...");
cm.dispose();
}
} else if (status == 2) {
cm.sendGetNumber("#b#t4031346##k is a precious iteml I cannot give it to you just like that. How about doing me a little favor? Then I'll give it to you. I'll sell the #b#t4031346##k to you for #b30,000 mesos#k each. Are you willing to make the purchase? How many would you like, then?", 0, 0, 99);
} else if (status == 3) {
if (selection == 0) {
cm.sendOk("I can't sell you 0.");
cm.dispose();
} else {
temp = selection;
cost = temp * 30000;
cm.sendYesNo("Buying #b" + temp + " #t4031346#(s)#k will cost you #b" + cost + " mesos#k. Are you sure you want to make the purchase?");
}
} else if (status == 4) {
if (cm.getMeso() < cost || !cm.canHold(4031346)) {
cm.sendOk("Please check and see if you have enough mesos to make the purchase. Also, I suggest you check the etc. inventory and see if you have enough space available to make the purchase.");
} else {
cm.sendOk("See you again~");
cm.gainItem(4031346, temp);
cm.gainMeso(-cost);
}
cm.dispose();
}
}