Turn mob id magic numbers into constants

This commit is contained in:
P0nk
2021-11-07 12:15:36 +01:00
parent 4efd356cbf
commit 8d10e3d1b0
18 changed files with 205 additions and 90 deletions

View File

@@ -25,6 +25,7 @@ import client.Character;
import client.Disease;
import client.status.MonsterStatus;
import constants.game.GameConstants;
import constants.id.MobId;
import net.server.services.task.channel.OverallService;
import net.server.services.type.ChannelServices;
import server.maps.MapObject;
@@ -265,17 +266,17 @@ public class MobSkill {
xpos = (int) monster.getPosition().getX();
ypos = (int) monster.getPosition().getY();
switch (mobId) {
case 8500003: // Pap bomb high
case MobId.HIGH_DARKSTAR: // Pap bomb high
toSpawn.setFh((int) Math.ceil(Math.random() * 19.0));
ypos = -590;
break;
case 8500004: // Pap bomb
case MobId.LOW_DARKSTAR: // Pap bomb
xpos = (int) (monster.getPosition().getX() + Randomizer.nextInt(1000) - 500);
if (ypos != -590) {
ypos = (int) monster.getPosition().getY();
}
break;
case 8510100: //Pianus bomb
case MobId.BLOODY_BOOM: //Pianus bomb
if (Math.ceil(Math.random() * 5) == 1) {
ypos = 78;
xpos = Randomizer.nextInt(5) + (Randomizer.nextInt(2) == 1 ? 180 : 0);
@@ -301,7 +302,7 @@ public class MobSkill {
break;
}
toSpawn.setPosition(new Point(xpos, ypos));
if (toSpawn.getId() == 8500004) {
if (toSpawn.getId() == MobId.LOW_DARKSTAR) {
map.spawnFakeMonster(toSpawn);
} else {
map.spawnMonsterWithEffect(toSpawn, getSpawnEffect(), toSpawn.getPosition());

View File

@@ -26,6 +26,7 @@ import client.*;
import client.status.MonsterStatus;
import client.status.MonsterStatusEffect;
import config.YamlConfig;
import constants.id.MobId;
import constants.skills.*;
import net.packet.Packet;
import net.server.audit.LockCollector;
@@ -761,7 +762,7 @@ public class Monster extends AbstractLoadedLife {
final List<Integer> toSpawn = this.getRevives();
if (toSpawn != null) {
final MapleMap reviveMap = map;
if (toSpawn.contains(9300216) && reviveMap.getId() > 925000000 && reviveMap.getId() < 926000000) {
if (toSpawn.contains(MobId.TRANSPARENT_ITEM) && reviveMap.getId() > 925000000 && reviveMap.getId() < 926000000) {
reviveMap.broadcastMessage(PacketCreator.playSound("Dojang/clear"));
reviveMap.broadcastMessage(PacketCreator.showEffect("dojang/end/clear"));
}
@@ -790,9 +791,9 @@ public class Monster extends AbstractLoadedLife {
}
reviveMap.spawnMonster(mob);
if (mob.getId() >= 8810010 && mob.getId() <= 8810017 && reviveMap.isHorntailDefeated()) {
if (MobId.isDeadHorntailPart(mob.getId()) && reviveMap.isHorntailDefeated()) {
boolean htKilled = false;
Monster ht = reviveMap.getMonsterById(8810018);
Monster ht = reviveMap.getMonsterById(MobId.HORNTAIL);
if (ht != null) {
ht.lockMonster();
@@ -808,7 +809,7 @@ public class Monster extends AbstractLoadedLife {
}
}
for (int i = 8810017; i >= 8810010; i--) {
for (int i = MobId.DEAD_HORNTAIL_MAX; i >= MobId.DEAD_HORNTAIL_MIN; i--) {
reviveMap.killMonster(reviveMap.getMonsterById(i), killer, true);
}
} else if (controller != null) {