@Override
 public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
   slea.skip(17);
   final List<LifeMovementFragment> res = parseMovement(slea);
   if (res != null && res.size() > 0) {
     if (c.getPlayer().isHidden()) {
       c.getPlayer()
           .getMap()
           .broadcastGMMessage(
               c.getPlayer(), MaplePacketCreator.movePlayer(c.getPlayer().getId(), res), false);
     } else {
       c.getPlayer()
           .getMap()
           .broadcastMessage(
               c.getPlayer(), MaplePacketCreator.movePlayer(c.getPlayer().getId(), res), false);
     }
     final MapleMap map = c.getPlayer().getMap();
     updatePosition(res, c.getPlayer(), 0);
     map.movePlayer(c.getPlayer(), c.getPlayer().getPosition());
     int count = c.getPlayer().getFallCounter(); // from vana
     if (map.getFootholds().findBelow(c.getPlayer().getPosition()) == null) {
       if (count > 3) {
         c.getPlayer().changeMap(map, map.getPortal(0));
       } else {
         c.getPlayer().setFallCounter(++count);
       }
     } else if (count > 0) {
       c.getPlayer().setFallCounter(0);
     }
   }
 }
Esempio n. 2
0
 public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
   if (!c.getPlayer().isAlive()) {
     c.getSession().write(MaplePacketCreator.enableActions());
     return;
   }
   MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
   slea.readInt();
   byte slot = (byte) slea.readShort();
   int itemId = slea.readInt();
   IItem toUse = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slot);
   if (toUse != null && toUse.getQuantity() > 0 && toUse.getItemId() == itemId) {
     if (itemId == 2022178 || itemId == 2022433 || itemId == 2050004) {
       c.getPlayer().dispelDebuffs();
       remove(c, slot);
       return;
     } else if (itemId == 2050003) {
       c.getPlayer().dispelSeal();
       remove(c, slot);
       return;
     }
     if (isTownScroll(itemId)) {
       if (ii.getItemEffect(toUse.getItemId()).applyTo(c.getPlayer())) {
         remove(c, slot);
       }
       c.getSession().write(MaplePacketCreator.enableActions());
       return;
     }
     remove(c, slot);
     ii.getItemEffect(toUse.getItemId()).applyTo(c.getPlayer());
     c.getPlayer().checkBerserk();
   }
 }
Esempio n. 3
0
 public void forceComplete(MapleCharacter c, int npc) {
   MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.COMPLETED, npc);
   newStatus.setForfeited(c.getQuest(this).getForfeited());
   newStatus.setCompletionTime(System.currentTimeMillis());
   c.announce(MaplePacketCreator.showSpecialEffect(9));
   c.getMap().broadcastMessage(c, MaplePacketCreator.showForeignEffect(c.getId(), 9), false);
   c.updateQuest(newStatus);
 }
Esempio n. 4
0
 public void chat(String message) {
   chr.getClient().getSession().write(MaplePacketCreator.getTradeChat(chr, message, true));
   if (partner != null) {
     partner
         .getChr()
         .getClient()
         .getSession()
         .write(MaplePacketCreator.getTradeChat(chr, message, false));
   }
 }
Esempio n. 5
0
 public void addItem(IItem item) {
   items.add(item);
   chr.getClient().getSession().write(MaplePacketCreator.getTradeItemAdd((byte) 0, item));
   if (partner != null) {
     partner
         .getChr()
         .getClient()
         .getSession()
         .write(MaplePacketCreator.getTradeItemAdd((byte) 1, item));
   }
 }
Esempio n. 6
0
 public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
   int itemId = slea.readInt();
   if (c.getPlayer().getInventory(MapleInventoryType.SETUP).findById(itemId) == null) {
     return;
   }
   c.getPlayer().setChair(itemId);
   c.getPlayer()
       .getMap()
       .broadcastMessage(
           c.getPlayer(), MaplePacketCreator.showChair(c.getPlayer().getId(), itemId), false);
   c.announce(MaplePacketCreator.enableActions());
 }
Esempio n. 7
0
 public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
   if (!c.getPlayer().isAlive()) {
     c.announce(MaplePacketCreator.enableActions());
     return;
   }
   slea.readInt();
   byte slot = (byte) slea.readShort();
   int itemId = slea.readInt();
   MapleCharacter player = c.getPlayer();
   IItem toUse = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slot);
   if (toUse != null && toUse.getQuantity() == 1) {
     if (toUse.getItemId() != itemId) {
       return;
     }
     Map<String, Integer> skilldata =
         MapleItemInformationProvider.getInstance()
             .getSkillStats(toUse.getItemId(), c.getPlayer().getJob().getId());
     boolean canuse = false;
     boolean success = false;
     int skill = 0;
     int maxlevel = 0;
     if (skilldata == null) {
       return;
     }
     if (skilldata.get("skillid") == 0) {
       canuse = false;
     } else if (player.getMasterLevel(SkillFactory.getSkill(skilldata.get("skillid")))
             >= skilldata.get("reqSkillLevel")
         || skilldata.get("reqSkillLevel") == 0) {
       canuse = true;
       if (Randomizer.nextInt(101) < skilldata.get("success") && skilldata.get("success") != 0) {
         success = true;
         ISkill skill2 = SkillFactory.getSkill(skilldata.get("skillid"));
         player.changeSkillLevel(
             skill2,
             player.getSkillLevel(skill2),
             Math.max(skilldata.get("masterLevel"), player.getMasterLevel(skill2)),
             -1);
       } else {
         success = false;
         player.message(
             "The skill book lights up, but the skill winds up as if nothing happened.");
       }
       MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
     } else {
       canuse = false;
     }
     player
         .getClient()
         .announce(MaplePacketCreator.skillBookSuccess(player, skill, maxlevel, canuse, success));
   }
 }
Esempio n. 8
0
 public static void visitTrade(MapleCharacter c1, MapleCharacter c2) {
   if (c1.getTrade() != null
       && c1.getTrade().getPartner() == c2.getTrade()
       && c2.getTrade() != null
       && c2.getTrade().getPartner() == c1.getTrade()) {
     c2.getClient().getSession().write(MaplePacketCreator.getTradePartnerAdd(c1));
     c1.getClient()
         .getSession()
         .write(MaplePacketCreator.getTradeStart(c1.getClient(), c1.getTrade(), (byte) 1));
   } else {
     c1.message("The other player has already closed the trade.");
   }
 }
  @Override
  public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {

    String pic = slea.readMapleAsciiString();
    int charId = slea.readInt();
    byte world = (byte) slea.readInt(); // world
    c.setWorld(world);
    byte channel =
        (byte) Randomizer.rand(0, Server.getInstance().getWorld(world).getChannels().size());
    c.setChannel(channel);
    String macs = slea.readMapleAsciiString();
    c.updateMacs(macs);

    if (c.hasBannedMac()) {
      c.getSession().close(true);
      return;
    }
    if (c.checkPic(pic)) {
      try {
        if (c.getIdleTask() != null) {
          c.getIdleTask().cancel(true);
        }
        c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);

        String channelServerIP =
            MapleClient.getChannelServerIPFromSubnet(
                c.getSession().getRemoteAddress().toString().replace("/", "").split(":")[0],
                channel);
        if (channelServerIP.equals("0.0.0.0")) {
          String[] socket = Server.getInstance().getIP(world, channel).split(":");

          c.announce(
              MaplePacketCreator.getServerIP(
                  InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
        } else {
          String[] socket = Server.getInstance().getIP(world, channel).split(":");
          c.announce(
              MaplePacketCreator.getServerIP(
                  InetAddress.getByName(channelServerIP), Integer.parseInt(socket[1]), charId));
        }
      } catch (UnknownHostException e) {
        log.error("Host not found", e);
      }

    } else {

      c.announce(MaplePacketCreator.wrongPic());
    }
  }
Esempio n. 10
0
 @Override
 public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
   int id = slea.readShort();
   if (id == -1) { // Cancel Chair
     c.getPlayer().setChair(0);
     c.announce(MaplePacketCreator.cancelChair(-1));
     c.getPlayer()
         .getMap()
         .broadcastMessage(
             c.getPlayer(), MaplePacketCreator.showChair(c.getPlayer().getId(), 0), false);
   } else { // Use In-Map Chair
     c.getPlayer().setChair(id);
     c.announce(MaplePacketCreator.cancelChair(id));
   }
 }
Esempio n. 11
0
 public void addVisitor(MapleCharacter visitor) {
   int i = this.getFreeSlot();
   if (i > -1) {
     visitors[i] = visitor;
     broadcastToVisitors(MaplePacketCreator.hiredMerchantVisitorAdd(visitor, i + 1));
   }
 }
Esempio n. 12
0
 @Override
 public void execute(MapleClient c, MessageCallback mc, String[] splitted)
     throws Exception, IllegalCommandSyntaxException {
   if (splitted[0].equals("!whosthere")) {
     MessageCallback callback = new ServernoticeMapleClientMessageCallback(c);
     StringBuilder builder = new StringBuilder("Players on Map: ");
     for (MapleCharacter chr : c.getPlayer().getMap().getCharacters()) {
       if (builder.length() > 150) { // wild guess :o
         builder.setLength(builder.length() - 2);
         callback.dropMessage(builder.toString());
         builder = new StringBuilder();
       }
       builder.append(MapleCharacter.makeMapleReadable(chr.getName()));
       builder.append(", ");
     }
     builder.setLength(builder.length() - 2);
     c.getSession().write(MaplePacketCreator.serverNotice(6, builder.toString()));
   } else if (splitted[0].equals("!cheaters")) {
     try {
       List<CheaterData> cheaters =
           c.getChannelServer().getWorldInterface().getCheaters(c.getWorld());
       for (int x = cheaters.size() - 1; x >= 0; x--) {
         CheaterData cheater = cheaters.get(x);
         mc.dropMessage(cheater.getInfo());
       }
     } catch (RemoteException e) {
       c.getChannelServer().reconnectWorld();
     }
   }
 }
Esempio n. 13
0
 @Override
 public void sendSpawnData(final MapleClient client) {
   if (questid <= 0
       || (client.getPlayer().getQuestStatus(questid) == 1
           && client.getPlayer().needQuestItem(questid, item.getItemId()))) {
     client.announce(
         MaplePacketCreator.dropItemFromMapObject(this, null, getPosition(), (byte) 2));
   }
 }
Esempio n. 14
0
 public void removeVisitor(MapleCharacter visitor) {
   int slot = getVisitorSlot(visitor);
   if (visitors[slot] == visitor) {
     visitors[slot] = null;
     if (slot != -1) {
       broadcastToVisitors(MaplePacketCreator.hiredMerchantVisitorLeave(slot + 1));
     }
   }
 }
Esempio n. 15
0
 @Override
 public int execute(MapleClient c, String[] splitted) {
   c.removeClickedNPC();
   NPCScriptManager.getInstance().dispose(c);
   ItemScriptManager.getInstance().dispose(c);
   QuestScriptManager.getInstance().dispose(c);
   c.getSession().write(MaplePacketCreator.enableActions());
   c.getPlayer().dropMessage(6, "解卡成功。");
   return 1;
 }
Esempio n. 16
0
 public static void startTrade(MapleCharacter c) {
   if (c.getTrade() == null) {
     c.setTrade(new MapleTrade((byte) 0, c));
     c.getClient()
         .getSession()
         .write(MaplePacketCreator.getTradeStart(c.getClient(), c.getTrade(), (byte) 0));
   } else {
     c.message("You are already in a trade.");
   }
 }
Esempio n. 17
0
 @Override
 public int execute(MapleClient c, String[] splitted) {
   for (final ChannelServer cserv : ChannelServer.getAllInstances()) {
     cserv.broadcastGMMessage(
         MaplePacketCreator.multiChat(
             "[管理员帮助] " + c.getPlayer().getName(), StringUtil.joinStringFrom(splitted, 1), 0));
   }
   c.getPlayer().dropMessage(5, "你的消息已经发送成功");
   return 1;
 }
Esempio n. 18
0
 public static void inviteTrade(MapleCharacter c1, MapleCharacter c2) {
   if (c2.getTrade() == null) {
     c2.setTrade(new MapleTrade((byte) 1, c2));
     c2.getTrade().setPartner(c1.getTrade());
     c1.getTrade().setPartner(c2.getTrade());
     c2.getClient().getSession().write(MaplePacketCreator.getTradeInvite(c1));
   } else {
     c1.message("The other player is already trading with someone else.");
     cancelTrade(c1);
   }
 }
Esempio n. 19
0
 public void forfeit(MapleCharacter c) {
   if (!c.getQuest(this).getStatus().equals(Status.STARTED)) {
     return;
   }
   if (timeLimit > 0) {
     c.announce(MaplePacketCreator.removeQuestTimeLimit(id));
   }
   MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.NOT_STARTED);
   newStatus.setForfeited(c.getQuest(this).getForfeited() + 1);
   c.updateQuest(newStatus);
 }
Esempio n. 20
0
 public void setMeso(int meso) {
   if (locked) {
     throw new RuntimeException("Trade is locked.");
   }
   if (meso < 0) {
     System.out.println("[h4x] " + chr.getName() + " Trying to trade < 0 mesos");
     return;
   }
   if (chr.getMeso() >= meso) {
     chr.gainMeso(-meso, false, true, false);
     this.meso += meso;
     chr.getClient().getSession().write(MaplePacketCreator.getTradeMesoSet((byte) 0, this.meso));
     if (partner != null) {
       partner
           .getChr()
           .getClient()
           .getSession()
           .write(MaplePacketCreator.getTradeMesoSet((byte) 1, this.meso));
     }
   } else {
   }
 }
 public static boolean handlePortal(String name, MapleCharacter c) {
   if (name.equals(FourthJobQuests.RUSH.getValue())) {
     if (!(c.getParty().getLeader().getId() == c.getId()) && !checkRush(c)) {
       c.dropMessage("You step into the portal, but it swiftly kicks you out.");
       c.getClient().announce(MaplePacketCreator.enableActions());
     }
     if (!(c.getParty().getLeader().getId() == c.getId()) && checkRush(c)) {
       c.dropMessage("You're not the party leader.");
       c.getClient().announce(MaplePacketCreator.enableActions());
       return true;
     }
     if (!checkRush(c)) {
       c.dropMessage("Someone in your party is not a 4th Job warrior.");
       c.getClient().announce(MaplePacketCreator.enableActions());
       return true;
     }
     c.getClient()
         .getChannelServer()
         .getEventSM()
         .getEventManager("4jrush")
         .startInstance(c.getParty(), c.getMap());
     return true;
   } else if (name.equals(FourthJobQuests.BERSERK.getValue())) {
     if (!c.haveItem(4031475)) {
       c.dropMessage("The portal to the Forgotten Shrine is locked");
       c.getClient().announce(MaplePacketCreator.enableActions());
       return true;
     }
     c.getClient()
         .getChannelServer()
         .getEventSM()
         .getEventManager("4jberserk")
         .startInstance(c.getParty(), c.getMap());
     return true;
   }
   return false;
 }
Esempio n. 22
0
 public void removeAllVisitors(String message) {
   for (int i = 0; i < 3; i++) {
     if (visitors[i] != null) {
       visitors[i].setHiredMerchant(null);
       visitors[i]
           .getClient()
           .getSession()
           .write(MaplePacketCreator.leaveHiredMerchant(i + 1, 0x11));
       if (message.length() > 0) {
         visitors[i].dropMessage(1, message);
       }
       visitors[i] = null;
     }
   }
 }
Esempio n. 23
0
 public void playerDisconnected(int charid) {
   if (leader1.getId() == charid || leader2.getId() == charid) {
     earlyFinish();
     int team = -1;
     for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
       if (mpc.getId() == charid) {
         team = 0;
       }
     }
     for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
       if (mpc.getId() == charid) {
         team = 1;
       }
     }
     if (team == -1) team = 1;
     String teamS = "undefined";
     switch (team) {
       case 0:
         teamS = "Red";
         break;
       case 1:
         teamS = "Blue";
         break;
     }
     map.broadcastMessage(
         MaplePacketCreator.serverNotice(
             5, "Maple " + teamS + " has quitted the Monster Carnival."));
     return;
   } else {
     map.broadcastMessage(
         MaplePacketCreator.serverNotice(
             5,
             ChannelServer.getInstance(1).getMarket().getCharacterName(charid)
                 + " has quitted the Monster Carnival."));
   }
 }
Esempio n. 24
0
  public static void doFishing(client.MapleCharacter chr) {
    int mesoMultiplier = 1;
    int expMultiplier = 1;
    switch (chr.getWorld()) {
      case 0:
        mesoMultiplier = 40000;
        expMultiplier = 20000;
        break;
    }
    int mesoAward =
        (int) (1400.0 * Math.random() + 1201) * mesoMultiplier + (6 * chr.getLevel() / 5);
    int expAward =
        (int) ((645.0 * Math.random()) * expMultiplier + (15 * chr.getLevel() / 2) / 6)
            * chr.getFishingLevel();
    if (chr.getReborns() >= 5
        && chr.getMapId() == 970020001
        && chr.haveItem(3011000)
        && chr.getChair() == 3011000) {
      int rand = (int) (3.0 * Math.random());
      int fishingexp = (int) (7.0 * Math.random()) + 1;
      switch (rand) {
        case 0:
          chr.gainMeso(mesoAward, true, true, true);
          chr.gainFishingEXP(fishingexp);
          chr.getClient()
              .getSession()
              .write(MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1));
          chr.getMap()
              .broadcastMessage(
                  chr, MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1), false);
          break;
        case 1:
          chr.gainExp(expAward, true, true);
          chr.gainFishingEXP(fishingexp);
          chr.getClient()
              .getSession()
              .write(MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1));
          chr.getMap()
              .broadcastMessage(
                  chr, MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1), false);
          break;
        case 2:
          chr.gainFishingEXP(fishingexp * 2);
          chr.getClient()
              .getSession()
              .write(MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1));
          chr.getMap()
              .broadcastMessage(
                  chr, MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1), false);
          break;
      }

    } else {
      chr.dropMessage("Please sit on your fishing chair at the fishing lagoon to fish.");
    }
  }
Esempio n. 25
0
 public static void completeTrade(MapleCharacter c) {
   c.getTrade().lock();
   MapleTrade local = c.getTrade();
   MapleTrade partner = local.getPartner();
   if (partner.isLocked()) {
     local.complete1();
     partner.complete1();
     if (!local.fitsInInventory() || !partner.fitsInInventory()) {
       cancelTrade(c);
       c.message("There is not enough inventory space to complete the trade.");
       partner.getChr().message("There is not enough inventory space to complete the trade.");
       return;
     }
     if (local.getChr().getLevel() < 15) {
       if (local.getChr().getMesosTraded() + local.exchangeMeso > 1000000) {
         cancelTrade(c);
         local.getChr().getClient().getSession().write(MaplePacketCreator.sendMesoLimit());
         return;
       } else {
         local.getChr().addMesosTraded(local.exchangeMeso);
       }
     } else if (c.getTrade().getChr().getLevel() < 15) {
       if (c.getMesosTraded() + c.getTrade().exchangeMeso > 1000000) {
         cancelTrade(c);
         c.getClient().getSession().write(MaplePacketCreator.sendMesoLimit());
         return;
       } else {
         c.addMesosTraded(local.exchangeMeso);
       }
     }
     local.complete2();
     partner.complete2();
     partner.getChr().setTrade(null);
     c.setTrade(null);
   }
 }
Esempio n. 26
0
  public static byte[] applyMonsterPoisonStatus(MapleMonster mons, List<MonsterStatusEffect> mse) {
    if (ServerProperties.ShowPacket()) {
      System.out.println("调用: " + new java.lang.Throwable().getStackTrace()[0]);
    }
    if ((mse.size() <= 0) || (mse.get(0) == null)) {
      return MaplePacketCreator.enableActions();
    }
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
    mplew.writeInt(mons.getObjectId());
    MonsterStatusEffect ms = (MonsterStatusEffect) mse.get(0);
    if (ms.getStati() == MonsterStatus.中毒) {
      PacketHelper.writeMonsterStatusMask(mplew, MonsterStatus.持续掉血);
      mplew.write(mse.size());
      for (MonsterStatusEffect m : mse) {
        mplew.writeInt(m.getFromID());
        if (m.isMonsterSkill()) {
          mplew.writeShort(m.getMobSkill().getSkillId());
          mplew.writeShort(m.getMobSkill().getSkillLevel());
        } else if (m.getSkill() > 0) {
          mplew.writeInt(m.getSkill());
        }
        mplew.writeInt(m.getX());
        mplew.writeInt(1000);
        mplew.writeInt(0);
        mplew.writeInt(10000);
        mplew.writeInt((int) (m.getDotTime() / 1000L));
        mplew.writeInt(0);
      }
      mplew.writeShort(1000);
      mplew.write(1);
    } else {
      PacketHelper.writeSingleMask(mplew, ms.getStati());
      mplew.writeInt(ms.getX());
      if (ms.isMonsterSkill()) {
        mplew.writeShort(ms.getMobSkill().getSkillId());
        mplew.writeShort(ms.getMobSkill().getSkillLevel());
      } else if (ms.getSkill() > 0) {
        mplew.writeInt(ms.getSkill());
      }
      mplew.writeShort(0);
      mplew.writeShort(0);
      mplew.write(1);
      mplew.write(1);
    }
    return mplew.getPacket();
  }
Esempio n. 27
0
  public void forceClose() {
    if (schedule != null) {
      schedule.cancel(false);
    }
    try {
      saveItems(true);
    } catch (SQLException ex) {
    }
    Server.getInstance().getChannel(world, channel).removeHiredMerchant(ownerId);
    map.broadcastMessage(MaplePacketCreator.destroyHiredMerchant(getOwnerId()));

    map.removeMapObject(this);

    map = null;
    schedule = null;
  }
Esempio n. 28
0
 public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
   byte type = slea.readByte(); // ?
   if (type == 0x01 && c.getGender() == 10) { // Packet shouldn't come if Gender isn't 10.
     c.setGender(slea.readByte());
     c.announce(MaplePacketCreator.getAuthSuccess(c));
     final MapleClient client = c;
     c.setIdleTask(
         TimerManager.getInstance()
             .schedule(
                 new Runnable() {
                   public void run() {
                     client.getSession().close(true);
                   }
                 },
                 600000));
   }
 }
Esempio n. 29
0
 private void cancel() {
   for (IItem item : items) {
     MapleInventoryManipulator.addFromDrop(chr.getClient(), item, true);
   }
   if (meso > 0) {
     chr.gainMeso(meso, true, true, true);
   }
   meso = 0;
   if (items != null) {
     items.clear();
   }
   exchangeMeso = 0;
   if (exchangeItems != null) {
     exchangeItems.clear();
   }
   chr.getClient().getSession().write(MaplePacketCreator.getTradeCancel(number));
 }
Esempio n. 30
0
 public void complete() {
   int cp1 = this.redTotalCP;
   int cp2 = this.blueTotalCP;
   if (cp1 == cp2) {
     return;
   }
   boolean redWin = cp1 > cp2;
   int chnl = leader1.getClient().getChannel();
   int chnl1 = leader2.getClient().getChannel();
   if (chnl != chnl1) throw new RuntimeException("CPQ leaders are on different channels..");
   ChannelServer cs = ChannelServer.getInstance(chnl);
   map.killAllMonsters(false);
   for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
     MapleCharacter mc;
     mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
     if (mc != null) {
       if (redWin) {
         mc.getClient().getSession().write(MaplePacketCreator.showEffect("quest/carnival/win"));
         mc.getClient().getSession().write(MaplePacketCreator.playSound("MobCarnival/Win"));
       } else {
         mc.getClient().getSession().write(MaplePacketCreator.showEffect("quest/carnival/lose"));
         mc.getClient().getSession().write(MaplePacketCreator.playSound("MobCarnival/Lose"));
       }
     }
   }
   for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
     MapleCharacter mc;
     mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
     if (mc != null) {
       if (!redWin) {
         mc.getClient().getSession().write(MaplePacketCreator.showEffect("quest/carnival/win"));
         mc.getClient().getSession().write(MaplePacketCreator.playSound("MobCarnival/Win"));
       } else {
         mc.getClient().getSession().write(MaplePacketCreator.showEffect("quest/carnival/lose"));
         mc.getClient().getSession().write(MaplePacketCreator.playSound("MobCarnival/Lose"));
       }
     }
   }
 }