Exemplo n.º 1
0
 /** Spawning of pests. Should call this every 7-9 seconds. */
 public void spawnMonsters() {
   if (!getPortals(0)) World.spawnNPC(PESTS[lastIndex], new WorldTile(2634, 2593, 0), -1, false);
   if (!getPortals(1)) World.spawnNPC(PESTS[lastIndex], new WorldTile(2670, 2576, 0), -1, false);
   if (!getPortals(2)) World.spawnNPC(PESTS[lastIndex], new WorldTile(2646, 2574, 0), -1, false);
   if (!getPortals(2)) World.spawnNPC(PESTS[lastIndex], new WorldTile(2676, 2589, 0), -1, false);
   lastIndex++;
 }
Exemplo n.º 2
0
 public static void enterDonatorzone(final Player player) {
   Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2140, 5101, 0));
   for (int regionId : player.getMapRegionsIds()) {
     List<Integer> npcIndexes = World.getRegion(regionId).getNPCsIndexes();
     if (npcIndexes != null) {
       for (int npcIndex : npcIndexes) {
         final NPC n = World.getNPCs().get(npcIndex);
         if (n == null || n.getId() != 5445) continue;
         WorldTasksManager.schedule(
             new WorldTask() {
               @Override
               public void run() {
                 final int random = Utils.getRandom(3);
                 if (random == 0)
                   n.setNextForceTalk(
                       new ForceTalk(
                           "Everyone welcome "
                               + player.getDisplayName()
                               + " to the donator zone."));
                 else if (random == 1)
                   n.setNextForceTalk(
                       new ForceTalk(
                           player.getDisplayName() + " has just joined the penguin zone."));
                 else if (random == 2)
                   n.setNextForceTalk(
                       new ForceTalk(
                           "Ma boi "
                               + player.getDisplayName()
                               + " has just joined the penguin zone."));
                 else if (random == 3)
                   n.setNextForceTalk(
                       new ForceTalk(
                           "Who else wouldnt want "
                               + player.getDisplayName()
                               + " from joining the penguin zone."));
               }
             },
             4);
       }
     }
   }
 }
Exemplo n.º 3
0
 @Override
 public ArrayList<Entity> getPossibleTargets() {
   ArrayList<Entity> possibleTarget = new ArrayList<Entity>();
   for (int regionId : getMapRegionsIds()) {
     List<Integer> playerIndexes = World.getRegion(regionId).getPlayerIndexes();
     if (playerIndexes != null) {
       for (int npcIndex : playerIndexes) {
         Player player = World.getPlayers().get(npcIndex);
         if (player == null
             || player.isDead()
             || player.hasFinished()
             || !player.isRunning()
             || !player.withinDistance(this, 64)
             || ((!isAtMultiArea() || !player.isAtMultiArea())
                 && player.getAttackedBy() != this
                 && player.getAttackedByDelay() > System.currentTimeMillis())
             || !clipedProjectile(player, false)) continue;
         possibleTarget.add(player);
       }
     }
   }
   return possibleTarget;
 }
 @Override
 public boolean processObjectClick1(WorldObject object) {
   if (npc == null) {
     return true;
   }
   if (object.getId() == 70790) {
     if (npc.getPhase() < 5) {
       return true;
     }
     player.lock();
     FadingScreen.fade(
         player,
         new Runnable() {
           @Override
           public void run() {
             player
                 .getPackets()
                 .sendGameMessage(
                     "You descend the stairs that appeared when you defeated the Queen Black Dragon.");
             player.getPackets().sendGlobalConfig(184, -1);
             npc.finish();
             RegionBuilder.copyAllPlanesMap(160, 760, regionBase[0], regionBase[1], 8, 8);
             player.setForceNextMapLoadRefresh(true);
             player.loadMapRegions();
             player
                 .getPackets()
                 .sendDestroyObject(new WorldObject(70849, 10, 0, base.transform(24, 21, -1)));
             player
                 .getPackets()
                 .sendDestroyObject(new WorldObject(70837, 10, 0, base.transform(22, 24, -1)));
             player
                 .getPackets()
                 .sendDestroyObject(new WorldObject(70840, 10, 0, base.transform(34, 24, -1)));
             World.removeObject(new WorldObject(70775, 10, 0, base.transform(31, 29, -1)), true);
             player
                 .getPackets()
                 .sendDestroyObject(new WorldObject(70822, 10, 0, base.transform(21, 35, -1)));
             player
                 .getPackets()
                 .sendDestroyObject(new WorldObject(70818, 10, 0, base.transform(39, 35, -1)));
             player.setNextWorldTile(base.transform(31, 36, -1));
             boolean resizable = player.getInterfaceManager().hasRezizableScreen();
             player.getPackets().closeInterface(resizable ? 746 : 548, resizable ? 1 : 0);
             player.unlock();
           }
         });
     return false;
   }
   if (object.getId() == 70813) {
     Magic.sendObjectTeleportSpell(player, true, Settings.RESPAWN_PLAYER_LOCATION);
     return false;
   }
   if (object.getId() == 70814) {
     player.getPackets().sendGameMessage("The gate is locked.");
     return false;
   }
   if (object.getId() == 70815) {
     player.getDialogueManager().startDialogue("RewardChest", npc);
     return false;
   }
   if (object.getId() == 70817) {
     npc.openRewardChest(false);
     return false;
   }
   if (object.getId() == npc.getActiveArtifact().getId()) {
     player.getMusicsManager().playMusic(1118); // QUEEN BLACK DRAGON
     npc.setSpawningWorms(false);
     npc.setNextAttack(20);
     npc.setActiveArtifact(new WorldObject(object.getId() + 1, 10, 0, object));
     npc.setHitpoints(npc.getMaxHitpoints());
     npc.setCantInteract(false);
     npc.setPhase(npc.getPhase() + 1);
     World.spawnObject(npc.getActiveArtifact(), false);
     switch (object.getId()) {
       case 70777:
         player.getPackets().sendGlobalConfig(1924, 2);
         player
             .getPackets()
             .sendSpawnedObject(new WorldObject(70843, 10, 0, base.transform(24, 21, -1)));
         break;
       case 70780:
         player.getPackets().sendGlobalConfig(1924, 4);
         player
             .getPackets()
             .sendSpawnedObject(new WorldObject(70845, 10, 0, base.transform(24, 21, -1)));
         break;
       case 70783:
         player.getPackets().sendGlobalConfig(1924, 6);
         player
             .getPackets()
             .sendSpawnedObject(new WorldObject(70847, 10, 0, base.transform(24, 21, -1)));
         break;
       case 70786:
         player.getPackets().sendGlobalConfig(1924, 8);
         player
             .getPackets()
             .sendSpawnedObject(new WorldObject(70849, 10, 0, base.transform(24, 21, -1)));
         break;
     }
     return false;
   }
   return true;
 }
Exemplo n.º 5
0
 public void setPlayer(Player player) {
   this.player = player;
   playingMusic = World.getRegion(player.getRegionId()).getMusicId();
 }
Exemplo n.º 6
0
 public void reset() {
   settedMusic = false;
   player.getMusicsManager().checkMusic(World.getRegion(player.getRegionId()).getMusicId());
 }