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

@@ -37,6 +37,7 @@ import config.YamlConfig;
import constants.game.ExpTable;
import constants.game.GameConstants;
import constants.id.ItemId;
import constants.id.MobId;
import constants.inventory.ItemConstants;
import constants.skills.*;
import net.packet.Packet;
@@ -7518,12 +7519,12 @@ public class Character extends AbstractCharacterObject {
public void raiseQuestMobCount(int id) {
// It seems nexon uses monsters that don't exist in the WZ (except string) to merge multiple mobs together for these 3 monsters.
// We also want to run mobKilled for both since there are some quest that don't use the updated ID...
if (id == 1110100 || id == 1110130) {
raiseQuestMobCount(9101000);
} else if (id == 2230101 || id == 2230131) {
raiseQuestMobCount(9101001);
} else if (id == 1140100 || id == 1140130) {
raiseQuestMobCount(9101002);
if (id == MobId.GREEN_MUSHROOM || id == MobId.DEJECTED_GREEN_MUSHROOM) {
raiseQuestMobCount(MobId.GREEN_MUSHROOM_QUEST);
} else if (id == MobId.ZOMBIE_MUSHROOM || id == MobId.ANNOYED_ZOMBIE_MUSHROOM) {
raiseQuestMobCount(MobId.ZOMBIE_MUSHROOM_QUEST);
} else if (id == MobId.GHOST_STUMP || id == MobId.SMIRKING_GHOST_STUMP) {
raiseQuestMobCount(MobId.GHOST_STUMP_QUEST);
}
int lastQuestProcessed = 0;

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm2;
import client.Character;
import client.Client;
import client.command.Command;
import constants.id.MobId;
import net.server.Server;
import server.life.LifeFactory;
import tools.PacketCreator;
@@ -41,13 +42,13 @@ public class BombCommand extends Command {
if (params.length > 0) {
Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]);
if (victim != null) {
victim.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(9300166), victim.getPosition());
victim.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(MobId.ARPQ_BOMB), victim.getPosition());
Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.serverNotice(5, player.getName() + " used !bomb on " + victim.getName()));
} else {
player.message("Player '" + params[0] + "' could not be found on this world.");
}
} else {
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(9300166), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(MobId.ARPQ_BOMB), player.getPosition());
}
}
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm3;
import client.Character;
import client.Client;
import client.command.Command;
import constants.id.MobId;
import server.life.Monster;
import server.maps.MapObject;
import server.maps.MapObjectType;
@@ -47,7 +48,7 @@ public class KillAllCommand extends Command {
int count = 0;
for (MapObject monstermo : monsters) {
Monster monster = (Monster) monstermo;
if (!monster.getStats().isFriendly() && !(monster.getId() >= 8810010 && monster.getId() <= 8810018)) {
if (!monster.getStats().isFriendly() && !(monster.getId() >= MobId.DEAD_HORNTAIL_MIN && monster.getId() <= MobId.HORNTAIL)) {
map.damageMonster(player, monster, Integer.MAX_VALUE);
count++;
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import constants.id.MobId;
import server.life.LifeFactory;
import server.life.Monster;
@@ -37,7 +38,7 @@ public class CakeCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
Monster monster = LifeFactory.getMonster(9400606);
Monster monster = LifeFactory.getMonster(MobId.GIANT_CAKE);
if (params.length == 1) {
double mobHp = Double.parseDouble(params[0]);
int newHp = (mobHp <= 0) ? Integer.MAX_VALUE : ((mobHp > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) mobHp);

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import constants.id.MobId;
import server.life.LifeFactory;
public class PapCommand extends Command {
@@ -38,6 +39,6 @@ public class PapCommand extends Command {
Character player = c.getPlayer();
// thanks Conrad for noticing mobid typo here
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(8500001), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(MobId.PAPULATUS_CLOCK), player.getPosition());
}
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import constants.id.MobId;
import server.life.LifeFactory;
public class PianusCommand extends Command {
@@ -36,6 +37,6 @@ public class PianusCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(8510000), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(MobId.PIANUS_R), player.getPosition());
}
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import constants.id.MobId;
import server.life.LifeFactory;
public class PinkbeanCommand extends Command {
@@ -36,7 +37,7 @@ public class PinkbeanCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(8820001), player.getPosition());
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(MobId.PINK_BEAN), player.getPosition());
}
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import constants.id.MobId;
import server.life.LifeFactory;
public class ZakumCommand extends Command {
@@ -36,9 +37,9 @@ public class ZakumCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
player.getMap().spawnFakeMonsterOnGroundBelow(LifeFactory.getMonster(8800000), player.getPosition());
for (int x = 8800003; x < 8800011; x++) {
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(x), player.getPosition());
player.getMap().spawnFakeMonsterOnGroundBelow(LifeFactory.getMonster(MobId.ZAKUM_1), player.getPosition());
for (int mobId = MobId.ZAKUM_ARM_1; mobId <= MobId.ZAKUM_ARM_8; mobId++) {
player.getMap().spawnMonsterOnGroundBelow(LifeFactory.getMonster(mobId), player.getPosition());
}
}
}