From d7a2243319b8b730baf514d94735f17488497899 Mon Sep 17 00:00:00 2001 From: ronancpl Date: Mon, 18 Jul 2016 13:46:28 -0300 Subject: [PATCH] Instant sell NPC + new features Donation Box NPC sells instantly items from inventory. Minor patches. --- README.txt | 9 ++- configuration.ini | 2 +- mychanges_ptbr.txt | 8 +- nbproject/private/private.xml | 38 +++++---- scripts/npc/world0/1022003.js | 4 +- scripts/npc/world0/1072000.js | 3 +- scripts/npc/world0/2040016.js | 6 +- scripts/npc/world0/2091005.js | 4 +- scripts/npc/world0/9000036.js | 8 +- scripts/npc/world0/9000041.js | 79 +++++++++++++++++++ scripts/npc/world0/9201057.js | 9 ++- scripts/npc/world0/9201097.js | 12 +-- scripts/quest/3454.js | 53 +++++++++++++ scripts/reactor/2202002.js | 5 +- scripts/reactor/2302001.js | 5 ++ sql/db_drops.sql | 15 ++-- sql/db_shopupdate.sql | 3 + sql/readme.txt | 5 +- src/client/MapleCharacter.java | 53 ++++++++++++- src/client/inventory/MapleInventory.java | 10 +++ src/constants/ExpTable.java | 2 +- src/constants/ServerConstants.java | 4 +- src/scripting/npc/NPCConversationManager.java | 1 + .../reactor/ReactorActionManager.java | 2 +- src/server/maps/MapleReactor.java | 6 +- .../quest/requirements/NpcRequirement.java | 5 +- wz/Quest.wz/Act.img.xml | 2 +- wz/Quest.wz/Check.img.xml | 4 +- 28 files changed, 290 insertions(+), 67 deletions(-) create mode 100644 scripts/npc/world0/9000041.js create mode 100644 scripts/quest/3454.js diff --git a/README.txt b/README.txt index cd17c9fe7a..e02fe38f2c 100644 --- a/README.txt +++ b/README.txt @@ -2,16 +2,17 @@ MapleSolaxiaV2 Freelance developer: Ronan C. P. Lana -Credits about are to be given to the original MapleSolaxia staff and other colaborators, as some minor -changes/patches on the game were applied by me. +Credits about are to be given to the original MapleSolaxia staff and other colaborators, as just some minor +changes/patches on the game were applied by myself. This is a NetBeans 8.0.2 Project. This means that it's easier to install the project via "NetBeans' import new project using existing code". Once installed, build this project on your machine and run the server using the "launch.bat" application. -Note that the project uses the IP 25.15.163.31. Therefore, change the IP wherever it applies to run properly -the program. Eventually, I will change the settings on this repository to run at localhost (127.0.0.1). +Note that the project uses the IP 25.75.212.150. Therefore, change the IP wherever it applies (Ctrl+f the +entire project) to run properly the program. Eventually, I will change the settings on this repository to run +at localhost (127.0.0.1). ------------------------------------------------ diff --git a/configuration.ini b/configuration.ini index 81330a3e9c..2e8bd4adae 100644 --- a/configuration.ini +++ b/configuration.ini @@ -1,4 +1,4 @@ -HOST=25.15.163.31 +HOST=25.75.212.150 URL=jdbc:mysql://localhost:3306/maplesolaxia DB_USER=root DB_PASS= diff --git a/mychanges_ptbr.txt b/mychanges_ptbr.txt index e11fc7a207..5f72daaabc 100644 --- a/mychanges_ptbr.txt +++ b/mychanges_ptbr.txt @@ -87,4 +87,10 @@ Correcao de bug em scripts que fazia o jogador ficar preso num mapa de transicao Correcao de bug, onde o sistema nao contabilizava corretamente queda de HP em determinados mapas. 03 Janeiro 2016, -Correcao de bug, onde clientes podiam congelar apos acessar o Cash Shop. \ No newline at end of file +Correcao de bug, onde clientes podiam congelar apos acessar o Cash Shop. + +16 Julho 2016, +Correcao de bug. + +18 Julho 2016, +Bazaar NPC (Donation Box): venda automatica de um item designado e todos os itens que estiverem imediatamente após. \ No newline at end of file diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index f33c95db5f..078212c0ee 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -3,25 +3,33 @@ - file:/C:/Nexon/MapleSolaxia/src/net/server/world/World.java - file:/C:/Nexon/MapleSolaxia/src/server/MapleStatEffect.java - file:/C:/Nexon/MapleSolaxia/src/net/MapleServerHandler.java + file:/C:/Nexon/MapleSolaxia/scripts/npc/world0/9000036.js + file:/C:/Nexon/MapleSolaxia/src/scripting/reactor/ReactorActionManager.java + file:/C:/Nexon/MapleSolaxia/src/scripting/npc/NPCConversationManager.java + file:/C:/Nexon/MapleSolaxia/src/client/inventory/MapleInventory.java + file:/C:/Nexon/MapleSolaxia/src/scripting/npc/NPCScriptManager.java file:/C:/Nexon/MapleSolaxia/src/client/MapleClient.java - file:/C:/Nexon/MapleSolaxia/src/net/server/PlayerStorage.java - file:/C:/Nexon/MapleSolaxia/src/client/command/Commands.java + file:/C:/Nexon/MapleSolaxia/src/server/MapleItemInformationProvider.java + file:/C:/Nexon/MapleSolaxia/wz/Quest.wz/QuestInfo.img.xml + file:/C:/Nexon/MapleSolaxia/src/client/MonsterBook.java + file:/C:/Nexon/MapleSolaxia/src/scripting/event/EventInstanceManager.java + file:/C:/Nexon/MapleSolaxia/src/server/MapleStorage.java + file:/C:/Nexon/MapleSolaxia/src/server/MapleShop.java + file:/C:/Nexon/MapleSolaxia/src/client/inventory/MapleInventoryType.java + file:/C:/Nexon/MapleSolaxia/src/client/inventory/Item.java + file:/C:/Nexon/MapleSolaxia/src/server/maps/MapleReactorStats.java + file:/C:/Nexon/MapleSolaxia/src/scripting/AbstractScriptManager.java + file:/C:/Nexon/MapleSolaxia/src/provider/MapleData.java + file:/C:/Nexon/MapleSolaxia/src/provider/MapleDataProvider.java + file:/C:/Nexon/MapleSolaxia/src/net/MapleServerHandler.java file:/C:/Nexon/MapleSolaxia/src/client/MapleCharacter.java - file:/C:/Nexon/MapleSolaxia/src/net/server/channel/handlers/ChangeMapSpecialHandler.java + file:/C:/Nexon/MapleSolaxia/src/client/command/Commands.java file:/C:/Nexon/MapleSolaxia/src/tools/MaplePacketCreator.java - file:/C:/Nexon/MapleSolaxia/src/net/server/channel/handlers/EnterMTSHandler.java - file:/C:/Nexon/MapleSolaxia/src/net/server/channel/Channel.java - file:/C:/Nexon/MapleSolaxia/src/net/server/channel/handlers/EnterCashShopHandler.java - file:/C:/Nexon/MapleSolaxia/src/net/server/channel/handlers/ChangeMapHandler.java - file:/C:/Nexon/MapleSolaxia/src/net/server/channel/handlers/StorageHandler.java - file:/C:/Nexon/MapleSolaxia/src/net/server/channel/handlers/PlayerLoggedinHandler.java - file:/C:/Nexon/MapleSolaxia/src/net/PacketProcessor.java - file:/C:/Nexon/MapleSolaxia/src/net/server/channel/handlers/ChangeChannelHandler.java + file:/C:/Nexon/MapleSolaxia/logs/29-07-2015/error/saveToDB.txt + file:/C:/Nexon/MapleSolaxia/src/scripting/AbstractPlayerInteraction.java + file:/C:/Nexon/MapleSolaxia/src/net/server/RankingWorker.java file:/C:/Nexon/MapleSolaxia/src/constants/ServerConstants.java - file:/C:/Nexon/MapleSolaxia/src/server/maps/MapleMap.java + file:/C:/Nexon/MapleSolaxia/src/server/maps/MapleReactor.java diff --git a/scripts/npc/world0/1022003.js b/scripts/npc/world0/1022003.js index 91857c4805..17b0c0afe5 100644 --- a/scripts/npc/world0/1022003.js +++ b/scripts/npc/world0/1022003.js @@ -139,9 +139,9 @@ function action(mode, type, selection) { qty = selection; if (selectedType == 2){ //helmet refine - var itemSet = new Array(1002042,1002041,1002002,1002044,1002003,1002040,1002007,1002052,1002011,1002058,1002009,1002056,1002087,1002088,1002049,1002050,1002047,1002048,1002099,1002098,1002085,1002028,1002022,1002101); + var itemSet = new Array(1002042,1002041,1002002,1002044,1002003,1002040,1002007,1002052,1002011,1002058,1002009,1002056,1002087,1002088,1002050,1002049,1002047,1002048,1002099,1002098,1002085,1002028,1002022,1002101); var matSet = new Array(new Array(1002001,4011002),new Array(1002001,4021006),new Array(1002043,4011001),new Array(1002043,4011002),new Array(1002039,4011001),new Array(1002039,4011002),new Array(1002051,4011001),new Array(1002051,4011002),new Array(1002059,4011001),new Array(1002059,4011002), - new Array(1002055,4011001),new Array(1002055,4011002),new Array(1002027,4011002),new Array(1002027,4011006),new Array(1002005,4011006),new Array(1002005,4011005),new Array(1002004,4021000),new Array(1002004,4021005),new Array(1002021,4011002),new Array(1002021,4011006),new Array(1002086,4011002), + new Array(1002055,4011001),new Array(1002055,4011002),new Array(1002027,4011002),new Array(1002027,4011006),new Array(1002005,4011005),new Array(1002005,4011006),new Array(1002004,4021000),new Array(1002004,4021005),new Array(1002021,4011002),new Array(1002021,4011006),new Array(1002086,4011002), new Array(1002086,4011004),new Array(1002100,4011007,4011001),new Array(1002100,4011007,4011002)); var matQtySet = new Array(new Array(1,1),new Array(1,1),new Array(1,1),new Array(1,1),new Array(1,1),new Array(1,1),new Array(1,2),new Array(1,2),new Array(1,3),new Array(1,3),new Array(1,3),new Array(1,3),new Array(1,4),new Array(1,4),new Array(1,5),new Array(1,5),new Array(1,3),new Array(1,3), new Array(1,5),new Array(1,6),new Array(1,5),new Array(1,4),new Array(1,1,7),new Array(1,1,7)); diff --git a/scripts/npc/world0/1072000.js b/scripts/npc/world0/1072000.js index bbaa7ac070..4c1e8749ad 100644 --- a/scripts/npc/world0/1072000.js +++ b/scripts/npc/world0/1072000.js @@ -55,10 +55,11 @@ function action(mode, type, selection) { cm.sendNextPrev("You'll be able to acquire a marble called #b#t4031013##k while knocking down those monsters. It is a special marble made out of their sinister, evil minds. Collect 30 of those, and then go talk to a colleague of mine in there. That's how you pass the test."); else if (status == 3) cm.sendYesNo("Once you go inside, you can't leave until you take care of your mission. If you die, your experience level will decrease..so you better really buckle up and get ready...well, do you want to go for it now?"); - else if (status == 4) + else if (status == 4) { cm.sendNext("Alright I'll let you in! Defeat the monsters inside, collect 30 Dark Marbles, then strike up a conversation with a colleague of mine inside. He'll give you #bThe Proof of a Hero#k, the proof that you've passed the test. Best of luck to you."); cm.startQuest(100004); cm.gainItem(4031008, -1); + } else if (status == 5) { cm.warp(108000300, 0); cm.dispose(); diff --git a/scripts/npc/world0/2040016.js b/scripts/npc/world0/2040016.js index 77b023d149..61091fcbf6 100644 --- a/scripts/npc/world0/2040016.js +++ b/scripts/npc/world0/2040016.js @@ -239,14 +239,12 @@ function action(mode, type, selection) { } } else { - - if (cm.haveItem(mats[i],matQty[i]*qty))complete=false; + if (!cm.haveItem(mats[i],matQty[i]*qty)) complete=false; } } } else { - if (!cm.haveItem(mats, matQty * qty))complete=false; - + if (!cm.haveItem(mats, matQty * qty)) complete=false; } } diff --git a/scripts/npc/world0/2091005.js b/scripts/npc/world0/2091005.js index 80d34af5d7..326ab962ad 100644 --- a/scripts/npc/world0/2091005.js +++ b/scripts/npc/world0/2091005.js @@ -30,7 +30,9 @@ importPackage(Packages.server.maps); var disabled = false; var belts = Array(1132000, 1132001, 1132002, 1132003, 1132004); var belt_level = Array(25, 35, 45, 60, 75); -var belt_points = Array(200, 1800, 4000, 9200, 17000); + +/* var belt_points = Array(200, 1800, 4000, 9200, 17000); */ +var belt_points = Array(5, 45, 100, 230, 425); /* Watered down version */ var status = -1; var selectedMenu = -1; diff --git a/scripts/npc/world0/9000036.js b/scripts/npc/world0/9000036.js index fed8e8c22d..7bd2d16fa5 100644 --- a/scripts/npc/world0/9000036.js +++ b/scripts/npc/world0/9000036.js @@ -42,7 +42,7 @@ var maxEqp = 0; function start() { cm.getPlayer().setCS(true); - var selStr = "Hello, I am the #bAccessory NPC Crafter#k! My works are widely recognized to be too fine, to the point which all my items mimic not only the appearance but too the attributes of them! Everything I charge is some 'ingredients' to make them and, of course, a fee for my services. On what kind of equipment will you take a look?#b" + var selStr = "Hello, I am the #bAccessory NPC Crafter#k! My works are widely recognized to be too fine, to the point which all my items mimic not only the appearance but too the attributes of them! Everything I charge is some 'ingredients' to make them and, of course, a fee for my services. On what kind of equipment will you take a look?#b"; var options = ["Pendants","Face accessories","Eye accessories","Belts & medals","Rings","#t4032496#"]; for (var i = 0; i < options.length; i++) selStr += "\r\n#L" + i + "# " + options[i] + "#l"; @@ -51,7 +51,7 @@ function start() { function action(mode, type, selection) { status++; - if (mode != 1){ + if (mode != 1) { cm.dispose(); return; } @@ -109,7 +109,7 @@ function action(mode, type, selection) { var matQtySet = [[20, 20, 5, 1], [5, 5, 10, 1], [10, 4, 20, 4], [20, 8, 20, 8], [10, 4, 20, 4], [15, 6, 30, 6], [20, 8, 40, 8], [15, 6, 30, 6], [1, 1, 1]]; var costSet = [150000, 500000, 200000, 400000, 200000, 300000, 400000, 300000, 2500000]; }else if (selectedType == 1) { //face accessory refine - var matSet = [[4001343, 4003004],[4001343, 4003004,4000026],[4001343, 4003004,4000026,4000082,4003002],[4001343, 4003005],[4001343, 4003005,4000026],[4001343, 4003005,4000026,4000082,4003002],[4001006, 4011008],[4001006, 4011008],[4001006, 4011008],[4001006, 4011008]]; + var matSet = [[4006000, 4003004],[4006000, 4003004,4000026],[4006000, 4003004,4000026,4000082,4003002],[4006000, 4003005],[4006000, 4003005,4000026],[4006000, 4003005,4000026,4000082,4003002],[4001006, 4011008],[4001006, 4011008],[4001006, 4011008],[4001006, 4011008]]; var matQtySet = [[5,5],[5,5,5],[5,5,5,5,1],[5,5],[5,5,5],[5,5,5,5,1],[1,1],[1,1],[1,1],[1,1]]; var costSet = [100000,200000,300000,125000,250000,375000,500000,500000,500000,500000, 25000, 25000, 25000, 25000]; }else if (selectedType == 2) { //eye accessory refine @@ -121,7 +121,7 @@ function action(mode, type, selection) { var matQtySet = [[2, 5, 10], [7777, 7777]]; var costSet = [15000, 7777]; }else if (selectedType == 4) { //ring refine - var matSet = [[4003001, 4001344, 4001343], [4003001, 4001344, 4001343], [4021004, 4011008], [4011008, 4001006], [1112405, 2022039], [1112413, 4000176], [4011007, 4021009]]; + var matSet = [[4003001, 4001344, 4006000], [4003001, 4001344, 4006000], [4021004, 4011008], [4011008, 4001006], [1112405, 2022039], [1112413, 4000176], [4011007, 4021009]]; var matQtySet = [[2, 2, 2], [2, 2, 2], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]; var costSet = [10000, 10000, 10000, 20000, 15000, 15000, 10000]; }else if (selectedType == 5) { //necklace refine diff --git a/scripts/npc/world0/9000041.js b/scripts/npc/world0/9000041.js new file mode 100644 index 0000000000..dbb5da98da --- /dev/null +++ b/scripts/npc/world0/9000041.js @@ -0,0 +1,79 @@ +/* + 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 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 . +*/ +/* NPC: Donation Box (9000041) + Victoria Road : Henesys + + NPC Bazaar: + * By Ronan Lana +*/ + +var options = ["EQUIP","USE","SET-UP","ETC"]; +var name; +var status; +var selectedType = 0; + +function start() { + status = -1; + action(1, 0, 0); +} + +function action(mode, type, selection) { + status++; + if (mode != 1) { + cm.dispose(); + return; + } + + if (status == 0) { + var selStr = "Hello, I am the #bBazaar NPC#k! Sell to me any item on your inventory you don't need. #rWARNING#b: Make sure you have your items ready to sell at the slots #rAFTER#b the item you have selected to sell.#k Any items #bunder#k the item selected will be sold thoroughly."; + for (var i = 0; i < options.length; i++) + selStr += "\r\n#L" + i + "# " + options[i] + "#l"; + cm.sendSimple(selStr); + } + + else if (status == 1) { + selectedType = selection; + cm.sendGetText("From what item on your #r" + options[selectedType] + "#k inventory do you want to start the transaction?"); + } + + else if (status == 2) { + name = cm.getText(); + var res = false; + + if (selectedType == 0) { + res = cm.getPlayer().sellAllItemsFromName(Packages.client.inventory.MapleInventoryType.EQUIP, name); + }else if (selectedType == 1) { + res = cm.getPlayer().sellAllItemsFromName(Packages.client.inventory.MapleInventoryType.USE, name); + }else if (selectedType == 2) { + res = cm.getPlayer().sellAllItemsFromName(Packages.client.inventory.MapleInventoryType.SETUP, name); + }else if (selectedType == 3) { + res = cm.getPlayer().sellAllItemsFromName(Packages.client.inventory.MapleInventoryType.ETC, name); + }else if (selectedType == 4) { + res = cm.getPlayer().sellAllItemsFromName(Packages.client.inventory.MapleInventoryType.CASH, name); + } + + if(res) cm.sendOk("Transaction complete!"); + else cm.sendOk("#b'" + name + "'#k is not a #b" + options[selectedType] + "#k item!"); + + cm.dispose(); + } +} \ No newline at end of file diff --git a/scripts/npc/world0/9201057.js b/scripts/npc/world0/9201057.js index 0916b2f4e1..71f718c056 100644 --- a/scripts/npc/world0/9201057.js +++ b/scripts/npc/world0/9201057.js @@ -11,9 +11,14 @@ function action(mode, type, selection) { return; } if (cm.c.getPlayer().getMapId() == 103000100 || cm.c.getPlayer().getMapId() == 600010001){ - if(cm.getMeso() >= 5000){ + var item = 4031711 + parseInt(cm.c.getPlayer().getMapId() / 300000000); + + if(!cm.canHold(item)) { + cm.sendNext("You don't have a etc. slot available."); + } + else if(cm.getMeso() >= 5000){ cm.gainMeso(-5000); - cm.gainItem(4031711 + parseInt(cm.c.getPlayer().getMapId() / 300000000), 1); + cm.gainItem(item, 1); cm.sendNext("There you go."); }else cm.sendNext("You don't have enough mesos."); diff --git a/scripts/npc/world0/9201097.js b/scripts/npc/world0/9201097.js index 5121900602..99d42f4750 100644 --- a/scripts/npc/world0/9201097.js +++ b/scripts/npc/world0/9201097.js @@ -72,14 +72,14 @@ function start() { function action(mode, type, selection) { if (mode == 0) { - cm.sendOk("Hmmm...it shouldn't be a bad deal for you. Come see me at the right time and you may get a much better item to be offered. Anyway, let me know when you have a change of heart."); + cm.sendOk("Hmmm...it shouldn't be a bad deal for you. Come see me at the right time and you may get a much better item to be offered. Anyway, let me know when you have a change of mind."); cm.dispose(); return; } status++; if (status == 0) { // first interaction with NPC - cm.sendNext("Hey, got a little bit of time? Well, my job is to collect items here and sell them elsewhere, but these days the monsters have become much more hostile so it's been difficult to getting good items ... What do you think? Do you want to do some business with me?"); + cm.sendNext("Hey, got a little bit of time? Well, my job is to collect items here and sell them elsewhere, but these days the monsters have become much more hostile so it have been difficult to get good items... What do you think? Do you want to do some business with me?"); } else if (status == 1) { cm.sendYesNo("The deal is simple. You get me something I need, I get you something you need. The problem is, I deal with a whole bunch of people, so the items I have to offer may change every time you see me. What do you think? Still want to do it?"); } else if (status == 2) { @@ -89,10 +89,10 @@ function action(mode, type, selection) { lastSelection = selection; requiredItem = eQuestChoices[selection]; - if(selection / 4 == 0) qnt = 50; + if(selection < 4) qnt = 50; else qnt=25; - cm.sendYesNo("Let's see, you want to trade your #b" + qnt + " #t" + requiredItem + "##k with my stuff right? Before trading make sure you have an empty slot available on your use or etc. inventory. Now, do you want to trade with me?"); + cm.sendYesNo("Let's see, you want to trade your #b" + qnt + " #t" + requiredItem + "##k with my stuff, right? Before trading make sure you have an empty slot available on your use or etc. inventory. Now, do you want to trade with me?"); }else if (status == 4){ itemSet = (Math.floor(Math.random() * eQuestPrizes[lastSelection].length)); reward = eQuestPrizes[lastSelection]; @@ -103,13 +103,13 @@ function action(mode, type, selection) { } else if(prizeItem == 0) { cm.gainItem(requiredItem,-qnt); cm.gainMeso(prizeQuantity); - cm.sendOk("For your #b" + qnt + " #t"+requiredItem+"##k, here's #b" + prizeQuantity + " mesos#k. What do you think? Do you like the items I gave you in return? I plan on being here for a while, so if you gather up more items, I'm always open for a trade ..."); + cm.sendOk("For your #b" + qnt + " #t"+requiredItem+"##k, here's #b" + prizeQuantity + " mesos#k. What do you think? Did you like the items I gave you in return? I plan on being here for awhile, so if you gather up more items, I'm always open for a trade..."); } else if(!cm.canHold(prizeItem)){ cm.sendOk("Your use and etc. inventory seems to be full. You need the free spaces to trade with me! Make room, and then find me."); } else { cm.gainItem(requiredItem,-qnt); cm.gainItem(prizeItem, prizeQuantity); - cm.sendOk("For your #b" + qnt + " #t"+requiredItem+"##k, here's my #b"+prizeQuantity+" #t"+prizeItem+"##k. What do you think? Do you like the items I gave you in return? I plan on being here for a while, so if you gather up more items, I'm always open for a trade ..."); + cm.sendOk("For your #b" + qnt + " #t"+requiredItem+"##k, here's my #b"+prizeQuantity+" #t"+prizeItem+"##k. What do you think? Did you like the items I gave you in return? I plan on being here for awhile, so if you gather up more items, I'm always open for a trade..."); } cm.dispose(); } diff --git a/scripts/quest/3454.js b/scripts/quest/3454.js new file mode 100644 index 0000000000..f37a76db3c --- /dev/null +++ b/scripts/quest/3454.js @@ -0,0 +1,53 @@ +/* + 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 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 . +*/ +/* + Author : Ronan + NPC Name: Dr. Kim + Map(s): Omega Sector + Description: Quest - Wave Translator + Quest ID: 3454 +*/ + +function end(mode, type, selection) { + if(qm.getPlayer().getInventory(Packages.client.inventory.MapleInventoryType.ETC).getNumFreeSlot() < 1) { + qm.sendOk("Make room on your ETC inventory first."); + qm.dispose(); + return; + } + + qm.gainItem(4000125, -1); + qm.gainItem(4031926, -10); + qm.gainItem(4000119, -30); + qm.gainItem(4000118, -30); + + rnd = Math.random(); + if(rnd < 1.0) { + qm.gainItem(4031928, 1); + } + else { + qm.gainItem(4031927, 1); + } + + qm.sendOk("Now, go meet Alien Gray and use this undercover to read through their plans. If this fails, we will need to gather some materials once again."); + qm.forceCompleteQuest(); + qm.dispose(); +} diff --git a/scripts/reactor/2202002.js b/scripts/reactor/2202002.js index d7bd70079d..cacd609183 100644 --- a/scripts/reactor/2202002.js +++ b/scripts/reactor/2202002.js @@ -27,5 +27,8 @@ */ function act(){ - rm.warp(922000009); + if(rm.isQuestActive(3238)) { + rm.warp(922000020); + } + else rm.warp(922000009); } \ No newline at end of file diff --git a/scripts/reactor/2302001.js b/scripts/reactor/2302001.js index df9ae16bf2..9955f9b0d2 100644 --- a/scripts/reactor/2302001.js +++ b/scripts/reactor/2302001.js @@ -26,6 +26,11 @@ * */ + function act(){ + //rm.dropItems(true, 2, 105, 140); + + rm.dropItems(); + } \ No newline at end of file diff --git a/sql/db_drops.sql b/sql/db_drops.sql index 630cddb5ec..9a767925a9 100644 --- a/sql/db_drops.sql +++ b/sql/db_drops.sql @@ -559,7 +559,6 @@ (1210101, 1072285, 1, 1, 0, 700), (9300059, 1072285, 1, 1, 0, 700), (9400242, 1072285, 1, 1, 0, 700), -(1110101, 1012031, 1, 1, 0, 700), (1110101, 4030009, 1, 1, 0, 10000), (1110101, 4001344, 1, 1, 0, 7000), (1110101, 4001356, 1, 1, 0, 7000), @@ -3718,11 +3717,6 @@ (9500307, 4000018, 1, 1, 0, 200000), (9500338, 4000018, 1, 1, 0, 200000), (9303001, 4000018, 1, 1, 0, 200000), -(3220000, 1012031, 1, 1, 0, 40000), -(9300185, 1012031, 1, 1, 0, 40000), -(9500307, 1012031, 1, 1, 0, 40000), -(9500338, 1012031, 1, 1, 0, 40000), -(9303001, 1012031, 1, 1, 0, 700), (3220000, 4003001, 1, 1, 0, 7000), (9300185, 4003001, 1, 1, 0, 7000), (9500307, 4003001, 1, 1, 0, 7000), @@ -18746,7 +18740,9 @@ (9400578, 2001000, 1, 1, 0, 800), (9400578, 1032032, 1, 1, 0, 1200), (9400578, 1032013, 1, 1, 0, 1200), -(9400578, 1372009, 1, 1, 0, 1200); +(9400578, 1372009, 1, 1, 0, 1200), +(9400578, 1372009, 1, 1, 0, 1200), +(9300011, 4031130, 1, 1, 0, 10000); UPDATE IGNORE temp_data SET dropperid=9000002 WHERE dropperid=9000000; @@ -18769,7 +18765,8 @@ `maximum_quantity` int(11) NOT NULL DEFAULT '1', `questid` int(11) NOT NULL DEFAULT '0', `chance` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`dropperid`, `itemid`), + PRIMARY KEY (`id`), + UNIQUE KEY (`dropperid`, `itemid`), KEY `mobid` (`dropperid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; @@ -18803,8 +18800,10 @@ UPDATE drop_data SET questid=77777 WHERE itemid=4001358; #id 77777 for ALL quest items with no v83 quest. UPDATE drop_data SET questid=77777 WHERE itemid=4001359; UPDATE drop_data SET questid=77777 WHERE itemid=4001342; + UPDATE drop_data SET chance=0 WHERE itemid=2050099; #update quest reactor items + UPDATE reactordrops SET questid=2086 WHERE itemid=4031165; UPDATE reactordrops SET questid=3407 WHERE itemid=4031141; UPDATE reactordrops SET questid=3407 WHERE itemid=4031142; UPDATE reactordrops SET questid=3407 WHERE itemid=4031143; diff --git a/sql/db_shopupdate.sql b/sql/db_shopupdate.sql index 8e4713dd70..f269de58a9 100644 --- a/sql/db_shopupdate.sql +++ b/sql/db_shopupdate.sql @@ -3,6 +3,9 @@ UPDATE shopitems SET itemid=1812004, price=1000 WHERE shopitemid=19; UPDATE shopitems SET itemid=2120000, price=100 WHERE shopitemid=20; UPDATE shopitems SET itemid=1812000, price=1000 WHERE shopitemid=21; UPDATE shopitems SET itemid=1812001, price=1000 WHERE shopitemid=22; + +INSERT IGNORE INTO `shopitems` (`shopitemid`, `shopid`, `itemid`, `price`, `pitch`, `position`, `chance`) VALUES +(995032, SHOPID, 2040025, 500000, 0, 0), UPDATE shopitems SET itemid=2040025, price=500000 WHERE shopitemid=995032; UPDATE shopitems SET itemid=2040029, price=500000 WHERE shopitemid=995033; UPDATE shopitems SET itemid=2040301, price=400000 WHERE shopitemid=995034; diff --git a/sql/readme.txt b/sql/readme.txt index 2ef088a9ad..6978170b5b 100644 --- a/sql/readme.txt +++ b/sql/readme.txt @@ -1,3 +1,4 @@ -These 2 SQL files must be executed IN ORDER to set up: +These SQL files must be executed IN ORDER to set up: - db_database.sql - - db_drops.sql \ No newline at end of file + - db_drops.sql + - db_shopupdate.sql (optional) \ No newline at end of file diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index 60dc99be81..61fdc8e365 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -2971,7 +2971,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public static MapleCharacter loadCharFromDB(int charid, MapleClient client, boolean channelserver) throws SQLException { try { - MapleCharacter ret = new MapleCharacter(); + MapleCharacter ret = new MapleCharacter(); ret.client = client; ret.id = charid; Connection con = DatabaseConnection.getConnection(); @@ -4701,7 +4701,58 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return false; } + + public boolean sellAllItemsFromName(MapleInventoryType type, String name) { + //player decides from which inventory items should be sold. + + Item it = getInventory(type).findByName(name); + if(it == null) return(false); + + sellAllItemsFromPosition(type, it.getPosition()); + return(true); + } + + public void sellAllItemsFromPosition(MapleInventoryType type, short pos) { + for(short i = pos; i <= getInventory(type).getSlotLimit(); i++) { + if(getInventory(type).getItem(i) == null) continue; + standaloneSell(getClient(), type, i, getInventory(type).getItem(i).getQuantity()); + } + } + private void standaloneSell(MapleClient c, MapleInventoryType type, short slot, short quantity) { + if (quantity == 0xFFFF || quantity == 0) { + quantity = 1; + } + MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); + Item item = getInventory(type).getItem((short) slot); + if (item == null){ //Basic check + return; + } + if (ItemConstants.isRechargable(item.getItemId())) { + quantity = item.getQuantity(); + } + if (quantity < 0) { + return; + } + short iQuant = item.getQuantity(); + if (iQuant == 0xFFFF) { + iQuant = 1; + } + if (quantity <= iQuant && iQuant > 0) { + MapleInventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false); + double price; + if (ItemConstants.isRechargable(item.getItemId())) { + price = ii.getWholePrice(item.getItemId()) / (double) ii.getSlotMax(c, item.getItemId()); + } else { + price = ii.getPrice(item.getItemId()); + } + int recvMesos = (int) Math.max(Math.ceil(price * quantity), 0); + if (price != -1 && recvMesos > 0) { + gainMeso(recvMesos, false); + } + } + } + public void setShop(MapleShop shop) { this.shop = shop; } diff --git a/src/client/inventory/MapleInventory.java b/src/client/inventory/MapleInventory.java index 019c00f1b1..a80fb0a380 100644 --- a/src/client/inventory/MapleInventory.java +++ b/src/client/inventory/MapleInventory.java @@ -32,6 +32,7 @@ import java.util.Map; import tools.Pair; import client.MapleCharacter; import constants.ItemConstants; +import server.MapleItemInformationProvider; /** * @@ -73,6 +74,15 @@ public class MapleInventory implements Iterable { } return null; } + + public Item findByName(String name) { + for (Item item : inventory.values()) { + if (name.compareToIgnoreCase(MapleItemInformationProvider.getInstance().getName(item.getItemId())) == 0) { + return item; + } + } + return null; + } public int countById(int itemId) { int possesed = 0; diff --git a/src/constants/ExpTable.java b/src/constants/ExpTable.java index af2508db5f..f9e95883f1 100644 --- a/src/constants/ExpTable.java +++ b/src/constants/ExpTable.java @@ -22,7 +22,7 @@ package constants; public final class ExpTable { - private static final int[] exp = {1, 15, 34, 57, 92, 135, 372, 560, 840, 1242, 1144, 1573, 2144, 2800, 3640, 4700, 5893, 7360, 9144, 11120, 13477, 16268, 19320, 22880, 27008, 31477, 36600, 42444, 48720, 55813, 63800, 86784, 98208, 110932, 124432, 139372, 155865, 173280, 192400, 213345, 235372, 259392, 285532, 312928, 342624, 374760, 408336, 445544, 483532, 524160, 567772, 598886, 631704, 666321, 702836, 741351, 781976, 824828, 870028, 917625, 967995, 1021041, 1076994, 1136013, 1198266, 1263930, 1333194, 1406252, 1483314, 1564600, 1650340, 1740778, 1836173, 1936794, 2042930, 2154882, 2272970, 2397528, 2528912, 2667496, 2813674, 2967863, 3130502, 3302053, 3483005, 3673873, 3875201, 4087562, 4311559, 4547832, 4797053, 5059931, 5337215, 5629694, 5938202, 6263614, 6606860, 6968915, 7350811, 7753635, 8178534, 8626718, 9099462, 9598112, 10124088, 10678888, 11264090, 11881362, 12532461, 13219239, 13943653, 14707765, 15513750, 16363902, 17260644, 18206527, 19204245, 20256637, 21366700, 22537594, 23772654, 25075395, 26449526, 27898960, 29427822, 31040466, 32741483, 34535716, 36428273, 38424542, 40530206, 42751262, 45094030, 47565183, 50171755, 52921167, 55821246, 58880250, 62106888, 65510344, 69100311, 72887008, 76881216, 81094306, 85594273, 90225770, 95170142, 100385466, 105886589, 111689174, 117809740, 124265714, 131075474, 138258410, 145834970, 153826726, 162256430, 171148082, 180526997, 190419876, 200854885, 211861732, 223471711, 223471711, 248635353, 262260570, 276632449, 291791906, 307782102, 324648562, 342439302, 361204976, 380999008, 401877754, 423900654, 447130410, 471633156, 497478653, 524740482, 553496261, 583827855, 615821622, 649568646, 685165008, 722712050, 762316670, 804091623, 848155844, 894634784, 943660770, 995373379, 1049919840, 1107455447, 1168144006, 1232158297, 1299680571, 1370903066, 1446028554, 1525246918, 1608855764, 1697021059}; + private static final int[] exp = {1, 15, 34, 57, 92, 135, 372, 560, 840, 1144, 1242, 1573, 2144, 2800, 3640, 4700, 5893, 7360, 9144, 11120, 13477, 16268, 19320, 22880, 27008, 31477, 36600, 42444, 48720, 55813, 63800, 86784, 98208, 110932, 124432, 139372, 155865, 173280, 192400, 213345, 235372, 259392, 285532, 312928, 342624, 374760, 408336, 445544, 483532, 524160, 567772, 598886, 631704, 666321, 702836, 741351, 781976, 824828, 870028, 917625, 967995, 1021041, 1076994, 1136013, 1198266, 1263930, 1333194, 1406252, 1483314, 1564600, 1650340, 1740778, 1836173, 1936794, 2042930, 2154882, 2272970, 2397528, 2528912, 2667496, 2813674, 2967863, 3130502, 3302053, 3483005, 3673873, 3875201, 4087562, 4311559, 4547832, 4797053, 5059931, 5337215, 5629694, 5938202, 6263614, 6606860, 6968915, 7350811, 7753635, 8178534, 8626718, 9099462, 9598112, 10124088, 10678888, 11264090, 11881362, 12532461, 13219239, 13943653, 14707765, 15513750, 16363902, 17260644, 18206527, 19204245, 20256637, 21366700, 22537594, 23772654, 25075395, 26449526, 27898960, 29427822, 31040466, 32741483, 34535716, 36428273, 38424542, 40530206, 42751262, 45094030, 47565183, 50171755, 52921167, 55821246, 58880250, 62106888, 65510344, 69100311, 72887008, 76881216, 81094306, 85594273, 90225770, 95170142, 100385466, 105886589, 111689174, 117809740, 124265714, 131075474, 138258410, 145834970, 153826726, 162256430, 171148082, 180526997, 190419876, 200854885, 211861732, 223471711, 223471711, 248635353, 262260570, 276632449, 291791906, 307782102, 324648562, 342439302, 361204976, 380999008, 401877754, 423900654, 447130410, 471633156, 497478653, 524740482, 553496261, 583827855, 615821622, 649568646, 685165008, 722712050, 762316670, 804091623, 848155844, 894634784, 943660770, 995373379, 1049919840, 1107455447, 1168144006, 1232158297, 1299680571, 1370903066, 1446028554, 1525246918, 1608855764, 1697021059}; private static final int[] pet = {1, 1, 3, 6, 14, 31, 60, 108, 181, 287, 434, 632, 891, 1224, 1642, 2161, 2793, 3557, 4467, 5542, 6801, 8263, 9950, 11882, 14084, 16578, 19391, 22547, 26074, 30000, 2147483647}; private static final int[] mount = {1, 24, 50, 105, 134, 196, 254, 263, 315, 367, 430, 543, 587, 679, 725, 897, 1146, 1394, 1701, 2247, 2543, 2898, 3156, 3313, 3584, 3923, 4150, 4305, 4550}; diff --git a/src/constants/ServerConstants.java b/src/constants/ServerConstants.java index f8b6eff693..8e38c9337b 100644 --- a/src/constants/ServerConstants.java +++ b/src/constants/ServerConstants.java @@ -13,7 +13,7 @@ public class ServerConstants { public static final long RANKING_INTERVAL = 60 * 60 * 1000;//60 minutes, 3600000 public static final boolean ENABLE_PIC = false; //Event Configuration - public static final boolean PERFECT_PITCH = false; //for lvl 30 or above, each lvlup player gains 1 perfect pitch. + public static final boolean PERFECT_PITCH = true; //for lvl 30 or above, each lvlup player gains 1 perfect pitch. // IP Configuration public static String HOST; //Database Configuration @@ -24,7 +24,7 @@ public class ServerConstants { public static boolean JAVA_8; public static boolean SHUTDOWNHOOK; //Gameplay Configurations - public static final boolean USE_DEBUG = false; + public static final boolean USE_DEBUG = true; public static final boolean USE_MTS = false; public static final boolean USE_FAMILY_SYSTEM = false; public static final boolean USE_DUEY = true; diff --git a/src/scripting/npc/NPCConversationManager.java b/src/scripting/npc/NPCConversationManager.java index c974f37aa9..d1d8227d54 100644 --- a/src/scripting/npc/NPCConversationManager.java +++ b/src/scripting/npc/NPCConversationManager.java @@ -440,6 +440,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction { return true; } } catch (SQLException e) { + e.printStackTrace(); return false; } if (getPlayer().getMerchantMeso() == 0) { diff --git a/src/scripting/reactor/ReactorActionManager.java b/src/scripting/reactor/ReactorActionManager.java index ff953d13f2..dce4f943a4 100644 --- a/src/scripting/reactor/ReactorActionManager.java +++ b/src/scripting/reactor/ReactorActionManager.java @@ -69,7 +69,7 @@ public class ReactorActionManager extends AbstractPlayerInteraction { Iterator iter = chances.iterator(); while (iter.hasNext()) { ReactorDropEntry d = iter.next(); - if (Math.random() < (1 / (double) d.chance)) { + if (Math.random() < (c.getPlayer().getDropRate() / (double) d.chance)) { numItems++; items.add(d); } diff --git a/src/server/maps/MapleReactor.java b/src/server/maps/MapleReactor.java index 0b4d04d23d..1b2bffcfbc 100644 --- a/src/server/maps/MapleReactor.java +++ b/src/server/maps/MapleReactor.java @@ -151,9 +151,9 @@ public class MapleReactor extends AbstractMapleMapObject { if(!this.isAlive()) { return; } - if(ServerConstants.USE_DEBUG == true) c.getPlayer().dropMessage(5, "Hitted REACTOR " + this.getId()); + if(ServerConstants.USE_DEBUG == true) c.getPlayer().dropMessage(5, "Hitted REACTOR " + this.getId() + " with POS " + charPos + " , STANCE " + stance + " , SkillID " + skillid); if (stats.getType(state) < 999 && stats.getType(state) != -1) {//type 2 = only hit from right (kerning swamp plants), 00 is air left 02 is ground left - if (!(stats.getType(state) == 2 && (charPos == 0 || charPos == 2))) { //get next state + if (!(stats.getType(state) == 2 && (stance == 0 || stance == 2))) { //get next state for (byte b = 0; b < stats.getStateSize(state); b++) {//YAY? List activeSkills = stats.getActiveSkills(state, b); if (activeSkills != null) { @@ -170,6 +170,8 @@ public class MapleReactor extends AbstractMapleMapObject { } else {//item-triggered on final step map.broadcastMessage(MaplePacketCreator.triggerReactor(this, stance)); } + + if(ServerConstants.USE_DEBUG == true) c.getPlayer().dropMessage(5, "REACTOR " + this.getId() + " activated"); ReactorScriptManager.getInstance().act(c, this); } else { //reactor not broken yet map.broadcastMessage(MaplePacketCreator.triggerReactor(this, stance)); diff --git a/src/server/quest/requirements/NpcRequirement.java b/src/server/quest/requirements/NpcRequirement.java index facd0c2b5d..b822e20c6b 100644 --- a/src/server/quest/requirements/NpcRequirement.java +++ b/src/server/quest/requirements/NpcRequirement.java @@ -33,13 +33,10 @@ import server.quest.MapleQuestRequirementType; */ public class NpcRequirement extends MapleQuestRequirement { private int reqNPC; - private final boolean autoComplete, autoStart; public NpcRequirement(MapleQuest quest, MapleData data) { super(MapleQuestRequirementType.NPC); processData(data); - this.autoComplete = quest.isAutoComplete(); - this.autoStart = quest.isAutoStart(); } @Override @@ -50,6 +47,6 @@ public class NpcRequirement extends MapleQuestRequirement { @Override public boolean check(MapleCharacter chr, Integer npcid) { - return npcid != null && npcid == reqNPC && (autoComplete || autoStart || chr.getMap().containsNPC(npcid)); + return npcid != null && npcid == reqNPC; } } diff --git a/wz/Quest.wz/Act.img.xml b/wz/Quest.wz/Act.img.xml index f02af38dbf..bf1e96b445 100644 --- a/wz/Quest.wz/Act.img.xml +++ b/wz/Quest.wz/Act.img.xml @@ -21699,7 +21699,7 @@ - + diff --git a/wz/Quest.wz/Check.img.xml b/wz/Quest.wz/Check.img.xml index 12c94c1725..d373b1cad4 100644 --- a/wz/Quest.wz/Check.img.xml +++ b/wz/Quest.wz/Check.img.xml @@ -43616,6 +43616,7 @@ + @@ -43649,7 +43650,6 @@ - @@ -49954,8 +49954,6 @@ - -