Rename and clean up MapleMapObject
This commit is contained in:
@@ -179,7 +179,7 @@ public class Character extends AbstractCharacterObject {
|
||||
private final Map<Short, QuestStatus> quests;
|
||||
private final Set<Monster> controlled = new LinkedHashSet<>();
|
||||
private final Map<Integer, String> entered = new LinkedHashMap<>();
|
||||
private final Set<MapleMapObject> visibleMapObjects = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
private final Set<MapObject> visibleMapObjects = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
private final Map<Skill, SkillEntry> skills = new LinkedHashMap<>();
|
||||
private final Map<Integer, Integer> activeCoupons = new LinkedHashMap<>();
|
||||
private final Map<Integer, Integer> activeCouponRates = new LinkedHashMap<>();
|
||||
@@ -636,7 +636,7 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void addVisibleMapObject(MapleMapObject mo) {
|
||||
public void addVisibleMapObject(MapObject mo) {
|
||||
visibleMapObjects.add(mo);
|
||||
}
|
||||
|
||||
@@ -832,7 +832,7 @@ public class Character extends AbstractCharacterObject {
|
||||
getMap().broadcastNONGMMessage(this, PacketCreator.spawnSummon(ms, false), false);
|
||||
}
|
||||
|
||||
for (MapleMapObject mo : this.getMap().getMonsters()) {
|
||||
for (MapObject mo : this.getMap().getMonsters()) {
|
||||
Monster m = (Monster) mo;
|
||||
m.aggroUpdateController();
|
||||
}
|
||||
@@ -1907,11 +1907,11 @@ public class Character extends AbstractCharacterObject {
|
||||
return false;
|
||||
}
|
||||
|
||||
public final void pickupItem(MapleMapObject ob) {
|
||||
public final void pickupItem(MapObject ob) {
|
||||
pickupItem(ob, -1);
|
||||
}
|
||||
|
||||
public final void pickupItem(MapleMapObject ob, int petIndex) { // yes, one picks the MapleMapObject, not the MapItem
|
||||
public final void pickupItem(MapObject ob, int petIndex) { // yes, one picks the MapObject, not the MapItem
|
||||
if (ob == null) { // pet index refers to the one picking up the item
|
||||
return;
|
||||
}
|
||||
@@ -5899,8 +5899,8 @@ public class Character extends AbstractCharacterObject {
|
||||
return vanquisherStage;
|
||||
}
|
||||
|
||||
public MapleMapObject[] getVisibleMapObjects() {
|
||||
return visibleMapObjects.toArray(new MapleMapObject[visibleMapObjects.size()]);
|
||||
public MapObject[] getVisibleMapObjects() {
|
||||
return visibleMapObjects.toArray(new MapObject[visibleMapObjects.size()]);
|
||||
}
|
||||
|
||||
public int getWorld() {
|
||||
@@ -6184,7 +6184,7 @@ public class Character extends AbstractCharacterObject {
|
||||
return hidden;
|
||||
}
|
||||
|
||||
public boolean isMapObjectVisible(MapleMapObject mo) {
|
||||
public boolean isMapObjectVisible(MapObject mo) {
|
||||
return visibleMapObjects.contains(mo);
|
||||
}
|
||||
|
||||
@@ -8007,7 +8007,7 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeVisibleMapObject(MapleMapObject mo) {
|
||||
public void removeVisibleMapObject(MapObject mo) {
|
||||
visibleMapObjects.remove(mo);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ package client.command.commands.gm2;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -40,8 +40,8 @@ public class LootCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
List<MapleMapObject> items = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
for (MapleMapObject item : items) {
|
||||
List<MapObject> items = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
for (MapObject item : items) {
|
||||
MapItem mapItem = (MapItem) item;
|
||||
if (mapItem.getOwnerId() == c.getPlayer().getId() || mapItem.getOwnerId() == c.getPlayer().getPartyId()) {
|
||||
c.getPlayer().pickupItem(mapItem);
|
||||
|
||||
@@ -29,7 +29,7 @@ import client.command.Command;
|
||||
import server.life.Monster;
|
||||
import server.life.NPC;
|
||||
import server.life.PlayerNPC;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class WhereaMiCommand extends Command {
|
||||
HashSet<PlayerNPC> playernpcs = new HashSet<>();
|
||||
HashSet<Monster> mobs = new HashSet<>();
|
||||
|
||||
for (MapleMapObject mmo : player.getMap().getMapObjects()) {
|
||||
for (MapObject mmo : player.getMap().getMapObjects()) {
|
||||
if (mmo instanceof NPC) {
|
||||
NPC npc = (NPC) mmo;
|
||||
npcs.add(npc);
|
||||
|
||||
@@ -29,7 +29,7 @@ import client.Disease;
|
||||
import client.command.Command;
|
||||
import server.life.MobSkill;
|
||||
import server.life.MobSkillFactory;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -107,7 +107,7 @@ public class DebuffCommand extends Command {
|
||||
return;
|
||||
}
|
||||
|
||||
for (MapleMapObject mmo : player.getMap().getMapObjectsInRange(player.getPosition(), 777777.7, Arrays.asList(MapleMapObjectType.PLAYER))) {
|
||||
for (MapObject mmo : player.getMap().getMapObjectsInRange(player.getPosition(), 777777.7, Arrays.asList(MapleMapObjectType.PLAYER))) {
|
||||
Character chr = (Character) mmo;
|
||||
|
||||
if (chr.getId() != player.getId()) {
|
||||
|
||||
@@ -27,8 +27,8 @@ import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import server.life.Monster;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -43,9 +43,9 @@ public class KillAllCommand extends Command {
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
MapleMap map = player.getMap();
|
||||
List<MapleMapObject> monsters = map.getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
List<MapObject> monsters = map.getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
int count = 0;
|
||||
for (MapleMapObject monstermo : monsters) {
|
||||
for (MapObject monstermo : monsters) {
|
||||
Monster monster = (Monster) monstermo;
|
||||
if (!monster.getStats().isFriendly() && !(monster.getId() >= 8810010 && monster.getId() <= 8810018)) {
|
||||
map.damageMonster(player, monster, Integer.MAX_VALUE);
|
||||
|
||||
@@ -29,7 +29,7 @@ import client.command.Command;
|
||||
import client.inventory.Pet;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import tools.PacketCreator;
|
||||
|
||||
@@ -44,8 +44,8 @@ public class ForceVacCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
List<MapleMapObject> items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
for (MapleMapObject item : items) {
|
||||
List<MapObject> items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
for (MapObject item : items) {
|
||||
MapItem mapItem = (MapItem) item;
|
||||
|
||||
mapItem.lockItem();
|
||||
|
||||
@@ -26,7 +26,7 @@ package client.command.commands.gm4;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -40,8 +40,8 @@ public class ItemVacCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
List<MapleMapObject> list = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
for (MapleMapObject item : list) {
|
||||
List<MapObject> list = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
for (MapObject item : list) {
|
||||
player.pickupItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import net.server.Server;
|
||||
import server.TimerManager;
|
||||
import server.life.Monster;
|
||||
import server.life.SpawnPoint;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MaplePortal;
|
||||
import server.maps.MapleReactor;
|
||||
@@ -67,8 +67,8 @@ public class DebugCommand extends Command {
|
||||
break;
|
||||
|
||||
case "monster":
|
||||
List<MapleMapObject> monsters = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
for (MapleMapObject monstermo : monsters) {
|
||||
List<MapObject> monsters = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
for (MapObject monstermo : monsters) {
|
||||
Monster monster = (Monster) monstermo;
|
||||
Character controller = monster.getController();
|
||||
player.message("Monster ID: " + monster.getId() + " Aggro target: " + ((controller != null) ? controller.getName() + " Has aggro: " + monster.isControllerHasAggro() + " Knowns aggro: " + monster.isControllerKnowsAboutAggro() : "<none>"));
|
||||
@@ -123,7 +123,7 @@ public class DebugCommand extends Command {
|
||||
case "reactors":
|
||||
player.dropMessage(6, "Current reactor states on map " + player.getMapId() + ":");
|
||||
|
||||
for (MapleMapObject mmo : player.getMap().getReactors()) {
|
||||
for (MapObject mmo : player.getMap().getReactors()) {
|
||||
MapleReactor mr = (MapleReactor) mmo;
|
||||
player.dropMessage(6, "Id: " + mr.getId() + " Oid: " + mr.getObjectId() + " name: '" + mr.getName() + "' -> Type: " + mr.getReactorType() + " State: " + mr.getState() + " Event State: " + mr.getEventState() + " Position: x " + mr.getPosition().getX() + " y " + mr.getPosition().getY() + ".");
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ import server.MapleStatEffect;
|
||||
import server.TimerManager;
|
||||
import server.life.*;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
@@ -151,7 +151,7 @@ public abstract class AbstractDealDamageHandler extends AbstractPacketHandler {
|
||||
if (attack.skill == ChiefBandit.MESO_EXPLOSION) {
|
||||
int delay = 0;
|
||||
for (Integer oned : attack.allDamage.keySet()) {
|
||||
MapleMapObject mapobject = map.getMapObject(oned);
|
||||
MapObject mapobject = map.getMapObject(oned);
|
||||
if (mapobject != null && mapobject.getType() == MapleMapObjectType.ITEM) {
|
||||
final MapItem mapitem = (MapItem) mapobject;
|
||||
if (mapitem.getMeso() == 0) { //Maybe it is possible some how?
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.packet.InPacket;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.life.LifeFactory;
|
||||
import server.life.Monster;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.quest.MapleQuest;
|
||||
import tools.PacketCreator;
|
||||
@@ -126,7 +126,7 @@ public final class AdminCommandHandler extends AbstractPacketHandler {
|
||||
case 0x15: // Kill
|
||||
int mobToKill = p.readInt();
|
||||
int amount = p.readInt();
|
||||
List<MapleMapObject> 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(MapleMapObjectType.MONSTER));
|
||||
for (int x = 0; x < amount; x++) {
|
||||
Monster monster = (Monster) monsterx.get(x);
|
||||
if (monster.getId() == mobToKill) {
|
||||
@@ -147,8 +147,8 @@ public final class AdminCommandHandler extends AbstractPacketHandler {
|
||||
case 0x18: // Maple & Mobhp
|
||||
int mobHp = p.readInt();
|
||||
c.getPlayer().dropMessage("Monsters HP");
|
||||
List<MapleMapObject> monsters = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
for (MapleMapObject mobs : monsters) {
|
||||
List<MapObject> monsters = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
for (MapObject mobs : monsters) {
|
||||
Monster monster = (Monster) mobs;
|
||||
if (monster.getId() == mobHp) {
|
||||
c.getPlayer().dropMessage(monster.getName() + ": " + monster.getHp());
|
||||
|
||||
@@ -25,7 +25,7 @@ import client.Character;
|
||||
import client.Client;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import tools.PacketCreator;
|
||||
|
||||
public final class CharInfoRequestHandler extends AbstractPacketHandler {
|
||||
@@ -34,7 +34,7 @@ public final class CharInfoRequestHandler extends AbstractPacketHandler {
|
||||
public final void handlePacket(InPacket p, Client c) {
|
||||
p.skip(4);
|
||||
int cid = p.readInt();
|
||||
MapleMapObject target = c.getPlayer().getMap().getMapObject(cid);
|
||||
MapObject target = c.getPlayer().getMap().getMapObject(cid);
|
||||
if (target != null) {
|
||||
if (target instanceof Character) {
|
||||
Character player = (Character) target;
|
||||
|
||||
@@ -26,7 +26,7 @@ import client.Character;
|
||||
import client.Client;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleSummon;
|
||||
import tools.PacketCreator;
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class DamageSummonHandler extends AbstractPacketHandler {
|
||||
int monsterIdFrom = p.readInt();
|
||||
|
||||
Character player = c.getPlayer();
|
||||
MapleMapObject mmo = player.getMap().getMapObject(oid);
|
||||
MapObject mmo = player.getMap().getMapObject(oid);
|
||||
|
||||
if(mmo != null && mmo instanceof MapleSummon) {
|
||||
MapleSummon summon = (MapleSummon) mmo;
|
||||
|
||||
@@ -26,7 +26,7 @@ import client.Client;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.maps.DoorObject;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ public final class DoorHandler extends AbstractPacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
for (MapleMapObject obj : chr.getMap().getMapObjects()) {
|
||||
for (MapObject obj : chr.getMap().getMapObjects()) {
|
||||
if (obj instanceof DoorObject) {
|
||||
DoorObject door = (DoorObject) obj;
|
||||
if (door.getOwnerId() == ownerid) {
|
||||
|
||||
@@ -27,7 +27,7 @@ import client.inventory.ItemFactory;
|
||||
import constants.game.GameConstants;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MaplePlayerShop;
|
||||
import server.maps.MaplePortal;
|
||||
@@ -47,7 +47,7 @@ public final class HiredMerchantRequest extends AbstractPacketHandler {
|
||||
Character chr = c.getPlayer();
|
||||
|
||||
try {
|
||||
for (MapleMapObject 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(MapleMapObjectType.HIRED_MERCHANT, MapleMapObjectType.PLAYER))) {
|
||||
if (mmo instanceof Character) {
|
||||
Character mc = (Character) mmo;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import client.Character;
|
||||
import client.Client;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import tools.FilePrinter;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -44,7 +44,7 @@ public final class ItemPickupHandler extends AbstractPacketHandler {
|
||||
p.readPos(); //cpos
|
||||
int oid = p.readInt();
|
||||
Character chr = c.getPlayer();
|
||||
MapleMapObject ob = chr.getMap().getMapObject(oid);
|
||||
MapObject ob = chr.getMap().getMapObject(oid);
|
||||
if(ob == null) return;
|
||||
|
||||
Point charPos = chr.getPosition();
|
||||
|
||||
@@ -29,8 +29,8 @@ import server.life.MobSkill;
|
||||
import server.life.MobSkillFactory;
|
||||
import server.life.Monster;
|
||||
import server.life.MonsterInformationProvider;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
@@ -59,7 +59,7 @@ public final class MoveLifeHandler extends AbstractMovementPacketHandler {
|
||||
|
||||
int objectid = p.readInt();
|
||||
short moveid = p.readShort();
|
||||
MapleMapObject mmo = map.getMapObject(objectid);
|
||||
MapObject mmo = map.getMapObject(objectid);
|
||||
if (mmo == null || mmo.getType() != MapleMapObjectType.MONSTER) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import net.packet.InPacket;
|
||||
import scripting.npc.NPCScriptManager;
|
||||
import server.life.NPC;
|
||||
import server.life.PlayerNPC;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import tools.FilePrinter;
|
||||
import tools.PacketCreator;
|
||||
|
||||
@@ -47,7 +47,7 @@ public final class NPCTalkHandler extends AbstractPacketHandler {
|
||||
}
|
||||
|
||||
int oid = p.readInt();
|
||||
MapleMapObject obj = c.getPlayer().getMap().getMapObject(oid);
|
||||
MapObject obj = c.getPlayer().getMap().getMapObject(oid);
|
||||
if (obj instanceof NPC) {
|
||||
NPC npc = (NPC) obj;
|
||||
if(YamlConfig.config.server.USE_DEBUG == true) c.getPlayer().dropMessage(5, "Talking to NPC " + npc.getId());
|
||||
|
||||
@@ -27,7 +27,7 @@ import client.inventory.Pet;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import tools.PacketCreator;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -50,7 +50,7 @@ public final class PetLootHandler extends AbstractPacketHandler {
|
||||
|
||||
p.skip(13);
|
||||
int oid = p.readInt();
|
||||
MapleMapObject ob = chr.getMap().getMapObject(oid);
|
||||
MapObject ob = chr.getMap().getMapObject(oid);
|
||||
try {
|
||||
MapItem mapitem = (MapItem) ob;
|
||||
if (mapitem.getMeso() > 0) {
|
||||
|
||||
@@ -281,7 +281,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
if (isTradeOpen(chr)) return;
|
||||
|
||||
int oid = p.readInt();
|
||||
MapleMapObject ob = chr.getMap().getMapObject(oid);
|
||||
MapObject ob = chr.getMap().getMapObject(oid);
|
||||
if (ob instanceof MaplePlayerShop) {
|
||||
MaplePlayerShop shop = (MaplePlayerShop) ob;
|
||||
shop.visitShop(chr);
|
||||
@@ -795,7 +795,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
|
||||
private static boolean canPlaceStore(Character chr) {
|
||||
try {
|
||||
for (MapleMapObject 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(MapleMapObjectType.HIRED_MERCHANT, MapleMapObjectType.PLAYER))) {
|
||||
if (mmo instanceof Character) {
|
||||
Character mc = (Character) mmo;
|
||||
if (mc.getId() == chr.getId()) {
|
||||
|
||||
@@ -26,7 +26,7 @@ import client.Client;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.life.Monster;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapObject;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
|
||||
@@ -53,7 +53,7 @@ public final class PlayerMapTransitionHandler extends AbstractPacketHandler {
|
||||
}
|
||||
|
||||
if (!chr.isHidden()) { // thanks Lame (Conrad) for noticing hidden characters controlling mobs
|
||||
for (MapleMapObject mo : chr.getMap().getMonsters()) { // thanks BHB, IxianMace, Jefe for noticing several issues regarding mob statuses (such as freeze)
|
||||
for (MapObject mo : chr.getMap().getMonsters()) { // thanks BHB, IxianMace, Jefe for noticing several issues regarding mob statuses (such as freeze)
|
||||
Monster m = (Monster) mo;
|
||||
if (m.getSpawnEffect() == 0 || m.getHp() < m.getMaxHp()) { // avoid effect-spawning mobs
|
||||
if (m.getController() == chr) {
|
||||
|
||||
@@ -38,8 +38,8 @@ import net.packet.InPacket;
|
||||
import server.MapleStatEffect;
|
||||
import server.life.LifeFactory.loseItem;
|
||||
import server.life.*;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObject;
|
||||
import tools.FilePrinter;
|
||||
import tools.PacketCreator;
|
||||
import tools.Randomizer;
|
||||
@@ -71,7 +71,7 @@ public final class TakeDamageHandler extends AbstractPacketHandler {
|
||||
oid = p.readInt();
|
||||
|
||||
try {
|
||||
MapleMapObject mmo = map.getMapObject(oid);
|
||||
MapObject mmo = map.getMapObject(oid);
|
||||
if(mmo instanceof Monster) {
|
||||
attacker = (Monster) mmo;
|
||||
if(attacker.getId() != monsteridfrom) {
|
||||
|
||||
@@ -42,8 +42,8 @@ import server.expeditions.Expedition;
|
||||
import server.expeditions.ExpeditionBossLog;
|
||||
import server.expeditions.ExpeditionType;
|
||||
import server.life.*;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.partyquest.PartyQuest;
|
||||
import server.partyquest.Pyramid;
|
||||
@@ -897,7 +897,7 @@ public class AbstractPlayerInteraction {
|
||||
public void resetMap(int mapid) {
|
||||
getMap(mapid).resetReactors();
|
||||
getMap(mapid).killAllMonsters();
|
||||
for (MapleMapObject 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(MapleMapObjectType.ITEM))) {
|
||||
getMap(mapid).removeMapObject(i);
|
||||
getMap(mapid).broadcastMessage(PacketCreator.removeItemFromMap(i.getObjectId(), 0, c.getPlayer().getId()));
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ import server.gachapon.MapleGachapon.MapleGachaponItem;
|
||||
import server.life.LifeFactory;
|
||||
import server.life.PlayerNPC;
|
||||
import server.maps.MapManager;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.partyquest.AriantColiseum;
|
||||
import server.partyquest.MonsterCarnival;
|
||||
@@ -315,7 +315,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public PlayerNPC getPlayerNPCByScriptid(int scriptId) {
|
||||
for(MapleMapObject 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(MapleMapObjectType.PLAYER_NPC))) {
|
||||
PlayerNPC pn = (PlayerNPC) pnpcObj;
|
||||
|
||||
if(pn.getScriptId() == scriptId) {
|
||||
@@ -608,7 +608,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
public int cpqCalcAvgLvl(int map) {
|
||||
int num = 0;
|
||||
int avg = 0;
|
||||
for (MapleMapObject mmo : c.getChannelServer().getMapFactory().getMap(map).getAllPlayer()) {
|
||||
for (MapObject mmo : c.getChannelServer().getMapFactory().getMap(map).getAllPlayer()) {
|
||||
avg += ((Character) mmo).getLevel();
|
||||
num++;
|
||||
}
|
||||
@@ -959,7 +959,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
public void challengeParty2(int field) {
|
||||
Character leader = null;
|
||||
MapleMap map = c.getChannelServer().getMapFactory().getMap(980031000 + 1000 * field);
|
||||
for (MapleMapObject mmo : map.getAllPlayer()) {
|
||||
for (MapObject mmo : map.getAllPlayer()) {
|
||||
Character mc = (Character) mmo;
|
||||
if (mc.getParty() == null) {
|
||||
sendOk(LanguageConstants.getMessage(mc, LanguageConstants.CPQFindError));
|
||||
@@ -990,7 +990,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
sendOk("An unexpected error regarding the other party has occurred.");
|
||||
return;
|
||||
}
|
||||
for (MapleMapObject mmo : map.getAllPlayer()) {
|
||||
for (MapObject mmo : map.getAllPlayer()) {
|
||||
Character mc = (Character) mmo;
|
||||
if (mc.getParty() == null) {
|
||||
sendOk(LanguageConstants.getMessage(mc, LanguageConstants.CPQFindError));
|
||||
|
||||
@@ -813,7 +813,7 @@ public class MapleStatEffect {
|
||||
* @param obj
|
||||
* @param attack damage done by the skill
|
||||
*/
|
||||
public void applyPassive(Character applyto, MapleMapObject obj, int attack) {
|
||||
public void applyPassive(Character applyto, MapObject obj, int attack) {
|
||||
if (makeChanceResult()) {
|
||||
switch (sourceid) { // MP eater
|
||||
case FPWizard.MP_EATER:
|
||||
@@ -1090,9 +1090,9 @@ 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<MapleMapObject> affecteds = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapleMapObjectType.PLAYER));
|
||||
List<MapObject> affecteds = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapleMapObjectType.PLAYER));
|
||||
List<Character> affectedp = new ArrayList<>(affecteds.size());
|
||||
for (MapleMapObject affectedmo : affecteds) {
|
||||
for (MapObject affectedmo : affecteds) {
|
||||
Character affected = (Character) affectedmo;
|
||||
if (affected != applyfrom && (isGmBuff() || applyfrom.getParty().equals(affected.getParty()))) {
|
||||
if (!isResurrection()) {
|
||||
@@ -1120,10 +1120,10 @@ public class MapleStatEffect {
|
||||
|
||||
private void applyMonsterBuff(Character applyfrom) {
|
||||
Rectangle bounds = calculateBoundingBox(applyfrom.getPosition(), applyfrom.isFacingLeft());
|
||||
List<MapleMapObject> affected = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
List<MapObject> affected = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
Skill skill_ = SkillFactory.getSkill(sourceid);
|
||||
int i = 0;
|
||||
for (MapleMapObject mo : affected) {
|
||||
for (MapObject mo : affected) {
|
||||
Monster monster = (Monster) mo;
|
||||
if (isDispel()) {
|
||||
monster.debuffMob(skill_.getId());
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ package server.maps;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public abstract class AbstractMapObject implements MapleMapObject {
|
||||
public abstract class AbstractMapObject implements MapObject {
|
||||
private Point position = new Point();
|
||||
private int objectId;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
package server.maps;
|
||||
|
||||
public interface AnimatedMapObject extends MapleMapObject {
|
||||
public interface AnimatedMapObject extends MapObject {
|
||||
int getStance();
|
||||
void setStance(int stance);
|
||||
boolean isFacingLeft();
|
||||
|
||||
@@ -33,14 +33,14 @@ import java.util.concurrent.locks.Lock;
|
||||
public class MapItem extends AbstractMapObject {
|
||||
protected Client ownerClient;
|
||||
protected Item item;
|
||||
protected MapleMapObject dropper;
|
||||
protected MapObject dropper;
|
||||
protected int character_ownerid, party_ownerid, meso, questid = -1;
|
||||
protected byte type;
|
||||
protected boolean pickedUp = false, playerDrop, partyDrop;
|
||||
protected long dropTime;
|
||||
private final Lock itemLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.MAP_ITEM);
|
||||
|
||||
public MapItem(Item item, Point position, MapleMapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop) {
|
||||
public MapItem(Item item, Point position, MapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop) {
|
||||
setPosition(position);
|
||||
this.item = item;
|
||||
this.dropper = dropper;
|
||||
@@ -53,7 +53,7 @@ public class MapItem extends AbstractMapObject {
|
||||
this.playerDrop = playerDrop;
|
||||
}
|
||||
|
||||
public MapItem(Item item, Point position, MapleMapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop, int questid) {
|
||||
public MapItem(Item item, Point position, MapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop, int questid) {
|
||||
setPosition(position);
|
||||
this.item = item;
|
||||
this.dropper = dropper;
|
||||
@@ -67,7 +67,7 @@ public class MapItem extends AbstractMapObject {
|
||||
this.questid = questid;
|
||||
}
|
||||
|
||||
public MapItem(int meso, Point position, MapleMapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop) {
|
||||
public MapItem(int meso, Point position, MapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop) {
|
||||
setPosition(position);
|
||||
this.item = null;
|
||||
this.dropper = dropper;
|
||||
@@ -95,7 +95,7 @@ public class MapItem extends AbstractMapObject {
|
||||
return item.getItemId();
|
||||
}
|
||||
|
||||
public final MapleMapObject getDropper() {
|
||||
public final MapObject getDropper() {
|
||||
return dropper;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import client.Client;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public interface MapleMapObject {
|
||||
public interface MapObject {
|
||||
int getObjectId();
|
||||
void setObjectId(int id);
|
||||
MapleMapObjectType getType();
|
||||
@@ -82,7 +82,7 @@ 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 Map<Integer, Pair<Integer, Integer>> dropBoundsCache = new HashMap<>(100);
|
||||
|
||||
private final Map<Integer, MapleMapObject> mapobjects = new LinkedHashMap<>();
|
||||
private final Map<Integer, MapObject> mapobjects = new LinkedHashMap<>();
|
||||
private final Set<Integer> selfDestructives = new LinkedHashSet<>();
|
||||
private final Collection<SpawnPoint> monsterSpawn = Collections.synchronizedList(new LinkedList<>());
|
||||
private final Collection<SpawnPoint> allMonsterSpawn = Collections.synchronizedList(new LinkedList<>());
|
||||
@@ -94,7 +94,7 @@ public class MapleMap {
|
||||
private final Map<Integer, Integer> backgroundTypes = new HashMap<>();
|
||||
private final Map<String, Integer> environment = new LinkedHashMap<>();
|
||||
private final Map<MapItem, Long> droppedItems = new LinkedHashMap<>();
|
||||
private final LinkedList<WeakReference<MapleMapObject>> registeredDrops = new LinkedList<>();
|
||||
private final LinkedList<WeakReference<MapObject>> registeredDrops = new LinkedList<>();
|
||||
private final Map<MobLootEntry, Long> mobLootEntries = new HashMap(20);
|
||||
private final List<Runnable> statUpdateRunnables = new ArrayList(50);
|
||||
private final List<Rectangle> areas = new ArrayList<>();
|
||||
@@ -230,11 +230,11 @@ public class MapleMap {
|
||||
return YamlConfig.config.server.USE_MAXRANGE ? Double.POSITIVE_INFINITY : 722500;
|
||||
}
|
||||
|
||||
public List<MapleMapObject> getMapObjectsInRect(Rectangle box, List<MapleMapObjectType> types) {
|
||||
public List<MapObject> getMapObjectsInRect(Rectangle box, List<MapleMapObjectType> types) {
|
||||
objectRLock.lock();
|
||||
final List<MapleMapObject> ret = new LinkedList<>();
|
||||
final List<MapObject> ret = new LinkedList<>();
|
||||
try {
|
||||
for (MapleMapObject l : mapobjects.values()) {
|
||||
for (MapObject l : mapobjects.values()) {
|
||||
if (types.contains(l.getType())) {
|
||||
if (box.contains(l.getPosition())) {
|
||||
ret.add(l);
|
||||
@@ -295,7 +295,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public void setReactorState() {
|
||||
for (MapleMapObject o : getMapObjects()) {
|
||||
for (MapObject o : getMapObjects()) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (((MapleReactor) o).getState() < 1) {
|
||||
MapleReactor mr = (MapleReactor) o;
|
||||
@@ -315,7 +315,7 @@ public class MapleMap {
|
||||
List<MapleReactor> toDestroy = new ArrayList<>();
|
||||
Map<Integer, Integer> contained = new LinkedHashMap<>();
|
||||
|
||||
for (MapleMapObject obj : getReactors()) {
|
||||
for (MapObject obj : getReactors()) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
if (contained.containsKey(mr.getId())) {
|
||||
if (contained.get(mr.getId()) >= num) {
|
||||
@@ -334,7 +334,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public boolean isAllReactorState(final int reactorId, final int state) {
|
||||
for (MapleMapObject mo : getReactors()) {
|
||||
for (MapObject mo : getReactors()) {
|
||||
MapleReactor r = (MapleReactor) mo;
|
||||
|
||||
if (r.getId() == reactorId && r.getState() != state) {
|
||||
@@ -362,7 +362,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public void addMapObject(MapleMapObject mapobject) {
|
||||
public void addMapObject(MapObject mapobject) {
|
||||
int curOID = getUsableOID();
|
||||
|
||||
objectWLock.lock();
|
||||
@@ -384,11 +384,11 @@ public class MapleMap {
|
||||
return this.selfDestructives.remove(mapobjectid);
|
||||
}
|
||||
|
||||
private void spawnAndAddRangedMapObject(MapleMapObject mapobject, DelayedPacketCreation packetbakery) {
|
||||
private void spawnAndAddRangedMapObject(MapObject mapobject, DelayedPacketCreation packetbakery) {
|
||||
spawnAndAddRangedMapObject(mapobject, packetbakery, null);
|
||||
}
|
||||
|
||||
private void spawnAndAddRangedMapObject(MapleMapObject mapobject, DelayedPacketCreation packetbakery, SpawnCondition condition) {
|
||||
private void spawnAndAddRangedMapObject(MapObject mapobject, DelayedPacketCreation packetbakery, SpawnCondition condition) {
|
||||
List<Character> inRangeCharacters = new LinkedList<>();
|
||||
int curOID = getUsableOID();
|
||||
|
||||
@@ -415,7 +415,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
private void spawnRangedMapObject(MapleMapObject mapobject, DelayedPacketCreation packetbakery, SpawnCondition condition) {
|
||||
private void spawnRangedMapObject(MapObject mapobject, DelayedPacketCreation packetbakery, SpawnCondition condition) {
|
||||
List<Character> inRangeCharacters = new LinkedList<>();
|
||||
|
||||
chrRLock.lock();
|
||||
@@ -466,7 +466,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeMapObject(final MapleMapObject obj) {
|
||||
public void removeMapObject(final MapObject obj) {
|
||||
removeMapObject(obj.getObjectId());
|
||||
}
|
||||
|
||||
@@ -863,7 +863,7 @@ public class MapleMap {
|
||||
|
||||
private void instantiateItemDrop(MapItem mdrop) {
|
||||
if (droppedItemCount.get() >= YamlConfig.config.server.ITEM_LIMIT_ON_MAP) {
|
||||
MapleMapObject mapobj;
|
||||
MapObject mapobj;
|
||||
|
||||
do {
|
||||
mapobj = null;
|
||||
@@ -1094,7 +1094,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
private void spawnDrop(final Item idrop, final Point dropPos, final MapleMapObject dropper, final Character chr, final byte droptype, final short questid) {
|
||||
private void spawnDrop(final Item idrop, final Point dropPos, final MapObject dropper, final Character chr, final byte droptype, final short questid) {
|
||||
final MapItem mdrop = new MapItem(idrop, dropPos, dropper, chr, chr.getClient(), droptype, false, questid);
|
||||
mdrop.setDropTime(Server.getInstance().getCurrentTime());
|
||||
spawnAndAddRangedMapObject(mdrop, c -> {
|
||||
@@ -1114,7 +1114,7 @@ public class MapleMap {
|
||||
activateItemReactors(mdrop, chr.getClient());
|
||||
}
|
||||
|
||||
public final void spawnMesoDrop(final int meso, final Point position, final MapleMapObject dropper, final Character owner, final boolean playerDrop, final byte droptype) {
|
||||
public final void spawnMesoDrop(final int meso, final Point position, final MapObject dropper, final Character owner, final boolean playerDrop, final byte droptype) {
|
||||
final Point droppos = calcDropPos(position, position);
|
||||
final MapItem mdrop = new MapItem(meso, droppos, dropper, owner, owner.getClient(), droptype, playerDrop);
|
||||
mdrop.setDropTime(Server.getInstance().getCurrentTime());
|
||||
@@ -1131,7 +1131,7 @@ public class MapleMap {
|
||||
instantiateItemDrop(mdrop);
|
||||
}
|
||||
|
||||
public final void disappearingItemDrop(final MapleMapObject dropper, final Character owner, final Item item, final Point pos) {
|
||||
public final void disappearingItemDrop(final MapObject dropper, final Character owner, final Item item, final Point pos) {
|
||||
final Point droppos = calcDropPos(pos, pos);
|
||||
final MapItem mdrop = new MapItem(item, droppos, dropper, owner, owner.getClient(), (byte) 1, false);
|
||||
|
||||
@@ -1143,7 +1143,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public final void disappearingMesoDrop(final int meso, final MapleMapObject dropper, final Character owner, final Point pos) {
|
||||
public final void disappearingMesoDrop(final int meso, final MapObject dropper, final Character owner, final Point pos) {
|
||||
final Point droppos = calcDropPos(pos, pos);
|
||||
final MapItem mdrop = new MapItem(meso, droppos, dropper, owner, owner.getClient(), (byte) 1, false);
|
||||
|
||||
@@ -1158,7 +1158,7 @@ public class MapleMap {
|
||||
public Monster getMonsterById(int id) {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapleMapObject obj : mapobjects.values()) {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.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 (MapleMapObject 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(MapleMapObjectType.MONSTER))) {
|
||||
Monster mob = (Monster) m;
|
||||
if (mob.getId() >= minid && mob.getId() <= maxid) {
|
||||
count++;
|
||||
@@ -1194,17 +1194,17 @@ public class MapleMap {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR)).size();
|
||||
}
|
||||
|
||||
public final List<MapleMapObject> getReactors() {
|
||||
public final List<MapObject> getReactors() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR));
|
||||
}
|
||||
|
||||
public final List<MapleMapObject> getMonsters() {
|
||||
public final List<MapObject> getMonsters() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
}
|
||||
|
||||
public final List<MapleReactor> getAllReactors() {
|
||||
List<MapleReactor> list = new LinkedList<>();
|
||||
for (MapleMapObject mmo : getReactors()) {
|
||||
for (MapObject mmo : getReactors()) {
|
||||
list.add((MapleReactor) mmo);
|
||||
}
|
||||
|
||||
@@ -1213,7 +1213,7 @@ public class MapleMap {
|
||||
|
||||
public final List<Monster> getAllMonsters() {
|
||||
List<Monster> list = new LinkedList<>();
|
||||
for (MapleMapObject mmo : getMonsters()) {
|
||||
for (MapObject mmo : getMonsters()) {
|
||||
list.add((Monster) mmo);
|
||||
}
|
||||
|
||||
@@ -1224,7 +1224,7 @@ public class MapleMap {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)).size();
|
||||
}
|
||||
|
||||
public final List<MapleMapObject> getItems() {
|
||||
public final List<MapObject> getItems() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
}
|
||||
|
||||
@@ -1232,7 +1232,7 @@ public class MapleMap {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER)).size();
|
||||
}
|
||||
|
||||
public List<MapleMapObject> getPlayers() {
|
||||
public List<MapObject> getPlayers() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER));
|
||||
}
|
||||
|
||||
@@ -1299,7 +1299,7 @@ public class MapleMap {
|
||||
|
||||
public boolean damageMonster(final Character chr, final Monster monster, final int damage) {
|
||||
if (monster.getId() == 8800000) {
|
||||
for (MapleMapObject object : chr.getMap().getMapObjects()) {
|
||||
for (MapObject object : chr.getMap().getMapObjects()) {
|
||||
Monster mons = chr.getMap().getMonsterByOid(object.getObjectId());
|
||||
if (mons != null) {
|
||||
if (mons.getId() >= 8800003 && mons.getId() <= 8800010) {
|
||||
@@ -1398,7 +1398,7 @@ public class MapleMap {
|
||||
int buff = monster.getBuffToGive();
|
||||
if (buff > -1) {
|
||||
MapleItemInformationProvider mii = MapleItemInformationProvider.getInstance();
|
||||
for (MapleMapObject mmo : this.getPlayers()) {
|
||||
for (MapObject mmo : this.getPlayers()) {
|
||||
Character character = (Character) mmo;
|
||||
if (character.isAlive()) {
|
||||
MapleStatEffect statEffect = mii.getItemEffect(buff);
|
||||
@@ -1411,8 +1411,8 @@ public class MapleMap {
|
||||
|
||||
if (monster.getId() >= 8800003 && monster.getId() <= 8800010) {
|
||||
boolean makeZakReal = true;
|
||||
Collection<MapleMapObject> objects = getMapObjects();
|
||||
for (MapleMapObject object : objects) {
|
||||
Collection<MapObject> objects = getMapObjects();
|
||||
for (MapObject object : objects) {
|
||||
Monster mons = getMonsterByOid(object.getObjectId());
|
||||
if (mons != null) {
|
||||
if (mons.getId() >= 8800003 && mons.getId() <= 8800010) {
|
||||
@@ -1424,7 +1424,7 @@ public class MapleMap {
|
||||
if (makeZakReal) {
|
||||
MapleMap map = chr.getMap();
|
||||
|
||||
for (MapleMapObject object : objects) {
|
||||
for (MapObject object : objects) {
|
||||
Monster mons = map.getMonsterByOid(object.getObjectId());
|
||||
if (mons != null) {
|
||||
if (mons.getId() == 8800000) {
|
||||
@@ -1499,7 +1499,7 @@ public class MapleMap {
|
||||
public void softKillAllMonsters() {
|
||||
closeMapSpawnPoints();
|
||||
|
||||
for (MapleMapObject 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(MapleMapObjectType.MONSTER))) {
|
||||
Monster monster = (Monster) monstermo;
|
||||
if (monster.getStats().isFriendly()) {
|
||||
continue;
|
||||
@@ -1514,7 +1514,7 @@ public class MapleMap {
|
||||
public void killAllMonstersNotFriendly() {
|
||||
closeMapSpawnPoints();
|
||||
|
||||
for (MapleMapObject 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(MapleMapObjectType.MONSTER))) {
|
||||
Monster monster = (Monster) monstermo;
|
||||
if (monster.getStats().isFriendly()) {
|
||||
continue;
|
||||
@@ -1527,7 +1527,7 @@ public class MapleMap {
|
||||
public void killAllMonsters() {
|
||||
closeMapSpawnPoints();
|
||||
|
||||
for (MapleMapObject 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(MapleMapObjectType.MONSTER))) {
|
||||
Monster monster = (Monster) monstermo;
|
||||
|
||||
killMonster(monster, null, false, 1);
|
||||
@@ -1536,9 +1536,9 @@ public class MapleMap {
|
||||
|
||||
public final void destroyReactors(final int first, final int last) {
|
||||
List<MapleReactor> toDestroy = new ArrayList<>();
|
||||
List<MapleMapObject> reactors = getReactors();
|
||||
List<MapObject> reactors = getReactors();
|
||||
|
||||
for (MapleMapObject obj : reactors) {
|
||||
for (MapObject obj : reactors) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
if (mr.getId() >= first && mr.getId() <= last) {
|
||||
toDestroy.add(mr);
|
||||
@@ -1565,7 +1565,7 @@ public class MapleMap {
|
||||
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapleMapObject o : mapobjects.values()) {
|
||||
for (MapObject o : mapobjects.values()) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
final MapleReactor r = ((MapleReactor) o);
|
||||
list.add(r);
|
||||
@@ -1599,13 +1599,13 @@ public class MapleMap {
|
||||
List<Point> points = new ArrayList<>();
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapleMapObject o : mapobjects.values()) {
|
||||
for (MapObject o : mapobjects.values()) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
points.add(o.getPosition());
|
||||
}
|
||||
}
|
||||
Collections.shuffle(points);
|
||||
for (MapleMapObject o : mapobjects.values()) {
|
||||
for (MapObject o : mapobjects.values()) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
o.setPosition(points.remove(points.size() - 1));
|
||||
}
|
||||
@@ -1617,10 +1617,10 @@ public class MapleMap {
|
||||
|
||||
public final void shuffleReactors(int first, int last) {
|
||||
List<Point> points = new ArrayList<>();
|
||||
List<MapleMapObject> reactors = getReactors();
|
||||
List<MapleMapObject> targets = new LinkedList<>();
|
||||
List<MapObject> reactors = getReactors();
|
||||
List<MapObject> targets = new LinkedList<>();
|
||||
|
||||
for (MapleMapObject obj : reactors) {
|
||||
for (MapObject obj : reactors) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
if (mr.getId() >= first && mr.getId() <= last) {
|
||||
points.add(mr.getPosition());
|
||||
@@ -1628,7 +1628,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
Collections.shuffle(points);
|
||||
for (MapleMapObject obj : targets) {
|
||||
for (MapObject obj : targets) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
mr.setPosition(points.remove(points.size() - 1));
|
||||
}
|
||||
@@ -1636,14 +1636,14 @@ public class MapleMap {
|
||||
|
||||
public final void shuffleReactors(List<Object> list) {
|
||||
List<Point> points = new ArrayList<>();
|
||||
List<MapleMapObject> listObjects = new ArrayList<>();
|
||||
List<MapleMapObject> targets = new LinkedList<>();
|
||||
List<MapObject> listObjects = new ArrayList<>();
|
||||
List<MapObject> targets = new LinkedList<>();
|
||||
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (Object ob : list) {
|
||||
if (ob instanceof MapleMapObject) {
|
||||
MapleMapObject mmo = (MapleMapObject) ob;
|
||||
if (ob instanceof MapObject) {
|
||||
MapObject mmo = (MapObject) ob;
|
||||
|
||||
if (mapobjects.containsValue(mmo) && mmo.getType() == MapleMapObjectType.REACTOR) {
|
||||
listObjects.add(mmo);
|
||||
@@ -1654,20 +1654,20 @@ public class MapleMap {
|
||||
objectRLock.unlock();
|
||||
}
|
||||
|
||||
for (MapleMapObject obj : listObjects) {
|
||||
for (MapObject obj : listObjects) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
|
||||
points.add(mr.getPosition());
|
||||
targets.add(obj);
|
||||
}
|
||||
Collections.shuffle(points);
|
||||
for (MapleMapObject obj : targets) {
|
||||
for (MapObject obj : targets) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
mr.setPosition(points.remove(points.size() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
private Map<Integer, MapleMapObject> getCopyMapObjects() {
|
||||
private Map<Integer, MapObject> getCopyMapObjects() {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
return new HashMap<>(mapobjects);
|
||||
@@ -1676,7 +1676,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public List<MapleMapObject> getMapObjects() {
|
||||
public List<MapObject> getMapObjects() {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
return new LinkedList(mapobjects.values());
|
||||
@@ -1686,7 +1686,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public NPC getNPCById(int id) {
|
||||
for (MapleMapObject obj : getMapObjects()) {
|
||||
for (MapObject obj : getMapObjects()) {
|
||||
if (obj.getType() == MapleMapObjectType.NPC) {
|
||||
NPC npc = (NPC) obj;
|
||||
if (npc.getId() == id) {
|
||||
@@ -1701,7 +1701,7 @@ public class MapleMap {
|
||||
public boolean containsNPC(int npcid) {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapleMapObject obj : mapobjects.values()) {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.NPC) {
|
||||
if (((NPC) obj).getId() == npcid) {
|
||||
return true;
|
||||
@@ -1715,12 +1715,12 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public void destroyNPC(int npcid) { // assumption: there's at most one of the same NPC in a map.
|
||||
List<MapleMapObject> 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(MapleMapObjectType.NPC));
|
||||
|
||||
chrRLock.lock();
|
||||
objectWLock.lock();
|
||||
try {
|
||||
for (MapleMapObject obj : npcs) {
|
||||
for (MapObject obj : npcs) {
|
||||
if (((NPC) obj).getId() == npcid) {
|
||||
broadcastMessage(PacketCreator.removeNPCController(obj.getObjectId()));
|
||||
broadcastMessage(PacketCreator.removeNPC(obj.getObjectId()));
|
||||
@@ -1734,7 +1734,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public MapleMapObject getMapObject(int oid) {
|
||||
public MapObject getMapObject(int oid) {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
return mapobjects.get(oid);
|
||||
@@ -1751,19 +1751,19 @@ public class MapleMap {
|
||||
* @return
|
||||
*/
|
||||
public Monster getMonsterByOid(int oid) {
|
||||
MapleMapObject mmo = getMapObject(oid);
|
||||
MapObject mmo = getMapObject(oid);
|
||||
return (mmo != null && mmo.getType() == MapleMapObjectType.MONSTER) ? (Monster) mmo : null;
|
||||
}
|
||||
|
||||
public MapleReactor getReactorByOid(int oid) {
|
||||
MapleMapObject mmo = getMapObject(oid);
|
||||
MapObject mmo = getMapObject(oid);
|
||||
return (mmo != null && mmo.getType() == MapleMapObjectType.REACTOR) ? (MapleReactor) mmo : null;
|
||||
}
|
||||
|
||||
public MapleReactor getReactorById(int Id) {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapleMapObject obj : mapobjects.values()) {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (((MapleReactor) obj).getId() == Id) {
|
||||
return (MapleReactor) obj;
|
||||
@@ -1781,7 +1781,7 @@ public class MapleMap {
|
||||
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapleMapObject obj : mapobjects.values()) {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.REACTOR) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
|
||||
@@ -1800,7 +1800,7 @@ public class MapleMap {
|
||||
public MapleReactor getReactorByName(String name) {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapleMapObject obj : mapobjects.values()) {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (((MapleReactor) obj).getName().equals(name)) {
|
||||
return (MapleReactor) obj;
|
||||
@@ -2076,8 +2076,8 @@ public class MapleMap {
|
||||
final ScheduledFuture<?> poisonSchedule;
|
||||
if (poison) {
|
||||
Runnable poisonTask = () -> {
|
||||
List<MapleMapObject> affectedMonsters = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapleMapObjectType.MONSTER));
|
||||
for (MapleMapObject mo : affectedMonsters) {
|
||||
List<MapObject> affectedMonsters = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapleMapObjectType.MONSTER));
|
||||
for (MapObject mo : affectedMonsters) {
|
||||
if (mist.makeChanceResult()) {
|
||||
MonsterStatusEffect poisonEffect = new MonsterStatusEffect(Collections.singletonMap(MonsterStatus.POISON, 1), mist.getSourceSkill(), null, false);
|
||||
((Monster) mo).applyStatus(mist.getOwner(), poisonEffect, true, duration);
|
||||
@@ -2087,8 +2087,8 @@ public class MapleMap {
|
||||
poisonSchedule = tMan.register(poisonTask, 2000, 2500);
|
||||
} else if (recovery) {
|
||||
Runnable poisonTask = () -> {
|
||||
List<MapleMapObject> players = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapleMapObjectType.PLAYER));
|
||||
for (MapleMapObject mo : players) {
|
||||
List<MapObject> players = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapleMapObjectType.PLAYER));
|
||||
for (MapObject mo : players) {
|
||||
if (mist.makeChanceResult()) {
|
||||
Character chr = (Character) mo;
|
||||
if (mist.getOwner().getId() == chr.getId() || mist.getOwner().getParty() != null && mist.getOwner().getParty().containsMembers(chr.getMPC())) {
|
||||
@@ -2126,11 +2126,11 @@ public class MapleMap {
|
||||
getWorldServer().registerTimedMapObject(expireKite, YamlConfig.config.server.KITE_EXPIRE_TIME);
|
||||
}
|
||||
|
||||
public final void spawnItemDrop(final MapleMapObject dropper, final Character owner, final Item item, Point pos, final boolean ffaDrop, final boolean playerDrop) {
|
||||
public final void spawnItemDrop(final MapObject dropper, final Character owner, final Item item, Point pos, final boolean ffaDrop, final boolean playerDrop) {
|
||||
spawnItemDrop(dropper, owner, item, pos, (byte) (ffaDrop ? 2 : 0), playerDrop);
|
||||
}
|
||||
|
||||
public final void spawnItemDrop(final MapleMapObject dropper, final Character owner, final Item item, Point pos, final byte dropType, final boolean playerDrop) {
|
||||
public final void spawnItemDrop(final MapObject dropper, final Character owner, final Item item, Point pos, final byte dropType, final boolean playerDrop) {
|
||||
if (FieldLimit.DROP_LIMIT.check(this.getFieldLimit())) { // thanks Conrad for noticing some maps shouldn't have loots available
|
||||
this.disappearingItemDrop(dropper, owner, item, pos);
|
||||
return;
|
||||
@@ -2160,16 +2160,16 @@ public class MapleMap {
|
||||
activateItemReactors(mdrop, owner.getClient());
|
||||
}
|
||||
|
||||
public final void spawnItemDropList(List<Integer> list, final MapleMapObject dropper, final Character owner, Point pos) {
|
||||
public final void spawnItemDropList(List<Integer> list, final MapObject dropper, final Character owner, Point pos) {
|
||||
spawnItemDropList(list, 1, 1, dropper, owner, pos, true, false);
|
||||
}
|
||||
|
||||
public final void spawnItemDropList(List<Integer> list, int minCopies, int maxCopies, final MapleMapObject dropper, final Character owner, Point pos) {
|
||||
public final void spawnItemDropList(List<Integer> list, int minCopies, int maxCopies, final MapObject dropper, final Character owner, Point pos) {
|
||||
spawnItemDropList(list, minCopies, maxCopies, dropper, owner, pos, true, false);
|
||||
}
|
||||
|
||||
// spawns item instances of all defined item ids on a list
|
||||
public final void spawnItemDropList(List<Integer> list, int minCopies, int maxCopies, final MapleMapObject dropper, final Character owner, Point pos, final boolean ffaDrop, final boolean playerDrop) {
|
||||
public final void spawnItemDropList(List<Integer> list, int minCopies, int maxCopies, final MapObject dropper, final Character owner, Point pos, final boolean ffaDrop, final boolean playerDrop) {
|
||||
int copies = (maxCopies - minCopies) + 1;
|
||||
if (copies < 1) {
|
||||
return;
|
||||
@@ -2211,7 +2211,7 @@ public class MapleMap {
|
||||
private void activateItemReactors(final MapItem drop, final Client c) {
|
||||
final Item item = drop.getItem();
|
||||
|
||||
for (final MapleMapObject o : getReactors()) {
|
||||
for (final MapObject o : getReactors()) {
|
||||
final MapleReactor react = (MapleReactor) o;
|
||||
|
||||
if (react.getReactorType() == 100) {
|
||||
@@ -2926,7 +2926,7 @@ public class MapleMap {
|
||||
|
||||
private void sendObjectPlacement(Client c) {
|
||||
Character chr = c.getPlayer();
|
||||
Collection<MapleMapObject> objects;
|
||||
Collection<MapObject> objects;
|
||||
|
||||
objectRLock.lock();
|
||||
try {
|
||||
@@ -2935,7 +2935,7 @@ public class MapleMap {
|
||||
objectRLock.unlock();
|
||||
}
|
||||
|
||||
for (MapleMapObject o : objects) {
|
||||
for (MapObject o : objects) {
|
||||
if (isNonRangedType(o.getType())) {
|
||||
o.sendSpawnData(c);
|
||||
} else if (o.getType() == MapleMapObjectType.SUMMON) {
|
||||
@@ -2956,7 +2956,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
if (chr != null) {
|
||||
for (MapleMapObject o : getMapObjectsInRange(chr.getPosition(), getRangedDistance(), rangedMapobjectTypes)) {
|
||||
for (MapObject o : getMapObjectsInRange(chr.getPosition(), getRangedDistance(), rangedMapobjectTypes)) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (((MapleReactor) o).isAlive()) {
|
||||
o.sendSpawnData(chr.getClient());
|
||||
@@ -2974,11 +2974,11 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public List<MapleMapObject> getMapObjectsInRange(Point from, double rangeSq, List<MapleMapObjectType> types) {
|
||||
List<MapleMapObject> ret = new LinkedList<>();
|
||||
public List<MapObject> getMapObjectsInRange(Point from, double rangeSq, List<MapleMapObjectType> types) {
|
||||
List<MapObject> ret = new LinkedList<>();
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapleMapObject l : mapobjects.values()) {
|
||||
for (MapObject l : mapobjects.values()) {
|
||||
if (types.contains(l.getType())) {
|
||||
if (from.distanceSq(l.getPosition()) <= rangeSq) {
|
||||
ret.add(l);
|
||||
@@ -2991,11 +2991,11 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public List<MapleMapObject> getMapObjectsInBox(Rectangle box, List<MapleMapObjectType> types) {
|
||||
List<MapleMapObject> ret = new LinkedList<>();
|
||||
public List<MapObject> getMapObjectsInBox(Rectangle box, List<MapleMapObjectType> types) {
|
||||
List<MapObject> ret = new LinkedList<>();
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapleMapObject l : mapobjects.values()) {
|
||||
for (MapObject l : mapobjects.values()) {
|
||||
if (types.contains(l.getType())) {
|
||||
if (box.contains(l.getPosition())) {
|
||||
ret.add(l);
|
||||
@@ -3171,7 +3171,7 @@ public class MapleMap {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void updateMapObjectVisibility(Character chr, MapleMapObject mo) {
|
||||
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()) {
|
||||
chr.addVisibleMapObject(mo);
|
||||
@@ -3194,10 +3194,10 @@ public class MapleMap {
|
||||
player.setPosition(newPosition);
|
||||
|
||||
try {
|
||||
MapleMapObject[] visibleObjects = player.getVisibleMapObjects();
|
||||
MapObject[] visibleObjects = player.getVisibleMapObjects();
|
||||
|
||||
Map<Integer, MapleMapObject> mapObjects = getCopyMapObjects();
|
||||
for (MapleMapObject mo : visibleObjects) {
|
||||
Map<Integer, MapObject> mapObjects = getCopyMapObjects();
|
||||
for (MapObject mo : visibleObjects) {
|
||||
if (mo != null) {
|
||||
if (mapObjects.get(mo.getObjectId()) == mo) {
|
||||
updateMapObjectVisibility(player, mo);
|
||||
@@ -3210,7 +3210,7 @@ public class MapleMap {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for (MapleMapObject mo : getMapObjectsInRange(player.getPosition(), getRangedDistance(), rangedMapobjectTypes)) {
|
||||
for (MapObject mo : getMapObjectsInRange(player.getPosition(), getRangedDistance(), rangedMapobjectTypes)) {
|
||||
if (!player.isMapObjectVisible(mo)) {
|
||||
mo.sendSpawnData(player.getClient());
|
||||
player.addVisibleMapObject(mo);
|
||||
@@ -3342,7 +3342,7 @@ public class MapleMap {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean makeDisappearItemFromMap(MapleMapObject mapobj) {
|
||||
public boolean makeDisappearItemFromMap(MapObject mapobj) {
|
||||
if (mapobj instanceof MapItem) {
|
||||
return makeDisappearItemFromMap((MapItem) mapobj);
|
||||
} else {
|
||||
@@ -3795,7 +3795,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public void clearDrops(Character player) {
|
||||
for (MapleMapObject i : getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM))) {
|
||||
for (MapObject i : getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.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 (MapleMapObject 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(MapleMapObjectType.ITEM))) {
|
||||
droppedItemCount.decrementAndGet();
|
||||
removeMapObject(i);
|
||||
this.broadcastMessage(PacketCreator.removeItemFromMap(i.getObjectId(), 0, 0));
|
||||
@@ -3964,7 +3964,7 @@ public class MapleMap {
|
||||
chrRLock.lock();
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for (MapleMapObject obj : mapobjects.values()) {
|
||||
for (MapObject obj : mapobjects.values()) {
|
||||
if (obj.getType() == MapleMapObjectType.NPC) {
|
||||
NPC npc = (NPC) obj;
|
||||
if (npc.getId() == id) {
|
||||
@@ -4166,7 +4166,7 @@ public class MapleMap {
|
||||
blueTeamBuffs.clear();
|
||||
}
|
||||
|
||||
public List<MapleMapObject> getAllPlayer() {
|
||||
public List<MapObject> getAllPlayer() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER));
|
||||
}
|
||||
|
||||
@@ -4324,7 +4324,7 @@ public class MapleMap {
|
||||
} else if (team == 1) {
|
||||
blueTeamBuffs.add(skill);
|
||||
}
|
||||
for (MapleMapObject mmo : this.mapobjects.values()) {
|
||||
for (MapObject mmo : this.mapobjects.values()) {
|
||||
if (mmo.getType() == MapleMapObjectType.MONSTER) {
|
||||
Monster mob = (Monster) mmo;
|
||||
if (mob.getTeam() == team) {
|
||||
|
||||
Reference in New Issue
Block a user