예제 #1
0
 /** 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);
 }
예제 #2
0
 /** 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);
 }