メルとアイテム交換NPC

Go down

メルとアイテム交換NPC

投稿 by 構築さん on 2014-05-30, 09:03

Code:
/*
Mesos for items, and vice versa.
By Kars
*/

var status = -1;
var item = Array(4032133,4031284,4031679,4000174); // Item's go here
var mesos = Array(1500000000,1000000000,500000000,250000000); // Mesos here
var choice;

function start() {
action(1, 0, 0);
}

function action(mode, type, selection) {
if (mode != 1) {
cm.dispose();
return;
} else
status++;
if (status == 0) {
cm.sendSimple("Hello there, what would you like to do?\r\n#b#L0#Exchange mesos for items#l\r\n#L1#Exchange items for mesos#l");
} else if (status == 1) {
if (selection == 0) {
choice = 1;
var text = "Mesos for items?";
for (var i = 0; i < item.length; i++)
text += "\r\n#L" + i + "##r" + mesos[i] + " Mesos#k for #b#v" + item[i] + "# #z" + item[i] + "##k#l";
cm.sendSimple(text);
} else {
choice = 0;
var text = "Items for mesos?";
for (var i = 0; i <item> mesos[selection]){
cm.gainMeso(-mesos[selection]);
cm.gainItem(item[selection],1);
cm.sendOk("You have traded #r" + mesos[selection] + " Mesos#k for #b#z" + item[selection] + "##k");
cm.dispose();
} else
cm.sendOk("You need at least #r" + mesos[selection] + " Mesos#k for #b#z" + item[selection] + "##k!");
cm.dispose();
} else {
if (cm.haveItem(item[selection],1)) {
if (cm.getMeso()+ mesos[selection] >= 2100000000) {
cm.sendOk("You have too much money!\r\n#b" + cm.getMeso() + "#k + #r" + mesos[selection] + "#k = Above the meso limit of \r\n#d2100000000#k!");
cm.dispose();
} else {
cm.gainItem(item[selection],-1);
cm.gainMeso(mesos[selection]);
cm.sendOk("You have traded #r#z" + item[selection] + "##k for #b" + mesos[selection] + " Mesos#k!");
cm.dispose();
}
} else {
cm.sendOk("You need #r#z" + item[selection] + "##k for #b" + mesos[selection] + " Mesos#k!");
cm.dispose();
}
}
}
}
avatar
構築さん
Admin

Posts : 193
Join date : 2014/05/29

http://maplescience.forumjap.com

トップに戻る Go down

トップに戻る


 
Permissions in this forum:
返信投稿: 不可