Search in sources :

Example 36 with MapleCharacter

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));
}
Also used : MapleCharacter(client.MapleCharacter) MonsterStatusEffect(client.status.MonsterStatusEffect) MonsterStatus(client.status.MonsterStatus) TimerManager(server.TimerManager)

Example 37 with MapleCharacter

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);
    }
}
Also used : MapleCharacter(client.MapleCharacter)

Example 38 with MapleCharacter

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));
        }
    }
}
Also used : MapleCharacter(client.MapleCharacter)

Example 39 with MapleCharacter

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;
}
Also used : MapleCharacter(client.MapleCharacter)

Example 40 with MapleCharacter

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);
}
Also used : MapleCharacter(client.MapleCharacter)

Aggregations

MapleCharacter (client.MapleCharacter)163 Point (java.awt.Point)32 SQLException (java.sql.SQLException)22 Item (client.inventory.Item)21 Connection (java.sql.Connection)15 PreparedStatement (java.sql.PreparedStatement)15 MapleMonster (server.life.MapleMonster)15 MapleMapObject (server.maps.MapleMapObject)15 DatabaseConnection (tools.DatabaseConnection)15 MapleMap (server.maps.MapleMap)14 ArrayList (java.util.ArrayList)13 Skill (client.Skill)12 SpawnPoint (server.life.SpawnPoint)12 LinkedList (java.util.LinkedList)11 MapleInventory (client.inventory.MapleInventory)10 World (net.server.world.World)10 MapleStatEffect (server.MapleStatEffect)10 MapleInventoryType (client.inventory.MapleInventoryType)9 ResultSet (java.sql.ResultSet)9 MapleItemInformationProvider (server.MapleItemInformationProvider)9