From ed6121dd5fd4f17ef2ae80d1b104fbbf5c85b0cf Mon Sep 17 00:00:00 2001 From: ronancpl Date: Wed, 10 May 2017 10:47:05 -0300 Subject: [PATCH] NPCs Taxis and Crafters now checks properly Fixed taxis that wouldn't check for mesos upon travel. Fixed crafters that wouldn't check for inventory slots available before crafting items. --- 9270017.js | 53 ----------- 9270018.js | 86 ----------------- 9270038.js | 80 ---------------- 9270041.js | 80 ---------------- nbproject/private/private.xml | 12 +-- scripts/npc/world0/1002004.js | 2 +- scripts/npc/world0/1002007.js | 16 ++-- scripts/npc/world0/1012000.js | 16 ++-- scripts/npc/world0/1012002.js | 23 +++-- scripts/npc/world0/1022001.js | 16 ++-- scripts/npc/world0/1022003.js | 22 +---- scripts/npc/world0/1022004.js | 34 ++----- scripts/npc/world0/1032000.js | 16 ++-- scripts/npc/world0/1032002.js | 22 +---- scripts/npc/world0/1032005.js | 2 +- scripts/npc/world0/1052002.js | 28 ++---- scripts/npc/world0/1052003.js | 14 +-- scripts/npc/world0/1052016.js | 16 ++-- scripts/npc/world0/1061000.js | 20 +--- scripts/npc/world0/1092014.js | 16 ++-- scripts/npc/world0/2010003.js | 20 +--- scripts/npc/world0/2020000.js | 93 +++++++++---------- scripts/npc/world0/2020002.js | 17 +--- scripts/npc/world0/2032001.js | 8 +- scripts/npc/world0/2040016.js | 28 +++--- scripts/npc/world0/2040020.js | 19 +--- scripts/npc/world0/2040021.js | 22 +---- scripts/npc/world0/2040022.js | 11 ++- scripts/npc/world0/2080000.js | 19 +--- scripts/npc/world0/2090004.js | 39 +------- scripts/npc/world0/2100001.js | 26 ++++-- scripts/npc/world0/2110005.js | 1 + scripts/npc/world0/9000017.js | 2 +- scripts/npc/world0/9000036.js | 4 +- scripts/npc/world0/9270017.js | 9 +- scripts/npc/world0/9270018.js | 44 +++++++-- scripts/npc/world0/9270038.js | 45 ++++++++- scripts/npc/world0/9270041.js | 43 ++++++++- .../portal/ariant_castle.js | 80 ++++++++-------- 39 files changed, 363 insertions(+), 741 deletions(-) delete mode 100644 9270017.js delete mode 100644 9270018.js delete mode 100644 9270038.js delete mode 100644 9270041.js rename ariant_castle.js => scripts/portal/ariant_castle.js (97%) diff --git a/9270017.js b/9270017.js deleted file mode 100644 index 64127f0633..0000000000 --- a/9270017.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License 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 . -*/ - -/** --- Odin JavaScript -------------------------------------------------------------------------------- - Xinga - Pilot --- By --------------------------------------------------------------------------------------------- - Information --- Version Info ----------------------------------------------------------------------------------- - 1.0 - First Version by Information - 2.0 - Second Version by Jayd ---------------------------------------------------------------------------------------------------- -**/ - -var status = 0; - -function start() { - cm.sendYesNo("The plane will be taking off soon, will you leave now? You will have to buy the plane ticket again to come in here."); -} - -function action(mode, type, selection) { - if (mode != 1) { - if (mode == 0) - cm.sendOk("Please hold on for a sec, and plane will be taking off. Thanks for your patience."); - cm.dispose(); - return; - } - status++; - if (status == 1) { - cm.sendNext("The ticket is not refundable, hope to see you again!"); - } else if(status == 2){ - cm.warp(103000000); - cm.dispose(); - } -} \ No newline at end of file diff --git a/9270018.js b/9270018.js deleted file mode 100644 index f655803d27..0000000000 --- a/9270018.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License 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 . -*/ - -/** --- Odin JavaScript -------------------------------------------------------------------------------- - Kerny - Pilot --- By --------------------------------------------------------------------------------------------- - Information --- Version Info ----------------------------------------------------------------------------------- - 1.0 - First Version by Information - 2.0 - Second Version by Jayd ---------------------------------------------------------------------------------------------------- -**/ -var k2s; -var airport; -var s2k; - -function start() { - status = -1; - action(1, 0, 0); -} - -function action(mode, type, selection) { - if(mode == -1) { - cm.dispose(); - return; - } - if(mode == 1) { - status++; - } - if(mode == 0) { - if (cm.getMapId() == 540010101) { - cm.sendOk("Please hold on for a sec, and we're reaching Singapore! Thanks for your patience."); - cm.dispose(); - return; - } else { - cm.sendOk("Please hold on for a sec, and we're reaching Kerning City! Thanks for your patience."); - cm.dispose(); - return; - } - } - if(status == 0) { - if (cm.getMapId() == 540010001) { - cm.sendYesNo("The plane is taking off soon, are you sure you want to leave now? The ticket is not refundable."); - airport = 1; - } else if (cm.getMapId() == 540010002) { - cm.sendYesNo("We're reaching Kerning City in a minute, are you sure you want to leave now? The ticket is not refundable."); - s2k = 1; - } else if (cm.getMapId() == 540010101) { - cm.sendYesNo("We're reaching Singapore in a minute, are you sure you want to leave now? The ticket is not refundable."); - k2s = 1; - } - } else if(status == 1) { - if (k2s == 1) { - cm.warp(103000000); - cm.sendOk("Hope to see you again soon!"); - cm.dispose(); - } else if (airport == 1) { - cm.warp(540010000); - cm.sendOk("Hope to see you again soon!"); - cm.dispose(); - } else if (s2k == 1) { - cm.warp(540010000); - cm.sendOk("Hope to see you again soon!"); - cm.dispose(); - } - } -} \ No newline at end of file diff --git a/9270038.js b/9270038.js deleted file mode 100644 index cacc6d4481..0000000000 --- a/9270038.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License 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 . -*/ - -/** --- Odin JavaScript -------------------------------------------------------------------------------- - Shalon - Ticketing Usher --- By --------------------------------------------------------------------------------------------- - Whoever written this script --- Version Info ----------------------------------------------------------------------------------- - 1.0 - First Version by whoever written this script - 2.0 - Second Version by Jayd ---------------------------------------------------------------------------------------------------- -**/ - -status = -1; -oldSelection = -1; - -function start() { - cm.sendSimple("Hello, I am Shalon from Singapore Airport. I can assist you in getting you to Kerning City in no time. Do you want to go to Kerning City?\r\n#b#L0#I would like to buy a plane ticket to Kerning City\r\n#b#L1#Let me go in to the departure point."); -} - -function action(mode, type, selection) { - status++; - if (mode <= 0){ - oldSelection = -1; - cm.dispose(); - } - - if(status == 0){ - if(selection == 0){ - cm.sendYesNo("The ticket will cost you 5,000 mesos. Will you purchase the ticket?"); - }else if(selection == 1){ - cm.sendYesNo("Would you like to go in now? You will lose your ticket once you go in! Thank you for choosing Wizet Airline."); - } - oldSelection = selection; - }else if(status == 1){ - if(oldSelection == 0){ - if (cm.getPlayer().getMeso() > 4999 && cm.getPlayer().haveItem(4031732) == false) { - cm.gainMeso(-5000); - cm.gainItem(4031732); - cm.sendOk("Thank you for choosing Wizet Airline! Enjoy your flight!"); - cm.dispose(); - } else if (cm.getPlayer().getMeso() < 4999 || cm.getPlayer().haveItem(4031732)) { - cm.sendOk("You do not have enough mesos or you've already purchased a ticket."); - cm.dispose(); - } - }else if(oldSelection == 1){ - if(cm.itemQuantity(4031732) > 0){ - var em = cm.getEventManager("AirPlane"); - if(em.getProperty("entry") == "true"){ - cm.warp(540010001); - cm.gainItem(4031732, -1); - }else{ - cm.sendOk("Sorry the plane has taken off, please wait a few minutes."); - } - }else{ - cm.sendOk("You need a #b#t4031732##k to get on the plane!"); - } - } - cm.dispose(); - } -} \ No newline at end of file diff --git a/9270041.js b/9270041.js deleted file mode 100644 index bb846d3b61..0000000000 --- a/9270041.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License 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 . -*/ - -/** --- Odin JavaScript -------------------------------------------------------------------------------- - Irene - Ticketing Usher --- By --------------------------------------------------------------------------------------------- - Whoever written this script --- Version Info ----------------------------------------------------------------------------------- - 1.0 - First Version by whoever written this script - 2.0 - Second Version by Jayd ---------------------------------------------------------------------------------------------------- -**/ - -status = -1; -oldSelection = -1; - -function start() { - cm.sendSimple("Hello, I am Irene from Singapore Airport. I can assist you in getting you to Singapore in no time. Do you want to go to Singapore?\r\n#b#L0#I would like to buy a plane ticket to Singapore\r\n#b#L1#Let me go in to the departure point."); -} - -function action(mode, type, selection) { - status++; - if (mode <= 0){ - oldSelection = -1; - cm.dispose(); - } - - if(status == 0){ - if(selection == 0){ - cm.sendYesNo("The ticket will cost you 5,000 mesos. Will you purchase the ticket?"); - }else if(selection == 1){ - cm.sendYesNo("Would you like to go in now? You will lose your ticket once you go in! Thank you for choosing Wizet Airline."); - } - oldSelection = selection; - }else if(status == 1){ - if(oldSelection == 0){ - if (cm.getPlayer().getMeso() > 4999 && cm.getPlayer().haveItem(4031731) == false) { - cm.gainMeso(-5000); - cm.gainItem(4031731); - cm.sendOk("Thank you for choosing Wizet Airline! Enjoy your flight!"); - cm.dispose(); - } else if (cm.getPlayer().getMeso() < 4999 || cm.getPlayer().haveItem(4031731)) { - cm.sendOk("You do not have enough mesos or you've already purchased a ticket."); - cm.dispose(); - } - }else if(oldSelection == 1){ - if(cm.itemQuantity(4031731) > 0){ - var em = cm.getEventManager("AirPlane"); - if(em.getProperty("entry") == "true"){ - cm.warp(540010100); - cm.gainItem(4031731, -1); - }else{ - cm.sendOk("Sorry the plane has taken off, please wait a few minutes."); - } - }else{ - cm.sendOk("You need a #b#t4031731##k to get on the plane!"); - } - } - cm.dispose(); - } -} \ No newline at end of file diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 5d37a0d8ae..6807a2ba19 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -2,16 +2,6 @@ - - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/Ellin.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/2094000.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/BossRushPQ.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/event/EventInstanceManager.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/KerningPQ.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/9000037.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/9020000.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/PiratePQ.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/2133000.js - + diff --git a/scripts/npc/world0/1002004.js b/scripts/npc/world0/1002004.js index 6c93bf04c2..e7652daba4 100644 --- a/scripts/npc/world0/1002004.js +++ b/scripts/npc/world0/1002004.js @@ -46,7 +46,7 @@ function action(mode, type, selection) { } if (status == 1) { cm.sendYesNo(cm.getJobId() == 0 ? "We have a special 90% discount for beginners. The Ant Tunnel is located deep inside in the dungeon that's placed at the center of the Victoria Island, where the 24 Hr Mobile Store is. Would you like to go there for #b1,000 mesos#k?" : "The regular fee applies for all non-beginners. The Ant Tunnel is located deep inside in the dungeon that's placed at the center of the Victoria Island, where 24 Hr Mobile Store is. Would you like to go there for #b10,000 mesos#k?"); - cost *= cm.getJobId() == 0 ? 10 : 1; + cost /= ((cm.getJobId() == 0) ? 10 : 1); } else if (status == 2) { if (cm.getMeso() < cost) cm.sendNext("It looks like you don't have enough mesos. Sorry but you won't be able to use this without it.") diff --git a/scripts/npc/world0/1002007.js b/scripts/npc/world0/1002007.js index 7cc0804c29..ddf662c0fb 100644 --- a/scripts/npc/world0/1002007.js +++ b/scripts/npc/world0/1002007.js @@ -46,17 +46,19 @@ function action(mode, type, selection) { cm.sendYesNo("You don't have anything else to do here, huh? Do you really want to go to #b#m" + maps[selection] + "##k? It'll cost you #b"+ (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection]) + " mesos#k."); selectedMap = selection; } else if (status == 3) { - if (cm.getMeso() < (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection])) { + if (cm.getJobId() == 0) { + mesos = cost[selectedMap] / 10; + } else { + mesos = cost[selectedMap]; + } + + if (cm.getMeso() < mesos) { cm.sendNext("You don't have enough mesos. Sorry to say this, but without them, you won't be able to ride the cab."); cm.dispose(); return; } - if (cm.getJobId() == 0) { - mesos = -cost[selectedMap] / 10; - } else { - mesos = -cost[selectedMap]; - } - cm.gainMeso(mesos); + + cm.gainMeso(-mesos); cm.warp(maps[selectedMap], 0); cm.dispose(); } diff --git a/scripts/npc/world0/1012000.js b/scripts/npc/world0/1012000.js index f95285e346..9cd96cd7c9 100644 --- a/scripts/npc/world0/1012000.js +++ b/scripts/npc/world0/1012000.js @@ -36,17 +36,19 @@ function action(mode, type, selection) { cm.sendYesNo("You don't have anything else to do here, huh? Do you really want to go to #b#m" + maps[selection] + "##k? It'll cost you #b"+ (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection]) + " mesos#k."); selectedMap = selection; } else if (status == 3) { - if (cm.getMeso() < (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection])) { + if (cm.getJobId() == 0) { + mesos = cost[selectedMap] / 10; + } else { + mesos = cost[selectedMap]; + } + + if (cm.getMeso() < mesos) { cm.sendNext("You don't have enough mesos. Sorry to say this, but without them, you won't be able to ride the cab."); cm.dispose(); return; } - if (cm.getJobId() == 0) { - mesos = -cost[selectedMap] / 10; - } else { - mesos = -cost[selectedMap]; - } - cm.gainMeso(mesos); + + cm.gainMeso(-mesos); cm.warp(maps[selectedMap], 0); cm.dispose(); } diff --git a/scripts/npc/world0/1012002.js b/scripts/npc/world0/1012002.js index 473116d506..fd2dc30358 100644 --- a/scripts/npc/world0/1012002.js +++ b/scripts/npc/world0/1012002.js @@ -167,21 +167,26 @@ function action(mode, type, selection) { if (!complete) cm.sendOk("Surely you, of all people, would understand the value of having quality items? I can't do that without the items I require."); else { - if (cm.canHold(item)) { + var recvItem = item, recvQty; + + if (item >= 2060000 && item <= 2060002) //bow arrows + recvQty = 1000 - (item - 2060000) * 100; + else if (item >= 2061000 && item <= 2061002) //xbow arrows + recvQty = 1000 - (item - 2061000) * 100; + else if (item == 4003000)//screws + recvQty = 15 * qty; + else + recvQty = qty; + + if (cm.canHold(recvItem, recvQty)) { if (mats instanceof Array) { for (var i = 0; i < mats.length; i++) cm.gainItem(mats[i], -(matQty[i] * qty)); }else cm.gainItem(mats, -(matQty * qty)); cm.gainMeso(-(cost * qty)); - if (item >= 2060000 && item <= 2060002) //bow arrows - cm.gainItem(item, 1000 - (item - 2060000) * 100); - else if (item >= 2061000 && item <= 2061002) //xbow arrows - cm.gainItem(item, 1000 - (item - 2061000) * 100); - else if (item == 4003000)//screws - cm.gainItem(4003000, 15 * qty); - else - cm.gainItem(item, qty); + + cm.gainItem(recvItem, recvQty); cm.sendOk("A perfect item, as usual. Come and see me if you need anything else."); }else { cm.sendOk("Please make sure you have room in your inventory, and talk to me again."); diff --git a/scripts/npc/world0/1022001.js b/scripts/npc/world0/1022001.js index df4e63fc8d..e7c5b53f3d 100644 --- a/scripts/npc/world0/1022001.js +++ b/scripts/npc/world0/1022001.js @@ -36,17 +36,19 @@ function action(mode, type, selection) { cm.sendYesNo("You don't have anything else to do here, huh? Do you really want to go to #b#m" + maps[selection] + "##k? It'll cost you #b"+ (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection]) + " mesos#k."); selectedMap = selection; } else if (status == 3) { - if (cm.getMeso() < (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection])) { + if (cm.getJobId() == 0) { + mesos = cost[selectedMap] / 10; + } else { + mesos = cost[selectedMap]; + } + + if (cm.getMeso() < mesos) { cm.sendNext("You don't have enough mesos. Sorry to say this, but without them, you won't be able to ride the cab."); cm.dispose(); return; } - if (cm.getJobId() == 0) { - mesos = -cost[selectedMap] / 10; - } else { - mesos = -cost[selectedMap]; - } - cm.gainMeso(mesos); + + cm.gainMeso(-mesos); cm.warp(maps[selectedMap], 0); cm.dispose(); } diff --git a/scripts/npc/world0/1022003.js b/scripts/npc/world0/1022003.js index 17b0c0afe5..90f0cb61c5 100644 --- a/scripts/npc/world0/1022003.js +++ b/scripts/npc/world0/1022003.js @@ -180,7 +180,7 @@ function action(mode, type, selection) { else if (status == 4 && mode == 1) { var complete = true; - if(!cm.canHold(item)) { + if(!cm.canHold(item, qty)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; @@ -200,26 +200,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - - /* if (mats instanceof Array) { - for(var i = 0; complete && i < mats.length; i++) - { - if (matQty[i] * qty == 1) { - if (!cm.haveItem(mats[i])) - { - complete = false; - } - } - else { - if (!cm.haveItem(mats[i],matQty[i] * selection)) complete=false; - - } - } - } - else { - if (!cm.haveItem(mats,matQty * selection)) complete=false; - - } */ } if (!complete) cm.sendOk("I'm afraid you're missing something for the item you want. See you another time, yes?"); diff --git a/scripts/npc/world0/1022004.js b/scripts/npc/world0/1022004.js index 5f4ad456d6..5017dc450a 100644 --- a/scripts/npc/world0/1022004.js +++ b/scripts/npc/world0/1022004.js @@ -165,8 +165,14 @@ function action(mode, type, selection) { } else if (status == 4 && mode == 1) { var complete = true; + var recvItem = item, recvQty; + + if (item == 4003000)//screws + recvQty = 15 * qty; + else + recvQty = qty; - if(!cm.canHold(item)) { + if(!cm.canHold(recvItem, recvQty)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; @@ -186,27 +192,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - - /* - if (mats instanceof Array) { - for(var i = 0; complete && i < mats.length; i++) - { - if (matQty[i] * qty == 1) { - if (!cm.haveItem(mats[i])) - { - complete = false; - } - } - else { - - if (!cm.haveItem(mats[i],matQty[i]*qty)) complete=false; - } - } - } - else { - if (!cm.haveItem(mats,matQty)) complete=false; - } - */ } if (!complete) @@ -223,10 +208,7 @@ function action(mode, type, selection) { if (cost > 0) cm.gainMeso(-cost * qty); - if (item == 4003000)//screws - cm.gainItem(4003000, 15 * qty); - else - cm.gainItem(item, qty); + cm.gainItem(recvItem, recvQty); cm.sendOk("Did that come out right? Come by me again if you have anything for me to practice on."); } cm.dispose(); diff --git a/scripts/npc/world0/1032000.js b/scripts/npc/world0/1032000.js index 676bb8c603..985f1b7191 100644 --- a/scripts/npc/world0/1032000.js +++ b/scripts/npc/world0/1032000.js @@ -36,17 +36,19 @@ function action(mode, type, selection) { cm.sendYesNo("You don't have anything else to do here, huh? Do you really want to go to #b#m" + maps[selection] + "##k? It'll cost you #b"+ (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection]) + " mesos#k."); selectedMap = selection; } else if (status == 3) { - if (cm.getMeso() < (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection])) { + if (cm.getJobId() == 0) { + mesos = cost[selectedMap] / 10; + } else { + mesos = cost[selectedMap]; + } + + if (cm.getMeso() < mesos) { cm.sendNext("You don't have enough mesos. Sorry to say this, but without them, you won't be able to ride the cab."); cm.dispose(); return; } - if (cm.getJobId() == 0) { - mesos = -cost[selectedMap] / 10; - } else { - mesos = -cost[selectedMap]; - } - cm.gainMeso(mesos); + + cm.gainMeso(-mesos); cm.warp(maps[selectedMap], 0); cm.dispose(); } diff --git a/scripts/npc/world0/1032002.js b/scripts/npc/world0/1032002.js index 0a57707201..942de6f639 100644 --- a/scripts/npc/world0/1032002.js +++ b/scripts/npc/world0/1032002.js @@ -185,7 +185,7 @@ function action(mode, type, selection) { else if (status == 3 && mode == 1) { var complete = true; - if(!cm.canHold(item)) { + if(!cm.canHold(item, 1)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; @@ -205,26 +205,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - - /*if (mats instanceof Array) { - for(var i = 0; complete && i < mats.length; i++) - { - if (matQty[i] == 1) { - if (!cm.haveItem(mats[i])) - { - complete = false; - } - } - else { - - if (!cm.haveItem(mats[i],matQty[i])) complete=false; - } - } - } - else { - - if (!cm.haveItem(mats,matQty)) complete=false; - }*/ } if (!complete) diff --git a/scripts/npc/world0/1032005.js b/scripts/npc/world0/1032005.js index f92abfea3e..e03312c65f 100644 --- a/scripts/npc/world0/1032005.js +++ b/scripts/npc/world0/1032005.js @@ -46,7 +46,7 @@ function action(mode, type, selection) { } if (status == 1) { cm.sendYesNo(cm.getJobId() == 0 ? "We have a special 90% discount for beginners. The Ant Tunnel is located deep inside in the dungeon that's placed at the center of the Victoria Island, where the 24 Hr Mobile Store is. Would you like to go there for #b1,000 mesos#k?" : "The regular fee applies for all non-beginners. The Ant Tunnel is located deep inside in the dungeon that's placed at the center of the Victoria Island, where 24 Hr Mobile Store is. Would you like to go there for #b10,000 mesos#k?"); - cost *= cm.getJobId() == 0 ? 10 : 1; + cost /= ((cm.getJobId() == 0) ? 10 : 1); } else if (status == 2) { if (cm.getMeso() < cost) cm.sendNext("It looks like you don't have enough mesos. Sorry but you won't be able to use this without it.") diff --git a/scripts/npc/world0/1052002.js b/scripts/npc/world0/1052002.js index 1a0c8bdc85..8f4377a871 100644 --- a/scripts/npc/world0/1052002.js +++ b/scripts/npc/world0/1052002.js @@ -205,8 +205,14 @@ function action(mode, type, selection) { } else if (status == 4 && mode == 1) { var complete = true; + var recvItem = item, recvQty; - if(!cm.canHold(item)) { + if (item == 4003000)//screws + recvQty = 15 * qty; + else + recvQty = qty; + + if(!cm.canHold(recvItem, recvQty)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; @@ -226,20 +232,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - /* - if (mats instanceof Array) { - for(var i = 0; complete && i < mats.length; i++) - { - if (matQty[i] * qty == 1) - if (!cm.haveItem(mats[i])) - complete = false; - else - if (!cm.haveItem(mats[i],matQty[i])) complete=false; - } - } - else - if (!cm.haveItem(mats,matQty)) complete=false; - */ } if (!complete) @@ -254,10 +246,8 @@ function action(mode, type, selection) { cm.gainItem(mats, -matQty * qty); if (cost > 0) cm.gainMeso(-cost * qty); - if (item == 4003000)//screws - cm.gainItem(4003000, 15 * qty); - else - cm.gainItem(item, qty); + + cm.gainItem(recvItem, recvQty); cm.sendOk("All done. If you need anything else... Well, I'm not going anywhere."); } cm.dispose(); diff --git a/scripts/npc/world0/1052003.js b/scripts/npc/world0/1052003.js index 8896f48a4b..c69bc259fd 100644 --- a/scripts/npc/world0/1052003.js +++ b/scripts/npc/world0/1052003.js @@ -161,7 +161,7 @@ function action(mode, type, selection) { } else if (status == 4) { var complete = true; - if(!cm.canHold(item)) { + if(!cm.canHold(item, qty)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; @@ -178,18 +178,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - - /*if (mats instanceof Array) { - for (var i = 0; complete && i < mats.length; i++) { - if (matQty[i] * qty == 1) { - complete = cm.haveItem(mats[i]); - } else { - complete = cm.haveItem(mats[i], matQty[i] * qty); - } - } - } else { - complete = cm.haveItem(mats, matQty * qty); - }*/ } if (!complete) diff --git a/scripts/npc/world0/1052016.js b/scripts/npc/world0/1052016.js index 40a4b3e0f4..7e757d92b5 100644 --- a/scripts/npc/world0/1052016.js +++ b/scripts/npc/world0/1052016.js @@ -36,17 +36,19 @@ function action(mode, type, selection) { cm.sendYesNo("You don't have anything else to do here, huh? Do you really want to go to #b#m" + maps[selection] + "##k? It'll cost you #b"+ (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection]) + " mesos#k."); selectedMap = selection; } else if (status == 3) { - if (cm.getMeso() < (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection])) { + if (cm.getJobId() == 0) { + mesos = cost[selectedMap] / 10; + } else { + mesos = cost[selectedMap]; + } + + if (cm.getMeso() < mesos) { cm.sendNext("You don't have enough mesos. Sorry to say this, but without them, you won't be able to ride the cab."); cm.dispose(); return; } - if (cm.getJobId() == 0) { - mesos = -cost[selectedMap] / 10; - } else { - mesos = -cost[selectedMap]; - } - cm.gainMeso(mesos); + + cm.gainMeso(-mesos); cm.warp(maps[selectedMap], 0); cm.dispose(); } diff --git a/scripts/npc/world0/1061000.js b/scripts/npc/world0/1061000.js index 34485164c2..d8be4a8f0f 100644 --- a/scripts/npc/world0/1061000.js +++ b/scripts/npc/world0/1061000.js @@ -165,7 +165,7 @@ function action(mode, type, selection) { else if (status == 3 && mode == 1) { var complete = true; - if(!cm.canHold(item)) { + if(!cm.canHold(item, 1)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; @@ -184,24 +184,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - - /* - if (mats instanceof Array) { - for(var i = 0; complete && i < mats.length; i++) { - if (matQty[i] == 1) { - if (!cm.haveItem(mats[i])) - complete = false; - } - else { - if (!cm.haveItem(mats[i],matQty[i] * selection)) complete=false; - - } - } - } - else { - if (!cm.haveItem(mats,matQty * selection)) complete=false; - - }*/ } if (!complete) cm.sendOk("Sorry, but I have to have those items to get this exactly right. Perhaps next time."); diff --git a/scripts/npc/world0/1092014.js b/scripts/npc/world0/1092014.js index 76dc351e06..d4fbf2dd3b 100644 --- a/scripts/npc/world0/1092014.js +++ b/scripts/npc/world0/1092014.js @@ -35,17 +35,19 @@ function action(mode, type, selection) { cm.sendYesNo("You don't have anything else to do here, huh? Do you really want to go to #b#m" + maps[selection] + "##k? It'll cost you #b"+ (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection]) + " mesos#k."); selectedMap = selection; } else if (status == 3) { - if (cm.getMeso() < (cm.getJobId() == 0 ? cost[selection] / 10 : cost[selection])) { + if (cm.getJobId() == 0) { + mesos = cost[selectedMap] / 10; + } else { + mesos = cost[selectedMap]; + } + + if (cm.getMeso() < mesos) { cm.sendNext("You don't have enough mesos. Sorry to say this, but without them, you won't be able to ride the cab."); cm.dispose(); return; } - if (cm.getJobId() == 0) { - mesos = -cost[selectedMap] / 10; - } else { - mesos = -cost[selectedMap]; - } - cm.gainMeso(mesos); + + cm.gainMeso(-mesos); cm.warp(maps[selectedMap], 0); cm.dispose(); } diff --git a/scripts/npc/world0/2010003.js b/scripts/npc/world0/2010003.js index c4ea3eaf48..1c8c356be4 100644 --- a/scripts/npc/world0/2010003.js +++ b/scripts/npc/world0/2010003.js @@ -157,7 +157,7 @@ function action(mode, type, selection) { else if (status == 3 && mode == 1) { var complete = true; - if(!cm.canHold(item)) { + if(!cm.canHold(item, 1)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; @@ -177,24 +177,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - /* - if (mats instanceof Array) { - for(var i = 0; complete && i < mats.length; i++) - { - if (matQty[i] == 1) { - if (!cm.haveItem(mats[i])) - { - complete = false; - } - } - else { - if (!cm.haveItem(mats[i],matQty[i])) complete=false; - } - } - } - else { - if (!cm.haveItem(mats,matQty)) complete=false; - }*/ } if (!complete) diff --git a/scripts/npc/world0/2020000.js b/scripts/npc/world0/2020000.js index 9d3128f5e6..909e9c6cd7 100644 --- a/scripts/npc/world0/2020000.js +++ b/scripts/npc/world0/2020000.js @@ -86,6 +86,7 @@ function action(mode, type, selection) { for (var i = 0; i < items.length; i++){ selStr += "\r\n#L" + i + "# " + items[i] + "#l"; } + equip = false; cm.sendSimple(selStr); } else if (selectedType == 3){ //crystal refine @@ -176,8 +177,7 @@ function action(mode, type, selection) { cm.sendGetNumber(prompt,1,1,100) } else if (status == 3 && mode == 1) { - if (equip) - { + if (equip) { selectedItem = selection; qty = 1; } @@ -187,7 +187,7 @@ function action(mode, type, selection) { if (selectedType == 5){ //arrow refine var itemSet = new Array(2060000,2061000,2060001,2061001,2060002,2061002); var matSet = new Array(new Array (4003001,4003004),new Array (4003001,4003004),new Array (4011000,4003001,4003004),new Array (4011000,4003001,4003004), - new Array (4011001,4003001,4003005),new Array (4011001,4003001,4003005)); + new Array (4011001,4003001,4003005),new Array (4011001,4003001,4003005)); var matQtySet = new Array (new Array (1,1),new Array (1,1),new Array (1,3,10),new Array (1,3,10),new Array (1,5,15),new Array (1,5,15)); var costSet = new Array (0,0,0,0,0,0); item = itemSet[selectedItem]; @@ -219,59 +219,58 @@ function action(mode, type, selection) { cm.sendYesNo(prompt); } else if (status == 4 && mode == 1) { - var complete = true; - - if (cm.getMeso() < cost * qty) - { - cm.sendOk("I'm afraid you cannot afford my services.") + var recvItem = item, recvQty; + + if (item >= 2060000 && item <= 2060002) {//bow arrows + recvQty = 1000 - (item - 2060000) * 100; + } + else if (item >= 2061000 && item <= 2061002) {//xbow arrows + recvQty = 1000 - (item - 2061000) * 100; + } + else if (item == 4003000) {//screws + recvQty = 15 * qty; + } + else { + recvQty = qty; } - else - { - if (mats instanceof Array) { - for(var i = 0; complete && i < mats.length; i++) - { - if (matQty[i] * qty == 1) { - if (!cm.haveItem(mats[i])) - { - complete = false; - } - } - else { - if (cm.haveItem(matQty[i]*qty))complete=false; - } + if(!cm.canHold(recvItem, recvQty)) { + cm.sendOk("I'm afraid you don't have a slot available for the item in your inventory."); + } else if (cm.getMeso() < cost * qty) { + cm.sendOk("I'm afraid you cannot afford my services."); + } else { + var complete = true; + + if (mats instanceof Array) { + for(var i = 0; complete && i < mats.length; i++) { + if (!cm.haveItem(mats[i], matQty[i] * qty)) + complete = false; } } else { - if (cm.haveItem(matQty*qty))complete=false; - + if (!cm.haveItem(mats, matQty * qty)) + complete = false; } - } - - if (!complete) - cm.sendOk("I can't refine anything for you without the proper items."); - else { - if (mats instanceof Array) { - for (var i = 0; i < mats.length; i++){ - cm.gainItem(mats[i], -matQty[i] * qty); + + if (!complete) + cm.sendOk("I can't refine anything for you without the proper items."); + else { + if (mats instanceof Array) { + for (var i = 0; i < mats.length; i++){ + cm.gainItem(mats[i], -matQty[i] * qty); + } } + else + cm.gainItem(mats, -matQty * qty); + + if (cost > 0) + cm.gainMeso(-cost * qty); + + cm.gainItem(recvItem, recvQty); + cm.sendOk("All done. If you need anything else, just ask."); } - else - cm.gainItem(mats, -matQty * qty); - - if (cost > 0) - cm.gainMeso(-cost * qty); - - if (item >= 2060000 && item <= 2060002) //bow arrows - cm.gainItem(item, 1000 - (item - 2060000) * 100); - else if (item >= 2061000 && item <= 2061002) //xbow arrows - cm.gainItem(item, 1000 - (item - 2061000) * 100); - else if (item == 4003000)//screws - cm.gainItem(4003000, 15 * qty); - else - cm.gainItem(item, qty); - cm.sendOk("All done. If you need anything else, just ask."); } + cm.dispose(); } } \ No newline at end of file diff --git a/scripts/npc/world0/2020002.js b/scripts/npc/world0/2020002.js index 3ebaf27f33..e083d02e90 100644 --- a/scripts/npc/world0/2020002.js +++ b/scripts/npc/world0/2020002.js @@ -158,7 +158,7 @@ function action(mode, type, selection) { else if (status == 3 && mode == 1) { var complete = true; - if(!cm.canHold(item)) { + if(!cm.canHold(item, 1)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; @@ -176,21 +176,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - - /*if (mats instanceof Array) { - for(var i = 0; complete && i < mats.length; i++){ - if (matQty[i] == 1){ - if (!cm.haveItem(mats[i])) - complete = false; - } - else if (!cm.haveItem(mats[i],matQty[i])) - complete=false; - } - } - - else if (!cm.haveItem(mats,matQty)) - complete=false; - */ } if (!complete) cm.sendOk("I only make quality goods, which I cannot do without the proper materials."); diff --git a/scripts/npc/world0/2032001.js b/scripts/npc/world0/2032001.js index 3201c20bd8..9327427cf5 100644 --- a/scripts/npc/world0/2032001.js +++ b/scripts/npc/world0/2032001.js @@ -47,12 +47,18 @@ function action(mode, type, selection) { cm.sendGetNumber("Okay, so how many do you want me to make?", 1, 1, 100); else if (status == 2) { var complete = true; + if (cm.getMeso() < 500000 * selection){ cm.sendOk("I'm sorry, but I am NOT doing this for free."); cm.dispose(); return; - } else if (!cm.haveItem(4004004, 10 * selection)) + } else if (!cm.haveItem(4004004, 10 * selection)) { complete = false; + } else if(!cm.canHold(4005004, selection)) { + cm.sendOk("Are you having trouble with no empty slots on your inventory? Sort that out first!"); + cm.dispose(); + return; + } if (!complete) cm.sendOk("I need that ore to refine the Crystal. No exceptions.."); else { diff --git a/scripts/npc/world0/2040016.js b/scripts/npc/world0/2040016.js index 61091fcbf6..536b6ae27f 100644 --- a/scripts/npc/world0/2040016.js +++ b/scripts/npc/world0/2040016.js @@ -222,10 +222,23 @@ function action(mode, type, selection) { } else if (status == 4 && mode == 1) { var complete = true; - - if (cm.getMeso() < cost * qty) + var recvItem = item, recvQty; + + if (item >= 2060000 && item <= 2060002) //bow arrows + recvQty = 1000 - (item - 2060000) * 100; + else if (item >= 2061000 && item <= 2061002) //xbow arrows + recvQty = 1000 - (item - 2061000) * 100; + else if (item == 4003000)//screws + recvQty = 15 * qty; + else + recvQty = qty; + + if(!cm.canHold(recvItem, recvQty)) { + cm.sendOk("I'm afraid you have no slots available for this transaction."); + } + else if (cm.getMeso() < cost * qty) { - cm.sendOk("I'm afraid you cannot afford my services.") + cm.sendOk("I'm afraid you cannot afford my services."); } else { @@ -262,14 +275,7 @@ function action(mode, type, selection) { if (cost > 0) cm.gainMeso(-cost * qty); - if (item >= 2060000 && item <= 2060002) //bow arrows - cm.gainItem(item, 1000 - (item - 2060000) * 100); - else if (item >= 2061000 && item <= 2061002) //xbow arrows - cm.gainItem(item, 1000 - (item - 2061000) * 100); - else if (item == 4003000)//screws - cm.gainItem(4003000, 15 * qty); - else - cm.gainItem(item, qty); + cm.gainItem(recvItem, recvQty); cm.sendOk("All done. If you need anything else, you know where to find me."); } cm.dispose(); diff --git a/scripts/npc/world0/2040020.js b/scripts/npc/world0/2040020.js index ec56be7320..7a9d92d255 100644 --- a/scripts/npc/world0/2040020.js +++ b/scripts/npc/world0/2040020.js @@ -220,7 +220,7 @@ function action(mode, type, selection) { } else if (status == 3) { var complete = true; - if(!cm.canHold(item)) { + if(!cm.canHold(item, 1)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; @@ -238,23 +238,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - - /* - if (mats instanceof Array) { - for(var i = 0; complete && i < mats.length; i++) { - if (matQty[i] == 1) { - if (!cm.haveItem(mats[i])) { - complete = false; - } - } else { - if (!cm.haveItem(mats[i],matQty[i] * selection)) - complete=false; - } - } - } else { - if (!cm.haveItem(mats,matQty * selection)) - complete=false; - }*/ } if (stimulator){ //check for stimulator if (!cm.haveItem(stimID)) { diff --git a/scripts/npc/world0/2040021.js b/scripts/npc/world0/2040021.js index 3f5b22e70a..5f52af4613 100644 --- a/scripts/npc/world0/2040021.js +++ b/scripts/npc/world0/2040021.js @@ -159,12 +159,12 @@ function action(mode, type, selection) { } else if (status == 3) { var complete = true; - if(!cm.canHold(item)) { + if(!cm.canHold(item, 1)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; } - else if (cm.getMeso() < (cost)){ + else if (cm.getMeso() < cost){ cm.sendOk("Sorry, we only accept meso."); cm.dispose(); return; @@ -177,22 +177,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - - /* - if (mats instanceof Array) { - for (var i = 0; complete && i < mats.length; i++) { - if (matQty[i] == 1){ - if (!cm.haveItem(mats[i])) - complete = false; - } else { - if (!cm.haveItem(mats[i],matQty[i])) - complete=false; - } - } - } else { - if (!cm.haveItem(mats,matQty)) - complete=false; - }*/ } if (stimulator){ //check for stimulator if (!cm.haveItem(stimID)) { @@ -213,7 +197,7 @@ function action(mode, type, selection) { cm.gainItem(stimID, -1); var deleted = Math.floor(Math.random() * 10); if (deleted != 0) { - addRandomItem(item); + cm.gainItem(item, 1, true, true); cm.sendOk("There, the shoes are ready. Be careful, they're still hot."); } else { cm.sendOk("Eek! I think I accidently added too much stimulator and, well, the whole thing is unusable now... Sorry, but I can't offer a refund."); diff --git a/scripts/npc/world0/2040022.js b/scripts/npc/world0/2040022.js index 59c4193846..edba4b857b 100644 --- a/scripts/npc/world0/2040022.js +++ b/scripts/npc/world0/2040022.js @@ -197,10 +197,13 @@ function action(mode, type, selection) { } else if (status == 3 && mode == 1) { var complete = true; - - if (cm.getMeso() < cost) + + if(!cm.canHold(item, 1)) { + cm.sendOk("Verify for a slot in your inventory first."); + } + else if (cm.getMeso() < cost) { - cm.sendOk("I'm afraid my fees are non-negotiable.") + cm.sendOk("I'm afraid my fees are non-negotiable."); } else { @@ -247,7 +250,7 @@ function action(mode, type, selection) { var deleted = Math.floor(Math.random() * 10); if (deleted != 0) { - addRandomItem(item); + cm.gainItem(item, 1, true, true); cm.sendOk("Heeere you go! What do you think? Marvellous, isn't it?"); } else diff --git a/scripts/npc/world0/2080000.js b/scripts/npc/world0/2080000.js index bceb408de6..f2128e4ac3 100644 --- a/scripts/npc/world0/2080000.js +++ b/scripts/npc/world0/2080000.js @@ -182,7 +182,7 @@ function action(mode, type, selection) { } else if (status == 3) { var complete = true; - if(!cm.canHold(item)) { + if(!cm.canHold(item, 1)) { cm.sendOk("Check your inventory for a free slot first."); cm.dispose(); return; @@ -199,23 +199,6 @@ function action(mode, type, selection) { } else if (!cm.haveItem(mats, matQty)) complete = false; - - /* if (mats instanceof Array) { - for(var i = 0; complete && i < mats.length; i++) { - if (matQty[i] == 1) { - if (!cm.haveItem(mats[i])) { - complete = false; - } - } else { - if (!cm.haveItem(mats[i], matQty[i])) - complete=false; - } - } - } else { - if (!cm.haveItem(mats,matQty)) - complete=false; - } - */ } if (stimulator){ //check for stimulator if (!cm.haveItem(stimID)) { diff --git a/scripts/npc/world0/2090004.js b/scripts/npc/world0/2090004.js index 6759de5de9..3836f4e4a4 100644 --- a/scripts/npc/world0/2090004.js +++ b/scripts/npc/world0/2090004.js @@ -210,41 +210,17 @@ function action(mode, type, selection) { for(var i = 0; i < mats.length; i++) { if(!cm.haveItem(mats[i], matQty[i])) complete = false; - - /* if (matQty[i] == 1) { - if (!cm.haveItem(mats[i])) { - complete = false; - } - } - else { - var count = 0; - var iter = cm.getInventory(4).listById(mats[i]).iterator(); - while (iter.hasNext()) { - count += iter.next().getQuantity(); - } - if (count < matQty[i]) - complete = false; - } */ } } else { if(!cm.haveItem(mats, matQty)) complete = false; - - /* var count = 0; - var iter = cm.getInventory(4).listById(mats).iterator(); - while (iter.hasNext()) { - count += iter.next().getQuantity(); - } - if (count < matQty) - complete = false; - */ } if(java.lang.Math.random() >= 0.9) //A lucky find! Scroll 60% item += 1; - if (!complete || !cm.canHold(item)) + if (!complete || !cm.canHold(item, 1)) cm.sendOk("Please make sure you are neither lacking ingredients or lacking space in your use inventory."); else { if (mats instanceof Array) { @@ -255,7 +231,7 @@ function action(mode, type, selection) { else cm.gainItem(mats, -matQty); - cm.gainItem(item); + cm.gainItem(item, 1); } cm.dispose(); @@ -265,16 +241,7 @@ function action(mode, type, selection) { if(!cm.haveItem(item, 100)) complete = false; - - /* var count = 0; - var iter = cm.getInventory(4).listById(item).iterator(); - while (iter.hasNext()) { - count += iter.next().getQuantity(); - } - if (count < 100) - complete = false; - */ - + if(!complete) { cm.sendOk("Please make sure you are neither lacking ingredients or lacking space in your etc inventory."); cm.dispose(); diff --git a/scripts/npc/world0/2100001.js b/scripts/npc/world0/2100001.js index 22015e332c..740cf3ff55 100644 --- a/scripts/npc/world0/2100001.js +++ b/scripts/npc/world0/2100001.js @@ -146,10 +146,23 @@ function action(mode, type, selection) { } else if (status == 5 && mode == 1) { var complete = true; + var recvItem = item, recvQty; + + if (item >= 2060000 && item <= 2060002) //bow arrows + recvQty = 1000 - (item - 2060000) * 100; + else if (item >= 2061000 && item <= 2061002) //xbow arrows + recvQty = 1000 - (item - 2061000) * 100; + else if (item == 4003000)//screws + recvQty = 15 * qty; + else + recvQty = qty; - if (cm.getMeso() < cost * qty) + if(!cm.canHold(recvItem, recvQty)) { + cm.sendOk("I'm afraid you are short in inventory slots for this."); + } + else if (cm.getMeso() < cost * qty) { - cm.sendOk("I'm afraid you cannot afford my services.") + cm.sendOk("I'm afraid you cannot afford my services."); } else { @@ -188,14 +201,7 @@ function action(mode, type, selection) { if (cost > 0) cm.gainMeso(-cost * qty); - if (item >= 2060000 && item <= 2060002) //bow arrows - cm.gainItem(item, 1000 - (item - 2060000) * 100); - else if (item >= 2061000 && item <= 2061002) //xbow arrows - cm.gainItem(item, 1000 - (item - 2061000) * 100); - else if (item == 4003000)//screws - cm.gainItem(4003000, 15 * qty); - else - cm.gainItem(item, qty); + cm.gainItem(recvItem, recvQty); cm.sendOk("There, finished. What do you think, a piece of art, isn't it? Well, if you need anything else, you know where to find me."); } cm.dispose(); diff --git a/scripts/npc/world0/2110005.js b/scripts/npc/world0/2110005.js index a15a154616..6263cedf80 100644 --- a/scripts/npc/world0/2110005.js +++ b/scripts/npc/world0/2110005.js @@ -41,6 +41,7 @@ function action(mode, type, selection) { if (mode == 1) { if (cm.getMeso() < 1500) { cm.sendNext("I am sorry, but I think you are short on mesos. I am afraid I can't let you ride this if you do not have enough money to do so. Please come back when you have enough money to use this."); + cm.dispose(); } else { cm.warp(cm.getPlayer().getMapId() == 260020000 ? 261000000 : 260000000, 0); cm.gainMeso(-1500); diff --git a/scripts/npc/world0/9000017.js b/scripts/npc/world0/9000017.js index 5f24f867c9..d2189b9bbe 100644 --- a/scripts/npc/world0/9000017.js +++ b/scripts/npc/world0/9000017.js @@ -89,7 +89,7 @@ function action(mode, type, selection) { if (cm.getMeso() < cost * qty) { cm.sendOk("Come on! We're not here doing you a favor! We all need money to live properly, so bring the cash so we make deal and start the synthesis."); } - else if(!cm.canHold(item)) { + else if(!cm.canHold(item, qty)) { cm.sendOk("You didn't check if you got a slot to spare on your inventory before our business, no?"); } else { diff --git a/scripts/npc/world0/9000036.js b/scripts/npc/world0/9000036.js index 5b2fb31306..d560bbd6f7 100644 --- a/scripts/npc/world0/9000036.js +++ b/scripts/npc/world0/9000036.js @@ -177,11 +177,11 @@ function action(mode, type, selection) { if (!complete) cm.sendOk("Are you sure you got all the items required? Double check it!"); else { - if (cm.canHold(item)) { + if (cm.canHold(item, qty)) { if (mats instanceof Array) { for (var i = 0; i < mats.length; i++) cm.gainItem(mats[i], -(matQty[i] * qty)); - }else + } else cm.gainItem(mats, -(matQty * qty)); cm.gainMeso(-(cost * qty)); diff --git a/scripts/npc/world0/9270017.js b/scripts/npc/world0/9270017.js index 05539d4df1..64127f0633 100644 --- a/scripts/npc/world0/9270017.js +++ b/scripts/npc/world0/9270017.js @@ -26,13 +26,14 @@ Information -- Version Info ----------------------------------------------------------------------------------- 1.0 - First Version by Information + 2.0 - Second Version by Jayd --------------------------------------------------------------------------------------------------- **/ var status = 0; function start() { - cm.sendYesNo("The plane will be taking off soon, Will you leave now? You will have buy the plane ticket again to come in here."); + cm.sendYesNo("The plane will be taking off soon, will you leave now? You will have to buy the plane ticket again to come in here."); } function action(mode, type, selection) { @@ -44,9 +45,9 @@ function action(mode, type, selection) { } status++; if (status == 1) { - cm.sendNext("I have already told you the ticket is not refunable~ hope to see you again~"); + cm.sendNext("The ticket is not refundable, hope to see you again!"); } else if(status == 2){ - cm.warp(103000000); - cm.dispose(); + cm.warp(103000000); + cm.dispose(); } } \ No newline at end of file diff --git a/scripts/npc/world0/9270018.js b/scripts/npc/world0/9270018.js index a5b6b0537a..f655803d27 100644 --- a/scripts/npc/world0/9270018.js +++ b/scripts/npc/world0/9270018.js @@ -26,8 +26,12 @@ Information -- Version Info ----------------------------------------------------------------------------------- 1.0 - First Version by Information + 2.0 - Second Version by Jayd --------------------------------------------------------------------------------------------------- **/ +var k2s; +var airport; +var s2k; function start() { status = -1; @@ -43,16 +47,40 @@ function action(mode, type, selection) { status++; } if(mode == 0) { - cm.sendOk("Please hold on for a sec, and plane will be taking off. Thanks for your patience."); - cm.dispose(); - return; + if (cm.getMapId() == 540010101) { + cm.sendOk("Please hold on for a sec, and we're reaching Singapore! Thanks for your patience."); + cm.dispose(); + return; + } else { + cm.sendOk("Please hold on for a sec, and we're reaching Kerning City! Thanks for your patience."); + cm.dispose(); + return; + } } if(status == 0) { - cm.sendYesNo("The plane will be taking off soon, Will you leave now? You will have buy the plane ticket again to come in here."); + if (cm.getMapId() == 540010001) { + cm.sendYesNo("The plane is taking off soon, are you sure you want to leave now? The ticket is not refundable."); + airport = 1; + } else if (cm.getMapId() == 540010002) { + cm.sendYesNo("We're reaching Kerning City in a minute, are you sure you want to leave now? The ticket is not refundable."); + s2k = 1; + } else if (cm.getMapId() == 540010101) { + cm.sendYesNo("We're reaching Singapore in a minute, are you sure you want to leave now? The ticket is not refundable."); + k2s = 1; + } } else if(status == 1) { - cm.sendNext("I have already told you the ticket is not refunable~ hope to see you again~"); - } else if(status == 2) { - cm.warp(540010000); - cm.dispose(); + if (k2s == 1) { + cm.warp(103000000); + cm.sendOk("Hope to see you again soon!"); + cm.dispose(); + } else if (airport == 1) { + cm.warp(540010000); + cm.sendOk("Hope to see you again soon!"); + cm.dispose(); + } else if (s2k == 1) { + cm.warp(540010000); + cm.sendOk("Hope to see you again soon!"); + cm.dispose(); + } } } \ No newline at end of file diff --git a/scripts/npc/world0/9270038.js b/scripts/npc/world0/9270038.js index 938528f46a..2264221458 100644 --- a/scripts/npc/world0/9270038.js +++ b/scripts/npc/world0/9270038.js @@ -1,8 +1,40 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License 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 . +*/ + +/** +-- Odin JavaScript -------------------------------------------------------------------------------- + Shalon - Ticketing Usher +-- By --------------------------------------------------------------------------------------------- + Whoever written this script +-- Version Info ----------------------------------------------------------------------------------- + 1.0 - First Version by whoever written this script + 2.0 - Second Version by Jayd +--------------------------------------------------------------------------------------------------- +**/ + status = -1; oldSelection = -1; function start() { - cm.sendSimple("Hello, I am Shalon from Singapore Airport. I can assist you in getting you to Singapore in no time. Do you want to go to Singapore?\r\n#b#L0#I would like to buy a plane ticket to Kerning City\r\n#b#L1#Let me go in to the departure point."); + cm.sendSimple("Hello, I am Shalon from Singapore Airport. I can assist you in getting you to Kerning City in no time. Do you want to go to Kerning City?\r\n#b#L0#I would like to buy a plane ticket to Kerning City\r\n#b#L1#Let me go in to the departure point."); } function action(mode, type, selection) { @@ -21,8 +53,15 @@ function action(mode, type, selection) { oldSelection = selection; }else if(status == 1){ if(oldSelection == 0){ - cm.gainMeso(-5000); - cm.gainItem(4031732); + if (cm.getPlayer().getMeso() > 4999 && cm.getPlayer().haveItem(4031732) == false) { + cm.gainMeso(-5000); + cm.gainItem(4031732); + cm.sendOk("Thank you for choosing Wizet Airline! Enjoy your flight!"); + cm.dispose(); + } else { + cm.sendOk("You do not have enough mesos or you've already purchased a ticket."); + cm.dispose(); + } }else if(oldSelection == 1){ if(cm.itemQuantity(4031732) > 0){ var em = cm.getEventManager("AirPlane"); diff --git a/scripts/npc/world0/9270041.js b/scripts/npc/world0/9270041.js index 6b8bd294f8..5edb71938e 100644 --- a/scripts/npc/world0/9270041.js +++ b/scripts/npc/world0/9270041.js @@ -1,3 +1,35 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License 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 . +*/ + +/** +-- Odin JavaScript -------------------------------------------------------------------------------- + Irene - Ticketing Usher +-- By --------------------------------------------------------------------------------------------- + Whoever written this script +-- Version Info ----------------------------------------------------------------------------------- + 1.0 - First Version by whoever written this script + 2.0 - Second Version by Jayd +--------------------------------------------------------------------------------------------------- +**/ + status = -1; oldSelection = -1; @@ -21,8 +53,15 @@ function action(mode, type, selection) { oldSelection = selection; }else if(status == 1){ if(oldSelection == 0){ - cm.gainMeso(-5000); - cm.gainItem(4031731); + if (cm.getPlayer().getMeso() > 4999 && cm.getPlayer().haveItem(4031731) == false) { + cm.gainMeso(-5000); + cm.gainItem(4031731); + cm.sendOk("Thank you for choosing Wizet Airline! Enjoy your flight!"); + cm.dispose(); + } else { + cm.sendOk("You do not have enough mesos or you've already purchased a ticket."); + cm.dispose(); + } }else if(oldSelection == 1){ if(cm.itemQuantity(4031731) > 0){ var em = cm.getEventManager("AirPlane"); diff --git a/ariant_castle.js b/scripts/portal/ariant_castle.js similarity index 97% rename from ariant_castle.js rename to scripts/portal/ariant_castle.js index 831ef79e1e..929e839b74 100644 --- a/ariant_castle.js +++ b/scripts/portal/ariant_castle.js @@ -1,41 +1,41 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License 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 . -*/ - -/** --- Odin JavaScript -------------------------------------------------------------------------------- - Portal - To get into Ariant Castle --- By --------------------------------------------------------------------------------------------- - Jayd --- Version Info ----------------------------------------------------------------------------------- - 1.0 - First Version by Jayd ---------------------------------------------------------------------------------------------------- -**/ - -function enter(pi) { - if (pi.getPlayer().haveItem(4031582) == true) { - pi.playPortalSound(); - pi.warp(260000301); - return true; - } else { - pi.playerMessage(5, "You can enter only if you have a Entry Pass to the Palace."); - return false; - } +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License 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 . +*/ + +/** +-- Odin JavaScript -------------------------------------------------------------------------------- + Portal - To get into Ariant Castle +-- By --------------------------------------------------------------------------------------------- + Jayd +-- Version Info ----------------------------------------------------------------------------------- + 1.0 - First Version by Jayd +--------------------------------------------------------------------------------------------------- +**/ + +function enter(pi) { + if (pi.getPlayer().haveItem(4031582) == true) { + pi.playPortalSound(); + pi.warp(260000301); + return true; + } else { + pi.playerMessage(5, "You can enter only if you have a Entry Pass to the Palace."); + return false; + } } \ No newline at end of file