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); }
public void finish(int winningTeam) { 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); if (winningTeam == 0) { for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) { MapleCharacter mc; mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); if (mc != null) { mc.setCpqRanking(getRankByCP(this.redTotalCP)); mc.changeMap( cs.getMapFactory().getMap(map.getId() + 2), cs.getMapFactory().getMap(map.getId() + 2).getPortal(0)); mc.setTeam(-1); } } for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) { MapleCharacter mc; mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); if (mc != null) { mc.setCpqRanking(getRankByCP(this.blueTotalCP)); mc.changeMap( cs.getMapFactory().getMap(map.getId() + 3), cs.getMapFactory().getMap(map.getId() + 3).getPortal(0)); mc.setTeam(-1); } } } else if (winningTeam == 1) { for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) { MapleCharacter mc; mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); if (mc != null) { mc.changeMap( cs.getMapFactory().getMap(map.getId() + 2), cs.getMapFactory().getMap(map.getId() + 2).getPortal(0)); mc.setTeam(-1); } } for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) { MapleCharacter mc; mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); if (mc != null) { mc.changeMap( cs.getMapFactory().getMap(map.getId() + 3), cs.getMapFactory().getMap(map.getId() + 3).getPortal(0)); mc.setTeam(-1); } } } dispose(); }
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); }