use of client.MapleCharacter in project HeavenMS by ronancpl.
the class MapleMonster method applyMonsterBuff.
public void applyMonsterBuff(final Map<MonsterStatus, Integer> stats, final int x, int skillId, long duration, MobSkill skill, final List<Integer> reflection) {
TimerManager timerManager = TimerManager.getInstance();
final Runnable cancelTask = new Runnable() {
@Override
public void run() {
if (isAlive()) {
byte[] packet = MaplePacketCreator.cancelMonsterStatus(getObjectId(), stats);
map.broadcastMessage(packet, getPosition());
MapleCharacter controller = getController();
if (controller != null && !controller.isMapObjectVisible(MapleMonster.this)) {
controller.getClient().announce(packet);
}
statiLock.lock();
try {
for (final MonsterStatus stat : stats.keySet()) {
stati.remove(stat);
}
} finally {
statiLock.unlock();
}
}
}
};
final MonsterStatusEffect effect = new MonsterStatusEffect(stats, null, skill, true);
byte[] packet = MaplePacketCreator.applyMonsterStatus(getObjectId(), effect, reflection);
map.broadcastMessage(packet, getPosition());
statiLock.lock();
try {
for (MonsterStatus stat : stats.keySet()) {
stati.put(stat, effect);
alreadyBuffed.add(stat);
}
} finally {
statiLock.unlock();
}
MapleCharacter controller = getController();
if (controller != null && !controller.isMapObjectVisible(this)) {
controller.getClient().announce(packet);
}
effect.setCancelTask(timerManager.schedule(cancelTask, duration));
}
use of client.MapleCharacter in project HeavenMS by ronancpl.
the class MaplePlayerShop method banPlayer.
public void banPlayer(String name) {
if (!bannedList.contains(name)) {
bannedList.add(name);
}
MapleCharacter target = null;
visitorLock.lock();
try {
for (int i = 0; i < 3; i++) {
if (visitors[i] != null && visitors[i].getName().equals(name)) {
target = visitors[i];
break;
}
}
} finally {
visitorLock.unlock();
}
if (target != null) {
target.getClient().announce(MaplePacketCreator.shopErrorMessage(5, 1));
removeVisitor(target);
}
}
use of client.MapleCharacter in project HeavenMS by ronancpl.
the class MaplePlayerShop method recoverChatLog.
private void recoverChatLog() {
synchronized (chatLog) {
for (Pair<MapleCharacter, String> it : chatLog) {
MapleCharacter chr = it.getLeft();
Byte pos = chatSlot.get(chr.getId());
broadcastToVisitors(MaplePacketCreator.getPlayerShopChat(chr, it.getRight(), pos));
}
}
}
use of client.MapleCharacter in project HeavenMS by ronancpl.
the class Pyramid method warp.
public void warp(int mapid) {
for (MapleCharacter chr : getParticipants()) {
chr.changeMap(mapid, 0);
}
if (stage > -1) {
gaugeSchedule.cancel(false);
gaugeSchedule = null;
timer.cancel(false);
timer = null;
} else
stage = 0;
}
use of client.MapleCharacter in project HeavenMS by ronancpl.
the class MapleCoconut method startEvent.
public void startEvent() {
map.startEvent();
for (int i = 0; i < 506; i++) {
coconuts.add(new MapleCoconuts(i));
}
map.broadcastMessage(MaplePacketCreator.hitCoconut(true, 0, 0));
setCoconutsHittable(true);
map.broadcastMessage(MaplePacketCreator.getClock(300));
TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
if (map.getId() == 109080000) {
if (getMapleScore() == getStoryScore()) {
bonusTime();
} else if (getMapleScore() > getStoryScore()) {
for (MapleCharacter chr : map.getCharacters()) {
if (chr.getTeam() == 0) {
chr.getClient().announce(MaplePacketCreator.showEffect("event/coconut/victory"));
chr.getClient().announce(MaplePacketCreator.playSound("Coconut/Victory"));
} else {
chr.getClient().announce(MaplePacketCreator.showEffect("event/coconut/lose"));
chr.getClient().announce(MaplePacketCreator.playSound("Coconut/Failed"));
}
}
warpOut();
} else {
for (MapleCharacter chr : map.getCharacters()) {
if (chr.getTeam() == 1) {
chr.getClient().announce(MaplePacketCreator.showEffect("event/coconut/victory"));
chr.getClient().announce(MaplePacketCreator.playSound("Coconut/Victory"));
} else {
chr.getClient().announce(MaplePacketCreator.showEffect("event/coconut/lose"));
chr.getClient().announce(MaplePacketCreator.playSound("Coconut/Failed"));
}
}
warpOut();
}
}
}
}, 300000);
}
Aggregations