Turn npc id magic numbers into constants
This commit is contained in:
@@ -24,6 +24,7 @@ package net.server.channel.handlers;
|
||||
|
||||
import client.Client;
|
||||
import client.Job;
|
||||
import constants.id.NpcId;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import scripting.npc.NPCScriptManager;
|
||||
@@ -35,9 +36,9 @@ public class ClickGuideHandler extends AbstractPacketHandler {
|
||||
@Override
|
||||
public void handlePacket(InPacket p, Client c) {
|
||||
if (c.getPlayer().getJob().equals(Job.NOBLESSE)) {
|
||||
NPCScriptManager.getInstance().start(c, 1101008, null);
|
||||
NPCScriptManager.getInstance().start(c, NpcId.MIMO, null);
|
||||
} else {
|
||||
NPCScriptManager.getInstance().start(c, 1202000, null);
|
||||
NPCScriptManager.getInstance().start(c, NpcId.LILIN, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ package net.server.channel.handlers;
|
||||
import client.Client;
|
||||
import client.processor.npc.DueyProcessor;
|
||||
import config.YamlConfig;
|
||||
import constants.id.NpcId;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import scripting.npc.NPCScriptManager;
|
||||
@@ -48,13 +49,12 @@ public final class NPCTalkHandler extends AbstractPacketHandler {
|
||||
|
||||
int oid = p.readInt();
|
||||
MapObject obj = c.getPlayer().getMap().getMapObject(oid);
|
||||
if (obj instanceof NPC) {
|
||||
NPC npc = (NPC) obj;
|
||||
if (YamlConfig.config.server.USE_DEBUG == true) {
|
||||
if (obj instanceof NPC npc) {
|
||||
if (YamlConfig.config.server.USE_DEBUG) {
|
||||
c.getPlayer().dropMessage(5, "Talking to NPC " + npc.getId());
|
||||
}
|
||||
|
||||
if (npc.getId() == 9010009) { //is duey
|
||||
if (npc.getId() == NpcId.DUEY) {
|
||||
DueyProcessor.dueySendTalk(c, false);
|
||||
} else {
|
||||
if (c.getCM() != null || c.getQM() != null) {
|
||||
@@ -63,7 +63,7 @@ public final class NPCTalkHandler extends AbstractPacketHandler {
|
||||
}
|
||||
|
||||
// Custom handling to reduce the amount of scripts needed.
|
||||
if (npc.getId() >= 9100100 && npc.getId() <= 9100200) {
|
||||
if (npc.getId() >= NpcId.GACHAPON_MIN && npc.getId() <= NpcId.GACHAPON_MAX) {
|
||||
NPCScriptManager.getInstance().start(c, npc.getId(), "gachapon", null);
|
||||
} else if (npc.getName().endsWith("Maple TV")) {
|
||||
NPCScriptManager.getInstance().start(c, npc.getId(), "mapleTV", null);
|
||||
@@ -88,7 +88,7 @@ public final class NPCTalkHandler extends AbstractPacketHandler {
|
||||
PlayerNPC pnpc = (PlayerNPC) obj;
|
||||
NPCScriptManager nsm = NPCScriptManager.getInstance();
|
||||
|
||||
if (pnpc.getScriptId() < 9977777 && !nsm.isNpcScriptAvailable(c, "" + pnpc.getScriptId())) {
|
||||
if (pnpc.getScriptId() < NpcId.CUSTOM_DEV && !nsm.isNpcScriptAvailable(c, "" + pnpc.getScriptId())) {
|
||||
nsm.start(c, pnpc.getScriptId(), "rank_user", null);
|
||||
} else {
|
||||
nsm.start(c, pnpc.getScriptId(), null);
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.server.channel.handlers;
|
||||
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import constants.id.NpcId;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.minigame.RockPaperScissor;
|
||||
@@ -21,7 +22,7 @@ public final class RPSActionHandler extends AbstractPacketHandler {
|
||||
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
if (p.available() == 0 || !chr.getMap().containsNPC(9000019)) {
|
||||
if (p.available() == 0 || !chr.getMap().containsNPC(NpcId.RPS_ADMIN)) {
|
||||
if (rps != null) {
|
||||
rps.dispose(c);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ package net.server.channel.handlers;
|
||||
import client.Client;
|
||||
import client.autoban.AutobanFactory;
|
||||
import constants.id.ItemId;
|
||||
import constants.id.NpcId;
|
||||
import constants.inventory.ItemConstants;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
@@ -50,11 +51,11 @@ public final class RemoteGachaponHandler extends AbstractPacketHandler {
|
||||
c.disconnect(false, false);
|
||||
return;
|
||||
}
|
||||
int npcId = 9100100;
|
||||
int npcId = NpcId.GACHAPON_HENESYS;
|
||||
if (gacha != 8 && gacha != 9) {
|
||||
npcId += gacha;
|
||||
} else {
|
||||
npcId = gacha == 8 ? 9100109 : 9100117;
|
||||
npcId = gacha == 8 ? NpcId.GACHAPON_NLC : NpcId.GACHAPON_NAUTILUS;
|
||||
}
|
||||
NPCScriptManager.getInstance().start(c, npcId, "gachaponRemote", null);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package net.server.channel.handlers;
|
||||
|
||||
import client.Client;
|
||||
import constants.id.NpcId;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
|
||||
@@ -29,6 +30,6 @@ public final class UseWaterOfLifeHandler extends AbstractPacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(InPacket p, Client c) {
|
||||
c.getAbstractPlayerInteraction().openNpc(1032102, "waterOfLife");
|
||||
c.getAbstractPlayerInteraction().openNpc(NpcId.MAR_THE_FAIRY, "waterOfLife");
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ package net.server.coordinator.session;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import config.YamlConfig;
|
||||
import constants.id.NpcId;
|
||||
import net.server.Server;
|
||||
import net.server.coordinator.login.LoginStorage;
|
||||
import org.slf4j.Logger;
|
||||
@@ -401,6 +402,6 @@ public class SessionCoordinator {
|
||||
}
|
||||
}
|
||||
|
||||
c.getAbstractPlayerInteraction().npcTalk(2140000, str);
|
||||
c.getAbstractPlayerInteraction().npcTalk(NpcId.TEMPLE_KEEPER, str);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user