Rename and clean up MapleMapObjectType
This commit is contained in:
@@ -10065,8 +10065,8 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.PLAYER;
|
||||
public MapObjectType getType() {
|
||||
return MapObjectType.PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ import client.Client;
|
||||
import client.command.Command;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapObjectType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -40,7 +40,7 @@ public class LootCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
List<MapObject> items = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
List<MapObject> items = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM));
|
||||
for (MapObject item : items) {
|
||||
MapItem mapItem = (MapItem) item;
|
||||
if (mapItem.getOwnerId() == c.getPlayer().getId() || mapItem.getOwnerId() == c.getPlayer().getPartyId()) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import client.command.Command;
|
||||
import server.life.MobSkill;
|
||||
import server.life.MobSkillFactory;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapObjectType;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -107,7 +107,7 @@ public class DebuffCommand extends Command {
|
||||
return;
|
||||
}
|
||||
|
||||
for (MapObject mmo : player.getMap().getMapObjectsInRange(player.getPosition(), 777777.7, Arrays.asList(MapleMapObjectType.PLAYER))) {
|
||||
for (MapObject mmo : player.getMap().getMapObjectsInRange(player.getPosition(), 777777.7, Arrays.asList(MapObjectType.PLAYER))) {
|
||||
Character chr = (Character) mmo;
|
||||
|
||||
if (chr.getId() != player.getId()) {
|
||||
|
||||
@@ -28,8 +28,8 @@ import client.Client;
|
||||
import client.command.Command;
|
||||
import server.life.Monster;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapObjectType;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObjectType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -43,7 +43,7 @@ public class KillAllCommand extends Command {
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
MapleMap map = player.getMap();
|
||||
List<MapObject> monsters = map.getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
List<MapObject> monsters = map.getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER));
|
||||
int count = 0;
|
||||
for (MapObject monstermo : monsters) {
|
||||
Monster monster = (Monster) monstermo;
|
||||
|
||||
@@ -30,7 +30,7 @@ import client.inventory.Pet;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapObjectType;
|
||||
import tools.PacketCreator;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -44,7 +44,7 @@ public class ForceVacCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
List<MapObject> items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
List<MapObject> items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM));
|
||||
for (MapObject item : items) {
|
||||
MapItem mapItem = (MapItem) item;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapObjectType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -40,7 +40,7 @@ public class ItemVacCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
List<MapObject> list = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
List<MapObject> list = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM));
|
||||
for (MapObject item : list) {
|
||||
player.pickupItem(item);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import server.TimerManager;
|
||||
import server.life.Monster;
|
||||
import server.life.SpawnPoint;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapObjectType;
|
||||
import server.maps.MaplePortal;
|
||||
import server.maps.MapleReactor;
|
||||
|
||||
@@ -67,7 +67,7 @@ public class DebugCommand extends Command {
|
||||
break;
|
||||
|
||||
case "monster":
|
||||
List<MapObject> monsters = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
List<MapObject> monsters = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER));
|
||||
for (MapObject monstermo : monsters) {
|
||||
Monster monster = (Monster) monstermo;
|
||||
Character controller = monster.getController();
|
||||
|
||||
@@ -38,8 +38,8 @@ import server.TimerManager;
|
||||
import server.life.*;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapObjectType;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
import tools.Randomizer;
|
||||
@@ -152,7 +152,7 @@ public abstract class AbstractDealDamageHandler extends AbstractPacketHandler {
|
||||
int delay = 0;
|
||||
for (Integer oned : attack.allDamage.keySet()) {
|
||||
MapObject mapobject = map.getMapObject(oned);
|
||||
if (mapobject != null && mapobject.getType() == MapleMapObjectType.ITEM) {
|
||||
if (mapobject != null && mapobject.getType() == MapObjectType.ITEM) {
|
||||
final MapItem mapitem = (MapItem) mapobject;
|
||||
if (mapitem.getMeso() == 0) { //Maybe it is possible some how?
|
||||
return;
|
||||
@@ -178,7 +178,7 @@ public abstract class AbstractDealDamageHandler extends AbstractPacketHandler {
|
||||
} finally {
|
||||
mapitem.unlockItem();
|
||||
}
|
||||
} else if (mapobject != null && mapobject.getType() != MapleMapObjectType.MONSTER) {
|
||||
} else if (mapobject != null && mapobject.getType() != MapObjectType.MONSTER) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import server.MapleItemInformationProvider;
|
||||
import server.life.LifeFactory;
|
||||
import server.life.Monster;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapObjectType;
|
||||
import server.quest.MapleQuest;
|
||||
import tools.PacketCreator;
|
||||
import tools.Randomizer;
|
||||
@@ -126,7 +126,7 @@ public final class AdminCommandHandler extends AbstractPacketHandler {
|
||||
case 0x15: // Kill
|
||||
int mobToKill = p.readInt();
|
||||
int amount = p.readInt();
|
||||
List<MapObject> monsterx = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
List<MapObject> monsterx = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER));
|
||||
for (int x = 0; x < amount; x++) {
|
||||
Monster monster = (Monster) monsterx.get(x);
|
||||
if (monster.getId() == mobToKill) {
|
||||
@@ -147,7 +147,7 @@ public final class AdminCommandHandler extends AbstractPacketHandler {
|
||||
case 0x18: // Maple & Mobhp
|
||||
int mobHp = p.readInt();
|
||||
c.getPlayer().dropMessage("Monsters HP");
|
||||
List<MapObject> monsters = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
List<MapObject> monsters = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER));
|
||||
for (MapObject mobs : monsters) {
|
||||
Monster monster = (Monster) mobs;
|
||||
if (monster.getId() == mobHp) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import constants.game.GameConstants;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapObjectType;
|
||||
import server.maps.MaplePlayerShop;
|
||||
import server.maps.MaplePortal;
|
||||
import tools.PacketCreator;
|
||||
@@ -47,7 +47,7 @@ public final class HiredMerchantRequest extends AbstractPacketHandler {
|
||||
Character chr = c.getPlayer();
|
||||
|
||||
try {
|
||||
for (MapObject mmo : chr.getMap().getMapObjectsInRange(chr.getPosition(), 23000, Arrays.asList(MapleMapObjectType.HIRED_MERCHANT, MapleMapObjectType.PLAYER))) {
|
||||
for (MapObject mmo : chr.getMap().getMapObjectsInRange(chr.getPosition(), 23000, Arrays.asList(MapObjectType.HIRED_MERCHANT, MapObjectType.PLAYER))) {
|
||||
if (mmo instanceof Character) {
|
||||
Character mc = (Character) mmo;
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ import server.life.MobSkillFactory;
|
||||
import server.life.Monster;
|
||||
import server.life.MonsterInformationProvider;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapObjectType;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
import tools.Randomizer;
|
||||
@@ -60,7 +60,7 @@ public final class MoveLifeHandler extends AbstractMovementPacketHandler {
|
||||
int objectid = p.readInt();
|
||||
short moveid = p.readShort();
|
||||
MapObject mmo = map.getMapObject(objectid);
|
||||
if (mmo == null || mmo.getType() != MapleMapObjectType.MONSTER) {
|
||||
if (mmo == null || mmo.getType() != MapObjectType.MONSTER) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -795,7 +795,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
|
||||
private static boolean canPlaceStore(Character chr) {
|
||||
try {
|
||||
for (MapObject mmo : chr.getMap().getMapObjectsInRange(chr.getPosition(), 23000, Arrays.asList(MapleMapObjectType.HIRED_MERCHANT, MapleMapObjectType.PLAYER))) {
|
||||
for (MapObject mmo : chr.getMap().getMapObjectsInRange(chr.getPosition(), 23000, Arrays.asList(MapObjectType.HIRED_MERCHANT, MapObjectType.PLAYER))) {
|
||||
if (mmo instanceof Character) {
|
||||
Character mc = (Character) mmo;
|
||||
if (mc.getId() == chr.getId()) {
|
||||
|
||||
@@ -43,8 +43,8 @@ import server.expeditions.ExpeditionBossLog;
|
||||
import server.expeditions.ExpeditionType;
|
||||
import server.life.*;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapObjectType;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.partyquest.PartyQuest;
|
||||
import server.partyquest.Pyramid;
|
||||
import server.quest.MapleQuest;
|
||||
@@ -897,7 +897,7 @@ public class AbstractPlayerInteraction {
|
||||
public void resetMap(int mapid) {
|
||||
getMap(mapid).resetReactors();
|
||||
getMap(mapid).killAllMonsters();
|
||||
for (MapObject i : getMap(mapid).getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM))) {
|
||||
for (MapObject i : getMap(mapid).getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM))) {
|
||||
getMap(mapid).removeMapObject(i);
|
||||
getMap(mapid).broadcastMessage(PacketCreator.removeItemFromMap(i.getObjectId(), 0, c.getPlayer().getId()));
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ import server.life.LifeFactory;
|
||||
import server.life.PlayerNPC;
|
||||
import server.maps.MapManager;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapObjectType;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.partyquest.AriantColiseum;
|
||||
import server.partyquest.MonsterCarnival;
|
||||
import server.partyquest.Pyramid;
|
||||
@@ -315,7 +315,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public PlayerNPC getPlayerNPCByScriptid(int scriptId) {
|
||||
for(MapObject pnpcObj : getPlayer().getMap().getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC))) {
|
||||
for(MapObject pnpcObj : getPlayer().getMap().getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.PLAYER_NPC))) {
|
||||
PlayerNPC pn = (PlayerNPC) pnpcObj;
|
||||
|
||||
if(pn.getScriptId() == scriptId) {
|
||||
|
||||
@@ -819,7 +819,7 @@ public class MapleStatEffect {
|
||||
case FPWizard.MP_EATER:
|
||||
case ILWizard.MP_EATER:
|
||||
case Cleric.MP_EATER:
|
||||
if (obj == null || obj.getType() != MapleMapObjectType.MONSTER) {
|
||||
if (obj == null || obj.getType() != MapObjectType.MONSTER) {
|
||||
return;
|
||||
}
|
||||
Monster mob = (Monster) obj; // x is absorb percentage
|
||||
@@ -1090,7 +1090,7 @@ public class MapleStatEffect {
|
||||
|
||||
if (isPartyBuff() && (applyfrom.getParty() != null || isGmBuff())) {
|
||||
Rectangle bounds = (!useMaxRange) ? calculateBoundingBox(applyfrom.getPosition(), applyfrom.isFacingLeft()) : new Rectangle(Integer.MIN_VALUE / 2, Integer.MIN_VALUE / 2, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
List<MapObject> affecteds = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapleMapObjectType.PLAYER));
|
||||
List<MapObject> affecteds = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapObjectType.PLAYER));
|
||||
List<Character> affectedp = new ArrayList<>(affecteds.size());
|
||||
for (MapObject affectedmo : affecteds) {
|
||||
Character affected = (Character) affectedmo;
|
||||
@@ -1120,7 +1120,7 @@ public class MapleStatEffect {
|
||||
|
||||
private void applyMonsterBuff(Character applyfrom) {
|
||||
Rectangle bounds = calculateBoundingBox(applyfrom.getPosition(), applyfrom.isFacingLeft());
|
||||
List<MapObject> affected = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
List<MapObject> affected = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapObjectType.MONSTER));
|
||||
Skill skill_ = SkillFactory.getSkill(sourceid);
|
||||
int i = 0;
|
||||
for (MapObject mo : affected) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -28,7 +28,7 @@ public abstract class AbstractMapObject implements MapObject {
|
||||
private int objectId;
|
||||
|
||||
@Override
|
||||
public abstract MapleMapObjectType getType();
|
||||
public abstract MapObjectType getType();
|
||||
|
||||
@Override
|
||||
public Point getPosition() {
|
||||
|
||||
@@ -182,7 +182,7 @@ public class DoorObject extends AbstractMapObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.DOOR;
|
||||
public MapObjectType getType() {
|
||||
return MapObjectType.DOOR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ public class Dragon extends AbstractAnimatedMapObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.DRAGON;
|
||||
public MapObjectType getType() {
|
||||
return MapObjectType.DRAGON;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -713,8 +713,8 @@ public class HiredMerchant extends AbstractMapObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.HIRED_MERCHANT;
|
||||
public MapObjectType getType() {
|
||||
return MapObjectType.HIRED_MERCHANT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,8 +23,8 @@ public class Kite extends AbstractMapObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.KITE;
|
||||
public MapObjectType getType() {
|
||||
return MapObjectType.KITE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -196,8 +196,8 @@ public class MapItem extends AbstractMapObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.ITEM;
|
||||
public final MapObjectType getType() {
|
||||
return MapObjectType.ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.awt.*;
|
||||
public interface MapObject {
|
||||
int getObjectId();
|
||||
void setObjectId(int id);
|
||||
MapleMapObjectType getType();
|
||||
MapObjectType getType();
|
||||
Point getPosition();
|
||||
void setPosition(Point position);
|
||||
void sendSpawnData(Client client);
|
||||
|
||||
@@ -21,6 +21,19 @@
|
||||
*/
|
||||
package server.maps;
|
||||
|
||||
public enum MapleMapObjectType {
|
||||
NPC, MONSTER, ITEM, PLAYER, DOOR, SUMMON, SHOP, MINI_GAME, MIST, REACTOR, HIRED_MERCHANT, PLAYER_NPC, DRAGON, KITE
|
||||
public enum MapObjectType {
|
||||
NPC,
|
||||
MONSTER,
|
||||
ITEM,
|
||||
PLAYER,
|
||||
DOOR,
|
||||
SUMMON,
|
||||
SHOP,
|
||||
MINI_GAME,
|
||||
MIST,
|
||||
REACTOR,
|
||||
HIRED_MERCHANT,
|
||||
PLAYER_NPC,
|
||||
DRAGON,
|
||||
KITE
|
||||
}
|
||||
@@ -79,7 +79,7 @@ import java.util.function.Predicate;
|
||||
|
||||
public class MapleMap {
|
||||
|
||||
private static final List<MapleMapObjectType> rangedMapobjectTypes = Arrays.asList(MapleMapObjectType.SHOP, MapleMapObjectType.ITEM, MapleMapObjectType.NPC, MapleMapObjectType.MONSTER, MapleMapObjectType.DOOR, MapleMapObjectType.SUMMON, MapleMapObjectType.REACTOR);
|
||||
private static final List<MapObjectType> rangedMapobjectTypes = Arrays.asList(MapObjectType.SHOP, MapObjectType.ITEM, MapObjectType.NPC, MapObjectType.MONSTER, MapObjectType.DOOR, MapObjectType.SUMMON, MapObjectType.REACTOR);
|
||||
private static final Map<Integer, Pair<Integer, Integer>> dropBoundsCache = new HashMap<>(100);
|
||||
|
||||
private final Map<Integer, MapObject> mapobjects = new LinkedHashMap<>();
|
||||
@@ -230,7 +230,7 @@ public class MapleMap {
|
||||
return YamlConfig.config.server.USE_MAXRANGE ? Double.POSITIVE_INFINITY : 722500;
|
||||
}
|
||||
|
||||
public List<MapObject> getMapObjectsInRect(Rectangle box, List<MapleMapObjectType> types) {
|
||||
public List<MapObject> getMapObjectsInRect(Rectangle box, List<MapObjectType> types) {
|
||||
objectRLock.lock();
|
||||
final List<MapObject> ret = new LinkedList<>();
|
||||
try {
|
||||
@@ -296,7 +296,7 @@ public class MapleMap {
|
||||
|
||||
public void setReactorState() {
|
||||
for (MapObject o : getMapObjects()) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (o.getType() == MapObjectType.REACTOR) {
|
||||
if (((MapleReactor) o).getState() < 1) {
|
||||
MapleReactor mr = (MapleReactor) o;
|
||||
mr.lockReactor();
|
||||
@@ -1159,7 +1159,7 @@ public class MapleMap {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.MONSTER) {
|
||||
if (obj.getType() == MapObjectType.MONSTER) {
|
||||
if (((Monster) obj).getId() == id) {
|
||||
return (Monster) obj;
|
||||
}
|
||||
@@ -1177,7 +1177,7 @@ public class MapleMap {
|
||||
|
||||
public int countMonster(int minid, int maxid) {
|
||||
int count = 0;
|
||||
for (MapObject m : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER))) {
|
||||
for (MapObject m : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER))) {
|
||||
Monster mob = (Monster) m;
|
||||
if (mob.getId() >= minid && mob.getId() <= maxid) {
|
||||
count++;
|
||||
@@ -1187,19 +1187,19 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public int countMonsters() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER)).size();
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER)).size();
|
||||
}
|
||||
|
||||
public int countReactors() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR)).size();
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.REACTOR)).size();
|
||||
}
|
||||
|
||||
public final List<MapObject> getReactors() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR));
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.REACTOR));
|
||||
}
|
||||
|
||||
public final List<MapObject> getMonsters() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER));
|
||||
}
|
||||
|
||||
public final List<MapleReactor> getAllReactors() {
|
||||
@@ -1221,19 +1221,19 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public int countItems() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)).size();
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM)).size();
|
||||
}
|
||||
|
||||
public final List<MapObject> getItems() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM));
|
||||
}
|
||||
|
||||
public int countPlayers() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER)).size();
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.PLAYER)).size();
|
||||
}
|
||||
|
||||
public List<MapObject> getPlayers() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER));
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.PLAYER));
|
||||
}
|
||||
|
||||
public List<Character> getAllPlayers() {
|
||||
@@ -1499,7 +1499,7 @@ public class MapleMap {
|
||||
public void softKillAllMonsters() {
|
||||
closeMapSpawnPoints();
|
||||
|
||||
for (MapObject monstermo : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER))) {
|
||||
for (MapObject monstermo : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER))) {
|
||||
Monster monster = (Monster) monstermo;
|
||||
if (monster.getStats().isFriendly()) {
|
||||
continue;
|
||||
@@ -1514,7 +1514,7 @@ public class MapleMap {
|
||||
public void killAllMonstersNotFriendly() {
|
||||
closeMapSpawnPoints();
|
||||
|
||||
for (MapObject monstermo : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER))) {
|
||||
for (MapObject monstermo : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER))) {
|
||||
Monster monster = (Monster) monstermo;
|
||||
if (monster.getStats().isFriendly()) {
|
||||
continue;
|
||||
@@ -1527,7 +1527,7 @@ public class MapleMap {
|
||||
public void killAllMonsters() {
|
||||
closeMapSpawnPoints();
|
||||
|
||||
for (MapObject monstermo : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER))) {
|
||||
for (MapObject monstermo : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.MONSTER))) {
|
||||
Monster monster = (Monster) monstermo;
|
||||
|
||||
killMonster(monster, null, false, 1);
|
||||
@@ -1566,7 +1566,7 @@ public class MapleMap {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapObject o : mapobjects.values()) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (o.getType() == MapObjectType.REACTOR) {
|
||||
final MapleReactor r = ((MapleReactor) o);
|
||||
list.add(r);
|
||||
}
|
||||
@@ -1600,13 +1600,13 @@ public class MapleMap {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapObject o : mapobjects.values()) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (o.getType() == MapObjectType.REACTOR) {
|
||||
points.add(o.getPosition());
|
||||
}
|
||||
}
|
||||
Collections.shuffle(points);
|
||||
for (MapObject o : mapobjects.values()) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (o.getType() == MapObjectType.REACTOR) {
|
||||
o.setPosition(points.remove(points.size() - 1));
|
||||
}
|
||||
}
|
||||
@@ -1645,7 +1645,7 @@ public class MapleMap {
|
||||
if (ob instanceof MapObject) {
|
||||
MapObject mmo = (MapObject) ob;
|
||||
|
||||
if (mapobjects.containsValue(mmo) && mmo.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (mapobjects.containsValue(mmo) && mmo.getType() == MapObjectType.REACTOR) {
|
||||
listObjects.add(mmo);
|
||||
}
|
||||
}
|
||||
@@ -1687,7 +1687,7 @@ public class MapleMap {
|
||||
|
||||
public NPC getNPCById(int id) {
|
||||
for (MapObject obj : getMapObjects()) {
|
||||
if (obj.getType() == MapleMapObjectType.NPC) {
|
||||
if (obj.getType() == MapObjectType.NPC) {
|
||||
NPC npc = (NPC) obj;
|
||||
if (npc.getId() == id) {
|
||||
return npc;
|
||||
@@ -1702,7 +1702,7 @@ public class MapleMap {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.NPC) {
|
||||
if (obj.getType() == MapObjectType.NPC) {
|
||||
if (((NPC) obj).getId() == npcid) {
|
||||
return true;
|
||||
}
|
||||
@@ -1715,7 +1715,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public void destroyNPC(int npcid) { // assumption: there's at most one of the same NPC in a map.
|
||||
List<MapObject> npcs = getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.NPC));
|
||||
List<MapObject> npcs = getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.NPC));
|
||||
|
||||
chrRLock.lock();
|
||||
objectWLock.lock();
|
||||
@@ -1752,19 +1752,19 @@ public class MapleMap {
|
||||
*/
|
||||
public Monster getMonsterByOid(int oid) {
|
||||
MapObject mmo = getMapObject(oid);
|
||||
return (mmo != null && mmo.getType() == MapleMapObjectType.MONSTER) ? (Monster) mmo : null;
|
||||
return (mmo != null && mmo.getType() == MapObjectType.MONSTER) ? (Monster) mmo : null;
|
||||
}
|
||||
|
||||
public MapleReactor getReactorByOid(int oid) {
|
||||
MapObject mmo = getMapObject(oid);
|
||||
return (mmo != null && mmo.getType() == MapleMapObjectType.REACTOR) ? (MapleReactor) mmo : null;
|
||||
return (mmo != null && mmo.getType() == MapObjectType.REACTOR) ? (MapleReactor) mmo : null;
|
||||
}
|
||||
|
||||
public MapleReactor getReactorById(int Id) {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (obj.getType() == MapObjectType.REACTOR) {
|
||||
if (((MapleReactor) obj).getId() == Id) {
|
||||
return (MapleReactor) obj;
|
||||
}
|
||||
@@ -1782,7 +1782,7 @@ public class MapleMap {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (obj.getType() == MapObjectType.REACTOR) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
|
||||
if (mr.getId() >= first && mr.getId() <= last) {
|
||||
@@ -1801,7 +1801,7 @@ public class MapleMap {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (obj.getType() == MapObjectType.REACTOR) {
|
||||
if (((MapleReactor) obj).getName().equals(name)) {
|
||||
return (MapleReactor) obj;
|
||||
}
|
||||
@@ -2076,7 +2076,7 @@ public class MapleMap {
|
||||
final ScheduledFuture<?> poisonSchedule;
|
||||
if (poison) {
|
||||
Runnable poisonTask = () -> {
|
||||
List<MapObject> affectedMonsters = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapleMapObjectType.MONSTER));
|
||||
List<MapObject> affectedMonsters = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapObjectType.MONSTER));
|
||||
for (MapObject mo : affectedMonsters) {
|
||||
if (mist.makeChanceResult()) {
|
||||
MonsterStatusEffect poisonEffect = new MonsterStatusEffect(Collections.singletonMap(MonsterStatus.POISON, 1), mist.getSourceSkill(), null, false);
|
||||
@@ -2087,7 +2087,7 @@ public class MapleMap {
|
||||
poisonSchedule = tMan.register(poisonTask, 2000, 2500);
|
||||
} else if (recovery) {
|
||||
Runnable poisonTask = () -> {
|
||||
List<MapObject> players = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapleMapObjectType.PLAYER));
|
||||
List<MapObject> players = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapObjectType.PLAYER));
|
||||
for (MapObject mo : players) {
|
||||
if (mist.makeChanceResult()) {
|
||||
Character chr = (Character) mo;
|
||||
@@ -2909,7 +2909,7 @@ public class MapleMap {
|
||||
broadcastMessage(PacketCreator.serverNotice(type, message));
|
||||
}
|
||||
|
||||
private static boolean isNonRangedType(MapleMapObjectType type) {
|
||||
private static boolean isNonRangedType(MapObjectType type) {
|
||||
switch (type) {
|
||||
case NPC:
|
||||
case PLAYER:
|
||||
@@ -2938,7 +2938,7 @@ public class MapleMap {
|
||||
for (MapObject o : objects) {
|
||||
if (isNonRangedType(o.getType())) {
|
||||
o.sendSpawnData(c);
|
||||
} else if (o.getType() == MapleMapObjectType.SUMMON) {
|
||||
} else if (o.getType() == MapObjectType.SUMMON) {
|
||||
MapleSummon summon = (MapleSummon) o;
|
||||
if (summon.getOwner() == chr) {
|
||||
if (chr.isSummonsEmpty() || !chr.containsSummon(summon)) {
|
||||
@@ -2957,7 +2957,7 @@ public class MapleMap {
|
||||
|
||||
if (chr != null) {
|
||||
for (MapObject o : getMapObjectsInRange(chr.getPosition(), getRangedDistance(), rangedMapobjectTypes)) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (o.getType() == MapObjectType.REACTOR) {
|
||||
if (((MapleReactor) o).isAlive()) {
|
||||
o.sendSpawnData(chr.getClient());
|
||||
chr.addVisibleMapObject(o);
|
||||
@@ -2966,7 +2966,7 @@ public class MapleMap {
|
||||
o.sendSpawnData(chr.getClient());
|
||||
chr.addVisibleMapObject(o);
|
||||
|
||||
if (o.getType() == MapleMapObjectType.MONSTER) {
|
||||
if (o.getType() == MapObjectType.MONSTER) {
|
||||
((Monster) o).aggroUpdateController();
|
||||
}
|
||||
}
|
||||
@@ -2974,7 +2974,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public List<MapObject> getMapObjectsInRange(Point from, double rangeSq, List<MapleMapObjectType> types) {
|
||||
public List<MapObject> getMapObjectsInRange(Point from, double rangeSq, List<MapObjectType> types) {
|
||||
List<MapObject> ret = new LinkedList<>();
|
||||
objectRLock.lock();
|
||||
try {
|
||||
@@ -2991,7 +2991,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public List<MapObject> getMapObjectsInBox(Rectangle box, List<MapleMapObjectType> types) {
|
||||
public List<MapObject> getMapObjectsInBox(Rectangle box, List<MapObjectType> types) {
|
||||
List<MapObject> ret = new LinkedList<>();
|
||||
objectRLock.lock();
|
||||
try {
|
||||
@@ -3173,11 +3173,11 @@ public class MapleMap {
|
||||
|
||||
private static void updateMapObjectVisibility(Character chr, MapObject mo) {
|
||||
if (!chr.isMapObjectVisible(mo)) { // object entered view range
|
||||
if (mo.getType() == MapleMapObjectType.SUMMON || mo.getPosition().distanceSq(chr.getPosition()) <= getRangedDistance()) {
|
||||
if (mo.getType() == MapObjectType.SUMMON || mo.getPosition().distanceSq(chr.getPosition()) <= getRangedDistance()) {
|
||||
chr.addVisibleMapObject(mo);
|
||||
mo.sendSpawnData(chr.getClient());
|
||||
}
|
||||
} else if (mo.getType() != MapleMapObjectType.SUMMON && mo.getPosition().distanceSq(chr.getPosition()) > getRangedDistance()) {
|
||||
} else if (mo.getType() != MapObjectType.SUMMON && mo.getPosition().distanceSq(chr.getPosition()) > getRangedDistance()) {
|
||||
chr.removeVisibleMapObject(mo);
|
||||
mo.sendDestroyData(chr.getClient());
|
||||
}
|
||||
@@ -3655,7 +3655,7 @@ public class MapleMap {
|
||||
|
||||
public final int getNumPlayersItemsInRect(final Rectangle rect) {
|
||||
int retP = getNumPlayersInRect(rect);
|
||||
int retI = getMapObjectsInBox(rect, Arrays.asList(MapleMapObjectType.ITEM)).size();
|
||||
int retI = getMapObjectsInBox(rect, Arrays.asList(MapObjectType.ITEM)).size();
|
||||
|
||||
return retP + retI;
|
||||
}
|
||||
@@ -3795,7 +3795,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public void clearDrops(Character player) {
|
||||
for (MapObject i : getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM))) {
|
||||
for (MapObject i : getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM))) {
|
||||
droppedItemCount.decrementAndGet();
|
||||
removeMapObject(i);
|
||||
this.broadcastMessage(PacketCreator.removeItemFromMap(i.getObjectId(), 0, player.getId()));
|
||||
@@ -3803,7 +3803,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public void clearDrops() {
|
||||
for (MapObject i : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM))) {
|
||||
for (MapObject i : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.ITEM))) {
|
||||
droppedItemCount.decrementAndGet();
|
||||
removeMapObject(i);
|
||||
this.broadcastMessage(PacketCreator.removeItemFromMap(i.getObjectId(), 0, 0));
|
||||
@@ -3965,7 +3965,7 @@ public class MapleMap {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.NPC) {
|
||||
if (obj.getType() == MapObjectType.NPC) {
|
||||
NPC npc = (NPC) obj;
|
||||
if (npc.getId() == id) {
|
||||
npc.setHide(!npc.isHidden());
|
||||
@@ -4167,7 +4167,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public List<MapObject> getAllPlayer() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER));
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapObjectType.PLAYER));
|
||||
}
|
||||
|
||||
public boolean isCPQMap() {
|
||||
@@ -4325,7 +4325,7 @@ public class MapleMap {
|
||||
blueTeamBuffs.add(skill);
|
||||
}
|
||||
for (MapObject mmo : this.mapobjects.values()) {
|
||||
if (mmo.getType() == MapleMapObjectType.MONSTER) {
|
||||
if (mmo.getType() == MapObjectType.MONSTER) {
|
||||
Monster mob = (Monster) mmo;
|
||||
if (mob.getTeam() == team) {
|
||||
skill.getSkill().applyEffect(null, mob, false, null);
|
||||
|
||||
@@ -516,7 +516,7 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
public void sendSpawnData(Client client) {}
|
||||
|
||||
@Override
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.MINI_GAME;
|
||||
public MapObjectType getType() {
|
||||
return MapObjectType.MINI_GAME;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ public class MapleMist extends AbstractMapObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.MIST;
|
||||
public MapObjectType getType() {
|
||||
return MapObjectType.MIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -571,8 +571,8 @@ public class MaplePlayerShop extends AbstractMapObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.SHOP;
|
||||
public MapObjectType getType() {
|
||||
return MapObjectType.SHOP;
|
||||
}
|
||||
|
||||
public class SoldItem {
|
||||
|
||||
@@ -129,8 +129,8 @@ public class MapleReactor extends AbstractMapObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.REACTOR;
|
||||
public MapObjectType getType() {
|
||||
return MapObjectType.REACTOR;
|
||||
}
|
||||
|
||||
public int getReactorType() {
|
||||
|
||||
@@ -87,8 +87,8 @@ public class MapleSummon extends AbstractAnimatedMapObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.SUMMON;
|
||||
public MapObjectType getType() {
|
||||
return MapObjectType.SUMMON;
|
||||
}
|
||||
|
||||
public final boolean isPuppet() {
|
||||
|
||||
Reference in New Issue
Block a user