コード例 #1
0
 protected void dispose(boolean warpout) {
   int chnl = p1.getLeader().getChannel();
   ChannelServer cs = ChannelServer.getInstance(chnl);
   MapleMap out = cs.getMapFactory().getMap(980000000);
   for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
     MapleCharacter mc;
     mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
     if (mc != null) {
       mc.setCpqRanking(getRankByCP(this.redTotalCP));
       mc.resetCP();
       if (warpout) {
         mc.changeMap(out, out.getPortal(0));
       }
     }
   }
   for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
     MapleCharacter mc;
     mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
     if (mc != null) {
       mc.setCpqRanking(getRankByCP(this.blueTotalCP));
       mc.resetCP();
       if (warpout) {
         mc.changeMap(out, out.getPortal(0));
       }
     }
   }
   timer.cancel(false);
   effectTimer.cancel(false);
   redTotalCP = 0;
   blueTotalCP = 0;
   leader1.getParty().setEnemy(null);
   leader2.getParty().setEnemy(null);
 }
コード例 #2
0
 public MonsterCarnival(MapleParty p1, MapleParty p2, int mapid) {
   this.p1 = p1;
   this.p2 = p2;
   int chnl = p1.getLeader().getChannel();
   int chnl1 = p2.getLeader().getChannel();
   if (chnl != chnl1) throw new RuntimeException("CPQ leaders are on different channels..");
   ChannelServer cs = ChannelServer.getInstance(chnl);
   p1.setEnemy(p2);
   p2.setEnemy(p1);
   cs.getMapFactory().disposeMap(mapid);
   map = cs.getMapFactory().getMap(mapid);
   int redPortal = 0;
   int bluePortal = 0;
   if (map.isPurpleCPQMap()) {
     redPortal = 2;
     bluePortal = 1;
   }
   for (MaplePartyCharacter mpc : p1.getMembers()) {
     MapleCharacter mc;
     mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
     if (mc != null) {
       mc.setMonsterCarnival(this);
       mc.changeMap(map, map.getPortal(redPortal));
       mc.setTeam(0);
       if (p1.getLeader().getId() == mc.getId()) {
         leader1 = mc;
       }
     }
   }
   for (MaplePartyCharacter mpc : p2.getMembers()) {
     MapleCharacter mc;
     mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
     if (mc != null) {
       mc.setMonsterCarnival(this);
       mc.changeMap(map, map.getPortal(bluePortal));
       mc.setTeam(1);
       if (p2.getLeader().getId() == mc.getId()) {
         leader2 = mc;
       }
     }
   }
   startTime = System.currentTimeMillis() + 60 * 10000;
   timer =
       TimerManager.getInstance()
           .schedule(
               new Runnable() {
                 public void run() {
                   timeUp();
                 }
               },
               10 * 60 * 1000);
   effectTimer =
       TimerManager.getInstance()
           .schedule(
               new Runnable() {
                 public void run() {
                   complete();
                 }
               },
               10 * 60 * 1000 - 10 * 1000);
   TimerManager.getInstance()
       .schedule(
           new Runnable() {
             public void run() {
               map.addClock(60 * 10);
             }
           },
           2000);
 }