Turn npc id magic numbers into constants
This commit is contained in:
@@ -25,6 +25,7 @@ package client.command.commands.gm0;
|
||||
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.id.NpcId;
|
||||
import server.ItemInformationProvider;
|
||||
import server.gachapon.Gachapon;
|
||||
|
||||
@@ -39,7 +40,9 @@ public class GachaCommand extends Command {
|
||||
String search = c.getPlayer().getLastCommandMessage();
|
||||
String gachaName = "";
|
||||
String[] names = {"Henesys", "Ellinia", "Perion", "Kerning City", "Sleepywood", "Mushroom Shrine", "Showa Spa Male", "Showa Spa Female", "New Leaf City", "Nautilus Harbor"};
|
||||
int[] ids = {9100100, 9100101, 9100102, 9100103, 9100104, 9100105, 9100106, 9100107, 9100109, 9100117};
|
||||
int[] ids = {NpcId.GACHAPON_HENESYS, NpcId.GACHAPON_ELLINIA, NpcId.GACHAPON_PERION, NpcId.GACHAPON_KERNING,
|
||||
NpcId.GACHAPON_SLEEPYWOOD, NpcId.GACHAPON_MUSHROOM_SHRINE, NpcId.GACHAPON_SHOWA_MALE,
|
||||
NpcId.GACHAPON_SHOWA_FEMALE, NpcId.GACHAPON_NLC, NpcId.GACHAPON_NAUTILUS};
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (search.equalsIgnoreCase(names[i])) {
|
||||
gachaName = names[i];
|
||||
@@ -61,6 +64,6 @@ public class GachaCommand extends Command {
|
||||
}
|
||||
talkStr += "\r\nPlease keep in mind that there are items that are in all gachapons and are not listed here.";
|
||||
|
||||
c.getAbstractPlayerInteraction().npcTalk(9010000, talkStr);
|
||||
c.getAbstractPlayerInteraction().npcTalk(NpcId.MAPLE_ADMINISTRATOR, talkStr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ package client.command.commands.gm0;
|
||||
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.id.NpcId;
|
||||
|
||||
public class HelpCommand extends Command {
|
||||
{
|
||||
@@ -33,6 +34,6 @@ public class HelpCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void execute(Client client, String[] params) {
|
||||
client.getAbstractPlayerInteraction().openNpc(9201143, "commands");
|
||||
client.getAbstractPlayerInteraction().openNpc(NpcId.STEWARD, "commands");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package client.command.commands.gm0;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.id.NpcId;
|
||||
import net.server.Server;
|
||||
import net.server.guild.GuildPackets;
|
||||
import tools.Pair;
|
||||
@@ -42,6 +43,6 @@ public class RanksCommand extends Command {
|
||||
Character player = c.getPlayer();
|
||||
|
||||
List<Pair<String, Integer>> worldRanking = Server.getInstance().getWorldPlayerRanking(player.getWorld());
|
||||
player.sendPacket(GuildPackets.showPlayerRanks(9010000, worldRanking));
|
||||
player.sendPacket(GuildPackets.showPlayerRanks(NpcId.MAPLE_ADMINISTRATOR, worldRanking));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ package client.command.commands.gm0;
|
||||
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.id.NpcId;
|
||||
|
||||
public class StaffCommand extends Command {
|
||||
{
|
||||
@@ -33,6 +34,6 @@ public class StaffCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
c.getAbstractPlayerInteraction().openNpc(2010007, "credits");
|
||||
c.getAbstractPlayerInteraction().openNpc(NpcId.HERACLE, "credits");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.game.GameConstants;
|
||||
import constants.id.NpcId;
|
||||
import server.maps.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -80,7 +81,7 @@ public class GotoCommand extends Command {
|
||||
sendStr += ("\r\n#rAreas:#k\r\n" + GOTO_AREAS_INFO);
|
||||
}
|
||||
|
||||
player.getAbstractPlayerInteraction().npcTalk(9000020, sendStr);
|
||||
player.getAbstractPlayerInteraction().npcTalk(NpcId.SPINEL, sendStr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -118,7 +119,7 @@ public class GotoCommand extends Command {
|
||||
sendStr += ("\r\n#rAreas:#k\r\n" + GOTO_AREAS_INFO);
|
||||
}
|
||||
|
||||
player.getAbstractPlayerInteraction().npcTalk(9000020, sendStr);
|
||||
player.getAbstractPlayerInteraction().npcTalk(NpcId.SPINEL, sendStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package client.command.commands.gm1;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.id.NpcId;
|
||||
import server.ItemInformationProvider;
|
||||
import server.life.MonsterDropEntry;
|
||||
import server.life.MonsterInformationProvider;
|
||||
@@ -72,6 +73,6 @@ public class WhatDropsFromCommand extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
c.getAbstractPlayerInteraction().npcTalk(9010000, output);
|
||||
c.getAbstractPlayerInteraction().npcTalk(NpcId.MAPLE_ADMINISTRATOR, output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package client.command.commands.gm1;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.id.NpcId;
|
||||
import server.ItemInformationProvider;
|
||||
import server.life.MonsterInformationProvider;
|
||||
import tools.DatabaseConnection;
|
||||
@@ -84,7 +85,7 @@ public class WhoDropsCommand extends Command {
|
||||
return;
|
||||
}
|
||||
|
||||
c.getAbstractPlayerInteraction().npcTalk(9010000, output);
|
||||
c.getAbstractPlayerInteraction().npcTalk(NpcId.MAPLE_ADMINISTRATOR, output);
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package client.command.commands.gm2;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.id.NpcId;
|
||||
import server.ThreadManager;
|
||||
import tools.exceptions.IdTypeNotSupportedException;
|
||||
|
||||
@@ -55,7 +56,7 @@ public class IdCommand extends Command {
|
||||
}
|
||||
sb.append(String.format("Results found: #r%d#k | Returned: #b%d#k/100 | Refine search query to improve time.", resultList.size(), count) + "\r\n");
|
||||
|
||||
player.getAbstractPlayerInteraction().npcTalk(9010000, sb.toString());
|
||||
player.getAbstractPlayerInteraction().npcTalk(NpcId.MAPLE_ADMINISTRATOR, sb.toString());
|
||||
} else {
|
||||
player.yellowMessage(String.format("Id not found for item: %s, of type: %s.", queryItem, params[0]));
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package client.command.commands.gm2;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.id.NpcId;
|
||||
import provider.Data;
|
||||
import provider.DataProvider;
|
||||
import provider.DataProviderFactory;
|
||||
@@ -133,6 +134,6 @@ public class SearchCommand extends Command {
|
||||
}
|
||||
sb.append("\r\n#kLoaded within ").append((double) (System.currentTimeMillis() - start) / 1000).append(" seconds.");//because I can, and it's free
|
||||
|
||||
c.getAbstractPlayerInteraction().npcTalk(9010000, sb.toString());
|
||||
c.getAbstractPlayerInteraction().npcTalk(NpcId.MAPLE_ADMINISTRATOR, sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.game.GameConstants;
|
||||
import constants.id.NpcId;
|
||||
import tools.PacketCreator;
|
||||
|
||||
public class MusicCommand extends Command {
|
||||
@@ -53,7 +54,7 @@ public class MusicCommand extends Command {
|
||||
sendMsg += "Syntax: #r!music <song>#k\r\n\r\n";
|
||||
sendMsg += getSongList();
|
||||
|
||||
c.sendPacket(PacketCreator.getNPCTalk(1052015, (byte) 0, sendMsg, "00 00", (byte) 0));
|
||||
c.sendPacket(PacketCreator.getNPCTalk(NpcId.BILLY, (byte) 0, sendMsg, "00 00", (byte) 0));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,6 +71,6 @@ public class MusicCommand extends Command {
|
||||
sendMsg += "Song not found, please enter a song below.\r\n\r\n";
|
||||
sendMsg += getSongList();
|
||||
|
||||
c.sendPacket(PacketCreator.getNPCTalk(1052015, (byte) 0, sendMsg, "00 00", (byte) 0));
|
||||
c.sendPacket(PacketCreator.getNPCTalk(NpcId.BILLY, (byte) 0, sendMsg, "00 00", (byte) 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package client.command.commands.gm5;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import constants.id.NpcId;
|
||||
import net.server.Server;
|
||||
import server.TimerManager;
|
||||
import server.life.Monster;
|
||||
@@ -63,7 +64,7 @@ public class DebugCommand extends Command {
|
||||
msgTypes += ("#L" + i + "#" + debugTypes[i] + "#l\r\n");
|
||||
}
|
||||
|
||||
c.getAbstractPlayerInteraction().npcTalk(9201143, msgTypes);
|
||||
c.getAbstractPlayerInteraction().npcTalk(NpcId.STEWARD, msgTypes);
|
||||
break;
|
||||
|
||||
case "monster":
|
||||
|
||||
40
src/main/java/constants/id/NpcId.java
Normal file
40
src/main/java/constants/id/NpcId.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package constants.id;
|
||||
|
||||
public class NpcId {
|
||||
public static final int CUSTOM_DEV = 9977777;
|
||||
|
||||
public static final int MAPLE_ADMINISTRATOR = 9010000;
|
||||
public static final int STEWARD = 9201143;
|
||||
public static final int DIMENSIONAL_MIRROR = 9010022;
|
||||
public static final int SPINEL = 9000020;
|
||||
public static final int DUEY = 9010009;
|
||||
public static final int RPS_ADMIN = 9000019;
|
||||
public static final int GRANDPA_MOON_BUNNY = 9001105;
|
||||
public static final int FREDRICK = 9030000;
|
||||
public static final int MAR_THE_FAIRY = 1032102;
|
||||
public static final int HERACLE = 2010007;
|
||||
public static final int MIMO = 1101008;
|
||||
public static final int LILIN = 1202000;
|
||||
public static final int BILLY = 1052015;
|
||||
public static final int TEMPLE_KEEPER = 2140000;
|
||||
|
||||
// Id in ascending order
|
||||
public static final int GACHAPON_HENESYS = 9100100;
|
||||
public static final int GACHAPON_ELLINIA = 9100101;
|
||||
public static final int GACHAPON_PERION = 9100102;
|
||||
public static final int GACHAPON_KERNING = 9100103;
|
||||
public static final int GACHAPON_SLEEPYWOOD = 9100104;
|
||||
public static final int GACHAPON_MUSHROOM_SHRINE = 9100105;
|
||||
public static final int GACHAPON_SHOWA_MALE = 9100106;
|
||||
public static final int GACHAPON_SHOWA_FEMALE = 9100107;
|
||||
public static final int GACHAPON_LUDIBRIUM = 9100108;
|
||||
public static final int GACHAPON_NLC = 9100109;
|
||||
public static final int GACHAPON_EL_NATH = 9100110;
|
||||
public static final int GACHAPON_NAUTILUS = 9100117;
|
||||
|
||||
public static final int GACHAPON_MIN = GACHAPON_HENESYS;
|
||||
public static final int GACHAPON_MAX = GACHAPON_NAUTILUS;
|
||||
|
||||
public static final int PLAYER_NPC_BASE = 9900000;
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import client.inventory.manipulator.InventoryManipulator;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import constants.id.ItemId;
|
||||
import constants.id.NpcId;
|
||||
import constants.inventory.ItemConstants;
|
||||
import net.server.Server;
|
||||
import net.server.guild.Guild;
|
||||
@@ -444,7 +445,7 @@ public class AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public boolean forceStartQuest(int id) {
|
||||
return forceStartQuest(id, 9010000);
|
||||
return forceStartQuest(id, NpcId.MAPLE_ADMINISTRATOR);
|
||||
}
|
||||
|
||||
public boolean forceStartQuest(int id, int npc) {
|
||||
@@ -452,7 +453,7 @@ public class AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public boolean forceCompleteQuest(int id) {
|
||||
return forceCompleteQuest(id, 9010000);
|
||||
return forceCompleteQuest(id, NpcId.MAPLE_ADMINISTRATOR);
|
||||
}
|
||||
|
||||
public boolean forceCompleteQuest(int id, int npc) {
|
||||
@@ -468,11 +469,11 @@ public class AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public boolean startQuest(int id) {
|
||||
return startQuest(id, 9010000);
|
||||
return startQuest(id, NpcId.MAPLE_ADMINISTRATOR);
|
||||
}
|
||||
|
||||
public boolean completeQuest(int id) {
|
||||
return completeQuest(id, 9010000);
|
||||
return completeQuest(id, NpcId.MAPLE_ADMINISTRATOR);
|
||||
}
|
||||
|
||||
public boolean startQuest(short id, int npc) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import client.inventory.ItemFactory;
|
||||
import client.inventory.Pet;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import constants.id.NpcId;
|
||||
import constants.inventory.ItemConstants;
|
||||
import constants.string.LanguageConstants;
|
||||
import net.server.Server;
|
||||
@@ -400,15 +401,15 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public void doGachapon() {
|
||||
int[] maps = {100000000, 101000000, 102000000, 103000000, 105040300, 800000000, 809000101, 809000201, 600000000, 120000000};
|
||||
|
||||
GachaponItem item = Gachapon.getInstance().process(npc);
|
||||
|
||||
Item itemGained = gainItem(item.getId(), (short) (item.getId() / 10000 == 200 ? 100 : 1), true, true); // For normal potions, make it give 100.
|
||||
|
||||
sendNext("You have obtained a #b#t" + item.getId() + "##k.");
|
||||
|
||||
String map = c.getChannelServer().getMapFactory().getMap(maps[(getNpc() != 9100117 && getNpc() != 9100109) ? (getNpc() - 9100100) : getNpc() == 9100109 ? 8 : 9]).getMapName();
|
||||
int[] maps = {100000000, 101000000, 102000000, 103000000, 105040300, 800000000, 809000101, 809000201, 600000000, 120000000};
|
||||
final int mapId = maps[(getNpc() != NpcId.GACHAPON_NAUTILUS && getNpc() != NpcId.GACHAPON_NLC) ?
|
||||
(getNpc() - NpcId.GACHAPON_HENESYS) : getNpc() == NpcId.GACHAPON_NLC ? 8 : 9];
|
||||
String map = c.getChannelServer().getMapFactory().getMap(mapId).getMapName();
|
||||
|
||||
LogHelper.logGacha(getPlayer(), item.getId(), map);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
package server.gachapon;
|
||||
|
||||
import constants.id.NpcId;
|
||||
import server.ItemInformationProvider;
|
||||
import tools.Randomizer;
|
||||
|
||||
@@ -38,18 +39,18 @@ public class Gachapon {
|
||||
public enum GachaponType {
|
||||
|
||||
GLOBAL(-1, -1, -1, -1, new Global()),
|
||||
HENESYS(9100100, 90, 8, 2, new Henesys()),
|
||||
ELLINIA(9100101, 90, 8, 2, new Ellinia()),
|
||||
PERION(9100102, 90, 8, 2, new Perion()),
|
||||
KERNING_CITY(9100103, 90, 8, 2, new KerningCity()),
|
||||
SLEEPYWOOD(9100104, 90, 8, 2, new Sleepywood()),
|
||||
MUSHROOM_SHRINE(9100105, 90, 8, 2, new MushroomShrine()),
|
||||
SHOWA_SPA_MALE(9100106, 90, 8, 2, new ShowaSpaMale()),
|
||||
SHOWA_SPA_FEMALE(9100107, 90, 8, 2, new ShowaSpaFemale()),
|
||||
LUDIBRIUM(9100108, 90, 8, 2, new Ludibrium()),
|
||||
NEW_LEAF_CITY(9100109, 90, 8, 2, new NewLeafCity()),
|
||||
EL_NATH(9100110, 90, 8, 2, new ElNath()),
|
||||
NAUTILUS_HARBOR(9100117, 90, 8, 2, new NautilusHarbor());
|
||||
HENESYS(NpcId.GACHAPON_HENESYS, 90, 8, 2, new Henesys()),
|
||||
ELLINIA(NpcId.GACHAPON_ELLINIA, 90, 8, 2, new Ellinia()),
|
||||
PERION(NpcId.GACHAPON_PERION, 90, 8, 2, new Perion()),
|
||||
KERNING_CITY(NpcId.GACHAPON_KERNING, 90, 8, 2, new KerningCity()),
|
||||
SLEEPYWOOD(NpcId.GACHAPON_SLEEPYWOOD, 90, 8, 2, new Sleepywood()),
|
||||
MUSHROOM_SHRINE(NpcId.GACHAPON_MUSHROOM_SHRINE, 90, 8, 2, new MushroomShrine()),
|
||||
SHOWA_SPA_MALE(NpcId.GACHAPON_SHOWA_MALE, 90, 8, 2, new ShowaSpaMale()),
|
||||
SHOWA_SPA_FEMALE(NpcId.GACHAPON_SHOWA_FEMALE, 90, 8, 2, new ShowaSpaFemale()),
|
||||
LUDIBRIUM(NpcId.GACHAPON_LUDIBRIUM, 90, 8, 2, new Ludibrium()),
|
||||
NEW_LEAF_CITY(NpcId.GACHAPON_NLC, 90, 8, 2, new NewLeafCity()),
|
||||
EL_NATH(NpcId.GACHAPON_EL_NATH, 90, 8, 2, new ElNath()),
|
||||
NAUTILUS_HARBOR(NpcId.GACHAPON_NAUTILUS, 90, 8, 2, new NautilusHarbor());
|
||||
|
||||
private static final GachaponType[] values = GachaponType.values();
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import constants.id.NpcId;
|
||||
import net.server.Server;
|
||||
import net.server.channel.Channel;
|
||||
import net.server.world.World;
|
||||
@@ -312,7 +313,7 @@ public class PlayerNPC extends AbstractMapObject {
|
||||
private static void fetchAvailableScriptIdsFromDb(byte branch, List<Integer> list) {
|
||||
try {
|
||||
int branchLen = (branch < 26) ? 100 : 400;
|
||||
int branchSid = 9900000 + (branch * 100);
|
||||
int branchSid = NpcId.PLAYER_NPC_BASE + (branch * 100);
|
||||
int nextBranchSid = branchSid + branchLen;
|
||||
|
||||
List<Integer> availables = new ArrayList<>(20);
|
||||
@@ -556,7 +557,7 @@ public class PlayerNPC extends AbstractMapObject {
|
||||
for (MapObject pnpcObj : wserv.getChannel(1).getMapFactory().getMap(map).getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.PLAYER_NPC))) {
|
||||
PlayerNPC pn = (PlayerNPC) pnpcObj;
|
||||
|
||||
if (name.contentEquals(pn.getName()) && pn.getScriptId() < 9977777) {
|
||||
if (name.contentEquals(pn.getName()) && pn.getScriptId() < NpcId.CUSTOM_DEV) {
|
||||
return pn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package server.life;
|
||||
|
||||
import constants.id.ItemId;
|
||||
import constants.id.NpcId;
|
||||
import net.server.Server;
|
||||
import provider.Data;
|
||||
import provider.DataProvider;
|
||||
@@ -46,7 +47,7 @@ public class PlayerNPCFactory {
|
||||
}
|
||||
|
||||
private static void loadDeveloperRoomMetadata(DataProvider npc) {
|
||||
Data thisData = npc.getData("9977777.img");
|
||||
Data thisData = npc.getData(NpcId.CUSTOM_DEV + ".img");
|
||||
if (thisData != null) {
|
||||
DataProvider map = DataProviderFactory.getDataProvider(WZFiles.MAP);
|
||||
|
||||
@@ -106,13 +107,13 @@ public class PlayerNPCFactory {
|
||||
runningDeveloperOid++;
|
||||
}
|
||||
} else {
|
||||
Data thisData = npc.getData("9977777.img");
|
||||
Data thisData = npc.getData(NpcId.CUSTOM_DEV + ".img");
|
||||
|
||||
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 FH = 4, RX0 = -143, RX1 = -243, CX = -193, CY = 117, scriptId = 9977777;
|
||||
int FH = 4, RX0 = -143, RX1 = -243, CX = -193, CY = 117, scriptId = NpcId.CUSTOM_DEV;
|
||||
|
||||
Map<Short, Integer> equips = new HashMap<>();
|
||||
equips.put((short) -1, ItemId.GREEN_HEADBAND);
|
||||
|
||||
@@ -34,6 +34,7 @@ import config.YamlConfig;
|
||||
import constants.game.ExpTable;
|
||||
import constants.game.GameConstants;
|
||||
import constants.id.ItemId;
|
||||
import constants.id.NpcId;
|
||||
import constants.inventory.ItemConstants;
|
||||
import constants.skills.Buccaneer;
|
||||
import constants.skills.Corsair;
|
||||
@@ -3312,7 +3313,7 @@ public class PacketCreator {
|
||||
public static Packet getDimensionalMirror(String talk) {
|
||||
final OutPacket p = OutPacket.create(SendOpcode.NPC_TALK);
|
||||
p.writeByte(4); // ?
|
||||
p.writeInt(9010022);
|
||||
p.writeInt(NpcId.DIMENSIONAL_MIRROR);
|
||||
p.writeByte(0x0E);
|
||||
p.writeByte(0);
|
||||
p.writeInt(0);
|
||||
@@ -4873,7 +4874,7 @@ public class PacketCreator {
|
||||
public static Packet openRPSNPC() {
|
||||
OutPacket p = OutPacket.create(SendOpcode.RPS_GAME);
|
||||
p.writeByte(8);// open npc
|
||||
p.writeInt(9000019);
|
||||
p.writeInt(NpcId.RPS_ADMIN);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -4925,7 +4926,7 @@ public class PacketCreator {
|
||||
public static Packet getFredrick(Character chr) {
|
||||
final OutPacket p = OutPacket.create(SendOpcode.FREDRICK);
|
||||
p.writeByte(0x23);
|
||||
p.writeInt(9030000); // Fredrick
|
||||
p.writeInt(NpcId.FREDRICK);
|
||||
p.writeInt(32272); //id
|
||||
p.skip(5);
|
||||
p.writeInt(chr.getMerchantNetMeso());
|
||||
|
||||
Reference in New Issue
Block a user