Rename and clean up MapleMapObject

This commit is contained in:
P0nk
2021-09-09 22:29:01 +02:00
parent e917980a39
commit a979577e5d
33 changed files with 185 additions and 185 deletions

View File

@@ -27,8 +27,8 @@ import client.status.MonsterStatus;
import constants.game.GameConstants;
import net.server.services.task.channel.OverallService;
import net.server.services.type.ChannelServices;
import server.maps.MapObject;
import server.maps.MapleMap;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
import server.maps.MapleMist;
import tools.ArrayMap;
@@ -144,9 +144,9 @@ public class MobSkill {
break;
case 114:
if (lt != null && rb != null && skill) {
List<MapleMapObject> objects = getObjectsInRange(monster, MapleMapObjectType.MONSTER);
List<MapObject> objects = getObjectsInRange(monster, MapleMapObjectType.MONSTER);
final int hps = (getX() / 1000) * (int) (950 + 1050 * Math.random());
for (MapleMapObject mons : objects) {
for (MapObject mons : objects) {
((Monster) mons).heal(hps, getY());
}
} else {
@@ -317,7 +317,7 @@ public class MobSkill {
}
if (stats.size() > 0) {
if (lt != null && rb != null && skill) {
for (MapleMapObject mons : getObjectsInRange(monster, MapleMapObjectType.MONSTER)) {
for (MapObject mons : getObjectsInRange(monster, MapleMapObjectType.MONSTER)) {
((Monster) mons).applyMonsterBuff(stats, getX(), getSkillId(), getDuration(), this, reflection);
}
} else {
@@ -412,7 +412,7 @@ public class MobSkill {
return bounds;
}
private List<MapleMapObject> getObjectsInRange(Monster monster, MapleMapObjectType objectType) {
private List<MapObject> getObjectsInRange(Monster monster, MapleMapObjectType objectType) {
return monster.getMap().getMapObjectsInBox(calculateBoundingBox(monster.getPosition()), Collections.singletonList(objectType));
}
}

View File

@@ -33,8 +33,8 @@ import net.server.world.World;
import server.life.positioner.PlayerNPCPodium;
import server.life.positioner.PlayerNPCPositioner;
import server.maps.AbstractMapObject;
import server.maps.MapObject;
import server.maps.MapleMap;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
import tools.DatabaseConnection;
import tools.PacketCreator;
@@ -553,7 +553,7 @@ public class PlayerNPC extends AbstractMapObject {
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))) {
for (MapObject 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) {
@@ -617,7 +617,7 @@ public class PlayerNPC extends AbstractMapObject {
for (Channel channel : Server.getInstance().getChannelsFromWorld(world)) {
MapleMap m = channel.getMapFactory().getMap(map);
for (MapleMapObject pnpcObj : m.getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC))) {
for (MapObject pnpcObj : m.getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC))) {
PlayerNPC pn = (PlayerNPC) pnpcObj;
m.removeMapObject(pnpcObj);
m.broadcastMessage(PacketCreator.removeNPCController(pn.getObjectId()));

View File

@@ -23,8 +23,8 @@ import config.YamlConfig;
import net.server.Server;
import net.server.channel.Channel;
import server.life.PlayerNPC;
import server.maps.MapObject;
import server.maps.MapleMap;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
import tools.PacketCreator;
@@ -73,14 +73,14 @@ public class PlayerNPCPodium {
return calcNextPos(i, newStep);
}
private static Point reorganizePlayerNpcs(MapleMap map, int newStep, List<MapleMapObject> mmoList) {
private static Point reorganizePlayerNpcs(MapleMap map, int newStep, List<MapObject> mmoList) {
if (!mmoList.isEmpty()) {
if (YamlConfig.config.server.USE_DEBUG) {
System.out.println("Reorganizing pnpc map, step " + newStep);
}
List<PlayerNPC> playerNpcs = new ArrayList<>(mmoList.size());
for (MapleMapObject mmo : mmoList) {
for (MapObject mmo : mmoList) {
playerNpcs.add((PlayerNPC) mmo);
}
@@ -128,7 +128,7 @@ public class PlayerNPCPodium {
return null;
}
List<MapleMapObject> mmoList = map.getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC));
List<MapObject> mmoList = map.getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC));
map.getWorldServer().setPlayerNpcMapPodiumData(map.getId(), encodePodiumData(podiumStep + 1, podiumCount + 1));
return reorganizePlayerNpcs(map, podiumStep + 1, mmoList);
} else {

View File

@@ -23,8 +23,8 @@ import config.YamlConfig;
import net.server.Server;
import net.server.channel.Channel;
import server.life.PlayerNPC;
import server.maps.MapObject;
import server.maps.MapleMap;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
import tools.PacketCreator;
@@ -132,14 +132,14 @@ public class PlayerNPCPositioner {
return null; // this area should not be reached under any scenario
}
private static Point reorganizePlayerNpcs(MapleMap map, int newStep, List<MapleMapObject> mmoList) {
private static Point reorganizePlayerNpcs(MapleMap map, int newStep, List<MapObject> mmoList) {
if (!mmoList.isEmpty()) {
if (YamlConfig.config.server.USE_DEBUG) {
System.out.println("Reorganizing pnpc map, step " + newStep);
}
List<PlayerNPC> playerNpcs = new ArrayList<>(mmoList.size());
for (MapleMapObject mmo : mmoList) {
for (MapObject mmo : mmoList) {
playerNpcs.add((PlayerNPC) mmo);
}
@@ -176,9 +176,9 @@ public class PlayerNPCPositioner {
}
private static Point getNextPlayerNpcPosition(MapleMap map, int initStep) { // automated playernpc position thanks to Ronan
List<MapleMapObject> mmoList = map.getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC));
List<MapObject> mmoList = map.getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC));
List<Point> otherPlayerNpcs = new LinkedList<>();
for (MapleMapObject mmo : mmoList) {
for (MapObject mmo : mmoList) {
otherPlayerNpcs.add(mmo.getPosition());
}