Rename and clean up MaplePlayerNPC

This commit is contained in:
P0nk
2021-09-09 22:12:29 +02:00
parent 2ee4cd79f6
commit f8e7a525bd
22 changed files with 94 additions and 89 deletions

View File

@@ -63,10 +63,10 @@ import server.events.Events;
import server.events.RescueGaga;
import server.events.gm.Fitness;
import server.events.gm.Ola;
import server.life.MaplePlayerNPC;
import server.life.MobSkill;
import server.life.MobSkillFactory;
import server.life.Monster;
import server.life.PlayerNPC;
import server.maps.*;
import server.maps.MapleMiniGame.MiniGameResult;
import server.minigame.MapleRockPaperScissor;
@@ -6410,7 +6410,7 @@ public class Character extends AbstractCharacterObject {
ThreadManager.getInstance().newTask(new Runnable() {
@Override
public void run() {
MaplePlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(job), Character.this);
PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(job), Character.this);
}
});
}

View File

@@ -26,9 +26,9 @@ package client.command.commands.gm2;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MaplePlayerNPC;
import server.life.Monster;
import server.life.NPC;
import server.life.PlayerNPC;
import server.maps.MapleMapObject;
import java.util.HashSet;
@@ -44,7 +44,7 @@ public class WhereaMiCommand extends Command {
HashSet<Character> chars = new HashSet<>();
HashSet<NPC> npcs = new HashSet<>();
HashSet<MaplePlayerNPC> playernpcs = new HashSet<>();
HashSet<PlayerNPC> playernpcs = new HashSet<>();
HashSet<Monster> mobs = new HashSet<>();
for (MapleMapObject mmo : player.getMap().getMapObjects()) {
@@ -59,8 +59,8 @@ public class WhereaMiCommand extends Command {
if (mob.isAlive()) {
mobs.add(mob);
}
} else if (mmo instanceof MaplePlayerNPC) {
MaplePlayerNPC npc = (MaplePlayerNPC) mmo;
} else if (mmo instanceof PlayerNPC) {
PlayerNPC npc = (PlayerNPC) mmo;
playernpcs.add(npc);
}
}
@@ -74,7 +74,7 @@ public class WhereaMiCommand extends Command {
if (!playernpcs.isEmpty()) {
player.yellowMessage("PlayerNPCs on this map:");
for (MaplePlayerNPC pnpc : playernpcs) {
for (PlayerNPC pnpc : playernpcs) {
player.dropMessage(5, ">> " + pnpc.getName() + " - Scriptid: " + pnpc.getScriptId() + " - Oid: " + pnpc.getObjectId());
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MaplePlayerNPC;
import server.life.PlayerNPC;
public class PlayerNpcCommand extends Command {
{
@@ -41,7 +41,7 @@ public class PlayerNpcCommand extends Command {
return;
}
if (!MaplePlayerNPC.spawnPlayerNPC(player.getMapId(), player.getPosition(), c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]))) {
if (!PlayerNPC.spawnPlayerNPC(player.getMapId(), player.getPosition(), c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]))) {
player.dropMessage(5, "Could not deploy PlayerNPC. Either there's no room available here or depleted out scriptids to use.");
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm4;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MaplePlayerNPC;
import server.life.PlayerNPC;
public class PlayerNpcRemoveCommand extends Command {
{
@@ -40,6 +40,6 @@ public class PlayerNpcRemoveCommand extends Command {
player.yellowMessage("Syntax: !playernpcremove <playername>");
return;
}
MaplePlayerNPC.removePlayerNPC(c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]));
PlayerNPC.removePlayerNPC(c.getChannelServer().getPlayerStorage().getCharacterByName(params[0]));
}
}

View File

@@ -25,7 +25,7 @@ package client.command.commands.gm6;
import client.Client;
import client.command.Command;
import server.life.MaplePlayerNPC;
import server.life.PlayerNPC;
public class EraseAllPNpcsCommand extends Command {
{
@@ -34,6 +34,6 @@ public class EraseAllPNpcsCommand extends Command {
@Override
public void execute(Client c, String[] params) {
MaplePlayerNPC.removeAllPlayerNPC();
PlayerNPC.removeAllPlayerNPC();
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm6;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MaplePlayerNPC;
import server.life.PlayerNPC;
public class SpawnAllPNpcsCommand extends Command {
{
@@ -36,6 +36,6 @@ public class SpawnAllPNpcsCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
MaplePlayerNPC.multicastSpawnPlayerNPC(player.getMapId(), player.getWorld());
PlayerNPC.multicastSpawnPlayerNPC(player.getMapId(), player.getWorld());
}
}

View File

@@ -27,8 +27,8 @@ import config.YamlConfig;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import scripting.npc.NPCScriptManager;
import server.life.MaplePlayerNPC;
import server.life.NPC;
import server.life.PlayerNPC;
import server.maps.MapleMapObject;
import tools.FilePrinter;
import tools.PacketCreator;
@@ -82,8 +82,8 @@ public final class NPCTalkHandler extends AbstractPacketHandler {
}
}
}
} else if (obj instanceof MaplePlayerNPC) {
MaplePlayerNPC pnpc = (MaplePlayerNPC) obj;
} else if (obj instanceof PlayerNPC) {
PlayerNPC pnpc = (PlayerNPC) obj;
NPCScriptManager nsm = NPCScriptManager.getInstance();
if (pnpc.getScriptId() < 9977777 && !nsm.isNpcScriptAvailable(c, "" + pnpc.getScriptId())) {

View File

@@ -50,7 +50,7 @@ import server.expeditions.ExpeditionType;
import server.gachapon.MapleGachapon;
import server.gachapon.MapleGachapon.MapleGachaponItem;
import server.life.LifeFactory;
import server.life.MaplePlayerNPC;
import server.life.PlayerNPC;
import server.maps.MapleMap;
import server.maps.MapleMapManager;
import server.maps.MapleMapObject;
@@ -311,12 +311,12 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
public boolean canSpawnPlayerNpc(int mapid) {
Character chr = getPlayer();
return !YamlConfig.config.server.PLAYERNPC_AUTODEPLOY && chr.getLevel() >= chr.getMaxClassLevel() && !chr.isGM() && MaplePlayerNPC.canSpawnPlayerNpc(chr.getName(), mapid);
return !YamlConfig.config.server.PLAYERNPC_AUTODEPLOY && chr.getLevel() >= chr.getMaxClassLevel() && !chr.isGM() && PlayerNPC.canSpawnPlayerNpc(chr.getName(), mapid);
}
public MaplePlayerNPC getPlayerNPCByScriptid(int scriptId) {
public PlayerNPC getPlayerNPCByScriptid(int scriptId) {
for(MapleMapObject pnpcObj : getPlayer().getMap().getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC))) {
MaplePlayerNPC pn = (MaplePlayerNPC) pnpcObj;
PlayerNPC pn = (PlayerNPC) pnpcObj;
if(pn.getScriptId() == scriptId) {
return pn;

View File

@@ -39,7 +39,7 @@ public class MaplePlayerNPCFactory {
private static DataProvider npcData = DataProviderFactory.getDataProvider(WZFiles.NPC);
private static final Map<Integer, List<MaplePlayerNPC>> dnpcMaps = new HashMap<>();
private static final Map<Integer, List<PlayerNPC>> dnpcMaps = new HashMap<>();
private static Integer runningDeveloperOid = 2147483000; // 647 slots, long enough
public synchronized static boolean isExistentScriptid(int scriptid) {
@@ -97,13 +97,13 @@ public class MaplePlayerNPCFactory {
equips.put(equippos, equipid);
}
List<MaplePlayerNPC> dnpcSet = dnpcMaps.get(mapid);
List<PlayerNPC> dnpcSet = dnpcMaps.get(mapid);
if(dnpcSet == null) {
dnpcSet = new LinkedList<>();
dnpcMaps.put(mapid, dnpcSet);
}
dnpcSet.add(new MaplePlayerNPC(name, scriptId, face, hair, gender, skin, equips, dir, FH, RX0, RX1, CX, CY, runningDeveloperOid));
dnpcSet.add(new PlayerNPC(name, scriptId, face, hair, gender, skin, equips, dir, FH, RX0, RX1, CX, CY, runningDeveloperOid));
runningDeveloperOid++;
}
} else {
@@ -123,19 +123,19 @@ public class MaplePlayerNPCFactory {
equips.put((short) -7, 1072154);
equips.put((short) -5, 1040103);
List<MaplePlayerNPC> dnpcSet = dnpcMaps.get(mapid);
List<PlayerNPC> dnpcSet = dnpcMaps.get(mapid);
if(dnpcSet == null) {
dnpcSet = new LinkedList<>();
dnpcMaps.put(mapid, dnpcSet);
}
dnpcSet.add(new MaplePlayerNPC(name, scriptId, face, hair, gender, (byte) skin, equips, dir, FH, RX0, RX1, CX, CY, runningDeveloperOid));
dnpcSet.add(new PlayerNPC(name, scriptId, face, hair, gender, (byte) skin, equips, dir, FH, RX0, RX1, CX, CY, runningDeveloperOid));
runningDeveloperOid++;
}
}
}
public synchronized static List<MaplePlayerNPC> getDeveloperNpcsFromMapid(int mapid) {
public synchronized static List<PlayerNPC> getDeveloperNpcsFromMapid(int mapid) {
return dnpcMaps.get(mapid);
}
}

View File

@@ -47,11 +47,10 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
*
* @author XoticStory
* @author Ronan
*/
public class MaplePlayerNPC extends AbstractMapleMapObject {
public class PlayerNPC extends AbstractMapleMapObject {
private static final Map<Byte, List<Integer>> availablePlayerNpcScriptIds = new HashMap<>();
private static final AtomicInteger runningOverallRank = new AtomicInteger();
private static final List<AtomicInteger> runningWorldRank = new ArrayList<>();
@@ -68,7 +67,7 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
getRunningMetadata();
}
public MaplePlayerNPC(String name, int scriptId, int face, int hair, int gender, byte skin, Map<Short, Integer> equips, int dir, int FH, int RX0, int RX1, int CX, int CY, int oid) {
public PlayerNPC(String name, int scriptId, int face, int hair, int gender, byte skin, Map<Short, Integer> equips, int dir, int FH, int RX0, int RX1, int CX, int CY, int oid) {
this.equips = equips;
this.scriptId = scriptId;
this.face = face;
@@ -87,7 +86,7 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
setObjectId(oid);
}
public MaplePlayerNPC(ResultSet rs) {
public PlayerNPC(ResultSet rs) {
try {
CY = rs.getInt("cy");
name = rs.getString("name");
@@ -261,7 +260,7 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
private static int getAndIncrementRunningWorldJobRanks(int world, int job) {
AtomicInteger wjr = runningWorldJobRank.get(new Pair<>(world, job));
if(wjr == null) {
if (wjr == null) {
wjr = new AtomicInteger(1);
runningWorldJobRank.put(new Pair<>(world, job), wjr);
}
@@ -357,15 +356,15 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
private static int getNextScriptId(byte branch) {
List<Integer> availablesBranch = availablePlayerNpcScriptIds.get(branch);
if(availablesBranch == null) {
if (availablesBranch == null) {
availablesBranch = new ArrayList<>(20);
availablePlayerNpcScriptIds.put(branch, availablesBranch);
}
if(availablesBranch.isEmpty()) {
if (availablesBranch.isEmpty()) {
fetchAvailableScriptIdsFromDb(branch, availablesBranch);
if(availablesBranch.isEmpty()) {
if (availablesBranch.isEmpty()) {
return -1;
}
}
@@ -373,7 +372,7 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
return availablesBranch.remove(availablesBranch.size() - 1);
}
private static MaplePlayerNPC createPlayerNPCInternal(MapleMap map, Point pos, Character chr) {
private static PlayerNPC createPlayerNPCInternal(MapleMap map, Point pos, Character chr) {
int mapId = map.getId();
if (!canSpawnPlayerNpc(chr.getName(), mapId)) {
@@ -406,7 +405,7 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
int worldId = chr.getWorld();
int jobId = (chr.getJob().getId() / 100) * 100;
MaplePlayerNPC ret;
PlayerNPC ret;
try (Connection con = DatabaseConnection.getConnection()) {
boolean createNew = false;
try (PreparedStatement ps = con.prepareStatement("SELECT * FROM playernpcs WHERE scriptid = ?")) {
@@ -467,7 +466,7 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
try (ResultSet rs = ps.executeQuery()) {
rs.next();
ret = new MaplePlayerNPC(rs);
ret = new PlayerNPC(rs);
}
}
} else {
@@ -519,8 +518,8 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
return mapids;
}
private static synchronized Pair<MaplePlayerNPC, List<Integer>> processPlayerNPCInternal(MapleMap map, Point pos, Character chr, boolean create) {
if(create) {
private static synchronized Pair<PlayerNPC, List<Integer>> processPlayerNPCInternal(MapleMap map, Point pos, Character chr, boolean create) {
if (create) {
return new Pair<>(createPlayerNPCInternal(map, pos, chr), null);
} else {
return new Pair<>(null, removePlayerNPCInternal(map, chr));
@@ -532,10 +531,12 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
}
public static boolean spawnPlayerNPC(int mapid, Point pos, Character chr) {
if(chr == null) return false;
if (chr == null) {
return false;
}
MaplePlayerNPC pn = processPlayerNPCInternal(chr.getClient().getChannelServer().getMapFactory().getMap(mapid), pos, chr, true).getLeft();
if(pn != null) {
PlayerNPC pn = processPlayerNPCInternal(chr.getClient().getChannelServer().getMapFactory().getMap(mapid), pos, chr, true).getLeft();
if (pn != null) {
for (Channel channel : Server.getInstance().getChannelsFromWorld(chr.getWorld())) {
MapleMap m = channel.getMapFactory().getMap(mapid);
@@ -550,12 +551,12 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
}
}
private static MaplePlayerNPC getPlayerNPCFromWorldMap(String name, int world, int map) {
private static PlayerNPC getPlayerNPCFromWorldMap(String name, int world, int map) {
World wserv = Server.getInstance().getWorld(world);
for(MapleMapObject pnpcObj : wserv.getChannel(1).getMapFactory().getMap(map).getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC))) {
MaplePlayerNPC pn = (MaplePlayerNPC) pnpcObj;
for (MapleMapObject pnpcObj : wserv.getChannel(1).getMapFactory().getMap(map).getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC))) {
PlayerNPC pn = (PlayerNPC) pnpcObj;
if(name.contentEquals(pn.getName()) && pn.getScriptId() < 9977777) {
if (name.contentEquals(pn.getName()) && pn.getScriptId() < 9977777) {
return pn;
}
}
@@ -564,15 +565,17 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
}
public static void removePlayerNPC(Character chr) {
if(chr == null) return;
if (chr == null) {
return;
}
List<Integer> updateMapids = processPlayerNPCInternal(null, null, chr, false).getRight();
int worldid = updateMapids.remove(0);
for (Integer mapid : updateMapids) {
MaplePlayerNPC pn = getPlayerNPCFromWorldMap(chr.getName(), worldid, mapid);
PlayerNPC pn = getPlayerNPCFromWorldMap(chr.getName(), worldid, mapid);
if(pn != null) {
if (pn != null) {
for (Channel channel : Server.getInstance().getChannelsFromWorld(worldid)) {
MapleMap m = channel.getMapFactory().getMap(mapid);
m.removeMapObject(pn);
@@ -586,13 +589,15 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
public static void multicastSpawnPlayerNPC(int mapid, int world) {
World wserv = Server.getInstance().getWorld(world);
if (wserv == null) return;
if (wserv == null) {
return;
}
Client c = Client.createMock();
c.setWorld(world);
c.setChannel(1);
for(Character mc : wserv.loadAndGetAllCharactersView()) {
for (Character mc : wserv.loadAndGetAllCharactersView()) {
mc.setClient(c);
spawnPlayerNPC(mapid, mc);
}
@@ -613,7 +618,7 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
MapleMap m = channel.getMapFactory().getMap(map);
for (MapleMapObject pnpcObj : m.getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC))) {
MaplePlayerNPC pn = (MaplePlayerNPC) pnpcObj;
PlayerNPC pn = (PlayerNPC) pnpcObj;
m.removeMapObject(pnpcObj);
m.broadcastMessage(PacketCreator.removeNPCController(pn.getObjectId()));
m.broadcastMessage(PacketCreator.removePlayerNPC(pn.getObjectId()));

View File

@@ -22,7 +22,7 @@ package server.life.positioner;
import config.YamlConfig;
import net.server.Server;
import net.server.channel.Channel;
import server.life.MaplePlayerNPC;
import server.life.PlayerNPC;
import server.maps.MapleMap;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
@@ -63,9 +63,9 @@ public class PlayerNPCPodium {
return pos;
}
private static Point rearrangePlayerNpcs(MapleMap map, int newStep, List<MaplePlayerNPC> pnpcs) {
private static Point rearrangePlayerNpcs(MapleMap map, int newStep, List<PlayerNPC> pnpcs) {
int i = 0;
for (MaplePlayerNPC pn : pnpcs) {
for (PlayerNPC pn : pnpcs) {
pn.updatePlayerNPCPosition(map, calcNextPos(i, newStep));
i++;
}
@@ -79,9 +79,9 @@ public class PlayerNPCPodium {
System.out.println("Reorganizing pnpc map, step " + newStep);
}
List<MaplePlayerNPC> playerNpcs = new ArrayList<>(mmoList.size());
List<PlayerNPC> playerNpcs = new ArrayList<>(mmoList.size());
for (MapleMapObject mmo : mmoList) {
playerNpcs.add((MaplePlayerNPC) mmo);
playerNpcs.add((PlayerNPC) mmo);
}
playerNpcs.sort((p1, p2) -> {
@@ -91,7 +91,7 @@ public class PlayerNPCPodium {
for (Channel ch : Server.getInstance().getChannelsFromWorld(map.getWorld())) {
MapleMap m = ch.getMapFactory().getMap(map.getId());
for (MaplePlayerNPC pn : playerNpcs) {
for (PlayerNPC pn : playerNpcs) {
m.removeMapObject(pn);
m.broadcastMessage(PacketCreator.removeNPCController(pn.getObjectId()));
m.broadcastMessage(PacketCreator.removePlayerNPC(pn.getObjectId()));
@@ -103,7 +103,7 @@ public class PlayerNPCPodium {
for (Channel ch : Server.getInstance().getChannelsFromWorld(map.getWorld())) {
MapleMap m = ch.getMapFactory().getMap(map.getId());
for (MaplePlayerNPC pn : playerNpcs) {
for (PlayerNPC pn : playerNpcs) {
m.addPlayerNPCMapObject(pn);
m.broadcastMessage(PacketCreator.spawnPlayerNPC(pn));
m.broadcastMessage(PacketCreator.getPlayerNPC(pn));

View File

@@ -22,7 +22,7 @@ package server.life.positioner;
import config.YamlConfig;
import net.server.Server;
import net.server.channel.Channel;
import server.life.MaplePlayerNPC;
import server.life.PlayerNPC;
import server.maps.MapleMap;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
@@ -94,7 +94,7 @@ public class PlayerNPCPositioner {
return null;
}
private static Point rearrangePlayerNpcs(MapleMap map, int newStep, List<MaplePlayerNPC> pnpcs) {
private static Point rearrangePlayerNpcs(MapleMap map, int newStep, List<PlayerNPC> pnpcs) {
Rectangle mapArea = map.getMapArea();
int leftPx = mapArea.x + YamlConfig.config.server.PLAYERNPC_INITIAL_X, px, py = mapArea.y + YamlConfig.config.server.PLAYERNPC_INITIAL_Y;
@@ -115,7 +115,7 @@ public class PlayerNPCPositioner {
return searchPos;
}
MaplePlayerNPC pn = pnpcs.get(i);
PlayerNPC pn = pnpcs.get(i);
i++;
pn.updatePlayerNPCPosition(map, searchPos);
@@ -138,9 +138,9 @@ public class PlayerNPCPositioner {
System.out.println("Reorganizing pnpc map, step " + newStep);
}
List<MaplePlayerNPC> playerNpcs = new ArrayList<>(mmoList.size());
List<PlayerNPC> playerNpcs = new ArrayList<>(mmoList.size());
for (MapleMapObject mmo : mmoList) {
playerNpcs.add((MaplePlayerNPC) mmo);
playerNpcs.add((PlayerNPC) mmo);
}
playerNpcs.sort((p1, p2) -> {
@@ -150,7 +150,7 @@ public class PlayerNPCPositioner {
for (Channel ch : Server.getInstance().getChannelsFromWorld(map.getWorld())) {
MapleMap m = ch.getMapFactory().getMap(map.getId());
for (MaplePlayerNPC pn : playerNpcs) {
for (PlayerNPC pn : playerNpcs) {
m.removeMapObject(pn);
m.broadcastMessage(PacketCreator.removeNPCController(pn.getObjectId()));
m.broadcastMessage(PacketCreator.removePlayerNPC(pn.getObjectId()));
@@ -162,7 +162,7 @@ public class PlayerNPCPositioner {
for (Channel ch : Server.getInstance().getChannelsFromWorld(map.getWorld())) {
MapleMap m = ch.getMapFactory().getMap(map.getId());
for (MaplePlayerNPC pn : playerNpcs) {
for (PlayerNPC pn : playerNpcs) {
m.addPlayerNPCMapObject(pn);
m.broadcastMessage(PacketCreator.spawnPlayerNPC(pn));
m.broadcastMessage(PacketCreator.getPlayerNPC(pn));

View File

@@ -352,7 +352,7 @@ public class MapleMap {
return -1;
}
public void addPlayerNPCMapObject(MaplePlayerNPC pnpcobject) {
public void addPlayerNPCMapObject(PlayerNPC pnpcobject) {
objectWLock.lock();
try {
this.mapobjects.put(pnpcobject.getObjectId(), pnpcobject);

View File

@@ -242,16 +242,16 @@ public class MapleMapFactory {
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
map.addPlayerNPCMapObject(new MaplePlayerNPC(rs));
map.addPlayerNPCMapObject(new PlayerNPC(rs));
}
}
} catch (SQLException e) {
e.printStackTrace();
}
List<MaplePlayerNPC> dnpcs = MaplePlayerNPCFactory.getDeveloperNpcsFromMapid(mapid);
List<PlayerNPC> dnpcs = MaplePlayerNPCFactory.getDeveloperNpcsFromMapid(mapid);
if (dnpcs != null) {
for (MaplePlayerNPC dnpc : dnpcs) {
for (PlayerNPC dnpc : dnpcs) {
map.addPlayerNPCMapObject(dnpc);
}
}

View File

@@ -61,10 +61,10 @@ import server.CashShop.CashItemFactory;
import server.CashShop.SpecialCashItem;
import server.*;
import server.events.gm.Snowball;
import server.life.MaplePlayerNPC;
import server.life.MobSkill;
import server.life.Monster;
import server.life.NPC;
import server.life.PlayerNPC;
import server.maps.*;
import server.maps.MapleMiniGame.MiniGameResult;
import server.movement.LifeMovementFragment;
@@ -5234,7 +5234,7 @@ public class PacketCreator {
return p;
}
public static Packet spawnPlayerNPC(MaplePlayerNPC npc) {
public static Packet spawnPlayerNPC(PlayerNPC npc) {
final OutPacket p = OutPacket.create(SendOpcode.SPAWN_NPC_REQUEST_CONTROLLER);
p.writeByte(1);
p.writeInt(npc.getObjectId());
@@ -5249,7 +5249,7 @@ public class PacketCreator {
return p;
}
public static Packet getPlayerNPC(MaplePlayerNPC npc) { // thanks to Arnah
public static Packet getPlayerNPC(PlayerNPC npc) { // thanks to Arnah
final OutPacket p = OutPacket.create(SendOpcode.IMITATED_NPC_DATA);
p.writeByte(0x01);
p.writeInt(npc.getScriptId());