use of server.life.MapleMonster in project HeavenMS by ronancpl.
the class MapleMap method spawnMonsterOnGroundBelow.
public void spawnMonsterOnGroundBelow(int id, int x, int y) {
MapleMonster mob = MapleLifeFactory.getMonster(id);
spawnMonsterOnGroundBelow(mob, new Point(x, y));
}
use of server.life.MapleMonster in project HeavenMS by ronancpl.
the class MapleMap method removePlayer.
/*
public Collection<MaplePortal> getPortals() {
return Collections.unmodifiableCollection(portals.values());
}
*/
public void removePlayer(MapleCharacter chr) {
chr.unregisterChairBuff();
chrWLock.lock();
try {
removePartyMemberInternal(chr);
characters.remove(chr);
} finally {
chrWLock.unlock();
}
if (MapleMiniDungeonInfo.isDungeonMap(mapid)) {
MapleMiniDungeon mmd = chr.getClient().getChannelServer().getMiniDungeon(mapid);
if (mmd != null) {
if (!mmd.unregisterPlayer(chr)) {
chr.getClient().getChannelServer().removeMiniDungeon(mapid);
}
}
}
removeMapObject(chr.getObjectId());
if (!chr.isHidden()) {
broadcastMessage(MaplePacketCreator.removePlayerFromMap(chr.getId()));
} else {
broadcastGMMessage(MaplePacketCreator.removePlayerFromMap(chr.getId()));
}
for (MapleMonster monster : chr.getControlledMonsters()) {
monster.setController(null);
monster.setControllerHasAggro(false);
monster.setControllerKnowsAboutAggro(false);
updateMonsterController(monster);
}
chr.leaveMap();
for (MapleSummon summon : new ArrayList<>(chr.getSummonsValues())) {
if (summon.isStationary()) {
chr.cancelBuffStats(MapleBuffStat.PUPPET);
} else {
removeMapObject(summon);
}
}
if (chr.getDragon() != null) {
removeMapObject(chr.getDragon());
if (chr.isHidden()) {
this.broadcastGMMessage(chr, MaplePacketCreator.removeDragon(chr.getId()));
} else {
this.broadcastMessage(chr, MaplePacketCreator.removeDragon(chr.getId()));
}
}
}
use of server.life.MapleMonster in project HeavenMS by ronancpl.
the class MapleMap method monsterCloakingDevice.
public void monsterCloakingDevice() {
for (MapleMapObject monstermo : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER))) {
MapleMonster monster = (MapleMonster) monstermo;
broadcastMessage(MaplePacketCreator.makeMonsterInvisible(monster));
}
}
use of server.life.MapleMonster in project HeavenMS by ronancpl.
the class MapleMap method killAllMonstersNotFriendly.
public void killAllMonstersNotFriendly() {
closeMapSpawnPoints();
for (MapleMapObject monstermo : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER))) {
MapleMonster monster = (MapleMonster) monstermo;
if (monster.getStats().isFriendly()) {
continue;
}
killMonster(monster, null, false, 1);
}
}
use of server.life.MapleMonster in project HeavenMS by ronancpl.
the class MapleMap method spawnMist.
public void spawnMist(final MapleMist mist, final int duration, boolean poison, boolean fake, boolean recovery) {
addMapObject(mist);
broadcastMessage(fake ? mist.makeFakeSpawnData(30) : mist.makeSpawnData());
TimerManager tMan = TimerManager.getInstance();
final ScheduledFuture<?> poisonSchedule;
if (poison) {
Runnable poisonTask = new Runnable() {
@Override
public void run() {
List<MapleMapObject> affectedMonsters = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapleMapObjectType.MONSTER));
for (MapleMapObject mo : affectedMonsters) {
if (mist.makeChanceResult()) {
MonsterStatusEffect poisonEffect = new MonsterStatusEffect(Collections.singletonMap(MonsterStatus.POISON, 1), mist.getSourceSkill(), null, false);
((MapleMonster) mo).applyStatus(mist.getOwner(), poisonEffect, true, duration);
}
}
}
};
poisonSchedule = tMan.register(poisonTask, 2000, 2500);
} else if (recovery) {
Runnable poisonTask = new Runnable() {
@Override
public void run() {
List<MapleMapObject> players = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapleMapObjectType.PLAYER));
for (MapleMapObject mo : players) {
if (mist.makeChanceResult()) {
MapleCharacter chr = (MapleCharacter) mo;
if (mist.getOwner().getId() == chr.getId() || mist.getOwner().getParty() != null && mist.getOwner().getParty().containsMembers(chr.getMPC())) {
chr.addMP((int) mist.getSourceSkill().getEffect(chr.getSkillLevel(mist.getSourceSkill().getId())).getX() * chr.getMp() / 100);
}
}
}
}
};
poisonSchedule = tMan.register(poisonTask, 2000, 2500);
} else {
poisonSchedule = null;
}
tMan.schedule(new Runnable() {
@Override
public void run() {
removeMapObject(mist);
if (poisonSchedule != null) {
poisonSchedule.cancel(false);
}
broadcastMessage(mist.makeDestroyData());
}
}, duration);
}
Aggregations