Rename and clean up MapleMapObjectType

This commit is contained in:
P0nk
2021-09-09 22:31:05 +02:00
parent a979577e5d
commit fa8222d9a0
35 changed files with 132 additions and 119 deletions

View File

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

View File

@@ -47,8 +47,8 @@ import server.TimerManager;
import server.life.LifeFactory.BanishInfo;
import server.loot.LootManager;
import server.maps.AbstractAnimatedMapObject;
import server.maps.MapObjectType;
import server.maps.MapleMap;
import server.maps.MapleMapObjectType;
import server.maps.MapleSummon;
import tools.IntervalBuilder;
import tools.PacketCreator;
@@ -1042,8 +1042,8 @@ public class Monster extends AbstractLoadedLife {
}
@Override
public MapleMapObjectType getType() {
return MapleMapObjectType.MONSTER;
public MapObjectType getType() {
return MapObjectType.MONSTER;
}
public boolean isMobile() {

View File

@@ -23,7 +23,7 @@ package server.life;
import client.Client;
import server.MapleShopFactory;
import server.maps.MapleMapObjectType;
import server.maps.MapObjectType;
import tools.PacketCreator;
public class NPC extends AbstractLoadedLife {
@@ -55,8 +55,8 @@ public class NPC extends AbstractLoadedLife {
}
@Override
public MapleMapObjectType getType() {
return MapleMapObjectType.NPC;
public MapObjectType getType() {
return MapObjectType.NPC;
}
public String getName() {

View File

@@ -34,8 +34,8 @@ import server.life.positioner.PlayerNPCPodium;
import server.life.positioner.PlayerNPCPositioner;
import server.maps.AbstractMapObject;
import server.maps.MapObject;
import server.maps.MapObjectType;
import server.maps.MapleMap;
import server.maps.MapleMapObjectType;
import tools.DatabaseConnection;
import tools.PacketCreator;
import tools.Pair;
@@ -193,8 +193,8 @@ public class PlayerNPC extends AbstractMapObject {
}
@Override
public MapleMapObjectType getType() {
return MapleMapObjectType.PLAYER_NPC;
public MapObjectType getType() {
return MapObjectType.PLAYER_NPC;
}
@Override
@@ -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 (MapObject 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(MapObjectType.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 (MapObject 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(MapObjectType.PLAYER_NPC))) {
PlayerNPC pn = (PlayerNPC) pnpcObj;
m.removeMapObject(pnpcObj);
m.broadcastMessage(PacketCreator.removeNPCController(pn.getObjectId()));

View File

@@ -24,8 +24,8 @@ import net.server.Server;
import net.server.channel.Channel;
import server.life.PlayerNPC;
import server.maps.MapObject;
import server.maps.MapObjectType;
import server.maps.MapleMap;
import server.maps.MapleMapObjectType;
import tools.PacketCreator;
import java.awt.*;
@@ -128,7 +128,7 @@ public class PlayerNPCPodium {
return null;
}
List<MapObject> 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(MapObjectType.PLAYER_NPC));
map.getWorldServer().setPlayerNpcMapPodiumData(map.getId(), encodePodiumData(podiumStep + 1, podiumCount + 1));
return reorganizePlayerNpcs(map, podiumStep + 1, mmoList);
} else {

View File

@@ -24,8 +24,8 @@ import net.server.Server;
import net.server.channel.Channel;
import server.life.PlayerNPC;
import server.maps.MapObject;
import server.maps.MapObjectType;
import server.maps.MapleMap;
import server.maps.MapleMapObjectType;
import tools.PacketCreator;
import java.awt.*;
@@ -176,7 +176,7 @@ public class PlayerNPCPositioner {
}
private static Point getNextPlayerNpcPosition(MapleMap map, int initStep) { // automated playernpc position thanks to Ronan
List<MapObject> 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(MapObjectType.PLAYER_NPC));
List<Point> otherPlayerNpcs = new LinkedList<>();
for (MapObject mmo : mmoList) {
otherPlayerNpcs.add(mmo.getPosition());