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

@@ -24,7 +24,7 @@ package server.life;
import client.Character;
import client.Disease;
import client.status.MonsterStatus;
import constants.game.GameConstants;
import constants.id.MapId;
import constants.id.MobId;
import net.server.services.task.channel.OverallService;
import net.server.services.type.ChannelServices;
@@ -244,7 +244,7 @@ public class MobSkill {
int skillLimit = this.getLimit();
MapleMap map = monster.getMap();
if (GameConstants.isDojo(map.getId())) { // spawns in dojo should be unlimited
if (MapId.isDojo(map.getId())) { // spawns in dojo should be unlimited
skillLimit = Integer.MAX_VALUE;
}
@@ -252,7 +252,7 @@ public class MobSkill {
List<Integer> summons = getSummons();
int summonLimit = monster.countAvailableMobSummons(summons.size(), skillLimit);
if (summonLimit >= 1) {
boolean bossRushMap = GameConstants.isBossRush(map.getId());
boolean bossRushMap = MapId.isBossRush(map.getId());
Collections.shuffle(summons);
for (Integer mobId : summons.subList(0, summonLimit)) {
@@ -286,14 +286,14 @@ public class MobSkill {
break;
}
switch (map.getId()) {
case 220080001: //Pap map
case MapId.ORIGIN_OF_CLOCKTOWER: //Pap map
if (xpos < -890) {
xpos = (int) (Math.ceil(Math.random() * 150) - 890);
} else if (xpos > 230) {
xpos = (int) (230 - Math.ceil(Math.random() * 150));
}
break;
case 230040420: // Pianus map
case MapId.CAVE_OF_PIANUS: // Pianus map
if (xpos < -239) {
xpos = (int) (Math.ceil(Math.random() * 150) - 239);
} else if (xpos > 371) {

View File

@@ -20,6 +20,7 @@
package server.life;
import constants.id.ItemId;
import constants.id.MapId;
import constants.id.NpcId;
import net.server.Server;
import provider.Data;
@@ -51,7 +52,7 @@ public class PlayerNPCFactory {
if (thisData != null) {
DataProvider map = DataProviderFactory.getDataProvider(WZFiles.MAP);
thisData = map.getData("Map/Map7/777777777.img");
thisData = map.getData("Map/Map7/" + MapId.DEVELOPERS_HQ + ".img");
if (thisData != null) {
DataProvider sound = DataProviderFactory.getDataProvider(WZFiles.SOUND);
@@ -112,7 +113,7 @@ public class PlayerNPCFactory {
if (thisData != null) {
byte[] encData = {0x52, 0x6F, 0x6E, 0x61, 0x6E};
String name = new String(encData);
int face = 20104, hair = 30215, gender = 0, skin = 0, dir = 0, mapid = 777777777;
int face = 20104, hair = 30215, gender = 0, skin = 0, dir = 0, mapid = MapId.DEVELOPERS_HQ;
int FH = 4, RX0 = -143, RX1 = -243, CX = -193, CY = 117, scriptId = NpcId.CUSTOM_DEV;
Map<Short, Integer> equips = new HashMap<>();