From 61292f5c9b6bf03f0cd2d45b6324e3d2c0268548 Mon Sep 17 00:00:00 2001 From: ronancpl Date: Fri, 27 Apr 2018 11:14:45 -0300 Subject: [PATCH] Medal quest system tweak + Proximity check on quests + DB leak fix Rebalanced the EXTREMELY low level section of the equipment level up system. Added support code for quests on Kerning Square and Mushroom Castle. Added quest scripts for many missing scripted quests. Refactored medal quests, now using a default script system for uncoded medal questid's. Fixed a DB leak regarding quest status and medal maps tables. Added proximity check for NPCs to start/complete quests that doesn't use the lightbulb system. Added "debuff" command, that debuffs people nearby. --- docs/mychanges_ptbr.txt | 11 ++- docs/todo.txt | 1 + scripts/QUEST Base.js | 4 +- .../{VIPRockSpirit.js => RockSpiritVIP.js} | 2 +- scripts/npc/1052125.js | 13 ++- scripts/npc/commands.js | 1 + scripts/npc/credits.js | 2 +- scripts/portal/TD_MC_first.js | 3 +- scripts/portal/curseforest.js | 2 - scripts/portal/dragonNest.js | 7 +- scripts/portal/tristanEnter.js | 9 +- scripts/quest/2238.js | 21 +---- scripts/quest/2245.js | 58 +++++++++++++ scripts/quest/{29911.js => 2257.js} | 39 +++++---- scripts/quest/2258.js | 69 +++++++++++++++ scripts/quest/2259.js | 73 ++++++++++++++++ scripts/quest/2260.js | 75 ++++++++++++++++ scripts/quest/2291.js | 57 +++++++++++++ scripts/quest/2338.js | 56 ++++++++++++ scripts/quest/29905.js | 39 --------- scripts/quest/29910.js | 39 --------- scripts/quest/29912.js | 39 --------- scripts/quest/29913.js | 39 --------- scripts/quest/29914.js | 39 --------- scripts/quest/29915.js | 39 --------- scripts/quest/29916.js | 39 --------- scripts/quest/29917.js | 39 --------- scripts/quest/29918.js | 39 --------- scripts/quest/29919.js | 39 --------- scripts/quest/29920.js | 39 --------- scripts/quest/29921.js | 39 --------- scripts/quest/29922.js | 39 --------- scripts/quest/29923.js | 39 --------- scripts/quest/29927.js | 39 --------- scripts/quest/29929.js | 39 --------- scripts/quest/29930.js | 39 --------- scripts/quest/29931.js | 39 --------- scripts/quest/29932.js | 39 --------- scripts/quest/29933.js | 39 --------- scripts/quest/3507.js | 2 +- scripts/quest/{29904.js => 3529.js} | 39 +++++---- scripts/quest/3714.js | 53 ++++++++++++ scripts/quest/medalQuest.js | 23 +++++ sql/db_drops.sql | 26 +++++- src/client/DiseaseValueHolder.java | 34 -------- src/client/MapleCharacter.java | 60 ++++++++----- src/client/command/Commands.java | 85 +++++++++++++++++-- src/client/inventory/Equip.java | 4 +- src/constants/GameConstants.java | 4 + .../channel/handlers/QuestActionHandler.java | 45 ++++++++-- src/scripting/quest/QuestActionManager.java | 6 ++ src/scripting/quest/QuestScriptManager.java | 83 ++++++++++-------- src/server/MapleStatEffect.java | 16 ++-- src/server/maps/MapleMap.java | 13 +++ src/server/quest/MapleQuest.java | 50 +++++++++-- .../quest/MapleQuestRequirementType.java | 12 ++- src/server/quest/actions/BuffAction.java | 6 +- .../requirements/BuffExceptRequirement.java | 50 +++++++++++ .../quest/requirements/BuffRequirement.java | 50 +++++++++++ src/tools/MaplePacketCreator.java | 2 +- 60 files changed, 965 insertions(+), 981 deletions(-) rename scripts/event/{VIPRockSpirit.js => RockSpiritVIP.js} (98%) create mode 100644 scripts/quest/2245.js rename scripts/quest/{29911.js => 2257.js} (58%) create mode 100644 scripts/quest/2258.js create mode 100644 scripts/quest/2259.js create mode 100644 scripts/quest/2260.js create mode 100644 scripts/quest/2291.js create mode 100644 scripts/quest/2338.js delete mode 100644 scripts/quest/29905.js delete mode 100644 scripts/quest/29910.js delete mode 100644 scripts/quest/29912.js delete mode 100644 scripts/quest/29913.js delete mode 100644 scripts/quest/29914.js delete mode 100644 scripts/quest/29915.js delete mode 100644 scripts/quest/29916.js delete mode 100644 scripts/quest/29917.js delete mode 100644 scripts/quest/29918.js delete mode 100644 scripts/quest/29919.js delete mode 100644 scripts/quest/29920.js delete mode 100644 scripts/quest/29921.js delete mode 100644 scripts/quest/29922.js delete mode 100644 scripts/quest/29923.js delete mode 100644 scripts/quest/29927.js delete mode 100644 scripts/quest/29929.js delete mode 100644 scripts/quest/29930.js delete mode 100644 scripts/quest/29931.js delete mode 100644 scripts/quest/29932.js delete mode 100644 scripts/quest/29933.js rename scripts/quest/{29904.js => 3529.js} (58%) create mode 100644 scripts/quest/3714.js create mode 100644 scripts/quest/medalQuest.js delete mode 100644 src/client/DiseaseValueHolder.java create mode 100644 src/server/quest/requirements/BuffExceptRequirement.java create mode 100644 src/server/quest/requirements/BuffRequirement.java diff --git a/docs/mychanges_ptbr.txt b/docs/mychanges_ptbr.txt index 2b919ee0d8..7c03a05e2a 100644 --- a/docs/mychanges_ptbr.txt +++ b/docs/mychanges_ptbr.txt @@ -885,4 +885,13 @@ Modificado sistema do chaos scroll, agora utilizando uma flag nova ao invés de Otimizado PlayerStorage, agora utilizando um mapa próprio de nomes, ao invés de realizar busca exaustiva no mapa de inteiros. Corrigido alguns aspectos do BalrogPQ, tais como a cabeça sendo atingível antes das mãos serem derrotadas e contador de kills do boss não subindo ao derrotr o chefe. Corrigido barras da tela de seleção de canais na etapa de login não atuando corretamente. -Adicionado checks de world server lotado de diversos pontos das etapas de login. \ No newline at end of file +Adicionado checks de world server lotado de diversos pontos das etapas de login. + +26 Março 2018, +Corrigido sistema de levelup ainda desbalanceado para o cenário EXTREMAMENTE low-level. +Adicionado suporte para quests de Kerning Square e Mushroom Castle. +Adicionado script para várias quests ainda não-scriptadas. +Refatorado medal quests, agora adotando um sistema de script default para aquelas não-scriptadas. +Adicionado comando "debuff", debuffando em área próximo ao character que ativou o comando. +Corrigido vazamento de dados na DB referente às informações de quest status e medal maps dos jogadores. +Adicionado checagem de proximidade aos NPCs para começar e terminar quests sem lightbulb. \ No newline at end of file diff --git a/docs/todo.txt b/docs/todo.txt index 087ff5a207..0430301e76 100644 --- a/docs/todo.txt +++ b/docs/todo.txt @@ -41,6 +41,7 @@ ToDo / Missing features list: --------------------------- ** Skills ** +Check autoban system --------------------------- diff --git a/scripts/QUEST Base.js b/scripts/QUEST Base.js index fd2717cd74..b92a1c10d3 100644 --- a/scripts/QUEST Base.js +++ b/scripts/QUEST Base.js @@ -40,8 +40,8 @@ function start(mode, type, selection) { if (status == 0) { qm.sendNext("Sample Text."); + } else if (status == 1) { qm.forceStartQuest(); - qm.dispose(); } } @@ -63,8 +63,8 @@ function end(mode, type, selection) { if (status == 0) { qm.sendNext("Sample Text."); + } else if (status == 1) { qm.forceCompleteQuest(); - qm.dispose(); } } diff --git a/scripts/event/VIPRockSpirit.js b/scripts/event/RockSpiritVIP.js similarity index 98% rename from scripts/event/VIPRockSpirit.js rename to scripts/event/RockSpiritVIP.js index 057acf1d40..e6636ee87c 100644 --- a/scripts/event/VIPRockSpirit.js +++ b/scripts/event/RockSpiritVIP.js @@ -35,7 +35,7 @@ function init() { } function setup() { - var eim = em.newInstance("VIPRockSpirit_" + em.getProperty("player")); + var eim = em.newInstance("RockSpiritVIP_" + em.getProperty("player")); respawn(eim); eim.startEventTimer(timer); return eim; diff --git a/scripts/npc/1052125.js b/scripts/npc/1052125.js index 28a7b3b397..edd17e6b74 100644 --- a/scripts/npc/1052125.js +++ b/scripts/npc/1052125.js @@ -57,13 +57,12 @@ function action(mode, type, selection) { cm.sendOk("I did not hear anything from Blake that you are assisting him."); } } else { - if (cm.isQuestCompleted(2291)) { - var rock = cm.getEventManager("VIPRockSpirit"); - rock.newInstance("VIPRockSpirit"); - rock.setProperty("player", cm.getPlayer().getName()); - rock.startInstance(cm.getPlayer()); - cm.dispose(); - return; + if (cm.isQuestCompleted(2290)) { + if(cm.getPlayer().getLevel() > 50) { + cm.sendOk("The VIP area is available only for players #rlevel 50 or below#k."); + } else { + cm.sendOk("The VIP area is available via completing the #r'Admission to the VIP Zone'#k quest."); + } } else { cm.sendOk("#rVIP#k? Yeah that is funny #rMr. VIP#k, now get lost before I call security."); } diff --git a/scripts/npc/commands.js b/scripts/npc/commands.js index 44e168326f..31459e9c94 100644 --- a/scripts/npc/commands.js +++ b/scripts/npc/commands.js @@ -102,6 +102,7 @@ function writeSolaxiaCommandsLv3() { //GM comm_cursor = comm_lv3; desc_cursor = desc_lv3; + addCommand("debuff", ""); addCommand("fly", ""); addCommand("spawn", ""); addCommand("mutemap", ""); diff --git a/scripts/npc/credits.js b/scripts/npc/credits.js index 67ebfb6fb1..001f9994b0 100644 --- a/scripts/npc/credits.js +++ b/scripts/npc/credits.js @@ -27,7 +27,7 @@ function writeServerStaff_HeavenMS() { addPerson("Ronan", "Developer"); addPerson("Vcoc", "Freelance Developer"); - setHistory(2015, 2017); + setHistory(2015, 2018); } function writeServerStaff_MapleSolaxia() { diff --git a/scripts/portal/TD_MC_first.js b/scripts/portal/TD_MC_first.js index 591741cd04..c663d15421 100644 --- a/scripts/portal/TD_MC_first.js +++ b/scripts/portal/TD_MC_first.js @@ -1,5 +1,6 @@ function enter(pi) { - if (pi.isQuestStarted(2300) || pi.isQuestCompleted(2300) || + if (pi.isQuestCompleted(2260) || + pi.isQuestStarted(2300) || pi.isQuestCompleted(2300) || pi.isQuestStarted(2301) || pi.isQuestCompleted(2301) || pi.isQuestStarted(2302) || pi.isQuestCompleted(2302) || pi.isQuestStarted(2303) || pi.isQuestCompleted(2303) || diff --git a/scripts/portal/curseforest.js b/scripts/portal/curseforest.js index 93cd66818c..9db67dba5d 100644 --- a/scripts/portal/curseforest.js +++ b/scripts/portal/curseforest.js @@ -1,5 +1,3 @@ -importPackage(java.util); - function enter(pi) { if(pi.isQuestStarted(2224) || pi.isQuestStarted(2226) || pi.isQuestCompleted(2227)) { var hourDay = pi.getHourOfDay(); diff --git a/scripts/portal/dragonNest.js b/scripts/portal/dragonNest.js index f2be6f7674..98c0285d21 100644 --- a/scripts/portal/dragonNest.js +++ b/scripts/portal/dragonNest.js @@ -20,6 +20,11 @@ along with this program. If not, see . */ function enter(pi) { - pi.playPortalSound(); pi.warp(240040611, "out00"); + if(!pi.isQuestCompleted(3706)) { + pi.playPortalSound(); pi.warp(240040611, "out00"); + } else { + pi.playPortalSound(); pi.warp(240040612, "out00"); + } + return true; } \ No newline at end of file diff --git a/scripts/portal/tristanEnter.js b/scripts/portal/tristanEnter.js index 451b39241f..2d5d1836eb 100644 --- a/scripts/portal/tristanEnter.js +++ b/scripts/portal/tristanEnter.js @@ -1,4 +1,9 @@ function enter(pi) { - pi.playPortalSound(); pi.warp(105100101, "in00"); - return true; + if(pi.isQuestCompleted(2238)) { + pi.playPortalSound(); pi.warp(105100101, "in00"); + return true; + } else { + pi.message("A mysterious force won't let you in."); + return false; + } } \ No newline at end of file diff --git a/scripts/quest/2238.js b/scripts/quest/2238.js index 8288c8ec5b..c0e328a180 100644 --- a/scripts/quest/2238.js +++ b/scripts/quest/2238.js @@ -35,25 +35,8 @@ function start(mode, type, selection) { status--; if (status == 0) { - em = qm.getEventManager("BalrogQuest"); - if (em == null) { - qm.sendOk("Sorry, but the BalrogQuest is closed."); - qm.dispose(); - return; - } - - if (em.getProperty("noEntry") == "false") { - var eim = em.newInstance("BalrogQuest"); - eim.registerPlayer(qm.getPlayer()); - eim.startEvent(); - - qm.forceStartQuest(); - qm.dispose(); - } - else { - qm.sendOk("There is currently someone in this map, come back later."); - qm.dispose(); - } + qm.forceStartQuest(); + qm.dispose(); } } } diff --git a/scripts/quest/2245.js b/scripts/quest/2245.js new file mode 100644 index 0000000000..a84500cf39 --- /dev/null +++ b/scripts/quest/2245.js @@ -0,0 +1,58 @@ +/* + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana + + 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 . +*/ + +var status = -1; + +function start(mode, type, selection) { + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + em = qm.getEventManager("BalrogQuest"); + if (em == null) { + qm.sendOk("Sorry, but the BalrogQuest is closed."); + qm.dispose(); + return; + } + + if (em.getProperty("noEntry") == "false") { + var eim = em.newInstance("BalrogQuest"); + eim.registerPlayer(qm.getPlayer()); + eim.startEvent(); + + qm.dispose(); + } + else { + qm.sendOk("There is currently someone in this map, come back later."); + qm.dispose(); + } + } + } +} diff --git a/scripts/quest/29911.js b/scripts/quest/2257.js similarity index 58% rename from scripts/quest/29911.js rename to scripts/quest/2257.js index 76e264cd8f..4fd5bc1ae8 100644 --- a/scripts/quest/29911.js +++ b/scripts/quest/2257.js @@ -1,8 +1,6 @@ /* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as @@ -19,21 +17,28 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -/* - Author : Ronan Lana - Description: Wildcard medals - Quest ID : ----- -*/ var status = -1; -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + qm.sendNext("Hey there, do you want a ride to #r#m261000000##k? Oh a request from #b#p2101013##k?"); + } else { + qm.forceCompleteQuest(); + qm.dispose(); + } + } } \ No newline at end of file diff --git a/scripts/quest/2258.js b/scripts/quest/2258.js new file mode 100644 index 0000000000..9765335672 --- /dev/null +++ b/scripts/quest/2258.js @@ -0,0 +1,69 @@ +/* + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana + + 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 . +*/ + +var status = -1; + +function start(mode, type, selection) { + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + qm.sendAcceptDecline("Meerkats spreads rumors like wildfire... By blackmailing me and my cab service, they are taking costumers away from me day after day... Hey, tell no one about this, if you clean some #rMeerkats#k from my way, I'll tell you an info about the #rMushroom Castle#k. What do you say?"); + } else if (status == 1) { + qm.sendNext("Great, they you have #r5 minutes#k to kill #b40 Meerkats#k within this time. Good luck!"); + } else { + qm.forceStartQuest(); + qm.dispose(); + } + } +} + +function end(mode, type, selection) { + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + qm.sendNext("You did it! ... Hey, #rMeerkats#k around here may listen to our conversation. I'm not going to talk about THAT right now."); + } else { + qm.forceCompleteQuest(); + qm.dispose(); + } + } +} \ No newline at end of file diff --git a/scripts/quest/2259.js b/scripts/quest/2259.js new file mode 100644 index 0000000000..a3bba3acbf --- /dev/null +++ b/scripts/quest/2259.js @@ -0,0 +1,73 @@ +/* + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana + + 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 . +*/ + +var status = -1; + +function start(mode, type, selection) { + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + qm.sendNext("Ok, meet me at #b#m260020700##k for your information. To reach there, follow #reast#k from here until you reach #rMagatia#k, I will be there. Now go."); + } else { + qm.forceStartQuest(); + qm.dispose(); + } + } +} + +function end(mode, type, selection) { + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + if(qm.getMapId() == 260020000) { + qm.sendNext("Eh you're still here? To reach #b#m260020700##k, follow #reast#k from here until you reach #rMagatia#k, I will be there. Now go."); + qm.dispose(); + return; + } + + qm.sendNext("Oh there you are. There're no Meerkat's nearby, so there probably is no eavesdropping around here. Very well, you must be fit to go to the #rMushroom Castle#k. Talk to me once you've got #blevel 30#k."); + } else { + qm.forceCompleteQuest(); + qm.dispose(); + } + } +} \ No newline at end of file diff --git a/scripts/quest/2260.js b/scripts/quest/2260.js new file mode 100644 index 0000000000..0b6ad48d92 --- /dev/null +++ b/scripts/quest/2260.js @@ -0,0 +1,75 @@ +/* + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana + + 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 . +*/ + +importPackage(Packages.constants); + +var status = -1; + +function start(mode, type, selection) { + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + qm.sendNext("Once you've got #b2nd job advancement#k, I'll tell you about the #bMushroom Castle#k."); + } else { + qm.forceStartQuest(); + qm.dispose(); + } + } +} + +function end(mode, type, selection) { + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + if(GameConstants.getJobBranch(qm.getPlayer().getJob()) == 1) { + qm.sendNext("Eh, didn't you get the #r2nd job advancement#k yet?"); + qm.dispose(); + return; + } + + qm.sendNext("Okay you seem ready to go to the #bMushroom Castle#k. In #rHenesys#k, climb at the tree fort at #bwest#k then enter a portal over there. On the other area, #rgo west#k. From there, a portal will be readily available to access the #bMushroom Castle#k area."); + } else { + qm.forceCompleteQuest(); + qm.dispose(); + } + } +} \ No newline at end of file diff --git a/scripts/quest/2291.js b/scripts/quest/2291.js new file mode 100644 index 0000000000..33c5d4f356 --- /dev/null +++ b/scripts/quest/2291.js @@ -0,0 +1,57 @@ +/* + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana + + 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 . +*/ + +var status = -1; + +function end(mode, type, selection) { + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + if(!qm.haveItem(4032521, 10)) { + qm.sendNext("Hey, you didn't get #b10 #t4032521##k yet, did you?"); + qm.dispose(); + return; + } + + qm.sendNext("You got the #b#i4032521##k with you, great. Let me show you the way."); + } else if (status == 1) { + qm.gainItem(4032521, -10); + + var rock = qm.getEventManager("RockSpiritVIP"); + rock.newInstance("RockSpiritVIP"); + rock.setProperty("player", qm.getPlayer().getName()); + rock.startInstance(qm.getPlayer()); + + qm.forceCompleteQuest(); + qm.dispose(); + } + } +} \ No newline at end of file diff --git a/scripts/quest/2338.js b/scripts/quest/2338.js new file mode 100644 index 0000000000..e267b20ff7 --- /dev/null +++ b/scripts/quest/2338.js @@ -0,0 +1,56 @@ +/* + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana + + 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 . +*/ + +var status = -1; + +function start(mode, type, selection) { + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + if(qm.haveItem(2430014, 1)) { + qm.sendNext("It looks like you already have one #b#t2430014##k on your inventory."); + qm.dispose(); + return; + } + + qm.sendNext("You've used the #b#t2430014##k? Oh well, good thing I have a spare one right here."); + } else if (status == 1) { + if(!qm.canHold(2430014, 1)) { + qm.sendNext("Please make a USE slot available to get it, alright?"); + } else { + qm.gainItem(2430014, 1); + qm.forceCompleteQuest(); + } + + qm.dispose(); + } + } +} diff --git a/scripts/quest/29905.js b/scripts/quest/29905.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29905.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29910.js b/scripts/quest/29910.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29910.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29912.js b/scripts/quest/29912.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29912.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29913.js b/scripts/quest/29913.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29913.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29914.js b/scripts/quest/29914.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29914.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29915.js b/scripts/quest/29915.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29915.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29916.js b/scripts/quest/29916.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29916.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29917.js b/scripts/quest/29917.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29917.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29918.js b/scripts/quest/29918.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29918.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29919.js b/scripts/quest/29919.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29919.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29920.js b/scripts/quest/29920.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29920.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29921.js b/scripts/quest/29921.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29921.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29922.js b/scripts/quest/29922.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29922.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29923.js b/scripts/quest/29923.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29923.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29927.js b/scripts/quest/29927.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29927.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29929.js b/scripts/quest/29929.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29929.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29930.js b/scripts/quest/29930.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29930.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29931.js b/scripts/quest/29931.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29931.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29932.js b/scripts/quest/29932.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29932.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/29933.js b/scripts/quest/29933.js deleted file mode 100644 index 76e264cd8f..0000000000 --- a/scripts/quest/29933.js +++ /dev/null @@ -1,39 +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 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 Lana - Description: Wildcard medals - Quest ID : ----- -*/ - -var status = -1; - -function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} \ No newline at end of file diff --git a/scripts/quest/3507.js b/scripts/quest/3507.js index 5aee0c2b0d..41dab043eb 100644 --- a/scripts/quest/3507.js +++ b/scripts/quest/3507.js @@ -1,5 +1,5 @@ function end(mode, type, selection) { - if(qm.isQuestCompleted(3523) || qm.isQuestCompleted(3524) || qm.isQuestCompleted(3525) || qm.isQuestCompleted(3526) || qm.isQuestCompleted(3527) || qm.isQuestCompleted(3539)) { + if(qm.isQuestCompleted(3523) || qm.isQuestCompleted(3524) || qm.isQuestCompleted(3525) || qm.isQuestCompleted(3526) || qm.isQuestCompleted(3527) || qm.isQuestCompleted(3529) || qm.isQuestCompleted(3539)) { qm.completeQuest(); qm.sendOk("You are now filled with all of your memories again.. You are now allowed to go to #m270020000#."); } else { diff --git a/scripts/quest/29904.js b/scripts/quest/3529.js similarity index 58% rename from scripts/quest/29904.js rename to scripts/quest/3529.js index 76e264cd8f..ab1d00ab59 100644 --- a/scripts/quest/29904.js +++ b/scripts/quest/3529.js @@ -1,8 +1,6 @@ /* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as @@ -19,21 +17,28 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -/* - Author : Ronan Lana - Description: Wildcard medals - Quest ID : ----- -*/ var status = -1; function start(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); -} - - -function end(mode, type, selection) { - qm.forceCompleteQuest(); - qm.dispose(); + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + qm.sendOk("You have regained your memories, talk to #b#p2140001##k to get the pass."); + } else if (status == 1) { + qm.forceCompleteQuest(); + qm.dispose(); + } + } } \ No newline at end of file diff --git a/scripts/quest/3714.js b/scripts/quest/3714.js new file mode 100644 index 0000000000..c0fb077e58 --- /dev/null +++ b/scripts/quest/3714.js @@ -0,0 +1,53 @@ +/* + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana + + 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 . +*/ + +var status = -1; + +function start(mode, type, selection) { + if (mode == -1) { + qm.dispose(); + } else { + if(mode == 0 && type > 0) { + qm.dispose(); + return; + } + + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + if(!qm.haveItem(4001094, 1)) { + qm.sendNext("You don't have a #b#t4001094##k..."); + qm.dispose(); + return; + } + + qm.sendNext("You have brought a #b#t4001094##k, thank you for the effort!"); + } else if (status == 1) { + qm.gainItem(4001094, -1); + qm.gainExp(42000 * qm.getPlayer().getExpRate()); + + qm.forceCompleteQuest(); + qm.dispose(); + } + } +} diff --git a/scripts/quest/medalQuest.js b/scripts/quest/medalQuest.js new file mode 100644 index 0000000000..9c696935ee --- /dev/null +++ b/scripts/quest/medalQuest.js @@ -0,0 +1,23 @@ +/** + * + * @author Arnah, Ronan + */ + +function start(mode, type, selection) { + qm.forceStartQuest(); + qm.forceCompleteQuest(); + + var medalname = qm.getMedalName(); + qm.message("<" + medalname + "> has been awarded."); + qm.earnTitle("<" + medalname + "> has been awarded."); + qm.dispose(); +} + +function complete(mode, type, selection) { + qm.forceCompleteQuest(); + + var medalname = qm.getMedalName(); + qm.message("<" + medalname + "> has been awarded."); + qm.earnTitle("<" + medalname + "> has been awarded."); + qm.dispose(); +} \ No newline at end of file diff --git a/sql/db_drops.sql b/sql/db_drops.sql index 162322500c..1f99e07864 100644 --- a/sql/db_drops.sql +++ b/sql/db_drops.sql @@ -19100,7 +19100,7 @@ USE `heavenms`; (4300011,4000536,1,1,0,600000), (4300011,4004000,1,1,0,10000), (4300011,4020008,1,1,0,9000), -(4300011,4032509,1,1,2286,999999), +(4300011,4032509,1,1,2286,70000), (4300012,1302009,1,1,0,700), (4300012,1312007,1,1,0,700), (4300012,1322016,1,1,0,700), @@ -19176,7 +19176,7 @@ USE `heavenms`; (4300013,2049207,1,1,0,3000), (4300013,4004000,1,1,0,100000), (4300013,4020008,1,1,0,90000), -(4300015,4032509,1,1,2286,999999), +(4300015,4032509,1,1,2286,70000), (4300016,4000537,1,1,0,400000), (3400000,0,50,90,0,400000), (3400001,0,60,90,0,400000), @@ -20188,7 +20188,27 @@ USE `heavenms`; (2230131, 4032321, 1, 1, 21727, 20000), (5250002, 4032326, 1, 1, 21752, 100000), (2110301, 4032401, 1, 1, 2261, 100000), -(2110300, 4032402, 1, 1, 2263, 100000); +(2110300, 4032402, 1, 1, 2263, 100000), +(3400000, 4032521, 1, 1, 2291, 120000), +(3400001, 4032521, 1, 1, 2291, 120000), +(3400002, 4032521, 1, 1, 2291, 120000), +(3400003, 4032521, 1, 1, 2291, 120000), +(3400004, 4032521, 1, 1, 2291, 120000), +(3400005, 4032521, 1, 1, 2291, 120000), +(3400006, 4032521, 1, 1, 2291, 120000), +(3400007, 4032521, 1, 1, 2291, 120000), +(3400008, 4032521, 1, 1, 2291, 120000), +(4300000, 4032521, 1, 1, 2291, 120000), +(4300001, 4032521, 1, 1, 2291, 120000), +(4300002, 4032521, 1, 1, 2291, 120000), +(4300003, 4032521, 1, 1, 2291, 120000), +(4300004, 4032521, 1, 1, 2291, 120000), +(4300005, 4032521, 1, 1, 2291, 120000), +(4300006, 4032521, 1, 1, 2291, 120000), +(4300007, 4032521, 1, 1, 2291, 120000), +(4300008, 4032521, 1, 1, 2291, 120000), +(4300009, 4032521, 1, 1, 2291, 120000), +(4300010, 4032521, 1, 1, 2291, 120000); # (dropperid, itemid, minqty, maxqty, questid, chance) diff --git a/src/client/DiseaseValueHolder.java b/src/client/DiseaseValueHolder.java deleted file mode 100644 index 180c1cf764..0000000000 --- a/src/client/DiseaseValueHolder.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 ~ 2010 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 . -*/ -package client; - -/** - * - * @author anybody can do this - */ -public class DiseaseValueHolder { - public long startTime, length; - - public DiseaseValueHolder(long start, long length) { - this.startTime = start; - this.length = length; - } -} diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index f0add8452b..6d240f7d86 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -1850,25 +1850,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } } - try (PreparedStatement ps = con.prepareStatement("SELECT queststatusid FROM queststatus WHERE characterid = ?")) { - ps.setInt(1, cid); - - try (ResultSet rs = ps.executeQuery()) { - while (rs.next()) { - int queststatusid = rs.getInt("queststatusid"); - - try (PreparedStatement ps2 = con.prepareStatement("DELETE FROM medalmaps WHERE queststatusid = ?")) { - ps2.setInt(1, queststatusid); - ps2.executeUpdate(); - } - - try (PreparedStatement ps2 = con.prepareStatement("DELETE FROM questprogress WHERE queststatusid = ?")) { - ps2.setInt(1, queststatusid); - ps2.executeUpdate(); - } - } - } - } + deleteQuestProgressWhereCharacterId(con, cid); try (PreparedStatement ps = con.prepareStatement("SELECT id FROM mts_cart WHERE cid = ?")) { ps.setInt(1, cid); @@ -1902,6 +1884,28 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return false; } } + + private static void deleteQuestProgressWhereCharacterId(Connection con, int cid) throws SQLException { + try (PreparedStatement ps = con.prepareStatement("SELECT queststatusid FROM queststatus WHERE characterid = ?")) { + ps.setInt(1, cid); + + try (ResultSet rs = ps.executeQuery()) { + while (rs.next()) { + int queststatusid = rs.getInt("queststatusid"); + + try (PreparedStatement ps2 = con.prepareStatement("DELETE FROM medalmaps WHERE queststatusid = ?")) { + ps2.setInt(1, queststatusid); + ps2.executeUpdate(); + } + + try (PreparedStatement ps2 = con.prepareStatement("DELETE FROM questprogress WHERE queststatusid = ?")) { + ps2.setInt(1, queststatusid); + ps2.executeUpdate(); + } + } + } + } + } private void deleteWhereCharacterId(Connection con, String sql) throws SQLException { try (PreparedStatement ps = con.prepareStatement(sql)) { @@ -2744,6 +2748,17 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } } + public boolean hasBuffFromSourceid(int sourceid) { + effLock.lock(); + chrLock.lock(); + try { + return buffEffects.containsKey(sourceid); + } finally { + chrLock.unlock(); + effLock.unlock(); + } + } + private List> getActiveStatupsFromSourceid(int sourceid) { // already under effLock & chrLock List> ret = new ArrayList<>(); @@ -5084,7 +5099,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } else if (level == 25) { yellowMessage("You seem to be improving, but you are still not ready to move on to the next step."); } else if (level == 30) { - yellowMessage("You have finally reached level 30! Try job advancing, after that try the Mushroom Kingdom!"); + yellowMessage("You have finally reached level 30! Try job advancing, after that try the Mushroom Castle!"); } else if (level == 35) { yellowMessage("Hey did you hear about this mall that opened in Kerning? Try visiting the Kerning Mall."); } else if (level == 40) { @@ -6644,7 +6659,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } ps.executeBatch(); deleteWhereCharacterId(con, "DELETE FROM eventstats WHERE characterid = ?"); - deleteWhereCharacterId(con, "DELETE FROM queststatus WHERE characterid = ?"); + + deleteQuestProgressWhereCharacterId(con, id); ps = con.prepareStatement("INSERT INTO queststatus (`queststatusid`, `characterid`, `quest`, `status`, `time`, `expires`, `forfeited`) VALUES (DEFAULT, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS); PreparedStatement psf; try (PreparedStatement pse = con.prepareStatement("INSERT INTO questprogress VALUES (DEFAULT, ?, ?, ?)")) { @@ -7556,7 +7572,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { announce(MaplePacketCreator.updateQuestInfo((short) quest.getQuest().getId(), quest.getNpc())); } else if (quest.getStatus().equals(MapleQuestStatus.Status.COMPLETED)) { short questid = quest.getQuest().getId(); - if(questid != 3637) { + if(!MapleQuest.isExploitableQuest(questid)) { quest_fame += 1; if(ServerConstants.FAME_GAIN_BY_QUEST > 0) fameGainByQuest(); diff --git a/src/client/command/Commands.java b/src/client/command/Commands.java index c208d2afd8..5ffa6687d4 100644 --- a/src/client/command/Commands.java +++ b/src/client/command/Commands.java @@ -68,6 +68,8 @@ import server.life.MapleLifeFactory; import server.life.MapleMonster; import server.life.MapleMonsterInformationProvider; import server.life.MapleNPC; +import server.life.MobSkill; +import server.life.MobSkillFactory; import server.life.MonsterDropEntry; import server.maps.MapleMap; import server.maps.MapleMapItem; @@ -89,6 +91,7 @@ import tools.data.output.MaplePacketLittleEndianWriter; import client.MapleBuffStat; import client.MapleCharacter; import client.MapleClient; +import client.MapleDisease; import client.MapleJob; import client.MapleStat; import client.Skill; @@ -743,14 +746,9 @@ public class Commands { break; } c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0)); - break; + break; case "buffme": - if(!player.isGM()) { - player.dropMessage(5, "You are already dead."); - break; - } - //GM Skills : Haste(Super) - Holy Symbol - Bless - Hyper Body - Echo of Hero SkillFactory.getSkill(4101004).getEffect(SkillFactory.getSkill(4101004).getMaxLevel()).applyTo(player); SkillFactory.getSkill(2311003).getEffect(SkillFactory.getSkill(2311003).getMaxLevel()).applyTo(player); @@ -1572,6 +1570,81 @@ public class Commands { MapleCharacter victim; switch(sub[0]) { + case "debuff": + if (sub.length < 2) { + player.yellowMessage("Syntax: !debuff SLOW|SEDUCE|ZOMBIFY|CONFUSE|STUN|POISON|SEAL|DARKNESS|WEAKEN|CURSE"); + break; + } + + MapleDisease disease = null; + MobSkill skill = null; + + switch(sub[1].toUpperCase()) { + case "SLOW": + disease = MapleDisease.SLOW; + skill = MobSkillFactory.getMobSkill(126, 7); + break; + + case "SEDUCE": + disease = MapleDisease.SEDUCE; + skill = MobSkillFactory.getMobSkill(128, 7); + break; + + case "ZOMBIFY": + disease = MapleDisease.ZOMBIFY; + skill = MobSkillFactory.getMobSkill(133, 1); + break; + + case "CONFUSE": + disease = MapleDisease.CONFUSE; + skill = MobSkillFactory.getMobSkill(132, 2); + break; + + case "STUN": + disease = MapleDisease.STUN; + skill = MobSkillFactory.getMobSkill(123, 7); + break; + + case "POISON": + disease = MapleDisease.POISON; + skill = MobSkillFactory.getMobSkill(125, 5); + break; + + case "SEAL": + disease = MapleDisease.SEAL; + skill = MobSkillFactory.getMobSkill(120, 1); + break; + + case "DARKNESS": + disease = MapleDisease.DARKNESS; + skill = MobSkillFactory.getMobSkill(121, 1); + break; + + case "WEAKEN": + disease = MapleDisease.WEAKEN; + skill = MobSkillFactory.getMobSkill(122, 1); + break; + + case "CURSE": + disease = MapleDisease.CURSE; + skill = MobSkillFactory.getMobSkill(124, 1); + break; + } + + if(disease == null) { + player.yellowMessage("Syntax: !debuff SLOW|SEDUCE|ZOMBIFY|CONFUSE|STUN|POISON|SEAL|DARKNESS|WEAKEN|CURSE"); + break; + } + + for (MapleMapObject mmo : player.getMap().getMapObjectsInRange(player.getPosition(), 1000.0, Arrays.asList(MapleMapObjectType.PLAYER))) { + MapleCharacter chr = (MapleCharacter) mmo; + + if(chr.getId() != player.getId()) { + chr.giveDebuff(disease, skill); + } + } + break; + case "fly": if (sub.length < 2) { player.yellowMessage("Syntax: !fly "); diff --git a/src/client/inventory/Equip.java b/src/client/inventory/Equip.java index 58bb1b7a27..0e90836fe8 100644 --- a/src/client/inventory/Equip.java +++ b/src/client/inventory/Equip.java @@ -486,7 +486,9 @@ public class Equip extends Item { // Conversion factor between mob exp and equip exp gain. Through many calculations, the expected for equipment levelup // from level 1 to 2 is killing about 100~200 mobs of the same level range, on a 1x EXP rate scenario. - if(reqLevel >= 78) { + if(reqLevel < 5) { + return 42; + } else if(reqLevel >= 78) { return Math.max((10413.648 * Math.exp(reqLevel * 0.03275)), 15); } else if(reqLevel >= 38) { return Math.max(( 4985.818 * Math.exp(reqLevel * 0.02007)), 15); diff --git a/src/constants/GameConstants.java b/src/constants/GameConstants.java index 5899106a36..fcb394d776 100644 --- a/src/constants/GameConstants.java +++ b/src/constants/GameConstants.java @@ -210,6 +210,10 @@ public class GameConstants { return skillId > 1111002 && skillId < 1111007 || skillId == 11111002 || skillId == 11111003; } + public static boolean isMedalQuest(short questid) { + return questid / 100 == 299; + } + public static boolean hasSPTable(MapleJob job) { switch (job) { case EVAN: diff --git a/src/net/server/channel/handlers/QuestActionHandler.java b/src/net/server/channel/handlers/QuestActionHandler.java index f57490edba..6a00281f33 100644 --- a/src/net/server/channel/handlers/QuestActionHandler.java +++ b/src/net/server/channel/handlers/QuestActionHandler.java @@ -21,11 +21,13 @@ */ package net.server.channel.handlers; +import java.awt.Point; import client.MapleCharacter; import client.MapleClient; import net.AbstractMaplePacketHandler; import scripting.quest.QuestScriptManager; import server.quest.MapleQuest; +import server.life.MapleNPC; import tools.data.input.SeekableLittleEndianAccessor; /** @@ -33,6 +35,31 @@ import tools.data.input.SeekableLittleEndianAccessor; * @author Matze */ public final class QuestActionHandler extends AbstractMaplePacketHandler { + + // credits to gabriel.sin + private static boolean isNpcNearby(SeekableLittleEndianAccessor slea, MapleCharacter player, MapleQuest quest, int npcId) { + Point playerP = null; + + if(slea.available() >= 4) { + playerP = new Point(slea.readShort(), slea.readShort()); + } + + if (playerP != null && !quest.isAutoStart() && !quest.isAutoComplete()) { + MapleNPC npc = player.getMap().getNPCById(npcId); + if(npc == null) { + return false; + } + + Point npcP = npc.getPosition(); + if (Math.abs(npcP.getX() - playerP.getX()) > 1200 || Math.abs(npcP.getY() - playerP.getY()) > 800) { + player.dropMessage(5, "Approach the NPC to fulfill this quest operation."); + return false; + } + } + + return true; + } + @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { byte action = slea.readByte(); @@ -41,8 +68,8 @@ public final class QuestActionHandler extends AbstractMaplePacketHandler { MapleQuest quest = MapleQuest.getInstance(questid); if (action == 1) { //Start Quest int npc = slea.readInt(); - if (slea.available() >= 4) { - slea.readInt(); + if(!isNpcNearby(slea, player, quest, npc)) { + return; } if(quest.canStart(player, npc)) { @@ -50,7 +77,9 @@ public final class QuestActionHandler extends AbstractMaplePacketHandler { } } else if (action == 2) { // Complete Quest int npc = slea.readInt(); - slea.readInt(); + if(!isNpcNearby(slea, player, quest, npc)) { + return; + } if(quest.canComplete(player, npc)) { if (slea.available() >= 2) { @@ -64,14 +93,18 @@ public final class QuestActionHandler extends AbstractMaplePacketHandler { quest.forfeit(player); } else if (action == 4) { // scripted start quest int npc = slea.readInt(); - slea.readInt(); + if(!isNpcNearby(slea, player, quest, npc)) { + return; + } + if(quest.canStart(player, npc)) { QuestScriptManager.getInstance().start(c, questid, npc); } } else if (action == 5) { // scripted end quests - //System.out.println(slea.toString()); int npc = slea.readInt(); - slea.readInt(); + if(!isNpcNearby(slea, player, quest, npc)) { + return; + } if(quest.canComplete(player, npc)) { QuestScriptManager.getInstance().end(c, questid, npc); diff --git a/src/scripting/quest/QuestActionManager.java b/src/scripting/quest/QuestActionManager.java index e1f63063bc..9c8001f8ba 100644 --- a/src/scripting/quest/QuestActionManager.java +++ b/src/scripting/quest/QuestActionManager.java @@ -23,6 +23,7 @@ package scripting.quest; import client.MapleClient; import scripting.npc.NPCConversationManager; +import server.MapleItemInformationProvider; import server.quest.MapleQuest; /** @@ -69,4 +70,9 @@ public class QuestActionManager extends NPCConversationManager { public void completeQuest() { forceCompleteQuest(); } + + public String getMedalName() { // usable only for medal quests (id 299XX) + MapleQuest q = MapleQuest.getInstance(quest); + return MapleItemInformationProvider.getInstance().getName(q.getMedalRequirement()); + } } diff --git a/src/scripting/quest/QuestScriptManager.java b/src/scripting/quest/QuestScriptManager.java index 5f647213c5..2bd0a22fb4 100644 --- a/src/scripting/quest/QuestScriptManager.java +++ b/src/scripting/quest/QuestScriptManager.java @@ -30,6 +30,7 @@ import javax.script.Invocable; import scripting.AbstractScriptManager; import server.quest.MapleQuest; import tools.FilePrinter; +import constants.GameConstants; import client.MapleClient; import client.MapleQuestStatus; @@ -45,40 +46,44 @@ public class QuestScriptManager extends AbstractScriptManager { public synchronized static QuestScriptManager getInstance() { return instance; } - + public void start(MapleClient c, short questid, int npc) { - MapleQuest quest = MapleQuest.getInstance(questid); - if (!c.getPlayer().getQuest(quest).getStatus().equals(MapleQuestStatus.Status.NOT_STARTED)) { - dispose(c); - return; - } - try { - QuestActionManager qm = new QuestActionManager(c, questid, npc, true); - if (qms.containsKey(c)) { - return; - } - if(c.canClickNPC()) { - qms.put(c, qm); - Invocable iv = getInvocable("quest/" + questid + ".js", c); - if (iv == null) { - FilePrinter.printError(FilePrinter.QUEST_UNCODED, "START Quest " + questid + " is uncoded.\r\n"); - } - if (iv == null || QuestScriptManager.getInstance() == null) { - qm.dispose(); - return; - } - engine.put("qm", qm); - scripts.put(c, iv); - c.setClickedNPC(); - iv.invokeFunction("start", (byte) 1, (byte) 0, 0); - } - } catch (final UndeclaredThrowableException ute) { - FilePrinter.printError(FilePrinter.QUEST + questid + ".txt", ute); - dispose(c); - } catch (final Throwable t) { - FilePrinter.printError(FilePrinter.QUEST + getQM(c).getQuest() + ".txt", t); - dispose(c); - } + MapleQuest quest = MapleQuest.getInstance(questid); + if (!quest.canStartWithoutRequirements(c.getPlayer())) { + dispose(c); + return; + } + try { + QuestActionManager qm = new QuestActionManager(c, questid, npc, true); + if (qms.containsKey(c)) { + return; + } + if(c.canClickNPC()) { + qms.put(c, qm); + Invocable iv = getInvocable("quest/" + questid + ".js", c); + if (iv == null) { + if(GameConstants.isMedalQuest(questid)) { // start generic medal quest + iv = getInvocable("quest/medalQuest.js", c); + } else { + FilePrinter.printError(FilePrinter.QUEST_UNCODED, "START Quest " + questid + " is uncoded.\r\n"); + } + } + if (iv == null || QuestScriptManager.getInstance() == null) { + qm.dispose(); + return; + } + engine.put("qm", qm); + scripts.put(c, iv); + c.setClickedNPC(); + iv.invokeFunction("start", (byte) 1, (byte) 0, 0); + } + } catch (final UndeclaredThrowableException ute) { + FilePrinter.printError(FilePrinter.QUEST + questid + ".txt", ute); + dispose(c); + } catch (final Throwable t) { + FilePrinter.printError(FilePrinter.QUEST + getQM(c).getQuest() + ".txt", t); + dispose(c); + } } public void start(MapleClient c, byte mode, byte type, int selection) { @@ -96,7 +101,7 @@ public class QuestScriptManager extends AbstractScriptManager { } } } - + public void end(MapleClient c, short questid, int npc) { MapleQuest quest = MapleQuest.getInstance(questid); if (!c.getPlayer().getQuest(quest).getStatus().equals(MapleQuestStatus.Status.STARTED) || !c.getPlayer().getMap().containsNPC(npc)) { @@ -112,9 +117,13 @@ public class QuestScriptManager extends AbstractScriptManager { qms.put(c, qm); Invocable iv = getInvocable("quest/" + questid + ".js", c); if (iv == null) { - FilePrinter.printError(FilePrinter.QUEST_UNCODED, "END Quest " + questid + " is uncoded.\r\n"); - qm.dispose(); - return; + if(GameConstants.isMedalQuest(questid)) { // start generic medal quest + iv = getInvocable("quest/medalQuest.js", c); + } else { + FilePrinter.printError(FilePrinter.QUEST_UNCODED, "END Quest " + questid + " is uncoded.\r\n"); + qm.dispose(); + return; + } } engine.put("qm", qm); scripts.put(c, iv); diff --git a/src/server/MapleStatEffect.java b/src/server/MapleStatEffect.java index 6b9e42a8af..01d03be4c3 100644 --- a/src/server/MapleStatEffect.java +++ b/src/server/MapleStatEffect.java @@ -955,14 +955,14 @@ public class MapleStatEffect { MapleMonster monster = (MapleMonster) mo; if (isDispel()) { monster.debuffMob(skill_.getId()); - } else { - if (makeChanceResult()) { - monster.applyStatus(applyfrom, new MonsterStatusEffect(getMonsterStati(), skill_, null, false), isPoison(), getDuration()); - if (isCrash()) { - monster.debuffMob(skill_.getId()); - } - } - } + } else { + if (makeChanceResult()) { + monster.applyStatus(applyfrom, new MonsterStatusEffect(getMonsterStati(), skill_, null, false), isPoison(), getDuration()); + if (isCrash()) { + monster.debuffMob(skill_.getId()); + } + } + } i++; if (i >= mobCount) { break; diff --git a/src/server/maps/MapleMap.java b/src/server/maps/MapleMap.java index fafa9d7401..d8a39292f8 100644 --- a/src/server/maps/MapleMap.java +++ b/src/server/maps/MapleMap.java @@ -1446,6 +1446,19 @@ public class MapleMap { } } + public MapleNPC getNPCById(int id) { + for (MapleMapObject obj : getMapObjects()) { + if (obj.getType() == MapleMapObjectType.NPC) { + MapleNPC npc = (MapleNPC) obj; + if (npc.getId() == id) { + return npc; + } + } + } + + return null; + } + public boolean containsNPC(int npcid) { if (npcid == 9000066) { return true; diff --git a/src/server/quest/MapleQuest.java b/src/server/quest/MapleQuest.java index 2d3fe98125..c5ce034b36 100644 --- a/src/server/quest/MapleQuest.java +++ b/src/server/quest/MapleQuest.java @@ -23,6 +23,7 @@ package server.quest; import java.io.File; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -30,6 +31,7 @@ import client.MapleCharacter; import client.MapleQuestStatus; import client.MapleQuestStatus.Status; import java.util.EnumMap; +import java.util.Set; import provider.MapleData; import provider.MapleDataProvider; import provider.MapleDataProviderFactory; @@ -41,10 +43,21 @@ import tools.MaplePacketCreator; /** * * @author Matze + * @author Ronan (support for medal quests) */ public class MapleQuest { private static Map quests = new HashMap<>(); + private static Map medals = new HashMap<>(); + + private static final Set exploitableQuests = new HashSet<>(); + static { + exploitableQuests.add((short) 2338); + exploitableQuests.add((short) 3637); + exploitableQuests.add((short) 3714); + exploitableQuests.add((short) 21752); + } + protected short infoNumber, id; protected int timeLimit, timeLimit2; protected String infoex; @@ -77,6 +90,9 @@ public class MapleQuest { autoStart = MapleDataTool.getInt("autoStart", reqInfo, 0) == 1; autoPreComplete = MapleDataTool.getInt("autoPreComplete", reqInfo, 0) == 1; autoComplete = MapleDataTool.getInt("autoComplete", reqInfo, 0) == 1; + + int medalid = MapleDataTool.getInt("viewMedalItem", reqInfo, 0); + if(medalid != 0) medals.put(this.id, medalid); } else { System.out.println("no data " + id); } @@ -209,8 +225,13 @@ public class MapleQuest { return str.toString(); } + public boolean canStartWithoutRequirements(MapleCharacter c) { + MapleQuestStatus mqs = c.getQuest(this); + return !(mqs.getStatus() != Status.NOT_STARTED && !(mqs.getStatus() == Status.COMPLETED && repeatable)); + } + public boolean canStart(MapleCharacter c, int npcid) { - if (c.getQuest(this).getStatus() != Status.NOT_STARTED && !(c.getQuest(this).getStatus() == Status.COMPLETED && repeatable)) { + if (!canStartWithoutRequirements(c)) { return false; } for (MapleQuestRequirement r : startReqs.values()) { @@ -229,7 +250,9 @@ public class MapleQuest { return false; } for (MapleQuestRequirement r : completeReqs.values()) { - if (r == null || !r.check(c, npcid)) { + if (r == null) { + return false; + } else if(!r.check(c, npcid)) { if(r.getType() == MapleQuestRequirementType.MESO) { // TODO: find a way to tell the client about the new MESO requirement type. c.dropMessage(5, "You don't have enough mesos to complete this quest."); } @@ -263,10 +286,6 @@ public class MapleQuest { } } - if (timeLimit > 0) { - c.announce(MaplePacketCreator.removeQuestTimeLimit(id)); - } - forceComplete(c, npc); for (MapleQuestAction a : completeActs.values()) { a.run(c, selection); @@ -308,6 +327,10 @@ public class MapleQuest { } public boolean forceComplete(MapleCharacter c, int npc) { + if (timeLimit > 0) { + c.announce(MaplePacketCreator.removeQuestTimeLimit(id)); + } + MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.COMPLETED, npc); newStatus.setForfeited(c.getQuest(this).getForfeited()); newStatus.setCompletionTime(System.currentTimeMillis()); @@ -431,6 +454,12 @@ public class MapleQuest { case PET: ret = new PetRequirement(this, data); break; + case BUFF: + ret = new BuffRequirement(this, data); + break; + case EXCEPT_BUFF: + ret = new BuffExceptRequirement(this, data); + break; case SCRIPT: case NORMAL_AUTO_START: case START: @@ -480,7 +509,16 @@ public class MapleQuest { } return ret; } + + public static boolean isExploitableQuest(short questid) { + return exploitableQuests.contains(questid); + } + public int getMedalRequirement() { + Integer medalid = medals.get(id); + return medalid != null ? medalid : -1; + } + public static void loadAllQuest() { questInfo = questData.getData("QuestInfo.img"); questReq = questData.getData("Check.img"); diff --git a/src/server/quest/MapleQuestRequirementType.java b/src/server/quest/MapleQuestRequirementType.java index 073fcab887..f96991773c 100644 --- a/src/server/quest/MapleQuestRequirementType.java +++ b/src/server/quest/MapleQuestRequirementType.java @@ -26,7 +26,7 @@ package server.quest; * @author Matze */ public enum MapleQuestRequirementType { - UNDEFINED(-1), JOB(0), ITEM(1), QUEST(2), MIN_LEVEL(3), MAX_LEVEL(4), END_DATE(5), MOB(6), NPC(7), FIELD_ENTER(8), INTERVAL(9), SCRIPT(10), PET(11), MIN_PET_TAMENESS(12), MONSTER_BOOK(13), NORMAL_AUTO_START(14), INFO_NUMBER(15), INFO_EX(16), COMPLETED_QUEST(17), START(18), END(19), DAY_BY_DAY(20), MESO(21); + UNDEFINED(-1), JOB(0), ITEM(1), QUEST(2), MIN_LEVEL(3), MAX_LEVEL(4), END_DATE(5), MOB(6), NPC(7), FIELD_ENTER(8), INTERVAL(9), SCRIPT(10), PET(11), MIN_PET_TAMENESS(12), MONSTER_BOOK(13), NORMAL_AUTO_START(14), INFO_NUMBER(15), INFO_EX(16), COMPLETED_QUEST(17), START(18), END(19), DAY_BY_DAY(20), MESO(21), BUFF(22), EXCEPT_BUFF(23); final byte type; private MapleQuestRequirementType(int type) { @@ -77,13 +77,17 @@ public enum MapleQuestRequirementType { } else if (name.equals("questComplete")) { return COMPLETED_QUEST; } else if(name.equals("start")) { - return START; + return START; } else if(name.equals("end")) { - return END; + return END; } else if(name.equals("daybyday")) { - return DAY_BY_DAY; + return DAY_BY_DAY; } else if (name.equals("money")) { return MESO; + } else if (name.equals("buff")) { + return BUFF; + } else if (name.equals("exceptbuff")) { + return EXCEPT_BUFF; } else { return UNDEFINED; } diff --git a/src/server/quest/actions/BuffAction.java b/src/server/quest/actions/BuffAction.java index 860c252d93..8ac57eef23 100644 --- a/src/server/quest/actions/BuffAction.java +++ b/src/server/quest/actions/BuffAction.java @@ -39,7 +39,11 @@ public class BuffAction extends MapleQuestAction { super(MapleQuestActionType.BUFF, quest); processData(data); } - + + @Override + public boolean check(MapleCharacter chr, Integer extSelection) { + return true; + } @Override public void processData(MapleData data) { diff --git a/src/server/quest/requirements/BuffExceptRequirement.java b/src/server/quest/requirements/BuffExceptRequirement.java new file mode 100644 index 0000000000..081ca72091 --- /dev/null +++ b/src/server/quest/requirements/BuffExceptRequirement.java @@ -0,0 +1,50 @@ +/* + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana + + 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 . +*/ +package server.quest.requirements; + +import client.MapleCharacter; +import provider.MapleData; +import provider.MapleDataTool; +import server.quest.MapleQuest; +import server.quest.MapleQuestRequirementType; + +/** + * + * @author Ronan + */ +public class BuffExceptRequirement extends MapleQuestRequirement { + private int buffId = -1; + + public BuffExceptRequirement(MapleQuest quest, MapleData data) { + super(MapleQuestRequirementType.BUFF); + processData(data); + } + + @Override + public void processData(MapleData data) { + // item buffs are negative + buffId = -1 * Integer.valueOf(MapleDataTool.getString(data)); + } + + @Override + public boolean check(MapleCharacter chr, Integer npcid) { + return !chr.hasBuffFromSourceid(buffId); + } +} diff --git a/src/server/quest/requirements/BuffRequirement.java b/src/server/quest/requirements/BuffRequirement.java new file mode 100644 index 0000000000..a0708fb95a --- /dev/null +++ b/src/server/quest/requirements/BuffRequirement.java @@ -0,0 +1,50 @@ +/* + This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server + Copyleft (L) 2017 RonanLana + + 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 . +*/ +package server.quest.requirements; + +import client.MapleCharacter; +import provider.MapleData; +import provider.MapleDataTool; +import server.quest.MapleQuest; +import server.quest.MapleQuestRequirementType; + +/** + * + * @author Ronan + */ +public class BuffRequirement extends MapleQuestRequirement { + private int buffId = 1; + + public BuffRequirement(MapleQuest quest, MapleData data) { + super(MapleQuestRequirementType.BUFF); + processData(data); + } + + @Override + public void processData(MapleData data) { + // item buffs are negative + buffId = -1 * Integer.valueOf(MapleDataTool.getString(data)); + } + + @Override + public boolean check(MapleCharacter chr, Integer npcid) { + return chr.hasBuffFromSourceid(buffId); + } +} diff --git a/src/tools/MaplePacketCreator.java b/src/tools/MaplePacketCreator.java index 4c609459b2..d47a5c521a 100644 --- a/src/tools/MaplePacketCreator.java +++ b/src/tools/MaplePacketCreator.java @@ -1458,7 +1458,7 @@ public class MaplePacketCreator { * 14: Angry ^ * 15: Orb animation thing, ?? * 16: ?? - * 19: Mushroom kingdom boss thing + * 19: Mushroom castle boss thing */ if (life.getParentMobOid() != 0) {