Turn map id magic numbers into constants

This commit is contained in:
P0nk
2021-11-07 14:26:34 +01:00
parent c022c3595f
commit b15a7e61d4
51 changed files with 615 additions and 341 deletions

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm0;
import client.Character;
import client.Client;
import client.command.Command;
import constants.id.MapId;
import server.events.gm.Event;
import server.maps.FieldLimit;
@@ -44,7 +45,7 @@ public class JoinEventCommand extends Command {
if (event.getLimit() > 0) {
player.saveLocation("EVENT");
if (event.getMapId() == 109080000 || event.getMapId() == 109060001) {
if (event.getMapId() == MapId.EVENT_COCONUT_HARVEST || event.getMapId() == MapId.EVENT_SNOWBALL_ENTRANCE) {
player.setTeam(event.getLimit() % 2);
}

View File

@@ -97,7 +97,7 @@ public class GotoCommand extends Command {
}
}
HashMap<String, Integer> gotomaps;
Map<String, Integer> gotomaps;
if (player.isGM()) {
gotomaps = new HashMap<>(GameConstants.GOTO_AREAS); // distinct map registry for GM/users suggested thanks to Vcoc
gotomaps.putAll(GameConstants.GOTO_TOWNS); // thanks Halcyon (UltimateMors) for pointing out duplicates on listed entries functionality

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm2;
import client.Character;
import client.Client;
import client.command.Command;
import constants.id.MapId;
import server.maps.MapleMap;
import server.maps.Portal;
@@ -57,10 +58,8 @@ public class JailCommand extends Command {
if (victim != null) {
victim.addJailExpirationTime(MINUTES.toMillis(minutesJailed));
int mapid = 300000012;
if (victim.getMapId() != mapid) { // those gone to jail won't be changing map anyway
MapleMap target = c.getChannelServer().getMapFactory().getMap(mapid);
if (victim.getMapId() != MapId.JAIL) { // those gone to jail won't be changing map anyway
MapleMap target = c.getChannelServer().getMapFactory().getMap(MapId.JAIL);
Portal targetPortal = target.getPortal(0);
victim.saveLocationOnWarp();
victim.changeMap(target, targetPortal);

View File

@@ -28,6 +28,7 @@ import client.Client;
import client.command.Command;
import client.inventory.Item;
import constants.id.ItemId;
import constants.id.MapId;
import java.awt.*;
@@ -39,7 +40,7 @@ public class SeedCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
if (player.getMapId() != 910010000) {
if (player.getMapId() != MapId.HENESYS_PQ) {
player.yellowMessage("This command can only be used in HPQ.");
return;
}