Rename and clean up MapleMiniDungeonInfo
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
84
src/main/java/server/maps/MiniDungeonInfo.java
Normal file
84
src/main/java/server/maps/MiniDungeonInfo.java
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user