diff --git a/build/built-jar.properties b/build/built-jar.properties index 27f014119a..eceba121aa 100644 --- a/build/built-jar.properties +++ b/build/built-jar.properties @@ -1,4 +1,4 @@ -#Fri, 13 Oct 2017 03:24:23 -0300 +#Mon, 16 Oct 2017 14:34:51 -0200 C\:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2= diff --git a/build/classes/client/MapleBuffStat.class b/build/classes/client/MapleBuffStat.class index ccdd55b24b..1ce02a3e34 100644 Binary files a/build/classes/client/MapleBuffStat.class and b/build/classes/client/MapleBuffStat.class differ diff --git a/build/classes/client/MapleCharacter$1.class b/build/classes/client/MapleCharacter$1.class index 8d36220073..fcc4883a62 100644 Binary files a/build/classes/client/MapleCharacter$1.class and b/build/classes/client/MapleCharacter$1.class differ diff --git a/build/classes/client/MapleCharacter$10.class b/build/classes/client/MapleCharacter$10.class index 54b1a80d04..30db8e59cc 100644 Binary files a/build/classes/client/MapleCharacter$10.class and b/build/classes/client/MapleCharacter$10.class differ diff --git a/build/classes/client/MapleCharacter$11.class b/build/classes/client/MapleCharacter$11.class index 9d51c82e5e..ef23fbb6ae 100644 Binary files a/build/classes/client/MapleCharacter$11.class and b/build/classes/client/MapleCharacter$11.class differ diff --git a/build/classes/client/MapleCharacter$12.class b/build/classes/client/MapleCharacter$12.class index 5e29ce92f9..ad9b9d082f 100644 Binary files a/build/classes/client/MapleCharacter$12.class and b/build/classes/client/MapleCharacter$12.class differ diff --git a/build/classes/client/MapleCharacter$13.class b/build/classes/client/MapleCharacter$13.class index 4803509f74..571dbae1e9 100644 Binary files a/build/classes/client/MapleCharacter$13.class and b/build/classes/client/MapleCharacter$13.class differ diff --git a/build/classes/client/MapleCharacter$14.class b/build/classes/client/MapleCharacter$14.class index 9e55dc566f..bb841cea8f 100644 Binary files a/build/classes/client/MapleCharacter$14.class and b/build/classes/client/MapleCharacter$14.class differ diff --git a/build/classes/client/MapleCharacter$15.class b/build/classes/client/MapleCharacter$15.class index f3507c7314..5aeefa138d 100644 Binary files a/build/classes/client/MapleCharacter$15.class and b/build/classes/client/MapleCharacter$15.class differ diff --git a/build/classes/client/MapleCharacter$16.class b/build/classes/client/MapleCharacter$16.class index 12803fffa3..39bb6eaa11 100644 Binary files a/build/classes/client/MapleCharacter$16.class and b/build/classes/client/MapleCharacter$16.class differ diff --git a/build/classes/client/MapleCharacter$17.class b/build/classes/client/MapleCharacter$17.class index 105581e4e6..8afb4b892f 100644 Binary files a/build/classes/client/MapleCharacter$17.class and b/build/classes/client/MapleCharacter$17.class differ diff --git a/build/classes/client/MapleCharacter$18.class b/build/classes/client/MapleCharacter$18.class index 02a48ebacb..4dfd86e071 100644 Binary files a/build/classes/client/MapleCharacter$18.class and b/build/classes/client/MapleCharacter$18.class differ diff --git a/build/classes/client/MapleCharacter$19.class b/build/classes/client/MapleCharacter$19.class index f06463953c..4d9bda9cad 100644 Binary files a/build/classes/client/MapleCharacter$19.class and b/build/classes/client/MapleCharacter$19.class differ diff --git a/build/classes/client/MapleCharacter$2.class b/build/classes/client/MapleCharacter$2.class index 6beb218ae6..ffe6fe8371 100644 Binary files a/build/classes/client/MapleCharacter$2.class and b/build/classes/client/MapleCharacter$2.class differ diff --git a/build/classes/client/MapleCharacter$3.class b/build/classes/client/MapleCharacter$3.class index 1058ab4bd0..c96c3e93d9 100644 Binary files a/build/classes/client/MapleCharacter$3.class and b/build/classes/client/MapleCharacter$3.class differ diff --git a/build/classes/client/MapleCharacter$4.class b/build/classes/client/MapleCharacter$4.class index 00e59eb443..b4acbc4028 100644 Binary files a/build/classes/client/MapleCharacter$4.class and b/build/classes/client/MapleCharacter$4.class differ diff --git a/build/classes/client/MapleCharacter$5.class b/build/classes/client/MapleCharacter$5.class index 6f9f679c52..4f32c82cdb 100644 Binary files a/build/classes/client/MapleCharacter$5.class and b/build/classes/client/MapleCharacter$5.class differ diff --git a/build/classes/client/MapleCharacter$6.class b/build/classes/client/MapleCharacter$6.class index 7909fee18d..239d69cfb8 100644 Binary files a/build/classes/client/MapleCharacter$6.class and b/build/classes/client/MapleCharacter$6.class differ diff --git a/build/classes/client/MapleCharacter$7.class b/build/classes/client/MapleCharacter$7.class index f2344ccef7..76d40490a5 100644 Binary files a/build/classes/client/MapleCharacter$7.class and b/build/classes/client/MapleCharacter$7.class differ diff --git a/build/classes/client/MapleCharacter$8.class b/build/classes/client/MapleCharacter$8.class index d2ff3bacfb..10514607e9 100644 Binary files a/build/classes/client/MapleCharacter$8.class and b/build/classes/client/MapleCharacter$8.class differ diff --git a/build/classes/client/MapleCharacter$9.class b/build/classes/client/MapleCharacter$9.class index 81275610fe..96cd8c43a1 100644 Binary files a/build/classes/client/MapleCharacter$9.class and b/build/classes/client/MapleCharacter$9.class differ diff --git a/build/classes/client/MapleCharacter$FameStatus.class b/build/classes/client/MapleCharacter$FameStatus.class index 4eb2d7077b..cd70ac8110 100644 Binary files a/build/classes/client/MapleCharacter$FameStatus.class and b/build/classes/client/MapleCharacter$FameStatus.class differ diff --git a/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class b/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class index 5161b64c7d..a02b7bffb8 100644 Binary files a/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class and b/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class differ diff --git a/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class b/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class index 24aaa25518..0229b42f76 100644 Binary files a/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class and b/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class differ diff --git a/build/classes/client/MapleCharacter$SkillEntry.class b/build/classes/client/MapleCharacter$SkillEntry.class index 6ed8dd7265..41c25bfb8d 100644 Binary files a/build/classes/client/MapleCharacter$SkillEntry.class and b/build/classes/client/MapleCharacter$SkillEntry.class differ diff --git a/build/classes/client/MapleCharacter.class b/build/classes/client/MapleCharacter.class index 91795d0819..a6d890a1ba 100644 Binary files a/build/classes/client/MapleCharacter.class and b/build/classes/client/MapleCharacter.class differ diff --git a/build/classes/client/MapleClient$1.class b/build/classes/client/MapleClient$1.class index 14f584027f..a63378c912 100644 Binary files a/build/classes/client/MapleClient$1.class and b/build/classes/client/MapleClient$1.class differ diff --git a/build/classes/client/MapleClient$CharNameAndId.class b/build/classes/client/MapleClient$CharNameAndId.class index 65e75ff13b..b40fec8e7f 100644 Binary files a/build/classes/client/MapleClient$CharNameAndId.class and b/build/classes/client/MapleClient$CharNameAndId.class differ diff --git a/build/classes/client/MapleClient.class b/build/classes/client/MapleClient.class index 71dc907cf1..55ac1ccd34 100644 Binary files a/build/classes/client/MapleClient.class and b/build/classes/client/MapleClient.class differ diff --git a/build/classes/client/inventory/MapleInventory.class b/build/classes/client/inventory/MapleInventory.class index ff65d92e67..ca4c669580 100644 Binary files a/build/classes/client/inventory/MapleInventory.class and b/build/classes/client/inventory/MapleInventory.class differ diff --git a/build/classes/net/PacketProcessor.class b/build/classes/net/PacketProcessor.class index d120086d80..c10f5ec8c8 100644 Binary files a/build/classes/net/PacketProcessor.class and b/build/classes/net/PacketProcessor.class differ diff --git a/build/classes/net/server/channel/Channel$1.class b/build/classes/net/server/channel/Channel$1.class index 03fdf711b1..6d195accb9 100644 Binary files a/build/classes/net/server/channel/Channel$1.class and b/build/classes/net/server/channel/Channel$1.class differ diff --git a/build/classes/net/server/channel/Channel$respawnMaps.class b/build/classes/net/server/channel/Channel$respawnMaps.class index 7a133f2649..9a9d557a5a 100644 Binary files a/build/classes/net/server/channel/Channel$respawnMaps.class and b/build/classes/net/server/channel/Channel$respawnMaps.class differ diff --git a/build/classes/net/server/channel/Channel.class b/build/classes/net/server/channel/Channel.class index 62b5466fb1..24a8b37ba6 100644 Binary files a/build/classes/net/server/channel/Channel.class and b/build/classes/net/server/channel/Channel.class differ diff --git a/build/classes/net/server/channel/handlers/DoorHandler.class b/build/classes/net/server/channel/handlers/DoorHandler.class index 8797672530..f38d7b5c10 100644 Binary files a/build/classes/net/server/channel/handlers/DoorHandler.class and b/build/classes/net/server/channel/handlers/DoorHandler.class differ diff --git a/build/classes/net/server/channel/handlers/EnterCashShopHandler.class b/build/classes/net/server/channel/handlers/EnterCashShopHandler.class index aeb8da9dad..c2705f25b1 100644 Binary files a/build/classes/net/server/channel/handlers/EnterCashShopHandler.class and b/build/classes/net/server/channel/handlers/EnterCashShopHandler.class differ diff --git a/build/classes/net/server/channel/handlers/EnterMTSHandler.class b/build/classes/net/server/channel/handlers/EnterMTSHandler.class index 4e999fd1e4..2c7dd0cf50 100644 Binary files a/build/classes/net/server/channel/handlers/EnterMTSHandler.class and b/build/classes/net/server/channel/handlers/EnterMTSHandler.class differ diff --git a/build/classes/net/server/channel/handlers/ItemIdSortHandler.class b/build/classes/net/server/channel/handlers/ItemIdSortHandler.class deleted file mode 100644 index d7e0ba5ffa..0000000000 Binary files a/build/classes/net/server/channel/handlers/ItemIdSortHandler.class and /dev/null differ diff --git a/build/classes/net/server/channel/handlers/ItemSortHandler.class b/build/classes/net/server/channel/handlers/ItemSortHandler.class deleted file mode 100644 index 0e088c8d2a..0000000000 Binary files a/build/classes/net/server/channel/handlers/ItemSortHandler.class and /dev/null differ diff --git a/build/classes/net/server/channel/handlers/PairedQuicksort.class b/build/classes/net/server/channel/handlers/PairedQuicksort.class index 22af6e471e..c018f11496 100644 Binary files a/build/classes/net/server/channel/handlers/PairedQuicksort.class and b/build/classes/net/server/channel/handlers/PairedQuicksort.class differ diff --git a/build/classes/net/server/channel/handlers/PartySearchStartHandler.class b/build/classes/net/server/channel/handlers/PartySearchStartHandler.class index 12c4722bc2..be3eb52db8 100644 Binary files a/build/classes/net/server/channel/handlers/PartySearchStartHandler.class and b/build/classes/net/server/channel/handlers/PartySearchStartHandler.class differ diff --git a/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class b/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class index 18b3a932ba..e5f971a63e 100644 Binary files a/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class and b/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class differ diff --git a/build/classes/scripting/AbstractPlayerInteraction.class b/build/classes/scripting/AbstractPlayerInteraction.class index db93f32582..5309869df6 100644 Binary files a/build/classes/scripting/AbstractPlayerInteraction.class and b/build/classes/scripting/AbstractPlayerInteraction.class differ diff --git a/build/classes/scripting/event/EventInstanceManager$1.class b/build/classes/scripting/event/EventInstanceManager$1.class index 0abc101de3..b58abca907 100644 Binary files a/build/classes/scripting/event/EventInstanceManager$1.class and b/build/classes/scripting/event/EventInstanceManager$1.class differ diff --git a/build/classes/scripting/event/EventInstanceManager$2.class b/build/classes/scripting/event/EventInstanceManager$2.class index ea29c509c2..378130a188 100644 Binary files a/build/classes/scripting/event/EventInstanceManager$2.class and b/build/classes/scripting/event/EventInstanceManager$2.class differ diff --git a/build/classes/scripting/event/EventInstanceManager$3.class b/build/classes/scripting/event/EventInstanceManager$3.class index 2b7e5d0884..9004e14ac8 100644 Binary files a/build/classes/scripting/event/EventInstanceManager$3.class and b/build/classes/scripting/event/EventInstanceManager$3.class differ diff --git a/build/classes/scripting/event/EventInstanceManager.class b/build/classes/scripting/event/EventInstanceManager.class index f86994b796..3527871339 100644 Binary files a/build/classes/scripting/event/EventInstanceManager.class and b/build/classes/scripting/event/EventInstanceManager.class differ diff --git a/build/classes/server/MapleInventoryManipulator.class b/build/classes/server/MapleInventoryManipulator.class index 37b279bc50..5070646180 100644 Binary files a/build/classes/server/MapleInventoryManipulator.class and b/build/classes/server/MapleInventoryManipulator.class differ diff --git a/build/classes/server/MapleStatEffect.class b/build/classes/server/MapleStatEffect.class index af915dcb94..6d00ffa008 100644 Binary files a/build/classes/server/MapleStatEffect.class and b/build/classes/server/MapleStatEffect.class differ diff --git a/build/classes/server/maps/MapleMap$27.class b/build/classes/server/maps/MapleMap$27.class index e121fd635b..27a98edfb2 100644 Binary files a/build/classes/server/maps/MapleMap$27.class and b/build/classes/server/maps/MapleMap$27.class differ diff --git a/build/classes/server/maps/MapleMap$28.class b/build/classes/server/maps/MapleMap$28.class index 57e0f455bd..0318fce7dd 100644 Binary files a/build/classes/server/maps/MapleMap$28.class and b/build/classes/server/maps/MapleMap$28.class differ diff --git a/build/classes/server/maps/MapleMap$29$1.class b/build/classes/server/maps/MapleMap$29$1.class deleted file mode 100644 index 1f60828cfe..0000000000 Binary files a/build/classes/server/maps/MapleMap$29$1.class and /dev/null differ diff --git a/build/classes/server/maps/MapleMap$29.class b/build/classes/server/maps/MapleMap$29.class index 724d769530..8dce272a4a 100644 Binary files a/build/classes/server/maps/MapleMap$29.class and b/build/classes/server/maps/MapleMap$29.class differ diff --git a/build/classes/server/maps/MapleMap$30.class b/build/classes/server/maps/MapleMap$30.class deleted file mode 100644 index 9709aa389d..0000000000 Binary files a/build/classes/server/maps/MapleMap$30.class and /dev/null differ diff --git a/build/classes/server/maps/MapleMap$ActivateItemReactor$1.class b/build/classes/server/maps/MapleMap$ActivateItemReactor$1.class index fc3a6be4cd..98ec32c14c 100644 Binary files a/build/classes/server/maps/MapleMap$ActivateItemReactor$1.class and b/build/classes/server/maps/MapleMap$ActivateItemReactor$1.class differ diff --git a/build/classes/server/maps/MapleMap$ActivateItemReactor.class b/build/classes/server/maps/MapleMap$ActivateItemReactor.class index 921ddbb31c..bd711f8dc9 100644 Binary files a/build/classes/server/maps/MapleMap$ActivateItemReactor.class and b/build/classes/server/maps/MapleMap$ActivateItemReactor.class differ diff --git a/build/classes/server/maps/MapleMap$ExpireMapItemJob.class b/build/classes/server/maps/MapleMap$ExpireMapItemJob.class index 2fb15715e1..212d770b3e 100644 Binary files a/build/classes/server/maps/MapleMap$ExpireMapItemJob.class and b/build/classes/server/maps/MapleMap$ExpireMapItemJob.class differ diff --git a/build/classes/server/maps/MapleMap.class b/build/classes/server/maps/MapleMap.class index f4163d75ca..826988fa2d 100644 Binary files a/build/classes/server/maps/MapleMap.class and b/build/classes/server/maps/MapleMap.class differ diff --git a/build/classes/server/maps/MapleMiniDungeon.class b/build/classes/server/maps/MapleMiniDungeon.class index 59a90e4c87..5bd0a17edf 100644 Binary files a/build/classes/server/maps/MapleMiniDungeon.class and b/build/classes/server/maps/MapleMiniDungeon.class differ diff --git a/dist/MapleSolaxia.jar b/dist/MapleSolaxia.jar index 1901f5be6e..b89d19b0ca 100644 Binary files a/dist/MapleSolaxia.jar and b/dist/MapleSolaxia.jar differ diff --git a/docs/mychanges_ptbr.txt b/docs/mychanges_ptbr.txt index bdded63caa..a462593a70 100644 --- a/docs/mychanges_ptbr.txt +++ b/docs/mychanges_ptbr.txt @@ -580,4 +580,9 @@ Alterado tempo-limite em mapas da PiratePQ para seguir o determinado para cada m 12 Outubro 2017, Corrigido alguns bugs com a PPQ. -Se houve sucesso usando white scroll, slot ainda é usado. \ No newline at end of file +Se houve sucesso usando white scroll, slot ainda é usado. + +15 Outubro 2017, +Corrigido Mini-dungeons não liberando os jogadores corretamente. Se player entra em outra sessão de MD antes de dar o timeout da primeira, o timeout leva efeito mesmo fora da sessão. +Corrigido um bug/exploit que permitia stackar map chair recovery. +Corrigido um bug no inventário de CASH mesclando itens de mesmo id. \ No newline at end of file diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index ce17874d10..5af0ed1acc 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -2,20 +2,6 @@ - - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/davy_next0.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/command/Commands.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/davy_next3.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/davy_next1.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/davy_next4.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleReactorStats.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleDoor.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/2094002.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/CathedralWedding.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/davy_next2.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleMap.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/PiratePQ.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/reactor/2512000.js - + diff --git a/scripts/NPC Base.js b/scripts/NPC Base.js index 893fe61d1e..41c50c737c 100644 --- a/scripts/NPC Base.js +++ b/scripts/NPC Base.js @@ -51,4 +51,12 @@ function action(mode, type, selection) { cm.dispose(); } } +} + +function generateSelectionMenu(array) { // nice tool for generating a string for the sendSimple functionality + var menu = ""; + for (var i = 0; i < array.length; i++) { + menu += "#L" + i + "#" + array[i] + "l\r\n"; + } + return menu; } \ No newline at end of file diff --git a/scripts/portal/MD_drakeroom.js b/scripts/portal/MD_drakeroom.js index bdf6c3eda1..93983577b6 100644 --- a/scripts/portal/MD_drakeroom.js +++ b/scripts/portal/MD_drakeroom.js @@ -27,28 +27,28 @@ var dungeons = 30; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); - return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); - return false; + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + return false; + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + return false; } else { pi.playPortalSound(); pi.warp(baseid, "MD00"); diff --git a/scripts/portal/MD_golem.js b/scripts/portal/MD_golem.js index 84abdc35db..4d113736d7 100644 --- a/scripts/portal/MD_golem.js +++ b/scripts/portal/MD_golem.js @@ -29,28 +29,28 @@ var dungeons = 30; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); - return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); - return false; + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + return false; + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + return false; } else { pi.playPortalSound(); pi.warp(baseid, "MD00"); diff --git a/scripts/portal/MD_high.js b/scripts/portal/MD_high.js index f06301773b..2f796e3684 100644 --- a/scripts/portal/MD_high.js +++ b/scripts/portal/MD_high.js @@ -29,35 +29,31 @@ var dungeons = 19; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getPlayer().getFame() < 10) { - pi.playerMessage(5, "You need 10 Fame to enter."); - return; - } - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); return false; } else { - pi.playPortalSound(); - pi.warp(baseid, "MD00"); - return true; + pi.playPortalSound(); + pi.warp(baseid, "MD00"); + return true; } } \ No newline at end of file diff --git a/scripts/portal/MD_mushroom.js b/scripts/portal/MD_mushroom.js index ffafdfe3d8..279a734529 100644 --- a/scripts/portal/MD_mushroom.js +++ b/scripts/portal/MD_mushroom.js @@ -29,28 +29,28 @@ var dungeons = 30; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); - return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); - return false; + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + return false; + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + return false; } else { pi.playPortalSound(); pi.warp(baseid, "MD00"); diff --git a/scripts/portal/MD_pig.js b/scripts/portal/MD_pig.js index ee976c5006..0e273e0493 100644 --- a/scripts/portal/MD_pig.js +++ b/scripts/portal/MD_pig.js @@ -29,28 +29,28 @@ var dungeons = 30; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); - return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); - return false; + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + return false; + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + return false; } else { pi.playPortalSound(); pi.warp(baseid, "MD00"); diff --git a/scripts/portal/MD_protect.js b/scripts/portal/MD_protect.js index f84717d8dd..475646b9cc 100644 --- a/scripts/portal/MD_protect.js +++ b/scripts/portal/MD_protect.js @@ -27,28 +27,28 @@ var dungeons = 19; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); - return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); - return false; + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + return false; + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + return false; } else { pi.playPortalSound(); pi.warp(baseid, "MD00"); diff --git a/scripts/portal/MD_rabbit.js b/scripts/portal/MD_rabbit.js index eba7e2823e..98c04d23a6 100644 --- a/scripts/portal/MD_rabbit.js +++ b/scripts/portal/MD_rabbit.js @@ -27,28 +27,28 @@ var dungeons = 30; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); - return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); - return false; + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + return false; + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + return false; } else { pi.playPortalSound(); pi.warp(baseid, "MD00"); diff --git a/scripts/portal/MD_remember.js b/scripts/portal/MD_remember.js index 1eac064a38..9f1c874aaa 100644 --- a/scripts/portal/MD_remember.js +++ b/scripts/portal/MD_remember.js @@ -27,28 +27,28 @@ var dungeons = 19; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); - return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); - return false; + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + return false; + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + return false; } else { pi.playPortalSound(); pi.warp(baseid, "MD00"); diff --git a/scripts/portal/MD_roundTable.js b/scripts/portal/MD_roundTable.js index 4b169e40c7..df0aec42ab 100644 --- a/scripts/portal/MD_roundTable.js +++ b/scripts/portal/MD_roundTable.js @@ -19,7 +19,7 @@ along with this program. If not, see . */ /* -MiniDungeon - Rabbit +MiniDungeon - Round Table */ var baseid = 240020500; var dungeonid = 240020512; @@ -27,28 +27,28 @@ var dungeons = 30; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); - return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); - return false; + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + return false; + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + return false; } else { pi.playPortalSound(); pi.warp(baseid, "MD00"); diff --git a/scripts/portal/MD_sand.js b/scripts/portal/MD_sand.js index d8e39deb72..d3d49f17b1 100644 --- a/scripts/portal/MD_sand.js +++ b/scripts/portal/MD_sand.js @@ -27,28 +27,28 @@ var dungeons = 34; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); - return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); - return false; + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + return false; + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + return false; } else { pi.playPortalSound(); pi.warp(baseid, "MD00"); diff --git a/scripts/portal/MD_treasure.js b/scripts/portal/MD_treasure.js index d51e09eba7..f4c6e4b15d 100644 --- a/scripts/portal/MD_treasure.js +++ b/scripts/portal/MD_treasure.js @@ -27,28 +27,28 @@ var dungeons = 30; function enter(pi) { if (pi.getMapId() == baseid) { - if (pi.getParty() != null) { - if (pi.isLeader()) { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warpParty(dungeonid + i); - return true; - } - } - } else { - pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); - return false; - } - } else { - for (var i = 0; i < dungeons; i++) { - if (pi.getPlayerCount(dungeonid + i) == 0) { - pi.warp(dungeonid + i); - return true; - } - } - } - pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); - return false; + if (pi.getParty() != null) { + if (pi.isLeader()) { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warpParty(dungeonid + i); + return true; + } + } + } else { + pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon."); + return false; + } + } else { + for (var i = 0; i < dungeons; i++) { + if(pi.startDungeonInstance(dungeonid + i)) { + pi.warp(dungeonid + i); + return true; + } + } + } + pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later."); + return false; } else { pi.playPortalSound(); pi.warp(baseid, "MD00"); diff --git a/scripts/portal/TD_MC_first.js b/scripts/portal/TD_MC_first.js index b9020c75ce..cccd26b8ed 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(2301) || pi.isQuestCompleted(2301) + if (pi.isQuestStarted(2300) || pi.isQuestCompleted(2300) + || pi.isQuestStarted(2301) || pi.isQuestCompleted(2301) || pi.isQuestStarted(2302) || pi.isQuestCompleted(2302) || pi.isQuestStarted(2303) || pi.isQuestCompleted(2303) || pi.isQuestStarted(2304) || pi.isQuestCompleted(2304) @@ -13,6 +14,6 @@ function enter(pi) { pi.warp(106020000, 0); return true; } - pi.playerMessage(5, "A strange force is blocking you from enetering"); + pi.playerMessage(5, "A strange force is blocking you from entering."); return false; } \ No newline at end of file diff --git a/src/client/MapleBuffStat.java b/src/client/MapleBuffStat.java index fefdb8f39d..ca743768aa 100644 --- a/src/client/MapleBuffStat.java +++ b/src/client/MapleBuffStat.java @@ -115,7 +115,7 @@ public enum MapleBuffStat { COMBO_BARRIER(0x4000000000L, true), BODY_PRESSURE(0x8000000000L, true), SMART_KNOCKBACK(0x10000000000L, true), - PYRAMID_PQ(0x20000000000L, true), + BERSERK(0x20000000000L, true), ENERGY_CHARGE(0x4000000000000L, true), DASH2(0x8000000000000L, true), // correct (speed) DASH(0x10000000000000L, true), // correct (jump) diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index c917646373..6b5019e776 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -49,6 +49,7 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.Lock; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.regex.Pattern; import net.server.PlayerBuffValueHolder; @@ -196,7 +197,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private int married; private long lastfametime, lastUsedCashItem, lastHealed, lastMesoDrop = -1, jailExpiration = -1; private transient int localmaxhp, localmaxmp, localstr, localdex, localluk, localint_, magic, watk; - private boolean hidden, canDoor = true, Berserk, hasMerchant, whiteChat = false; + private boolean hidden, canDoor = true, berserk, hasMerchant, whiteChat = false; private int linkedLevel = 0; private String linkedName = null; private boolean finishedDojoTutorial; @@ -204,6 +205,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private String chalktext; private String dataString; private String search = null; + private AtomicBoolean awayFromWorld = new AtomicBoolean(true); // player is online, but on cash shop or mts private AtomicInteger exp = new AtomicInteger(); private AtomicInteger gachaexp = new AtomicInteger(); private AtomicInteger meso = new AtomicInteger(); @@ -253,7 +255,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private Map doors = new LinkedHashMap<>(); private ScheduledFuture dragonBloodSchedule; private ScheduledFuture hpDecreaseTask; - private ScheduledFuture beholderHealingSchedule, beholderBuffSchedule, BerserkSchedule; + private ScheduledFuture beholderHealingSchedule, beholderBuffSchedule, berserkSchedule; private ScheduledFuture skillCooldownTask = null; private ScheduledFuture buffExpireTask = null; private ScheduledFuture itemExpireTask = null; @@ -411,6 +413,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { return ret; } + public boolean getAwayFromWorld() { + return awayFromWorld.get(); + } + + public void setAwayFromWorld(boolean away) { + awayFromWorld.set(away); + } + public long getPetLootCd() { return petLootCd; } @@ -1238,6 +1248,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private void changeMapInternal(final MapleMap to, final Point pos, final byte[] warpPacket) { if(!canWarpMap) return; + this.stopChairTask(); this.clearBanishPlayerData(); this.closePlayerInteractions(); this.resetPlayerAggro(); @@ -1325,21 +1336,23 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } public void checkBerserk(final boolean isHidden) { - if (BerserkSchedule != null) { - BerserkSchedule.cancel(false); + if (berserkSchedule != null) { + berserkSchedule.cancel(false); } final MapleCharacter chr = this; if (job.equals(MapleJob.DARKKNIGHT)) { Skill BerserkX = SkillFactory.getSkill(DarkKnight.BERSERK); final int skilllevel = getSkillLevel(BerserkX); if (skilllevel > 0) { - Berserk = chr.getHp() * 100 / chr.getMaxHp() < BerserkX.getEffect(skilllevel).getX(); - BerserkSchedule = TimerManager.getInstance().register(new Runnable() { + berserk = chr.getHp() * 100 / chr.getMaxHp() < BerserkX.getEffect(skilllevel).getX(); + berserkSchedule = TimerManager.getInstance().register(new Runnable() { @Override public void run() { - client.announce(MaplePacketCreator.showOwnBerserk(skilllevel, Berserk)); - if(!isHidden) getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showBerserk(getId(), skilllevel, Berserk), false); - else getMap().broadcastGMMessage(MapleCharacter.this, MaplePacketCreator.showBerserk(getId(), skilllevel, Berserk), false); + if(awayFromWorld.get()) return; + + client.announce(MaplePacketCreator.showOwnBerserk(skilllevel, berserk)); + if(!isHidden) getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showBerserk(getId(), skilllevel, berserk), false); + else getMap().broadcastGMMessage(MapleCharacter.this, MaplePacketCreator.showBerserk(getId(), skilllevel, berserk), false); } }, 5000, 3000); } @@ -2747,8 +2760,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } } - public void cancelAllBuffs(boolean disconnect) { - if (disconnect) { + public void cancelAllBuffs(boolean softcancel) { + if (softcancel) { effLock.lock(); chrLock.lock(); try { @@ -2762,33 +2775,23 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { effLock.unlock(); } } else { - List mbsvhList; - + Map mseBuffs = new LinkedHashMap<>(); + effLock.lock(); chrLock.lock(); try { - List> mbls = new LinkedList<>(); - for(Entry> bpl : buffEffects.entrySet()) { for(Entry mbse : bpl.getValue().entrySet()) { - if(effects.get(mbse.getKey()) != mbse.getValue()) { - mbls.add(new Pair<>(bpl.getKey(), mbse.getKey())); - } + mseBuffs.put(mbse.getValue().effect, mbse.getValue().startTime); } } - - for(Pair pmbs : mbls) { - removeEffectFromItemEffectHolder(pmbs.getLeft(), pmbs.getRight()); - } - - mbsvhList = new ArrayList<>(effects.values()); } finally { chrLock.unlock(); effLock.unlock(); } - - for (MapleBuffStatValueHolder mbsvh : mbsvhList) { - cancelEffect(mbsvh.effect, false, mbsvh.startTime); + + for (Entry mse : mseBuffs.entrySet()) { + cancelEffect(mse.getKey(), false, mse.getValue()); } } } @@ -3182,6 +3185,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { beholderHealingSchedule = TimerManager.getInstance().register(new Runnable() { @Override public void run() { + if(awayFromWorld.get()) return; + addHP(healEffect.getHp()); client.announce(MaplePacketCreator.showOwnBuffEffect(beholder, 2)); getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.summonSkill(getId(), beholder, 5), true); @@ -3196,6 +3201,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { beholderBuffSchedule = TimerManager.getInstance().register(new Runnable() { @Override public void run() { + if(awayFromWorld.get()) return; + buffEffect.applyTo(MapleCharacter.this); client.announce(MaplePacketCreator.showOwnBuffEffect(beholder, 2)); getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.summonSkill(getId(), beholder, (int) (Math.random() * 3) + 6), true); @@ -5713,6 +5720,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { dragonBloodSchedule = TimerManager.getInstance().register(new Runnable() { @Override public void run() { + if(awayFromWorld.get()) return; + addHP(-bloodEffect.getX()); client.announce(MaplePacketCreator.showOwnBuffEffect(bloodEffect.getSourceId(), 5)); getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showBuffeffect(getId(), bloodEffect.getSourceId(), 5), false); @@ -7771,8 +7780,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { if (beholderBuffSchedule != null) { beholderBuffSchedule.cancel(false); } - if (BerserkSchedule != null) { - BerserkSchedule.cancel(false); + if (berserkSchedule != null) { + berserkSchedule.cancel(false); } if (recoveryTask != null) { recoveryTask.cancel(false); @@ -7785,6 +7794,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { cancelDiseaseExpireTask(); cancelSkillCooldownTask(); cancelExpirationTask(); + stopChairTask(); for (ScheduledFuture sf : timers) { sf.cancel(false); diff --git a/src/client/MapleClient.java b/src/client/MapleClient.java index d3a3e4ebd4..588b982770 100644 --- a/src/client/MapleClient.java +++ b/src/client/MapleClient.java @@ -787,6 +787,7 @@ public class MapleClient { private void removePlayer() { try { + player.setAwayFromWorld(true); player.cancelAllBuffs(true); player.cancelAllDebuffs(); @@ -1290,7 +1291,12 @@ public class MapleClient { if (!player.isAlive() || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { announce(MaplePacketCreator.enableActions()); return; - } + } else if(MapleMiniDungeonInfo.isDungeonMap(player.getMapId())) { + announce(MaplePacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon.")); + announce(MaplePacketCreator.enableActions()); + return; + } + String[] socket = Server.getInstance().getIP(getWorld(), channel).split(":"); if (player.getTrade() != null) { MapleTrade.cancelTrade(getPlayer()); @@ -1305,10 +1311,12 @@ public class MapleClient { } } server.getPlayerBuffStorage().addBuffsToStorage(player.getId(), player.getAllBuffs()); + player.setAwayFromWorld(true); player.cancelAllBuffs(true); player.cancelBuffExpireTask(); player.cancelDiseaseExpireTask(); player.cancelSkillCooldownTask(); + player.stopChairTask(); //Cancelling magicdoor? Nope //Cancelling mounts? Noty if (player.getBuffedValue(MapleBuffStat.PUPPET) != null) { diff --git a/src/client/autoban/AutobanManager.java b/src/client/autoban/AutobanManager.java index 85a05dcc9e..b866695646 100644 --- a/src/client/autoban/AutobanManager.java +++ b/src/client/autoban/AutobanManager.java @@ -93,8 +93,8 @@ public class AutobanManager { * type:
* 0: HealOverTime
* 1: Pet Food
- * 2: ItemSort
- * 3: ItemIdSort
+ * 2: ItemMerge
+ * 3: ItemSort
* 4: SpecialMove
* 5: UseCatchItem
* 6: Item Drop
diff --git a/src/client/inventory/MapleInventory.java b/src/client/inventory/MapleInventory.java index e334b76157..c4e30c1bb3 100644 --- a/src/client/inventory/MapleInventory.java +++ b/src/client/inventory/MapleInventory.java @@ -212,10 +212,9 @@ public class MapleInventory implements Iterable { inventory.put(dSlot, source); inventory.remove(sSlot); } else if (target.getItemId() == source.getItemId() && !ItemConstants.isRechargable(source.getItemId())) { - if (type.getType() == MapleInventoryType.EQUIP.getType()) { + if (type.getType() == MapleInventoryType.EQUIP.getType() || type.getType() == MapleInventoryType.CASH.getType()) { swap(target, source); - } - if (source.getQuantity() + target.getQuantity() > slotMax) { + } else if (source.getQuantity() + target.getQuantity() > slotMax) { short rest = (short) ((source.getQuantity() + target.getQuantity()) - slotMax); source.setQuantity(rest); target.setQuantity(slotMax); diff --git a/src/net/PacketProcessor.java b/src/net/PacketProcessor.java index d3eab38f7b..d088e3cbd3 100644 --- a/src/net/PacketProcessor.java +++ b/src/net/PacketProcessor.java @@ -132,7 +132,7 @@ public final class PacketProcessor { registerHandler(RecvOpcode.NPC_TALK_MORE, new NPCMoreTalkHandler()); registerHandler(RecvOpcode.QUEST_ACTION, new QuestActionHandler()); registerHandler(RecvOpcode.NPC_SHOP, new NPCShopHandler()); - registerHandler(RecvOpcode.ITEM_SORT, new ItemSortHandler()); + registerHandler(RecvOpcode.ITEM_SORT, new InventoryMergeHandler()); registerHandler(RecvOpcode.ITEM_MOVE, new ItemMoveHandler()); registerHandler(RecvOpcode.MESO_DROP, new MesoDropHandler()); registerHandler(RecvOpcode.PLAYER_LOGGEDIN, new PlayerLoggedinHandler()); @@ -237,7 +237,7 @@ public final class PacketProcessor { registerHandler(RecvOpcode.MOB_DAMAGE_MOB_FRIENDLY, new MobDamageMobFriendlyHandler()); registerHandler(RecvOpcode.PARTY_SEARCH_REGISTER, new PartySearchRegisterHandler()); registerHandler(RecvOpcode.PARTY_SEARCH_START, new PartySearchStartHandler()); - registerHandler(RecvOpcode.ITEM_SORT2, new ItemIdSortHandler()); + registerHandler(RecvOpcode.ITEM_SORT2, new InventorySortHandler()); registerHandler(RecvOpcode.LEFT_KNOCKBACK, new LeftKnockbackHandler()); registerHandler(RecvOpcode.SNOWBALL, new SnowballHandler()); registerHandler(RecvOpcode.COCONUT, new CoconutHandler()); diff --git a/src/net/server/channel/Channel.java b/src/net/server/channel/Channel.java index 1c13eb0cf3..238b3ca354 100644 --- a/src/net/server/channel/Channel.java +++ b/src/net/server/channel/Channel.java @@ -32,6 +32,8 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; @@ -60,9 +62,11 @@ import server.expeditions.MapleExpeditionType; import server.maps.MapleHiredMerchant; import server.maps.MapleMap; import server.maps.MapleMapFactory; +import server.maps.MapleMiniDungeon; import tools.MaplePacketCreator; import client.MapleCharacter; import constants.ServerConstants; +import server.maps.MapleMiniDungeonInfo; public final class Channel { @@ -75,9 +79,6 @@ public final class Channel { private EventScriptManager eventSM; private Map hiredMerchants = new HashMap<>(); private final Map storedVars = new HashMap<>(); - private ReentrantReadWriteLock merchant_lock = new ReentrantReadWriteLock(true); - private ReadLock merchRlock = merchant_lock.readLock(); - private WriteLock merchWlock = merchant_lock.writeLock(); private List expeditions = new ArrayList<>(); private List expedType = new ArrayList<>(); private MapleEvent event; @@ -87,6 +88,13 @@ public final class Channel { private long[] dojoFinishTime; private ScheduledFuture[] dojoTask; private Map dojoParty = new HashMap<>(); + private Map dungeons = new HashMap<>(); + + private ReentrantReadWriteLock merchant_lock = new ReentrantReadWriteLock(true); + private ReadLock merchRlock = merchant_lock.readLock(); + private WriteLock merchWlock = merchant_lock.writeLock(); + + private Lock lock = new ReentrantLock(); public Channel(final int world, final int channel) { this.world = world; @@ -485,4 +493,37 @@ public final class Channel { public long getDojoFinishTime(int dojoMapId) { return dojoFinishTime[getDojoSlot(dojoMapId)]; } + + public boolean addMiniDungeon(int dungeonid) { + lock.lock(); + try { + if(dungeons.containsKey(dungeonid)) return false; + + MapleMiniDungeonInfo mmdi = MapleMiniDungeonInfo.getDungeon(dungeonid); + MapleMiniDungeon mmd = new MapleMiniDungeon(mmdi.getBase(), 30); // all minidungeons timeouts on 30 mins + + dungeons.put(dungeonid, mmd); + return true; + } finally { + lock.unlock(); + } + } + + public MapleMiniDungeon getMiniDungeon(int dungeonid) { + lock.lock(); + try { + return dungeons.get(dungeonid); + } finally { + lock.unlock(); + } + } + + public void removeMiniDungeon(int dungeonid) { + lock.lock(); + try { + dungeons.remove(dungeonid); + } finally { + lock.unlock(); + } + } } \ No newline at end of file diff --git a/src/net/server/channel/handlers/DoorHandler.java b/src/net/server/channel/handlers/DoorHandler.java index 66f918d288..c72907d663 100644 --- a/src/net/server/channel/handlers/DoorHandler.java +++ b/src/net/server/channel/handlers/DoorHandler.java @@ -30,7 +30,6 @@ import tools.data.input.SeekableLittleEndianAccessor; /** * * @author Matze - * @author Ronan */ public final class DoorHandler extends AbstractMaplePacketHandler { @Override diff --git a/src/net/server/channel/handlers/EnterCashShopHandler.java b/src/net/server/channel/handlers/EnterCashShopHandler.java index fac2f949c0..61ebe9dd46 100644 --- a/src/net/server/channel/handlers/EnterCashShopHandler.java +++ b/src/net/server/channel/handlers/EnterCashShopHandler.java @@ -25,6 +25,7 @@ import client.MapleCharacter; import client.MapleClient; import net.AbstractMaplePacketHandler; import net.server.Server; +import server.maps.MapleMiniDungeonInfo; import tools.MaplePacketCreator; import tools.data.input.SeekableLittleEndianAccessor; @@ -41,6 +42,13 @@ public class EnterCashShopHandler extends AbstractMaplePacketHandler { if (mc.cannotEnterCashShop()) { c.announce(MaplePacketCreator.enableActions()); return; + + } + + if(MapleMiniDungeonInfo.isDungeonMap(c.getPlayer().getMapId())) { + c.announce(MaplePacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon.")); + c.announce(MaplePacketCreator.enableActions()); + return; } if (mc.getCashShop().isOpened()) { @@ -50,11 +58,13 @@ public class EnterCashShopHandler extends AbstractMaplePacketHandler { mc.closePlayerInteractions(); Server.getInstance().getPlayerBuffStorage().addBuffsToStorage(mc.getId(), mc.getAllBuffs()); + mc.setAwayFromWorld(true); mc.cancelAllBuffs(true); mc.cancelBuffExpireTask(); mc.cancelDiseaseExpireTask(); mc.cancelSkillCooldownTask(); mc.cancelExpirationTask(); + mc.stopChairTask(); c.announce(MaplePacketCreator.openCashShop(c, false)); c.announce(MaplePacketCreator.showCashInventory(c)); diff --git a/src/net/server/channel/handlers/EnterMTSHandler.java b/src/net/server/channel/handlers/EnterMTSHandler.java index ba448f6093..188860ddf6 100644 --- a/src/net/server/channel/handlers/EnterMTSHandler.java +++ b/src/net/server/channel/handlers/EnterMTSHandler.java @@ -36,6 +36,7 @@ import constants.ServerConstants; import net.AbstractMaplePacketHandler; import net.server.Server; import server.MTSItemInfo; +import server.maps.MapleMiniDungeonInfo; import tools.DatabaseConnection; import tools.MaplePacketCreator; import tools.data.input.SeekableLittleEndianAccessor; @@ -47,6 +48,13 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler { c.announce(MaplePacketCreator.enableActions()); return; } + + if(MapleMiniDungeonInfo.isDungeonMap(c.getPlayer().getMapId())) { + c.announce(MaplePacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon.")); + c.announce(MaplePacketCreator.enableActions()); + return; + } + MapleCharacter chr = c.getPlayer(); if (!chr.isAlive()) { c.announce(MaplePacketCreator.enableActions()); @@ -59,11 +67,14 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler { } Server.getInstance().getPlayerBuffStorage().addBuffsToStorage(chr.getId(), chr.getAllBuffs()); + chr.setAwayFromWorld(true); chr.cancelAllBuffs(true); chr.cancelBuffExpireTask(); chr.cancelDiseaseExpireTask(); chr.cancelSkillCooldownTask(); chr.cancelExpirationTask(); + chr.stopChairTask(); + chr.saveToDB(); chr.getMap().removePlayer(c.getPlayer()); try { diff --git a/src/net/server/channel/handlers/ItemSortHandler.java b/src/net/server/channel/handlers/InventoryMergeHandler.java similarity index 97% rename from src/net/server/channel/handlers/ItemSortHandler.java rename to src/net/server/channel/handlers/InventoryMergeHandler.java index b8902553f8..92ffad463b 100644 --- a/src/net/server/channel/handlers/ItemSortHandler.java +++ b/src/net/server/channel/handlers/InventoryMergeHandler.java @@ -33,7 +33,7 @@ import client.inventory.MapleInventory; import client.inventory.MapleInventoryType; import server.MapleItemInformationProvider; -public final class ItemSortHandler extends AbstractMaplePacketHandler { +public final class InventoryMergeHandler extends AbstractMaplePacketHandler { @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { @@ -67,7 +67,7 @@ public final class ItemSortHandler extends AbstractMaplePacketHandler { MapleInventoryManipulator.move(c, inventoryType, src, dst); } } - + //------------------------------------------------------------ inventory = c.getPlayer().getInventory(inventoryType); diff --git a/src/net/server/channel/handlers/ItemIdSortHandler.java b/src/net/server/channel/handlers/InventorySortHandler.java similarity index 98% rename from src/net/server/channel/handlers/ItemIdSortHandler.java rename to src/net/server/channel/handlers/InventorySortHandler.java index af7fa6c747..ac7601feec 100644 --- a/src/net/server/channel/handlers/ItemIdSortHandler.java +++ b/src/net/server/channel/handlers/InventorySortHandler.java @@ -183,7 +183,7 @@ class PairedQuicksort { } } -public final class ItemIdSortHandler extends AbstractMaplePacketHandler { +public final class InventorySortHandler extends AbstractMaplePacketHandler { @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { MapleCharacter chr = c.getPlayer(); diff --git a/src/net/server/channel/handlers/PartySearchStartHandler.java b/src/net/server/channel/handlers/PartySearchStartHandler.java index 08f0c5d4b1..c75f083c0e 100644 --- a/src/net/server/channel/handlers/PartySearchStartHandler.java +++ b/src/net/server/channel/handlers/PartySearchStartHandler.java @@ -33,6 +33,9 @@ import client.MapleCharacter; import client.MapleClient; import client.MapleJob; import constants.ServerConstants; +import net.server.world.MaplePartyCharacter; +import net.server.world.PartyOperation; +import net.server.world.World; /** * @@ -40,40 +43,41 @@ import constants.ServerConstants; * @author BubblesDev */ public class PartySearchStartHandler extends AbstractMaplePacketHandler { + @Override public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { if(!ServerConstants.USE_PARTY_SEARCH){ return; } + int min = slea.readInt(); int max = slea.readInt(); slea.readInt(); // members int jobs = slea.readInt(); + + MapleParty party = c.getPlayer().getParty(); + if(party == null) return; + MapleCharacter chr = c.getPlayer(); MapleMap map = chr.getMap(); + World world = c.getWorldServer(); + Collection mapobjs = map.getPlayers(); + for (MapleMapObject mapobj : mapobjs) { - if (chr.getParty().getMembers().size() > 5) { + if (party.getMembers().size() > 5) { break; } if (mapobj instanceof MapleCharacter) { MapleCharacter tchar = (MapleCharacter) mapobj; int charlvl = tchar.getLevel(); if (charlvl >= min && charlvl <= max && isValidJob(tchar.getJob(), jobs)) { - if (c.getPlayer().getParty() == null) { - //WorldChannelInterface wci = c.getChannelServer().getWorldInterface(); - MapleParty party = c.getPlayer().getParty(); - //int partyid = party.getId(); - //party = null;//.getParty(partyid); - if (party != null) { - if (party.getMembers().size() < 6) { - //MaplePartyCharacter partyplayer = tchar.getMPC(); - //wci.updateParty(party.getId(), PartyOperation.JOIN, partyplayer); - c.getPlayer().receivePartyMemberHP(); - c.getPlayer().updatePartyMemberHP(); - } else { - c.announce(MaplePacketCreator.partyStatusMessage(17)); - } - } + if (tchar.getParty() == null) { + MaplePartyCharacter partyplayer = new MaplePartyCharacter(tchar); + tchar.getMap().addPartyMember(tchar); + + world.updateParty(party.getId(), PartyOperation.JOIN, partyplayer); + tchar.receivePartyMemberHP(); + tchar.updatePartyMemberHP(); } } } diff --git a/src/net/server/channel/handlers/PlayerLoggedinHandler.java b/src/net/server/channel/handlers/PlayerLoggedinHandler.java index 40aac49275..bf6759745e 100644 --- a/src/net/server/channel/handlers/PlayerLoggedinHandler.java +++ b/src/net/server/channel/handlers/PlayerLoggedinHandler.java @@ -172,6 +172,8 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler { player.getMap().addPlayer(player); World world = server.getWorld(c.getWorld()); world.getPlayerStorage().addPlayer(player); + + player.setAwayFromWorld(false); int buddyIds[] = player.getBuddylist().getBuddyIds(); world.loggedOn(player.getName(), player.getId(), c.getChannel(), buddyIds); diff --git a/src/scripting/AbstractPlayerInteraction.java b/src/scripting/AbstractPlayerInteraction.java index 4d09583236..39a960afee 100644 --- a/src/scripting/AbstractPlayerInteraction.java +++ b/src/scripting/AbstractPlayerInteraction.java @@ -46,6 +46,7 @@ import server.life.MobSkillFactory; import server.maps.MapleMap; import server.maps.MapleMapObject; import server.maps.MapleMapObjectType; +import server.maps.MapleMiniDungeon; import server.partyquest.PartyQuest; import server.partyquest.Pyramid; import server.quest.MapleQuest; @@ -922,4 +923,7 @@ public class AbstractPlayerInteraction { return list; } + public boolean startDungeonInstance(int dungeonid) { + return c.getChannelServer().addMiniDungeon(dungeonid); + } } diff --git a/src/scripting/event/EventInstanceManager.java b/src/scripting/event/EventInstanceManager.java index d71297cd5c..a8b846027f 100644 --- a/src/scripting/event/EventInstanceManager.java +++ b/src/scripting/event/EventInstanceManager.java @@ -282,6 +282,7 @@ public class EventInstanceManager { } event_schedule = TimerManager.getInstance().schedule(new Runnable() { + @Override public void run() { try { dismissEventTimer(); diff --git a/src/server/MapleInventoryManipulator.java b/src/server/MapleInventoryManipulator.java index a5d13dfe19..8be55f8cc3 100644 --- a/src/server/MapleInventoryManipulator.java +++ b/src/server/MapleInventoryManipulator.java @@ -355,15 +355,18 @@ public class MapleInventoryManipulator { public static void move(MapleClient c, MapleInventoryType type, short src, short dst) { if (src < 0 || dst < 0) { + System.out.println("src " + src + " dst " + dst); + return; + } + if(dst > c.getPlayer().getInventory(type).getSlotLimit()) { + System.out.println("slim " + c.getPlayer().getInventory(type).getSlotLimit() + " dst " + dst); return; } - if(dst > c.getPlayer().getInventory(type).getSlotLimit()) { - return; - } MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); Item source = c.getPlayer().getInventory(type).getItem(src); Item initialTarget = c.getPlayer().getInventory(type).getItem(dst); if (source == null) { + System.out.println("null"); return; } short olddstQ = -1; @@ -374,7 +377,7 @@ public class MapleInventoryManipulator { short slotMax = ii.getSlotMax(c, source.getItemId()); c.getPlayer().getInventory(type).move(src, dst, slotMax); final List mods = new ArrayList<>(); - if (!type.equals(MapleInventoryType.EQUIP) && initialTarget != null && initialTarget.getItemId() == source.getItemId() && !ItemConstants.isRechargable(source.getItemId())) { + if (!(type.equals(MapleInventoryType.EQUIP) || type.equals(MapleInventoryType.CASH)) && initialTarget != null && initialTarget.getItemId() == source.getItemId() && !ItemConstants.isRechargable(source.getItemId())) { if ((olddstQ + oldsrcQ) > slotMax) { mods.add(new ModifyInventory(1, source)); mods.add(new ModifyInventory(1, initialTarget)); diff --git a/src/server/MapleStatEffect.java b/src/server/MapleStatEffect.java index d666589d5e..b994f095a3 100644 --- a/src/server/MapleStatEffect.java +++ b/src/server/MapleStatEffect.java @@ -202,14 +202,6 @@ public class MapleStatEffect { ret.speed = (short) MapleDataTool.getInt("speed", source, 0); ret.jump = (short) MapleDataTool.getInt("jump", source, 0); - if((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) { - ret.jump = (short)(ret.speed * 4); - ret.speed *= 15; - } - - ret.berserk = MapleDataTool.getInt("berserk", source, 0); - ret.booster = MapleDataTool.getInt("booster", source, 0); - ret.mapProtection = mapProtection(sourceid); addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_PROTECTION, Integer.valueOf(ret.mapProtection)); @@ -222,11 +214,16 @@ public class MapleStatEffect { addBuffStatPairToListIfNotZero(statups, MapleBuffStat.AVOID, Integer.valueOf(ret.avoid)); addBuffStatPairToListIfNotZero(statups, MapleBuffStat.SPEED, Integer.valueOf(ret.speed)); addBuffStatPairToListIfNotZero(statups, MapleBuffStat.JUMP, Integer.valueOf(ret.jump)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.PYRAMID_PQ, Integer.valueOf(ret.berserk)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BOOSTER, Integer.valueOf(ret.booster)); if(!skill) { - if(isDojoBuff(sourceid) || sourceid == 2022337) { + if(isPyramidBuff(sourceid)) { + ret.berserk = MapleDataTool.getInt("berserk", source, 0); + ret.booster = MapleDataTool.getInt("booster", source, 0); + + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BERSERK, Integer.valueOf(ret.berserk)); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BOOSTER, Integer.valueOf(ret.booster)); + + } else if(isDojoBuff(sourceid) || sourceid == 2022337) { ret.mhpR = (byte) MapleDataTool.getInt("mhpR", source, 0); ret.mhpRRate = (short) (MapleDataTool.getInt("mhpRRate", source, 0) * 100); ret.mmpR = (byte) MapleDataTool.getInt("mmpR", source, 0); @@ -268,6 +265,11 @@ public class MapleStatEffect { break; } } + } else { + if((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) { + ret.jump = (short)(ret.speed * 4); + ret.speed *= 15; + } } } MapleData ltd = source.getChildByPath("lt"); @@ -1328,11 +1330,15 @@ public class MapleStatEffect { return sourceid >= 2022359 && sourceid <= 2022421; } + public static boolean isPyramidBuff(int sourceid) { + return sourceid >= 2022585 && sourceid <= 2022617; + } + public static boolean isRateCoupon(int sourceid) { int itemType = sourceid / 1000; return itemType == 5211 || itemType == 5360; } - + private boolean isDs() { return skill && (sourceid == Rogue.DARK_SIGHT || sourceid == WindArcher.WIND_WALK || sourceid == NightWalker.DARK_SIGHT); } diff --git a/src/server/maps/MapleMap.java b/src/server/maps/MapleMap.java index 39c31f1800..459ae53ba2 100644 --- a/src/server/maps/MapleMap.java +++ b/src/server/maps/MapleMap.java @@ -1979,19 +1979,11 @@ public class MapleMap { if (chr.getEventInstance() != null) { chr.getEventInstance().movePlayer(chr); } - } else if (MapleMiniDungeon.isDungeonMap(mapid)) { - final MapleMiniDungeon dungeon = MapleMiniDungeon.getDungeon(mapid); - chr.getClient().announce(MaplePacketCreator.getClock(30 * 60)); - TimerManager.getInstance().schedule(new Runnable() { - - @Override - public void run() { - if (MapleMiniDungeon.isDungeonMap(chr.getMapId())) { - chr.changeMap(dungeon.getBase()); - } - } - }, 30 * 60 * 1000); + } else if (MapleMiniDungeonInfo.isDungeonMap(mapid)) { + MapleMiniDungeon mmd = chr.getClient().getChannelServer().getMiniDungeon(mapid); + if(mmd != null) mmd.registerPlayer(chr); } + MaplePet[] pets = chr.getPets(); for (int i = 0; i < pets.length; i++) { if (pets[i] != null) { @@ -2152,6 +2144,16 @@ public class MapleMap { } finally { chrWLock.unlock(); } + + if (MapleMiniDungeonInfo.isDungeonMap(mapid)) { + MapleMiniDungeon mmd = chr.getClient().getChannelServer().getMiniDungeon(mapid); + if(mmd != null) { + if(!mmd.unregisterPlayer(chr)) { + chr.getClient().getChannelServer().removeMiniDungeon(mapid); + } + } + } + removeMapObject(chr.getObjectId()); if (!chr.isHidden()) { broadcastMessage(MaplePacketCreator.removePlayerFromMap(chr.getId())); diff --git a/src/server/maps/MapleMiniDungeon.java b/src/server/maps/MapleMiniDungeon.java index 1acdc3a94a..5d39376c65 100644 --- a/src/server/maps/MapleMiniDungeon.java +++ b/src/server/maps/MapleMiniDungeon.java @@ -1,86 +1,102 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ package server.maps; -/* - 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 . - */ +import server.TimerManager; +import client.MapleCharacter; +import java.util.List; +import java.util.ArrayList; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import tools.MaplePacketCreator; /** * - * @author SharpAceX(Alan) + * @author Ronan */ - -public enum MapleMiniDungeon { - - //http://bbb.hidden-street.net/search_finder/mini%20dungeon - - CAVE_OF_MUSHROOMS(105050100, 105050101, 30), - GOLEM_CASTLE_RUINS(105040304, 105040320, 34), - HILL_OF_SANDSTORMS(260020600, 260020630, 30), - HENESYS_PIG_FARM(100020000, 100020100, 30), - DRAKES_BLUE_CAVE(105090311, 105090320, 30), - DRUMMER_BUNNYS_LAIR(221023400, 221023401, 30), - THE_ROUND_TABLE_OF_KENTARUS(240020500, 240020512, 30), - THE_RESTORING_MEMORY(240040511, 240040800, 19), - NEWT_SECURED_ZONE(240040520, 240040900, 19), - PILLAGE_OF_TREASURE_ISLAND(251010402, 251010410, 30), - LONGEST_RIDE_ON_BYEBYE_STATION(551030000, 551030001, 19); - - private int baseId; - private int dungeonId; - private int dungeons; - - private MapleMiniDungeon(int baseId, int dungeonId, int dungeons) { - this.baseId = baseId; - this.dungeonId = dungeonId; - this.dungeons = dungeons; - } - - public int getBase() { - return baseId; - } - - public int getDungeonId() { - return dungeonId; - } - - public int getDungeons() { - return dungeons; - } - - public static boolean isDungeonMap(int map){ - for (MapleMiniDungeon dungeon : MapleMiniDungeon.values()){ - if (map >= dungeon.getDungeonId() && map <= dungeon.getDungeonId() + dungeon.getDungeons()){ - return true; - } - } - return false; - } - - public static MapleMiniDungeon getDungeon(int map){ - for (MapleMiniDungeon dungeon : MapleMiniDungeon.values()){ - if (map >= dungeon.getDungeonId() && map <= dungeon.getDungeonId() + dungeon.getDungeons()){ - return dungeon; - } - } - return null; - } +public class MapleMiniDungeon { + List players = new ArrayList<>(); + ScheduledFuture timeoutTask = null; + Lock lock = new ReentrantLock(); + + int baseMap; + long expireTime; + + public MapleMiniDungeon(int base, int durationMin) { + baseMap = base; + expireTime = durationMin * 60 * 1000; + + timeoutTask = TimerManager.getInstance().schedule(new Runnable() { + @Override + public void run() { + lock.lock(); + try { + List lchr = new ArrayList<>(players); + + for(MapleCharacter chr : lchr) { + chr.changeMap(baseMap); + } + + dispose(); + } finally { + lock.unlock(); + } + } + }, expireTime); + + expireTime += System.currentTimeMillis(); + } + + public boolean registerPlayer(MapleCharacter chr) { + int time = (int)((expireTime - System.currentTimeMillis()) / 1000); + if(time > 0) chr.getClient().announce(MaplePacketCreator.getClock(time)); + + lock.lock(); + try { + if(timeoutTask == null) return false; + + players.add(chr); + } finally { + lock.unlock(); + } + + return true; + } + + public boolean unregisterPlayer(MapleCharacter chr) { + chr.getClient().announce(MaplePacketCreator.removeClock()); + + lock.lock(); + try { + players.remove(chr); + + if(players.isEmpty()) { + dispose(); + return false; + } + + return true; + } finally { + lock.unlock(); + } + } + + public void dispose() { + lock.lock(); + try { + players.clear(); + + if(timeoutTask != null) { + timeoutTask.cancel(false); + timeoutTask = null; + } + } finally { + lock.unlock(); + } + } } diff --git a/src/server/maps/MapleMiniDungeonInfo.java b/src/server/maps/MapleMiniDungeonInfo.java new file mode 100644 index 0000000000..7e59af9b2d --- /dev/null +++ b/src/server/maps/MapleMiniDungeonInfo.java @@ -0,0 +1,86 @@ +package server.maps; + +/* + 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 SharpAceX(Alan) + */ + +public enum MapleMiniDungeonInfo { + + //http://bbb.hidden-street.net/search_finder/mini%20dungeon + + CAVE_OF_MUSHROOMS(105050100, 105050101, 30), + GOLEM_CASTLE_RUINS(105040304, 105040320, 34), + HILL_OF_SANDSTORMS(260020600, 260020630, 30), + HENESYS_PIG_FARM(100020000, 100020100, 30), + DRAKES_BLUE_CAVE(105090311, 105090320, 30), + DRUMMER_BUNNYS_LAIR(221023400, 221023401, 30), + THE_ROUND_TABLE_OF_KENTARUS(240020500, 240020512, 30), + THE_RESTORING_MEMORY(240040511, 240040800, 19), + NEWT_SECURED_ZONE(240040520, 240040900, 19), + PILLAGE_OF_TREASURE_ISLAND(251010402, 251010410, 30), + LONGEST_RIDE_ON_BYEBYE_STATION(551030000, 551030001, 19); + + private int baseId; + private int dungeonId; + private int dungeons; + + private MapleMiniDungeonInfo(int baseId, int dungeonId, int dungeons) { + this.baseId = baseId; + this.dungeonId = dungeonId; + this.dungeons = dungeons; + } + + public int getBase() { + return baseId; + } + + public int getDungeonId() { + return dungeonId; + } + + public int getDungeons() { + return dungeons; + } + + public static boolean isDungeonMap(int map){ + for (MapleMiniDungeonInfo dungeon : MapleMiniDungeonInfo.values()){ + if (map >= dungeon.getDungeonId() && map <= dungeon.getDungeonId() + dungeon.getDungeons()){ + return true; + } + } + return false; + } + + public static MapleMiniDungeonInfo getDungeon(int map){ + for (MapleMiniDungeonInfo dungeon : MapleMiniDungeonInfo.values()){ + if (map >= dungeon.getDungeonId() && map <= dungeon.getDungeonId() + dungeon.getDungeons()){ + return dungeon; + } + } + return null; + } +}