/** Method clearMe. */ private void clearMe() { HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena); for (Player player : _holder.getAllPlayers()) { if (player == null) { continue; } player.removeListener(_listener); } _holder.clearPlayers(); _blueTeamPoints.clear(); _redTeamPoints.clear(); HandysBlockCheckerManager.getInstance().setArenaFree(_arena); for (SimpleSpawner spawn : _spawns) { spawn.deleteAll(); } _spawns.clear(); for (ItemInstance item : _drops) { if (item == null) { continue; } if (!item.isVisible() || (item.getOwnerId() != 0)) { continue; } item.deleteMe(); } _drops.clear(); }
/** * Method onEvtDead. * * @param killer Creature */ @Override protected void onEvtDead(Creature killer) { if (checkAllDestroyed()) { try { final SimpleSpawner sp = new SimpleSpawner(NpcHolder.getInstance().getTemplate(TeleportCube)); sp.setLoc(new Location(-12527, 279714, -11622, 16384)); sp.doSpawn(true); sp.stopRespawn(); ThreadPoolManager.getInstance().schedule(new Unspawn(), 600 * 1000L); } catch (Exception e) { e.printStackTrace(); } } super.onEvtDead(killer); }
/** * Method onEvtSeeSpell. * * @param skill Skill * @param caster Creature */ @Override protected void onEvtSeeSpell(Skill skill, Creature caster) { final NpcInstance actor = getActor(); if (skill.isMagic()) { return; } if (_mobsNotSpawned) { _mobsNotSpawned = false; for (int i = 0; i < MOBS_COUNT; i++) { try { SimpleSpawner sp = new SimpleSpawner(NpcHolder.getInstance().getTemplate(MOBS)); sp.setLoc(Location.findPointToStay(actor, 100, 120)); NpcInstance npc = sp.doSpawn(true); if (caster.isPet() || caster.isServitor()) { npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, caster, Rnd.get(2, 100)); } npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, caster.getPlayer(), Rnd.get(1, 100)); } catch (Exception e) { e.printStackTrace(); } } } }
/** Method runImpl. */ @Override public void runImpl() { if (!_isStarted) { return; } switch (_round) { case 1: _task = ThreadPoolManager.getInstance().schedule(new SpawnRound(20, 2), 60000); break; case 2: _task = ThreadPoolManager.getInstance().schedule(new SpawnRound(14, 3), 60000); break; case 3: _task = ThreadPoolManager.getInstance().schedule(new CountDown(), 175000); break; } byte random = 2; final NpcTemplate template = NpcHolder.getInstance().getTemplate(18672); try { for (int i = 0; i < _numOfBoxes; i++) { SimpleSpawner spawn = new SimpleSpawner(template); spawn.setLocx(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400)); spawn.setLocy(_arenaCoordinates[_arena][5] + Rnd.get(-400, 400)); spawn.setLocz(_zCoord); spawn.setAmount(1); spawn.setHeading(1); spawn.setRespawnDelay(1); BlockInstance blockInstance = (BlockInstance) spawn.doSpawn(true); blockInstance.setRed((random % 2) == 0); _spawns.add(spawn); random++; } } catch (Exception e) { e.printStackTrace(); } if ((_round == 1) || (_round == 2)) { NpcTemplate girl = NpcHolder.getInstance().getTemplate(18676); try { final SimpleSpawner girlSpawn = new SimpleSpawner(girl); girlSpawn.setLocx(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400)); girlSpawn.setLocy(_arenaCoordinates[_arena][5] + Rnd.get(-400, 400)); girlSpawn.setLocz(_zCoord); girlSpawn.setAmount(1); girlSpawn.setHeading(1); girlSpawn.setRespawnDelay(1); girlSpawn.doSpawn(true); girlSpawn.init(); _girlNpc = girlSpawn.getLastSpawn(); ThreadPoolManager.getInstance() .schedule( new RunnableImpl() { @Override public void runImpl() { if (_girlNpc == null) { return; } _girlNpc.deleteMe(); } }, 9000); } catch (Exception e) { _log.warn("Couldnt Spawn Block Checker NPCs! Wrong instance type at npc table?" + e); } } _redPoints += _numOfBoxes / 2; _bluePoints += _numOfBoxes / 2; int timeLeft = (int) ((getStarterTime() - System.currentTimeMillis()) / 1000); ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints()); getHolder().broadCastPacketToTeam(changePoints); }
/** Method SpawnMammons. */ public void SpawnMammons() { final int firstTown = Rnd.get(MAMMON_PRIEST_POINTS.length); NpcTemplate template = NpcHolder.getInstance().getTemplate(MAMMON_PRIEST_ID); SimpleSpawner sp = new SimpleSpawner(template); sp.setLoc(MAMMON_PRIEST_POINTS[firstTown]); sp.setAmount(1); sp.setRespawnDelay(0); PriestNpc = sp.doSpawn(true); template = NpcHolder.getInstance().getTemplate(MAMMON_MERCHANT_ID); sp = new SimpleSpawner(template); sp.setLoc(MAMMON_MERCHANT_POINTS[firstTown]); sp.setAmount(1); sp.setRespawnDelay(0); MerchantNpc = sp.doSpawn(true); template = NpcHolder.getInstance().getTemplate(MAMMON_BLACKSMITH_ID); sp = new SimpleSpawner(template); sp.setLoc(MAMMON_BLACKSMITH_POINTS[firstTown]); sp.setAmount(1); sp.setRespawnDelay(0); BlacksmithNpc = sp.doSpawn(true); }