Rename and clean up MapleNPC

This commit is contained in:
P0nk
2021-09-09 22:09:31 +02:00
parent 3aa455a757
commit e48c25a200
11 changed files with 29 additions and 29 deletions

View File

@@ -284,8 +284,8 @@ public class LifeFactory {
}
}
public static MapleNPC getNPC(int nid) {
return new MapleNPC(nid, new MapleNPCStats(DataTool.getString(nid + "/name", npcStringData, "MISSINGNO")));
public static NPC getNPC(int nid) {
return new NPC(nid, new MapleNPCStats(DataTool.getString(nid + "/name", npcStringData, "MISSINGNO")));
}
public static String getNPCDefaultTalk(int nid) {

View File

@@ -26,10 +26,10 @@ import server.MapleShopFactory;
import server.maps.MapleMapObjectType;
import tools.PacketCreator;
public class MapleNPC extends AbstractLoadedLife {
public class NPC extends AbstractLoadedLife {
private final MapleNPCStats stats;
public MapleNPC(int id, MapleNPCStats stats) {
public NPC(int id, MapleNPCStats stats) {
super(id);
this.stats = stats;
}

View File

@@ -1684,10 +1684,10 @@ public class MapleMap {
}
}
public MapleNPC getNPCById(int id) {
public NPC getNPCById(int id) {
for (MapleMapObject obj : getMapObjects()) {
if (obj.getType() == MapleMapObjectType.NPC) {
MapleNPC npc = (MapleNPC) obj;
NPC npc = (NPC) obj;
if (npc.getId() == id) {
return npc;
}
@@ -1702,7 +1702,7 @@ public class MapleMap {
try {
for (MapleMapObject obj : mapobjects.values()) {
if (obj.getType() == MapleMapObjectType.NPC) {
if (((MapleNPC) obj).getId() == npcid) {
if (((NPC) obj).getId() == npcid) {
return true;
}
}
@@ -1720,7 +1720,7 @@ public class MapleMap {
objectWLock.lock();
try {
for (MapleMapObject obj : npcs) {
if (((MapleNPC) obj).getId() == npcid) {
if (((NPC) obj).getId() == npcid) {
broadcastMessage(PacketCreator.removeNPCController(obj.getObjectId()));
broadcastMessage(PacketCreator.removeNPC(obj.getObjectId()));
@@ -3965,7 +3965,7 @@ public class MapleMap {
try {
for (MapleMapObject obj : mapobjects.values()) {
if (obj.getType() == MapleMapObjectType.NPC) {
MapleNPC npc = (MapleNPC) obj;
NPC npc = (NPC) obj;
if (npc.getId() == id) {
npc.setHide(!npc.isHidden());
if (!npc.isHidden()) //Should only be hidden upon changing maps