From 1d8caff63f5a62738df0889413251013c98797be Mon Sep 17 00:00:00 2001 From: ronancpl Date: Sat, 29 Apr 2017 12:05:26 -0300 Subject: [PATCH] Boss Rush PQ Rewarding System + minor patches Introducing BRPQ rewarding system (KPQ/LPQ clear-like) and patched issues regarding "no apparent party leader" after party leader disconnects and reconnects. --- .gitignore | 3 +- README.txt | 2 + nbproject/private/private.properties | 8 +- nbproject/private/private.xml | 25 +- scripts/event/BossRushPQ.js | 75 +++- scripts/npc/world0/9000008.js | 26 ++ scripts/npc/world0/9000037.js | 62 ++- scripts/portal/raid_rest.js | 38 ++ scripts/portal/raid_stage.js | 6 +- sql/db_drops.sql | 400 +++++++++--------- src/client/MapleCharacter.java | 14 +- src/client/MapleClient.java | 10 +- src/constants/ServerConstants.java | 4 +- src/net/server/world/MapleParty.java | 20 +- src/scripting/AbstractPlayerInteraction.java | 2 +- src/scripting/event/EventInstanceManager.java | 171 +++++++- src/scripting/event/EventManager.java | 2 +- wz/Map.wz/Map/Map9/970030001.img.xml | 7 +- wz/Map.wz/Map/Map9/970030002.img.xml | 8 +- wz/Map.wz/Map/Map9/970030003.img.xml | 7 +- wz/Map.wz/Map/Map9/970030004.img.xml | 7 +- wz/Map.wz/Map/Map9/970030005.img.xml | 7 +- wz/Map.wz/Map/Map9/970030006.img.xml | 7 +- wz/Map.wz/Map/Map9/970030007.img.xml | 7 +- wz/Map.wz/Map/Map9/970030008.img.xml | 7 +- wz/Map.wz/Map/Map9/970030009.img.xml | 7 +- wz/Map.wz/Map/Map9/970030010.img.xml | 7 +- wz/Map.wz/Map/Map9/970032700.img.xml | 12 - wz/Map.wz/Map/Map9/970032701.img.xml | 12 - wz/Map.wz/Map/Map9/970032702.img.xml | 12 - wz/Map.wz/Map/Map9/970032703.img.xml | 12 - wz/Map.wz/Map/Map9/970032704.img.xml | 12 - wz/Map.wz/Map/Map9/970032705.img.xml | 12 - wz/Map.wz/Map/Map9/970032706.img.xml | 12 - wz/Map.wz/Map/Map9/970032707.img.xml | 12 - 35 files changed, 644 insertions(+), 391 deletions(-) create mode 100644 scripts/npc/world0/9000008.js create mode 100644 scripts/portal/raid_rest.js diff --git a/.gitignore b/.gitignore index 95832e8eb9..37a641d83f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /build/ -/dist/ \ No newline at end of file +/dist/ +/logs/ \ No newline at end of file diff --git a/README.txt b/README.txt index 0e7af8572f..ca81abf2c1 100644 --- a/README.txt +++ b/README.txt @@ -74,6 +74,8 @@ Configure the IP you want to use for your MapleStory server in "configuration.in Now open NetBeans, and choose to Open a project... Select then the "MapleSolaxia" folder, that should already be a project recognizable by NetBeans. If it doesn't, you have a problem. +Inside the project, you may encounter some code errors. These happens because you have not set yet the "cores" of the project. From the project hierarchy, right-click the project and select "Resolve Project Problems". Locate the "cores" folder inside the root directory of this project and manually configure the missing files with the files that are there. + Finally, select "Clean and Build project" to build the JAR file for the MapleStory server. Once done, make sure both WampServer and Hamachi are on and functioning, and then execute "launch.bat" on the root of the project. If no errors were raised from this action, your MapleStory server is now online. ---- Installing the CLIENT ---- diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties index aa5240c279..2948abe44a 100644 --- a/nbproject/private/private.properties +++ b/nbproject/private/private.properties @@ -1,10 +1,10 @@ compile.on.save=true do.depend=false do.jar=true -file.reference.mina-core-2.0.7.jar=C:\\Nexon\\MapleSolaxia\\cores\\mina-core-2.0.7.jar -file.reference.mysql-connector-java-bin.jar=C:\\Nexon\\MapleSolaxia\\cores\\mysql-connector-java-bin.jar -file.reference.slf4j-api-1.6.6.jar=C:\\Nexon\\MapleSolaxia\\cores\\slf4j-api-1.6.6.jar -file.reference.slf4j-jdk14-1.7.5.jar=C:\\Nexon\\MapleSolaxia\\cores\\slf4j-jdk14-1.7.5.jar +file.reference.mina-core-2.0.7.jar=C:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2\\cores\\mina-core-2.0.7.jar +file.reference.mysql-connector-java-bin.jar=C:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2\\cores\\mysql-connector-java-bin.jar +file.reference.slf4j-api-1.6.6.jar=C:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2\\cores\\slf4j-api-1.6.6.jar +file.reference.slf4j-jdk14-1.7.5.jar=C:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2\\cores\\slf4j-jdk14-1.7.5.jar javac.debug=true javadoc.preview=true user.properties.file=C:\\Users\\RonanLana\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index e4eefaaf95..d67be8ac01 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -3,11 +3,26 @@ - file:/C:/Nexon/MapleSolaxia/scripts/npc/world0/2133000.js - file:/C:/Nexon/MapleSolaxia/src/client/MapleCharacter.java - file:/C:/Nexon/MapleSolaxia/scripts/npc/world0/9020000.js - file:/C:/Nexon/MapleSolaxia/src/constants/ServerConstants.java - file:/C:/Nexon/MapleSolaxia/src/server/maps/MapleReactor.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/command/Commands.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/expeditions/MapleExpedition.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/raid_stage.js + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/AbstractPlayerInteraction.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/constants/ServerConstants.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/PartyOperationHandler.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/world/MapleParty.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/tools/MaplePacketCreator.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/raid_rest.js + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/world/MaplePartyCharacter.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/event/EventInstanceManager.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/BossRushPQ.js + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/npc/NPCConversationManager.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleCharacter.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/9000037.js + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleMap.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/raidout.js + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/PiratePQ.js + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleClient.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/event/EventManager.java diff --git a/scripts/event/BossRushPQ.js b/scripts/event/BossRushPQ.js index 55e4212563..bcbfa6dc91 100644 --- a/scripts/event/BossRushPQ.js +++ b/scripts/event/BossRushPQ.js @@ -11,6 +11,40 @@ function init() { em.setProperty("leader", "true"); } +function setEventRewards(eim) { + var itemSet, itemQty, evLevel; + + evLevel = 6; //Rewards at event completion + itemSet = [1122018, 1122005, 1022088, 1402013, 1032048, 1032070, 1102046, 2330004, 2041013, 2041016, 2041019, 2041022, 2049100, 2049003, 2020012, 2020013, 2020014, 2020015, 2022029, 2022045, 2022068, 2022069, 2022179, 2022180, 4004000, 4004001, 4004002, 4004003, 4004004, 4003000]; + itemQty = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 25, 25, 25, 25, 25, 25, 25, 25, 25, 4, 12, 12, 12, 12, 12, 25]; + eim.setEventRewards(evLevel, itemSet, itemQty); + + evLevel = 5; //Rewards at Rest Spot V + itemSet = [1122018, 1122005, 1022088, 1402013, 1032048, 1032070, 1102046, 2330004, 2041013, 2041016, 2041019, 2041022, 2049100, 2049003, 2020012, 2020013, 2020014, 2020015, 2022029, 2022045, 2022068, 2022069, 2022179, 2022180, 4004000, 4004001, 4004002, 4004003, 4004004, 4003000]; + itemQty = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 8, 8, 8, 8, 8, 12]; + eim.setEventRewards(evLevel, itemSet, itemQty); + + evLevel = 4; //Rewards at Rest Spot IV + itemSet = [1122001, 1122006, 1022103, 1442065, 1032042, 1032021, 1102168, 2070005, 2040025, 2040029, 2040301, 2040413, 2040701, 2040817, 2002028, 2020009, 2020010, 2020011, 2022004, 2022005, 2022025, 2022027, 2022048, 2022049, 4020000, 4020001, 4020002, 4020003, 4020004, 4020005, 4020006, 4020007, 4020008, 4003000]; + itemQty = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]; + eim.setEventRewards(evLevel, itemSet, itemQty); + + evLevel = 3; //Rewards at Rest Spot III + itemSet = [1122002, 1022088, 1012076, 1402029, 1032041, 1032044, 1102167, 2070011, 2040026, 2040030, 2040302, 2040412, 2040702, 2040818, 2002028, 2020009, 2020010, 2020011, 2022004, 2022005, 2022025, 2022027, 2022048, 2022049, 4010000, 4010001, 4010002, 4010003, 4010004, 4010005, 4010006, 4010007, 4003000]; + itemQty = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 5, 5, 5, 5, 5, 5, 5, 5, 5]; + eim.setEventRewards(evLevel, itemSet, itemQty); + + evLevel = 2; //Rewards at Rest Spot II + itemSet = [1122003, 1012077, 1012079, 1432014, 1032059, 1032002, 1102191, 2330002, 2040001, 2040311, 2040401, 2040601, 2040824, 2040901, 2010000, 2010001, 2010002, 2010003, 2010004, 2020001, 2020002, 2020003, 2022020, 2022022, 4020000, 4020001, 4020002, 4020003, 4020004, 4020005, 4020006, 4020007, 4020008, 4003000]; + itemQty = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]; + eim.setEventRewards(evLevel, itemSet, itemQty); + + evLevel = 1; //Rewards at Rest Spot I + itemSet = [1122004, 1012078, 1432008, 1432009, 1032040, 1032009, 1102166, 2070001, 2040002, 2040310, 2040400, 2040600, 2040825, 2040902, 2010000, 2010001, 2010002, 2010003, 2010004, 2020001, 2020002, 2020003, 2022020, 2022022, 4003000]; + itemQty = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2]; + eim.setEventRewards(evLevel, itemSet, itemQty); +} + function getEligibleParty(party) { //selects, from the given party, the team that is allowed to attempt this event var eligible = []; var hasLeader = false; @@ -28,6 +62,10 @@ function getEligibleParty(party) { //selects, from the given party, the tea } } + if(!hasLeader) print("no leader"); + else if(eligible.length < minPlayers) print("no min"); + else if(eligible.length < minPlayers) print("no max"); + if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = []; return eligible; } @@ -39,6 +77,7 @@ function setup(level, leaderid) { em.setProperty("level", level); eim.startEventTimer(45 * 60000); //45 mins + setEventRewards(eim); return eim; } @@ -51,26 +90,21 @@ function scheduledTimeout(eim) { end(eim); } -function removePlayer(eim, player) { - eim.unregisterPlayer(player); - player.changeMap(exitMap, 0); -} - function playerExit(eim, player) { eim.unregisterPlayer(player); player.changeMap(exitMap, 0); } function changedMap(eim, player, mapid) { - if (mapid < 970030001 || mapid > 970042711) { - var party = eim.getPlayers(); - if (eim.isLeader(player) || party.size() <= minPlayers) { - eim.unregisterPlayer(player); - end(eim); - } - else - eim.unregisterPlayer(player); - } + if (mapid < 970030001 || mapid > 970042711) { + var party = eim.getPlayers(); + if (eim.isLeader(player) || party.size() <= minPlayers) { + eim.unregisterPlayer(player); + end(eim); + } + else + eim.unregisterPlayer(player); + } } function playerDead(eim, player) {} @@ -88,12 +122,10 @@ function playerRevive(eim, player) { // player presses ok on the death pop up. function playerDisconnected(eim, player) { var party = eim.getPlayers(); - if (eim.isLeader(player) || party.size() <= minPlayers) { - eim.unregisterPlayer(player); + if (eim.isLeader(player) || party.size() <= minPlayers) end(eim); - } else - removePlayer(eim, player); + playerExit(eim, player); } function leftParty(eim, player) { @@ -122,9 +154,6 @@ function end(eim) { function playerClear(eim, player, toMap) { eim.unregisterPlayer(player); - - if(toMap != null) player.changeMap(toMap); - else player.changeMap(clearMap, 0); } function complete(eim, toMap) { @@ -139,6 +168,10 @@ function clearPQ(eim, toMap) { complete(eim, toMap); } +function giveRandomEventReward(eim, player) { + eim.giveEventReward(player); +} + function monsterKilled(mob, eim) {} function allMonstersDead(eim) {} diff --git a/scripts/npc/world0/9000008.js b/scripts/npc/world0/9000008.js new file mode 100644 index 0000000000..9b440945cb --- /dev/null +++ b/scripts/npc/world0/9000008.js @@ -0,0 +1,26 @@ +/* + 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 . +*/ + +function start() { + cm.sendOk("Should you have a locked box you want to open, bring it to me."); + cm.dispose(); +} \ No newline at end of file diff --git a/scripts/npc/world0/9000037.js b/scripts/npc/world0/9000037.js index f5f99acd1c..5f38731de4 100644 --- a/scripts/npc/world0/9000037.js +++ b/scripts/npc/world0/9000037.js @@ -12,9 +12,17 @@ var minPartySize = 1; var maxPartySize = 6; var state; +function onRestingSpot() { + return cm.getMapId() >= 970030001 && cm.getMapId() <= 970030010; +} + +function isFinalBossDone() { + return cm.getMapId() >= 970032700 && cm.getMapId() < 970032800 && cm.getMap().getMonsters().isEmpty(); +} + function start() { status = -1; - state = (cm.getMapId() >= 970030001 && cm.getMapId() <= 970042711) ? 1 : 0; + state = (cm.getMapId() >= 970030001 && cm.getMapId() <= 970042711) ? (!onRestingSpot() ? (isFinalBossDone() ? 3 : 1) : 2) : 0; action(1, 0, 0); } @@ -32,14 +40,62 @@ function action(mode, type, selection) { status--; if (status == 0) { - if(state) { + if(state == 3) { + if(cm.getPlayer().getEventInstance() != null) { + if(!cm.isLeader()) { + cm.sendOk("Your party leader has not spoken to me yet, please wait him/her talk to me."); + cm.dispose(); + return; + } + else { + cm.getPlayer().getEventInstance().finishPQ(); + } + } + + if(cm.isLeader()) { + cm.sendOk("Your party completed such an astounding feat coming this far, #byou have defeated all the bosses#k, congratulations! Now, tell your party I will be warping everyone out and rewarding them as they talk to me."); + } + else { + cm.sendOk("For completing all stages in this event, congratulations! Now you will receive a prize that matches your performance here as I warp you out."); + } + } + else if(state == 2) { + if(cm.isLeader()) { + if(cm.getPlayer().getEventInstance().isEventTeamTogether()) { + cm.sendYesNo("Is your party ready to proceed to the next stages? Walk through the portal if you think you're done, the time is now.. Now, do you guys REALLY want to proceed?"); + } + else { + cm.sendOk("Please wait for your party to reassemble before proceeding."); + cm.dispose(); + return; + } + } + else { + cm.sendOk("Wait for your party leader to give me the signal to proceed. If you're not feeling too well and want to quit, walk through the portal and you will be transported out, you will receive a prize for coming this far."); + cm.dispose(); + return; + } + } else if(state == 1) { cm.sendYesNo("Do you wish to abandon this event?"); } else { cm.sendSimple("#b#k\r\n\r\nWould you like to collaborate with party members to complete the expedition, or are you brave enough to take it on all by yourself? Have your #bparty leader#k talk to me or make yourself a party.#b\r\n#L0#I want to participate in the party quest.\r\n#L1#I want to find party members.\r\n#L2#I would like to hear more details."); } } else if (status == 1) { - if(state) { + if(state == 3) { + if(!cm.getPlayer().getEventInstance().giveEventReward(cm.getPlayer(), 6)) { + cm.sendOk("Please arrange a slot in all tabs of your inventory beforehand."); + cm.dispose(); + return; + } + + cm.warp(970030000); + cm.dispose(); + } else if(state == 2) { + var restSpot = ((cm.getMapId() - 1) % 5) + 1; + cm.getPlayer().getEventInstance().warpEventTeam(970030100 + (500 * restSpot)); //oh well, other maps won't be used anyway + cm.dispose(); + } else if(state == 1) { cm.warp(970030000); cm.dispose(); } diff --git a/scripts/portal/raid_rest.js b/scripts/portal/raid_rest.js new file mode 100644 index 0000000000..66c44846fe --- /dev/null +++ b/scripts/portal/raid_rest.js @@ -0,0 +1,38 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License version 3 + as published by the Free Software Foundation. You may not use, modify + or distribute this program under any other version of the + GNU Affero General Public License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +/* +BossRushPQ - Rest Spot portal +@author Ronan +*/ + +function enter(pi) { + var evLevel = ((pi.getMapId() - 1) % 5) + 1; + + if(pi.getPlayer().getEventInstance().giveEventReward(pi.getPlayer(), evLevel)) { + pi.warp(970030000); + return true; + } + else { + pi.message("You cannot receive an event prize without having an empty room in your EQUIP, USE, SET-UP or ETC inventory."); + return false; + } +} \ No newline at end of file diff --git a/scripts/portal/raid_stage.js b/scripts/portal/raid_stage.js index 21226306b9..3dff60be1b 100644 --- a/scripts/portal/raid_stage.js +++ b/scripts/portal/raid_stage.js @@ -25,11 +25,11 @@ BossRushPQ - Next Stage */ function enter(pi) { - if(pi.getMap().getMonsters().size() == 0) { + if(pi.getMap().getMonsters().isEmpty()) { var nextStage; - if(pi.getMapId() % 5 == 0) nextStage = pi.getMapId() + 100; - else nextStage = 970030001 + (pi.getMapId() - 970030100 / 500); + if(pi.getMapId() % 500 != 0) nextStage = pi.getMapId() + 100; + else nextStage = 970030001 + ((pi.getMapId() - 970030100) / 500); pi.warp(nextStage); return true; diff --git a/sql/db_drops.sql b/sql/db_drops.sql index 2789803667..640594508c 100644 --- a/sql/db_drops.sql +++ b/sql/db_drops.sql @@ -18798,206 +18798,206 @@ (9500355, 2388015, 1, 1, 0, 24000), (9500356, 2388032, 1, 1, 0, 24000), (9500357, 2388016, 1, 1, 0, 24000), -(9500357, 4003000, 5, 20, 0, 40000), -(9500357, 4003001, 5, 20, 0, 40000), -(9500357, 4003002, 5, 20, 0, 40000), -(9500357, 4003003, 5, 20, 0, 40000), -(9500357, 4004000, 5, 20, 0, 40000), -(9500357, 4004001, 5, 20, 0, 40000), -(9500357, 4004002, 5, 20, 0, 40000), -(9500357, 4004003, 5, 20, 0, 40000), -(9500357, 4004004, 5, 20, 0, 40000), -(9500357, 4010000, 5, 20, 0, 40000), -(9500357, 4010001, 5, 20, 0, 40000), -(9500357, 4010002, 5, 20, 0, 40000), -(9500357, 4010003, 5, 20, 0, 40000), -(9500357, 4010004, 5, 20, 0, 40000), -(9500357, 4010005, 5, 20, 0, 40000), -(9500357, 4010006, 5, 20, 0, 40000), -(9500357, 4010007, 5, 20, 0, 40000), -(9500357, 4020000, 5, 20, 0, 40000), -(9500357, 4020001, 5, 20, 0, 40000), -(9500357, 4020002, 5, 20, 0, 40000), -(9500357, 4020003, 5, 20, 0, 40000), -(9500357, 4020004, 5, 20, 0, 40000), -(9500357, 4020005, 5, 20, 0, 40000), -(9500357, 4020006, 5, 20, 0, 40000), -(9500357, 4020007, 5, 20, 0, 40000), -(9500357, 4020008, 5, 20, 0, 40000), -(9500357, 2020001, 5, 20, 0, 40000), -(9500357, 2020002, 5, 20, 0, 40000), -(9500357, 2020003, 5, 20, 0, 40000), -(9500357, 2020004, 5, 20, 0, 40000), -(9500357, 2020005, 5, 20, 0, 40000), -(9500357, 2020006, 5, 20, 0, 40000), -(9500357, 2020007, 5, 20, 0, 40000), -(9500357, 2020008, 5, 20, 0, 40000), -(9500357, 2020009, 5, 20, 0, 40000), -(9500357, 2020010, 5, 20, 0, 40000), -(9500357, 2020011, 5, 20, 0, 40000), -(9500357, 2020012, 5, 20, 0, 40000), -(9500357, 2020013, 5, 20, 0, 40000), -(9500357, 2020014, 5, 20, 0, 40000), -(9500357, 2020015, 5, 20, 0, 40000), -(9500357, 2020016, 5, 20, 0, 40000), -(9500357, 2020017, 5, 20, 0, 40000), -(9500357, 2020018, 5, 20, 0, 40000), -(9500357, 2020019, 5, 20, 0, 40000), -(9500357, 2020020, 5, 20, 0, 40000), -(9500357, 1092022, 1, 1, 0, 4000), -(9500357, 1092030, 1, 1, 0, 4000), -(9500357, 1092045, 1, 1, 0, 4000), -(9500357, 1092046, 1, 1, 0, 4000), -(9500357, 1092047, 1, 1, 0, 4000), -(9500357, 1112407, 1, 1, 0, 4000), -(9500357, 1112408, 1, 1, 0, 4000), -(9500358, 4003000, 5, 20, 0, 40000), -(9500358, 4003001, 5, 20, 0, 40000), -(9500358, 4003002, 5, 20, 0, 40000), -(9500358, 4003003, 5, 20, 0, 40000), -(9500358, 4004000, 5, 20, 0, 40000), -(9500358, 4004001, 5, 20, 0, 40000), -(9500358, 4004002, 5, 20, 0, 40000), -(9500358, 4004003, 5, 20, 0, 40000), -(9500358, 4004004, 5, 20, 0, 40000), -(9500358, 4010000, 5, 20, 0, 40000), -(9500358, 4010001, 5, 20, 0, 40000), -(9500358, 4010002, 5, 20, 0, 40000), -(9500358, 4010003, 5, 20, 0, 40000), -(9500358, 4010004, 5, 20, 0, 40000), -(9500358, 4010005, 5, 20, 0, 40000), -(9500358, 4010006, 5, 20, 0, 40000), -(9500358, 4010007, 5, 20, 0, 40000), -(9500358, 4020000, 5, 20, 0, 40000), -(9500358, 4020001, 5, 20, 0, 40000), -(9500358, 4020002, 5, 20, 0, 40000), -(9500358, 4020003, 5, 20, 0, 40000), -(9500358, 4020004, 5, 20, 0, 40000), -(9500358, 4020005, 5, 20, 0, 40000), -(9500358, 4020006, 5, 20, 0, 40000), -(9500358, 4020007, 5, 20, 0, 40000), -(9500358, 4020008, 5, 20, 0, 40000), -(9500358, 2020001, 5, 20, 0, 40000), -(9500358, 2020002, 5, 20, 0, 40000), -(9500358, 2020003, 5, 20, 0, 40000), -(9500358, 2020004, 5, 20, 0, 40000), -(9500358, 2020005, 5, 20, 0, 40000), -(9500358, 2020006, 5, 20, 0, 40000), -(9500358, 2020007, 5, 20, 0, 40000), -(9500358, 2020008, 5, 20, 0, 40000), -(9500358, 2020009, 5, 20, 0, 40000), -(9500358, 2020010, 5, 20, 0, 40000), -(9500358, 2020011, 5, 20, 0, 40000), -(9500358, 2020012, 5, 20, 0, 40000), -(9500358, 2020013, 5, 20, 0, 40000), -(9500358, 2020014, 5, 20, 0, 40000), -(9500358, 2020015, 5, 20, 0, 40000), -(9500358, 2020016, 5, 20, 0, 40000), -(9500358, 2020017, 5, 20, 0, 40000), -(9500358, 2020018, 5, 20, 0, 40000), -(9500358, 2020019, 5, 20, 0, 40000), -(9500358, 2020020, 5, 20, 0, 40000), -(9500358, 1052166, 1, 1, 0, 4000), -(9500358, 2330002, 1, 1, 0, 4000), -(9500358, 2070011, 1, 1, 0, 4000), -(9500358, 1102021, 1, 1, 0, 4000), -(9500358, 1102022, 1, 1, 0, 4000), -(9500358, 1102023, 1, 1, 0, 4000), -(9500358, 1102024, 1, 1, 0, 4000), -(9500358, 1102078, 1, 1, 0, 4000), -(9500358, 1122001, 1, 1, 0, 4000), -(9500358, 1122002, 1, 1, 0, 4000), -(9500358, 1122003, 1, 1, 0, 4000), -(9500358, 1122004, 1, 1, 0, 4000), -(9500358, 1122005, 1, 1, 0, 4000), -(9500358, 1122006, 1, 1, 0, 4000), -(9500358, 1082175, 1, 1, 0, 4000), -(9500358, 1082176, 1, 1, 0, 4000), -(9500358, 1082177, 1, 1, 0, 4000), -(9500358, 1082178, 1, 1, 0, 4000), -(9500358, 1082179, 1, 1, 0, 4000), -(9500359, 4003000, 5, 20, 0, 40000), -(9500359, 4003001, 5, 20, 0, 40000), -(9500359, 4003002, 5, 20, 0, 40000), -(9500359, 4003003, 5, 20, 0, 40000), -(9500359, 4004000, 5, 20, 0, 40000), -(9500359, 4004001, 5, 20, 0, 40000), -(9500359, 4004002, 5, 20, 0, 40000), -(9500359, 4004003, 5, 20, 0, 40000), -(9500359, 4004004, 5, 20, 0, 40000), -(9500359, 4010000, 5, 20, 0, 40000), -(9500359, 4010001, 5, 20, 0, 40000), -(9500359, 4010002, 5, 20, 0, 40000), -(9500359, 4010003, 5, 20, 0, 40000), -(9500359, 4010004, 5, 20, 0, 40000), -(9500359, 4010005, 5, 20, 0, 40000), -(9500359, 4010006, 5, 20, 0, 40000), -(9500359, 4010007, 5, 20, 0, 40000), -(9500359, 4020000, 5, 20, 0, 40000), -(9500359, 4020001, 5, 20, 0, 40000), -(9500359, 4020002, 5, 20, 0, 40000), -(9500359, 4020003, 5, 20, 0, 40000), -(9500359, 4020004, 5, 20, 0, 40000), -(9500359, 4020005, 5, 20, 0, 40000), -(9500359, 4020006, 5, 20, 0, 40000), -(9500359, 4020007, 5, 20, 0, 40000), -(9500359, 4020008, 5, 20, 0, 40000), -(9500359, 2020001, 5, 20, 0, 40000), -(9500359, 2020002, 5, 20, 0, 40000), -(9500359, 2020003, 5, 20, 0, 40000), -(9500359, 2020004, 5, 20, 0, 40000), -(9500359, 2020005, 5, 20, 0, 40000), -(9500359, 2020006, 5, 20, 0, 40000), -(9500359, 2020007, 5, 20, 0, 40000), -(9500359, 2020008, 5, 20, 0, 40000), -(9500359, 2020009, 5, 20, 0, 40000), -(9500359, 2020010, 5, 20, 0, 40000), -(9500359, 2020011, 5, 20, 0, 40000), -(9500359, 2020012, 5, 20, 0, 40000), -(9500359, 2020013, 5, 20, 0, 40000), -(9500359, 2020014, 5, 20, 0, 40000), -(9500359, 2020015, 5, 20, 0, 40000), -(9500359, 2020016, 5, 20, 0, 40000), -(9500359, 2020017, 5, 20, 0, 40000), -(9500359, 2020018, 5, 20, 0, 40000), -(9500359, 2020019, 5, 20, 0, 40000), -(9500359, 2020020, 5, 20, 0, 40000), -(9500359, 1052166, 1, 1, 0, 4000), -(9500359, 2280000, 1, 1, 0, 4000), -(9500359, 2280001, 1, 1, 0, 4000), -(9500359, 2280002, 1, 1, 0, 4000), -(9500359, 2280003, 1, 1, 0, 4000), -(9500359, 2280004, 1, 1, 0, 4000), -(9500359, 2280005, 1, 1, 0, 4000), -(9500359, 2280006, 1, 1, 0, 4000), -(9500359, 2280007, 1, 1, 0, 4000), -(9500359, 2280008, 1, 1, 0, 4000), -(9500359, 2280009, 1, 1, 0, 4000), -(9500359, 2280010, 1, 1, 0, 4000), -(9500359, 2280011, 1, 1, 0, 4000), -(9500359, 2280012, 1, 1, 0, 4000), -(9500359, 2044712, 1, 1, 0, 4000), -(9500359, 2044612, 1, 1, 0, 4000), -(9500359, 2044512, 1, 1, 0, 4000), -(9500359, 2044417, 1, 1, 0, 4000), -(9500359, 2044317, 1, 1, 0, 4000), -(9500359, 2044217, 1, 1, 0, 4000), -(9500359, 2044117, 1, 1, 0, 4000), -(9500359, 2044025, 1, 1, 0, 4000), -(9500359, 2043812, 1, 1, 0, 4000), -(9500359, 2043712, 1, 1, 0, 4000), -(9500359, 2043312, 1, 1, 0, 4000), -(9500359, 2043217, 1, 1, 0, 4000), -(9500359, 2043117, 1, 1, 0, 4000), -(9500359, 2043023, 1, 1, 0, 4000), -(9500359, 1132005, 1, 1, 0, 4000), -(9500359, 1132006, 1, 1, 0, 4000), -(9500359, 1132007, 1, 1, 0, 4000), -(9500359, 1132008, 1, 1, 0, 4000), -(9500359, 1132009, 1, 1, 0, 4000), -(9500359, 1422011, 1, 1, 0, 4000), -(9500359, 1432046, 1, 1, 0, 4000), -(9500359, 1332030, 1, 1, 0, 4000); +(9500317, 4003000, 5, 20, 0, 40000), +(9500317, 4003001, 5, 20, 0, 40000), +(9500317, 4003002, 5, 20, 0, 40000), +(9500317, 4003003, 5, 20, 0, 40000), +(9500317, 4004000, 5, 20, 0, 40000), +(9500317, 4004001, 5, 20, 0, 40000), +(9500317, 4004002, 5, 20, 0, 40000), +(9500317, 4004003, 5, 20, 0, 40000), +(9500317, 4004004, 5, 20, 0, 40000), +(9500317, 4010000, 5, 20, 0, 40000), +(9500317, 4010001, 5, 20, 0, 40000), +(9500317, 4010002, 5, 20, 0, 40000), +(9500317, 4010003, 5, 20, 0, 40000), +(9500317, 4010004, 5, 20, 0, 40000), +(9500317, 4010005, 5, 20, 0, 40000), +(9500317, 4010006, 5, 20, 0, 40000), +(9500317, 4010007, 5, 20, 0, 40000), +(9500317, 4020000, 5, 20, 0, 40000), +(9500317, 4020001, 5, 20, 0, 40000), +(9500317, 4020002, 5, 20, 0, 40000), +(9500317, 4020003, 5, 20, 0, 40000), +(9500317, 4020004, 5, 20, 0, 40000), +(9500317, 4020005, 5, 20, 0, 40000), +(9500317, 4020006, 5, 20, 0, 40000), +(9500317, 4020007, 5, 20, 0, 40000), +(9500317, 4020008, 5, 20, 0, 40000), +(9500317, 2020001, 5, 20, 0, 40000), +(9500317, 2020002, 5, 20, 0, 40000), +(9500317, 2020003, 5, 20, 0, 40000), +(9500317, 2020004, 5, 20, 0, 40000), +(9500317, 2020005, 5, 20, 0, 40000), +(9500317, 2020006, 5, 20, 0, 40000), +(9500317, 2020007, 5, 20, 0, 40000), +(9500317, 2020008, 5, 20, 0, 40000), +(9500317, 2020009, 5, 20, 0, 40000), +(9500317, 2020010, 5, 20, 0, 40000), +(9500317, 2020011, 5, 20, 0, 40000), +(9500317, 2020012, 5, 20, 0, 40000), +(9500317, 2020013, 5, 20, 0, 40000), +(9500317, 2020014, 5, 20, 0, 40000), +(9500317, 2020015, 5, 20, 0, 40000), +(9500317, 2020016, 5, 20, 0, 40000), +(9500317, 2020017, 5, 20, 0, 40000), +(9500317, 2020018, 5, 20, 0, 40000), +(9500317, 2020019, 5, 20, 0, 40000), +(9500317, 2020020, 5, 20, 0, 40000), +(9500317, 1092022, 1, 1, 0, 4000), +(9500317, 1092030, 1, 1, 0, 4000), +(9500317, 1092045, 1, 1, 0, 4000), +(9500317, 1092046, 1, 1, 0, 4000), +(9500317, 1092047, 1, 1, 0, 4000), +(9500317, 1112407, 1, 1, 0, 4000), +(9500317, 1112408, 1, 1, 0, 4000), +(9500318, 4003000, 5, 20, 0, 40000), +(9500318, 4003001, 5, 20, 0, 40000), +(9500318, 4003002, 5, 20, 0, 40000), +(9500318, 4003003, 5, 20, 0, 40000), +(9500318, 4004000, 5, 20, 0, 40000), +(9500318, 4004001, 5, 20, 0, 40000), +(9500318, 4004002, 5, 20, 0, 40000), +(9500318, 4004003, 5, 20, 0, 40000), +(9500318, 4004004, 5, 20, 0, 40000), +(9500318, 4010000, 5, 20, 0, 40000), +(9500318, 4010001, 5, 20, 0, 40000), +(9500318, 4010002, 5, 20, 0, 40000), +(9500318, 4010003, 5, 20, 0, 40000), +(9500318, 4010004, 5, 20, 0, 40000), +(9500318, 4010005, 5, 20, 0, 40000), +(9500318, 4010006, 5, 20, 0, 40000), +(9500318, 4010007, 5, 20, 0, 40000), +(9500318, 4020000, 5, 20, 0, 40000), +(9500318, 4020001, 5, 20, 0, 40000), +(9500318, 4020002, 5, 20, 0, 40000), +(9500318, 4020003, 5, 20, 0, 40000), +(9500318, 4020004, 5, 20, 0, 40000), +(9500318, 4020005, 5, 20, 0, 40000), +(9500318, 4020006, 5, 20, 0, 40000), +(9500318, 4020007, 5, 20, 0, 40000), +(9500318, 4020008, 5, 20, 0, 40000), +(9500318, 2020001, 5, 20, 0, 40000), +(9500318, 2020002, 5, 20, 0, 40000), +(9500318, 2020003, 5, 20, 0, 40000), +(9500318, 2020004, 5, 20, 0, 40000), +(9500318, 2020005, 5, 20, 0, 40000), +(9500318, 2020006, 5, 20, 0, 40000), +(9500318, 2020007, 5, 20, 0, 40000), +(9500318, 2020008, 5, 20, 0, 40000), +(9500318, 2020009, 5, 20, 0, 40000), +(9500318, 2020010, 5, 20, 0, 40000), +(9500318, 2020011, 5, 20, 0, 40000), +(9500318, 2020012, 5, 20, 0, 40000), +(9500318, 2020013, 5, 20, 0, 40000), +(9500318, 2020014, 5, 20, 0, 40000), +(9500318, 2020015, 5, 20, 0, 40000), +(9500318, 2020016, 5, 20, 0, 40000), +(9500318, 2020017, 5, 20, 0, 40000), +(9500318, 2020018, 5, 20, 0, 40000), +(9500318, 2020019, 5, 20, 0, 40000), +(9500318, 2020020, 5, 20, 0, 40000), +(9500318, 1052166, 1, 1, 0, 4000), +(9500318, 2330002, 1, 1, 0, 4000), +(9500318, 2070011, 1, 1, 0, 4000), +(9500318, 1102021, 1, 1, 0, 4000), +(9500318, 1102022, 1, 1, 0, 4000), +(9500318, 1102023, 1, 1, 0, 4000), +(9500318, 1102024, 1, 1, 0, 4000), +(9500318, 1102078, 1, 1, 0, 4000), +(9500318, 1122001, 1, 1, 0, 4000), +(9500318, 1122002, 1, 1, 0, 4000), +(9500318, 1122003, 1, 1, 0, 4000), +(9500318, 1122004, 1, 1, 0, 4000), +(9500318, 1122005, 1, 1, 0, 4000), +(9500318, 1122006, 1, 1, 0, 4000), +(9500318, 1082175, 1, 1, 0, 4000), +(9500318, 1082176, 1, 1, 0, 4000), +(9500318, 1082177, 1, 1, 0, 4000), +(9500318, 1082178, 1, 1, 0, 4000), +(9500318, 1082179, 1, 1, 0, 4000), +(9500319, 4003000, 5, 20, 0, 40000), +(9500319, 4003001, 5, 20, 0, 40000), +(9500319, 4003002, 5, 20, 0, 40000), +(9500319, 4003003, 5, 20, 0, 40000), +(9500319, 4004000, 5, 20, 0, 40000), +(9500319, 4004001, 5, 20, 0, 40000), +(9500319, 4004002, 5, 20, 0, 40000), +(9500319, 4004003, 5, 20, 0, 40000), +(9500319, 4004004, 5, 20, 0, 40000), +(9500319, 4010000, 5, 20, 0, 40000), +(9500319, 4010001, 5, 20, 0, 40000), +(9500319, 4010002, 5, 20, 0, 40000), +(9500319, 4010003, 5, 20, 0, 40000), +(9500319, 4010004, 5, 20, 0, 40000), +(9500319, 4010005, 5, 20, 0, 40000), +(9500319, 4010006, 5, 20, 0, 40000), +(9500319, 4010007, 5, 20, 0, 40000), +(9500319, 4020000, 5, 20, 0, 40000), +(9500319, 4020001, 5, 20, 0, 40000), +(9500319, 4020002, 5, 20, 0, 40000), +(9500319, 4020003, 5, 20, 0, 40000), +(9500319, 4020004, 5, 20, 0, 40000), +(9500319, 4020005, 5, 20, 0, 40000), +(9500319, 4020006, 5, 20, 0, 40000), +(9500319, 4020007, 5, 20, 0, 40000), +(9500319, 4020008, 5, 20, 0, 40000), +(9500319, 2020001, 5, 20, 0, 40000), +(9500319, 2020002, 5, 20, 0, 40000), +(9500319, 2020003, 5, 20, 0, 40000), +(9500319, 2020004, 5, 20, 0, 40000), +(9500319, 2020005, 5, 20, 0, 40000), +(9500319, 2020006, 5, 20, 0, 40000), +(9500319, 2020007, 5, 20, 0, 40000), +(9500319, 2020008, 5, 20, 0, 40000), +(9500319, 2020009, 5, 20, 0, 40000), +(9500319, 2020010, 5, 20, 0, 40000), +(9500319, 2020011, 5, 20, 0, 40000), +(9500319, 2020012, 5, 20, 0, 40000), +(9500319, 2020013, 5, 20, 0, 40000), +(9500319, 2020014, 5, 20, 0, 40000), +(9500319, 2020015, 5, 20, 0, 40000), +(9500319, 2020016, 5, 20, 0, 40000), +(9500319, 2020017, 5, 20, 0, 40000), +(9500319, 2020018, 5, 20, 0, 40000), +(9500319, 2020019, 5, 20, 0, 40000), +(9500319, 2020020, 5, 20, 0, 40000), +(9500319, 1052166, 1, 1, 0, 4000), +(9500319, 2280000, 1, 1, 0, 4000), +(9500319, 2280001, 1, 1, 0, 4000), +(9500319, 2280002, 1, 1, 0, 4000), +(9500319, 2280003, 1, 1, 0, 4000), +(9500319, 2280004, 1, 1, 0, 4000), +(9500319, 2280005, 1, 1, 0, 4000), +(9500319, 2280006, 1, 1, 0, 4000), +(9500319, 2280007, 1, 1, 0, 4000), +(9500319, 2280008, 1, 1, 0, 4000), +(9500319, 2280009, 1, 1, 0, 4000), +(9500319, 2280010, 1, 1, 0, 4000), +(9500319, 2280011, 1, 1, 0, 4000), +(9500319, 2280012, 1, 1, 0, 4000), +(9500319, 2044712, 1, 1, 0, 4000), +(9500319, 2044612, 1, 1, 0, 4000), +(9500319, 2044512, 1, 1, 0, 4000), +(9500319, 2044417, 1, 1, 0, 4000), +(9500319, 2044317, 1, 1, 0, 4000), +(9500319, 2044217, 1, 1, 0, 4000), +(9500319, 2044117, 1, 1, 0, 4000), +(9500319, 2044025, 1, 1, 0, 4000), +(9500319, 2043812, 1, 1, 0, 4000), +(9500319, 2043712, 1, 1, 0, 4000), +(9500319, 2043312, 1, 1, 0, 4000), +(9500319, 2043217, 1, 1, 0, 4000), +(9500319, 2043117, 1, 1, 0, 4000), +(9500319, 2043023, 1, 1, 0, 4000), +(9500319, 1132005, 1, 1, 0, 4000), +(9500319, 1132006, 1, 1, 0, 4000), +(9500319, 1132007, 1, 1, 0, 4000), +(9500319, 1132008, 1, 1, 0, 4000), +(9500319, 1132009, 1, 1, 0, 4000), +(9500319, 1422011, 1, 1, 0, 4000), +(9500319, 1432046, 1, 1, 0, 4000), +(9500319, 1332030, 1, 1, 0, 4000); # (dropperid, itemid, minqty, maxqty, questid, chance) diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index 8457f2bf60..9588f49755 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -1667,6 +1667,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public void gainGachaExp(int gain) { updateSingleStat(MapleStat.GACHAEXP, gachaexp.addAndGet(gain)); } + + public void gainExp(int gain) { + gainExp(gain, true, true); + } public void gainExp(int gain, boolean show, boolean inChat) { gainExp(gain, 0, show, inChat, true); @@ -2730,6 +2734,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { public boolean haveItem(int itemid) { return getItemQuantity(itemid, false) > 0; } + + public boolean hasEmptySlot(int itemId) { + return getInventory(MapleItemInformationProvider.getInstance().getInventoryType(itemId)).getNextFreeSlot() > -1; + } + + public boolean hasEmptySlot(byte invType) { + return getInventory(MapleInventoryType.getByType(invType)).getNextFreeSlot() > -1; + } public void increaseGuildCapacity() { //hopefully nothing is null if (getMeso() < getGuild().getIncreaseGuildCost(getGuild().getCapacity())) { @@ -2787,7 +2799,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public boolean isPartyLeader() { - return party.getLeader() == party.getMemberById(getId()); + return party.getLeaderId() == getId(); } public void leaveMap() { diff --git a/src/client/MapleClient.java b/src/client/MapleClient.java index 5f7da28688..651b6fbd7f 100644 --- a/src/client/MapleClient.java +++ b/src/client/MapleClient.java @@ -803,10 +803,12 @@ public class MapleClient { if (messengerid > 0) { worlda.leaveMessenger(messengerid, chrm); } - /* if (fid > 0) { - final MapleFamily family = worlda.getFamily(fid); - family. - }*/ + /* + if (fid > 0) { + final MapleFamily family = worlda.getFamily(fid); + family. + } + */ for (MapleQuestStatus status : player.getStartedQuests()) { //This is for those quests that you have to stay logged in for a certain amount of time MapleQuest quest = status.getQuest(); if (quest.getTimeLimit() > 0) { diff --git a/src/constants/ServerConstants.java b/src/constants/ServerConstants.java index c268cee21f..01e675e0fe 100644 --- a/src/constants/ServerConstants.java +++ b/src/constants/ServerConstants.java @@ -37,6 +37,7 @@ public class ServerConstants { public static final boolean USE_REFRESH_RANK_MOVE = true; public static final int MAX_AP = 999; + public static final int MAX_EVENT_LEVELS = 8; //event has different levels of rewarding system public static final long BLOCK_DUEY_RACE_COND = (long)(0.5 * 1000); public static final long PET_LOOT_UPON_ATTACK = (long)(0.7 * 1000); //time the pet must wait before trying to pick items up. @@ -57,8 +58,7 @@ public class ServerConstants { public static final double PET_AUTOHP_RATIO = 0.99; //will automatically consume potions until given ratio of the MaxHP/MaxMP is reached. public static final double PET_AUTOMP_RATIO = 0.99; - //Should bosses really use 1HP,1MP attacks in dojo? - public static final boolean USE_DEADLY_DOJO = false; + public static final boolean USE_DEADLY_DOJO = false; //Should bosses really use 1HP,1MP attacks in dojo? //Rates public static final int EXP_RATE = 10; diff --git a/src/net/server/world/MapleParty.java b/src/net/server/world/MapleParty.java index 4892007e02..beea9bd0f2 100644 --- a/src/net/server/world/MapleParty.java +++ b/src/net/server/world/MapleParty.java @@ -27,14 +27,14 @@ import java.util.LinkedList; import java.util.List; public class MapleParty { - private MaplePartyCharacter leader; + private int leaderId; private List members = new LinkedList(); private List pqMembers = null; private int id; public MapleParty(int id, MaplePartyCharacter chrfor) { - this.leader = chrfor; - this.members.add(this.leader); + this.leaderId = chrfor.getId(); + this.members.add(chrfor); this.id = id; } @@ -51,7 +51,7 @@ public class MapleParty { } public void setLeader(MaplePartyCharacter victim) { - this.leader = victim; + this.leaderId = victim.getId(); } public void updateMember(MaplePartyCharacter member) { @@ -95,9 +95,19 @@ public class MapleParty { public void setId(int id) { this.id = id; } + + public int getLeaderId() { + return leaderId; + } public MaplePartyCharacter getLeader() { - return leader; + for(MaplePartyCharacter mpc: members) { + if(mpc.getId() == leaderId) { + return mpc; + } + } + + return null; } @Override diff --git a/src/scripting/AbstractPlayerInteraction.java b/src/scripting/AbstractPlayerInteraction.java index 2dc6fe3324..b7c9d0d612 100644 --- a/src/scripting/AbstractPlayerInteraction.java +++ b/src/scripting/AbstractPlayerInteraction.java @@ -531,7 +531,7 @@ public class AbstractPlayerInteraction { if(getParty() == null) return false; - return getParty().getLeader().equals(getPlayer().getMPC()); + return getParty().getLeaderId() == getPlayer().getId(); } public void givePartyItems(int id, short quantity, List party) { diff --git a/src/scripting/event/EventInstanceManager.java b/src/scripting/event/EventInstanceManager.java index fdbb1f1b7b..4ada709f29 100644 --- a/src/scripting/event/EventInstanceManager.java +++ b/src/scripting/event/EventInstanceManager.java @@ -46,13 +46,16 @@ import server.maps.MapleMap; import server.maps.MapleMapFactory; import tools.DatabaseConnection; import client.MapleCharacter; +import constants.ItemConstants; +import constants.ServerConstants; import java.util.concurrent.ScheduledFuture; import java.util.logging.Level; import java.util.logging.Logger; +import scripting.AbstractPlayerInteraction; /** * - * @author Matze + * @author Matze, Ronan */ public class EventInstanceManager { private List chars = new ArrayList<>(); @@ -72,7 +75,12 @@ public class EventInstanceManager { private final WriteLock wL = mutex.writeLock(); private ScheduledFuture event_schedule = null; private boolean disposed = false; - + + // multi-leveled PQ rewards! + private Map> collectionSet = new HashMap<>(ServerConstants.MAX_EVENT_LEVELS); + private Map> collectionQty = new HashMap<>(ServerConstants.MAX_EVENT_LEVELS); + private Map collectionExp = new HashMap<>(ServerConstants.MAX_EVENT_LEVELS); + public EventInstanceManager(EventManager em, String name) { this.em = em; this.name = name; @@ -144,16 +152,51 @@ public class EventInstanceManager { eventTime = time; event_schedule = TimerManager.getInstance().schedule(new Runnable() { - public void run() { - try { - em.getIv().invokeFunction("scheduledTimeout", EventInstanceManager.this); - } catch (ScriptException | NoSuchMethodException ex) { - Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex); + public void run() { + try { + em.getIv().invokeFunction("scheduledTimeout", EventInstanceManager.this); + dismissEventTimer(); + } catch (ScriptException | NoSuchMethodException ex) { + Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex); + } } - } }, time); } + + public void addEventTimer(long time) { + if(event_schedule != null) { + if(event_schedule.cancel(false)) { + long nextTime = getTimeLeft() + time; + eventTime += time; + event_schedule = TimerManager.getInstance().schedule(new Runnable() { + public void run() { + try { + em.getIv().invokeFunction("scheduledTimeout", EventInstanceManager.this); + dismissEventTimer(); + } catch (ScriptException | NoSuchMethodException ex) { + Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex); + } + } + }, nextTime); + } + } + else { + startEventTimer(time); + } + } + + public void cancelEventTimer() { + if(event_schedule != null) event_schedule.cancel(false); + dismissEventTimer(); + } + + private void dismissEventTimer() { + event_schedule = null; + eventTime = 0; + timeStarted = 0; + } + public boolean isTimerStarted() { return eventTime > 0 && timeStarted > 0; } @@ -318,7 +361,7 @@ public class EventInstanceManager { wL.unlock(); } - if(event_schedule != null) event_schedule.cancel(true); + if(event_schedule != null) event_schedule.cancel(false); mobs.clear(); killCount.clear(); @@ -388,9 +431,9 @@ public class EventInstanceManager { return props.getProperty(key); } - public Properties getProperties(){ - return props; - } + public Properties getProperties(){ + return props; + } public void leftParty(MapleCharacter chr) { try { @@ -425,7 +468,7 @@ public class EventInstanceManager { } public boolean isLeader(MapleCharacter chr) { - return (chr.getParty().getLeader().getId() == chr.getId()); + return (chr.getParty().getLeaderId() == chr.getId()); } public final MapleMap setInstanceMap(final int mapid) { //gets instance map from the channelserv @@ -468,4 +511,106 @@ public class EventInstanceManager { } return false; } + + private List convertToIntegerArray(List list) { + List intList = new ArrayList<>(); + for(Double d: list) intList.add(d.intValue()); + + return intList; + } + + public final void setEventRewards(List rwds, List qtys) { + setEventRewards(1, rwds, qtys); + } + + public final void setEventRewards(int eventLevel, List rwds, List qtys) { + setEventRewards(eventLevel, rwds, qtys, 0); + } + + public final void setEventRewards(int eventLevel, List rwds, List qtys, int expGiven) { + // fixed EXP will be rewarded at the same time the random item is given + + if(eventLevel <= 0 || eventLevel > ServerConstants.MAX_EVENT_LEVELS) return; + eventLevel--; //event level starts from 1 + + List rewardIds = convertToIntegerArray(rwds); + List rewardQtys = convertToIntegerArray(qtys); + + //rewardsSet and rewardsQty hold temporary values + collectionSet.put(eventLevel, rewardIds); + collectionQty.put(eventLevel, rewardQtys); + collectionExp.put(eventLevel, expGiven); + } + + private byte getRewardListRequirements(int level) { + if(level >= collectionSet.size()) return 0; + + byte rewardTypes = 0; + List list = collectionSet.get(level); + + for (Integer itemId : list) { + rewardTypes |= (1 << ItemConstants.getInventoryType(itemId).getType()); + } + + return rewardTypes; + } + + private boolean hasRewardSlot(MapleCharacter player, int eventLevel) { + byte listReq = getRewardListRequirements(eventLevel); //gets all types of items present in the event reward list + + //iterating over all valid inventory types + for(byte type = 1; type <= 5; type++) { + if((listReq >> type) % 2 == 1 && !player.hasEmptySlot(type)) + return false; + } + + return true; + } + + public final boolean giveEventReward(MapleCharacter player) { + return giveEventReward(player, 1); + } + + //gives out EXP & a random item in a similar fashion of when clearing KPQ, LPQ, etc. + public final boolean giveEventReward(MapleCharacter player, int eventLevel) { + eventLevel--; //event level starts counting from 1 + if(eventLevel >= collectionSet.size()) return true; + + List rewardsSet = collectionSet.get(eventLevel); + List rewardsQty = collectionQty.get(eventLevel); + + Integer rewardExp = collectionExp.get(eventLevel); + if(rewardExp == null) rewardExp = 0; + + if(rewardsSet == null || rewardsSet.isEmpty()) { + if(rewardExp > 0) player.gainExp(rewardExp); + return true; + } + + if(!hasRewardSlot(player, eventLevel)) return false; + + AbstractPlayerInteraction api = new AbstractPlayerInteraction(player.getClient()); + int rnd = (int)Math.floor(Math.random() * rewardsSet.size()); + + api.gainItem(rewardsSet.get(rnd), rewardsQty.get(rnd).shortValue()); + if(rewardExp > 0) player.gainExp(rewardExp); + return true; + } + + public final boolean isEventTeamTogether() { + if(chars.size() <= 1) return true; + + int mapId = chars.get(0).getMapId(); + for(int i = 1; i < chars.size(); i++) { + if(chars.get(i).getMapId() != mapId) return false; + } + + return true; + } + + public final void warpEventTeam(int warpTo) { + for (MapleCharacter chr : chars) { + chr.changeMap(warpTo); + } + } } diff --git a/src/scripting/event/EventManager.java b/src/scripting/event/EventManager.java index 9e625b7c40..44cefb7ea8 100644 --- a/src/scripting/event/EventManager.java +++ b/src/scripting/event/EventManager.java @@ -92,7 +92,7 @@ public class EventManager { public void cancelSchedule() { if(schedule != null) - schedule.cancel(true); + schedule.cancel(false); } public ScheduledFuture scheduleAtTimestamp(final String methodName, long timestamp) { diff --git a/wz/Map.wz/Map/Map9/970030001.img.xml b/wz/Map.wz/Map/Map9/970030001.img.xml index 98f3582e88..1a1bde6ac8 100644 --- a/wz/Map.wz/Map/Map9/970030001.img.xml +++ b/wz/Map.wz/Map/Map9/970030001.img.xml @@ -946,11 +946,12 @@ - + - - + + + diff --git a/wz/Map.wz/Map/Map9/970030002.img.xml b/wz/Map.wz/Map/Map9/970030002.img.xml index 0ac20e090a..c50f9a6633 100644 --- a/wz/Map.wz/Map/Map9/970030002.img.xml +++ b/wz/Map.wz/Map/Map9/970030002.img.xml @@ -946,12 +946,12 @@ - + - - - + + + diff --git a/wz/Map.wz/Map/Map9/970030003.img.xml b/wz/Map.wz/Map/Map9/970030003.img.xml index 06be589267..bea8b53e4c 100644 --- a/wz/Map.wz/Map/Map9/970030003.img.xml +++ b/wz/Map.wz/Map/Map9/970030003.img.xml @@ -946,11 +946,12 @@ - + - - + + + diff --git a/wz/Map.wz/Map/Map9/970030004.img.xml b/wz/Map.wz/Map/Map9/970030004.img.xml index 0742e930bc..99fca005d5 100644 --- a/wz/Map.wz/Map/Map9/970030004.img.xml +++ b/wz/Map.wz/Map/Map9/970030004.img.xml @@ -946,11 +946,12 @@ - + - - + + + diff --git a/wz/Map.wz/Map/Map9/970030005.img.xml b/wz/Map.wz/Map/Map9/970030005.img.xml index 1a98a44f9f..a8abdc5909 100644 --- a/wz/Map.wz/Map/Map9/970030005.img.xml +++ b/wz/Map.wz/Map/Map9/970030005.img.xml @@ -946,11 +946,12 @@ - + - - + + + diff --git a/wz/Map.wz/Map/Map9/970030006.img.xml b/wz/Map.wz/Map/Map9/970030006.img.xml index 41ed5d6179..3fb1c0cafa 100644 --- a/wz/Map.wz/Map/Map9/970030006.img.xml +++ b/wz/Map.wz/Map/Map9/970030006.img.xml @@ -946,11 +946,12 @@ - + - - + + + diff --git a/wz/Map.wz/Map/Map9/970030007.img.xml b/wz/Map.wz/Map/Map9/970030007.img.xml index a4c8332c19..535cb56f51 100644 --- a/wz/Map.wz/Map/Map9/970030007.img.xml +++ b/wz/Map.wz/Map/Map9/970030007.img.xml @@ -946,11 +946,12 @@ - + - - + + + diff --git a/wz/Map.wz/Map/Map9/970030008.img.xml b/wz/Map.wz/Map/Map9/970030008.img.xml index 3ef12d5e1d..c6acbee9c2 100644 --- a/wz/Map.wz/Map/Map9/970030008.img.xml +++ b/wz/Map.wz/Map/Map9/970030008.img.xml @@ -946,11 +946,12 @@ - + - - + + + diff --git a/wz/Map.wz/Map/Map9/970030009.img.xml b/wz/Map.wz/Map/Map9/970030009.img.xml index 0df746b87e..a4c3bed041 100644 --- a/wz/Map.wz/Map/Map9/970030009.img.xml +++ b/wz/Map.wz/Map/Map9/970030009.img.xml @@ -946,11 +946,12 @@ - + - - + + + diff --git a/wz/Map.wz/Map/Map9/970030010.img.xml b/wz/Map.wz/Map/Map9/970030010.img.xml index 67796e8a6c..1d649e1f10 100644 --- a/wz/Map.wz/Map/Map9/970030010.img.xml +++ b/wz/Map.wz/Map/Map9/970030010.img.xml @@ -946,11 +946,12 @@ - + - - + + + diff --git a/wz/Map.wz/Map/Map9/970032700.img.xml b/wz/Map.wz/Map/Map9/970032700.img.xml index abe03c19c1..d00e56baa1 100644 --- a/wz/Map.wz/Map/Map9/970032700.img.xml +++ b/wz/Map.wz/Map/Map9/970032700.img.xml @@ -1534,17 +1534,5 @@ - - - - - - - - - - - - diff --git a/wz/Map.wz/Map/Map9/970032701.img.xml b/wz/Map.wz/Map/Map9/970032701.img.xml index 296b8e9386..e6e5a81f27 100644 --- a/wz/Map.wz/Map/Map9/970032701.img.xml +++ b/wz/Map.wz/Map/Map9/970032701.img.xml @@ -1534,17 +1534,5 @@ - - - - - - - - - - - - diff --git a/wz/Map.wz/Map/Map9/970032702.img.xml b/wz/Map.wz/Map/Map9/970032702.img.xml index 26259dea4d..b6d535ae93 100644 --- a/wz/Map.wz/Map/Map9/970032702.img.xml +++ b/wz/Map.wz/Map/Map9/970032702.img.xml @@ -1534,17 +1534,5 @@ - - - - - - - - - - - - diff --git a/wz/Map.wz/Map/Map9/970032703.img.xml b/wz/Map.wz/Map/Map9/970032703.img.xml index 7df13c9cfc..195c8fee36 100644 --- a/wz/Map.wz/Map/Map9/970032703.img.xml +++ b/wz/Map.wz/Map/Map9/970032703.img.xml @@ -1534,17 +1534,5 @@ - - - - - - - - - - - - diff --git a/wz/Map.wz/Map/Map9/970032704.img.xml b/wz/Map.wz/Map/Map9/970032704.img.xml index c96298f645..402d9bf13e 100644 --- a/wz/Map.wz/Map/Map9/970032704.img.xml +++ b/wz/Map.wz/Map/Map9/970032704.img.xml @@ -1534,17 +1534,5 @@ - - - - - - - - - - - - diff --git a/wz/Map.wz/Map/Map9/970032705.img.xml b/wz/Map.wz/Map/Map9/970032705.img.xml index 8f8309a33b..b9cd2e4b5b 100644 --- a/wz/Map.wz/Map/Map9/970032705.img.xml +++ b/wz/Map.wz/Map/Map9/970032705.img.xml @@ -1534,17 +1534,5 @@ - - - - - - - - - - - - diff --git a/wz/Map.wz/Map/Map9/970032706.img.xml b/wz/Map.wz/Map/Map9/970032706.img.xml index 7771dece1f..316b7560e2 100644 --- a/wz/Map.wz/Map/Map9/970032706.img.xml +++ b/wz/Map.wz/Map/Map9/970032706.img.xml @@ -1534,17 +1534,5 @@ - - - - - - - - - - - - diff --git a/wz/Map.wz/Map/Map9/970032707.img.xml b/wz/Map.wz/Map/Map9/970032707.img.xml index b1f716e9a3..768c288219 100644 --- a/wz/Map.wz/Map/Map9/970032707.img.xml +++ b/wz/Map.wz/Map/Map9/970032707.img.xml @@ -1534,17 +1534,5 @@ - - - - - - - - - - - -