diff --git a/src/main/java/client/Client.java b/src/main/java/client/Client.java index 6277f64422..97542ef771 100644 --- a/src/main/java/client/Client.java +++ b/src/main/java/client/Client.java @@ -61,7 +61,7 @@ import server.TimerManager; import server.life.Monster; import server.maps.FieldLimit; import server.maps.MapleMap; -import server.maps.MapleMiniDungeonInfo; +import server.maps.MiniDungeonInfo; import tools.*; import javax.script.ScriptEngine; @@ -1460,7 +1460,7 @@ public class Client extends ChannelInboundHandlerAdapter { if (!player.isAlive() || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { sendPacket(PacketCreator.enableActions()); return; - } else if (MapleMiniDungeonInfo.isDungeonMap(player.getMapId())) { + } else if (MiniDungeonInfo.isDungeonMap(player.getMapId())) { sendPacket(PacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon.")); sendPacket(PacketCreator.enableActions()); return; diff --git a/src/main/java/client/command/commands/gm1/GotoCommand.java b/src/main/java/client/command/commands/gm1/GotoCommand.java index d3445771ab..9ca9308cbc 100644 --- a/src/main/java/client/command/commands/gm1/GotoCommand.java +++ b/src/main/java/client/command/commands/gm1/GotoCommand.java @@ -90,7 +90,7 @@ public class GotoCommand extends Command { } if (!player.isGM()) { - if (player.getEventInstance() != null || MapleMiniDungeonInfo.isDungeonMap(player.getMapId()) || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { + if (player.getEventInstance() != null || MiniDungeonInfo.isDungeonMap(player.getMapId()) || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { player.dropMessage(1, "This command can not be used in this map."); return; } diff --git a/src/main/java/client/command/commands/gm2/WarpCommand.java b/src/main/java/client/command/commands/gm2/WarpCommand.java index b579b6c9a4..423da33013 100644 --- a/src/main/java/client/command/commands/gm2/WarpCommand.java +++ b/src/main/java/client/command/commands/gm2/WarpCommand.java @@ -28,7 +28,7 @@ import client.Client; import client.command.Command; import server.maps.FieldLimit; import server.maps.MapleMap; -import server.maps.MapleMiniDungeonInfo; +import server.maps.MiniDungeonInfo; public class WarpCommand extends Command { { @@ -56,7 +56,7 @@ public class WarpCommand extends Command { } if (!player.isGM()) { - if (player.getEventInstance() != null || MapleMiniDungeonInfo.isDungeonMap(player.getMapId()) || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { + if (player.getEventInstance() != null || MiniDungeonInfo.isDungeonMap(player.getMapId()) || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) { player.dropMessage(1, "This command cannot be used in this map."); return; } diff --git a/src/main/java/net/server/channel/Channel.java b/src/main/java/net/server/channel/Channel.java index 22df3ccff9..9ee4d7eaa2 100644 --- a/src/main/java/net/server/channel/Channel.java +++ b/src/main/java/net/server/channel/Channel.java @@ -658,7 +658,7 @@ public final class Channel { try { if(dungeons.containsKey(dungeonid)) return false; - MapleMiniDungeonInfo mmdi = MapleMiniDungeonInfo.getDungeon(dungeonid); + MiniDungeonInfo mmdi = MiniDungeonInfo.getDungeon(dungeonid); MiniDungeon mmd = new MiniDungeon(mmdi.getBase(), this.getMapFactory().getMap(mmdi.getDungeonId()).getTimeLimit()); // thanks Conrad for noticing hardcoded time limit for minidungeons dungeons.put(dungeonid, mmd); diff --git a/src/main/java/net/server/channel/handlers/EnterCashShopHandler.java b/src/main/java/net/server/channel/handlers/EnterCashShopHandler.java index 451695b2e1..127baed6d8 100644 --- a/src/main/java/net/server/channel/handlers/EnterCashShopHandler.java +++ b/src/main/java/net/server/channel/handlers/EnterCashShopHandler.java @@ -26,7 +26,7 @@ import client.Client; import net.AbstractPacketHandler; import net.packet.InPacket; import net.server.Server; -import server.maps.MapleMiniDungeonInfo; +import server.maps.MiniDungeonInfo; import tools.PacketCreator; /** @@ -50,7 +50,7 @@ public class EnterCashShopHandler extends AbstractPacketHandler { return; } - if(MapleMiniDungeonInfo.isDungeonMap(mc.getMapId())) { + if(MiniDungeonInfo.isDungeonMap(mc.getMapId())) { c.sendPacket(PacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon.")); c.sendPacket(PacketCreator.enableActions()); return; diff --git a/src/main/java/net/server/channel/handlers/EnterMTSHandler.java b/src/main/java/net/server/channel/handlers/EnterMTSHandler.java index 6a9283fdb9..159c88fa8e 100644 --- a/src/main/java/net/server/channel/handlers/EnterMTSHandler.java +++ b/src/main/java/net/server/channel/handlers/EnterMTSHandler.java @@ -32,7 +32,7 @@ import net.packet.InPacket; import net.server.Server; import server.MTSItemInfo; import server.maps.FieldLimit; -import server.maps.MapleMiniDungeonInfo; +import server.maps.MiniDungeonInfo; import tools.DatabaseConnection; import tools.PacketCreator; @@ -64,7 +64,7 @@ public final class EnterMTSHandler extends AbstractPacketHandler { return; } - if(MapleMiniDungeonInfo.isDungeonMap(chr.getMapId())) { + if(MiniDungeonInfo.isDungeonMap(chr.getMapId())) { c.sendPacket(PacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon.")); c.sendPacket(PacketCreator.enableActions()); return; diff --git a/src/main/java/net/server/world/World.java b/src/main/java/net/server/world/World.java index 2fb2444feb..e46d7c8152 100644 --- a/src/main/java/net/server/world/World.java +++ b/src/main/java/net/server/world/World.java @@ -960,7 +960,7 @@ public class World { } else { int oldLeaderMapid = mc.getMapId(); - if (MapleMiniDungeonInfo.isDungeonMap(oldLeaderMapid)) { + if (MiniDungeonInfo.isDungeonMap(oldLeaderMapid)) { if (oldLeaderMapid != target.getMapId()) { MiniDungeon mmd = mc.getClient().getChannelServer().getMiniDungeon(oldLeaderMapid); if(mmd != null) { diff --git a/src/main/java/server/maps/MapleMap.java b/src/main/java/server/maps/MapleMap.java index d06f36ffdd..cac95e97d2 100644 --- a/src/main/java/server/maps/MapleMap.java +++ b/src/main/java/server/maps/MapleMap.java @@ -2443,7 +2443,7 @@ public class MapleMap { chr.changeMap(130000210, 0); } }, travelTime); - } else if (MapleMiniDungeonInfo.isDungeonMap(mapid)) { + } else if (MiniDungeonInfo.isDungeonMap(mapid)) { MiniDungeon mmd = chr.getClient().getChannelServer().getMiniDungeon(mapid); if (mmd != null) { mmd.registerPlayer(chr); @@ -2681,7 +2681,7 @@ public class MapleMap { chrWLock.unlock(); } - if (MapleMiniDungeonInfo.isDungeonMap(mapid)) { + if (MiniDungeonInfo.isDungeonMap(mapid)) { MiniDungeon mmd = cserv.getMiniDungeon(mapid); if (mmd != null) { if (!mmd.unregisterPlayer(chr)) { diff --git a/src/main/java/server/maps/MapleMiniDungeonInfo.java b/src/main/java/server/maps/MapleMiniDungeonInfo.java deleted file mode 100644 index 853a038c1e..0000000000 --- a/src/main/java/server/maps/MapleMiniDungeonInfo.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - */ -package server.maps; - -/** - * - * @author Alan (SharpAceX) - */ - -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), - CRITICAL_ERROR(261020300, 261020301, 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; - } -} diff --git a/src/main/java/server/maps/MiniDungeonInfo.java b/src/main/java/server/maps/MiniDungeonInfo.java new file mode 100644 index 0000000000..7c1f36a12f --- /dev/null +++ b/src/main/java/server/maps/MiniDungeonInfo.java @@ -0,0 +1,84 @@ +/* + 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 . + */ +package server.maps; + +/** + * @author Alan (SharpAceX) + */ + +public enum MiniDungeonInfo { + + //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), + CRITICAL_ERROR(261020300, 261020301, 30), + LONGEST_RIDE_ON_BYEBYE_STATION(551030000, 551030001, 19); + + private final int baseId; + private final int dungeonId; + private final int dungeons; + + MiniDungeonInfo(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 (MiniDungeonInfo dungeon : MiniDungeonInfo.values()) { + if (map >= dungeon.getDungeonId() && map <= dungeon.getDungeonId() + dungeon.getDungeons()) { + return true; + } + } + return false; + } + + public static MiniDungeonInfo getDungeon(int map) { + for (MiniDungeonInfo dungeon : MiniDungeonInfo.values()) { + if (map >= dungeon.getDungeonId() && map <= dungeon.getDungeonId() + dungeon.getDungeons()) { + return dungeon; + } + } + return null; + } +}