@Override
 protected void handleDied() {
   cancelPhaseTask();
   if (getNpcId() == 217309) {
     sendMsg(1500390);
     spawn(217310, 238.160f, 598.624f, 178.480f, (byte) 0);
     deleteHelpers();
     AI2Actions.deleteOwner(this);
   } else {
     sendMsg(1500391);
     final WorldMapInstance instance = getPosition().getWorldMapInstance();
     if (instance != null) {
       final Npc ariana = instance.getNpc(799668);
       if (ariana != null) {
         ariana.getEffectController().removeEffect(19921);
         ThreadPoolManager.getInstance()
             .schedule(
                 new Runnable() {
                   @Override
                   public void run() {
                     ariana.getSpawn().setWalkerId("30028000016");
                     WalkManager.startWalking((NpcAI2) ariana.getAi2());
                   }
                 },
                 1000);
         NpcShoutsService.getInstance().sendMsg(ariana, 1500415, ariana.getObjectId(), 0, 4000);
         NpcShoutsService.getInstance().sendMsg(ariana, 1500416, ariana.getObjectId(), 0, 13000);
         ThreadPoolManager.getInstance()
             .schedule(
                 new Runnable() {
                   @Override
                   public void run() {
                     if (instance != null) {
                       SkillEngine.getInstance()
                           .getSkill(ariana, 19358, 60, ariana)
                           .useNoAnimationSkill();
                       instance.getDoors().get(145).setOpen(true);
                       deleteNpcs(instance.getNpcs(701156));
                       ThreadPoolManager.getInstance()
                           .schedule(
                               new Runnable() {
                                 @Override
                                 public void run() {
                                   if (ariana != null && !NpcActions.isAlreadyDead(ariana)) {
                                     NpcActions.delete(ariana);
                                   }
                                 }
                               },
                               13000);
                     }
                   }
                 },
                 13000);
       }
     }
   }
   super.handleDied();
 }
Пример #2
0
  private void markTarget() {
    ThreadPoolManager.getInstance()
        .schedule(
            new Runnable() {

              @Override
              public void run() {
                target = (Creature) getOwner().getTarget();
                if (target != null) {
                  AI2Actions.useSkill(CanyonMarkAI2.this, 19504);

                  ThreadPoolManager.getInstance()
                      .schedule(
                          new Runnable() {

                            @Override
                            public void run() {
                              if (!isAlreadyDead()) {
                                AI2Actions.targetCreature(CanyonMarkAI2.this, target);
                                AI2Actions.useSkill(CanyonMarkAI2.this, 19505);
                                AI2Actions.deleteOwner(CanyonMarkAI2.this);
                              }
                            }
                          },
                          Rnd.get(5, 10) * 1000);

                } else AI2Actions.deleteOwner(CanyonMarkAI2.this);
              }
            },
            5000);
  }
Пример #3
0
  public static void startEvent() {
    initCoordinates();

    World.getInstance()
        .doOnAllPlayers(
            new Visitor<Player>() {

              @Override
              public void visit(Player object) {
                PacketSendUtility.sendYellowMessageOnCenter(
                    object, MuiService.getInstance().getMessage("PIG_EVENT_START"));
              }
            });

    initPig();

    ThreadPoolManager.getInstance()
        .schedule(
            new Runnable() {

              @Override
              public void run() {
                endEvent(); // To change body of generated methods, choose Tools | Templates.
              }
            },
            30 * 60 * 1000);
  }
 private void startSanctuaryEvent() {
   ThreadPoolManager.getInstance()
       .schedule(
           new Runnable() {
             @Override
             public void run() {
               if (!isAlreadyDead()) {
                 canThink = true;
                 Creature creature = getAggroList().getMostHated();
                 if (creature == null
                     || creature.getLifeStats().isAlreadyDead()
                     || !getOwner().canSee(creature)) {
                   setStateIfNot(AIState.FIGHT);
                   getMoveController().recallPreviousStep();
                   getMoveController().abortMove();
                   onGeneralEvent(AIEventType.ATTACK_FINISH);
                   onGeneralEvent(AIEventType.BACK_HOME);
                 } else {
                   getMoveController().abortMove();
                   getOwner().setTarget(creature);
                   getOwner().getGameStats().renewLastAttackTime();
                   getOwner().getGameStats().renewLastAttackedTime();
                   getOwner().getGameStats().renewLastChangeTargetTime();
                   getOwner().getGameStats().renewLastSkillTime();
                   setStateIfNot(AIState.FIGHT);
                   handleMoveValidate();
                   SkillEngine.getInstance()
                       .getSkill(getOwner(), 19657, 60, getOwner())
                       .useNoAnimationSkill();
                 }
               }
             }
           },
           23000);
 }
 @SuppressWarnings("unused")
 private void spawnHelpers(final NpcAI2 ai) {
   ThreadPoolManager.getInstance()
       .schedule(
           new Runnable() {
             @Override
             public void run() {
               if (!isAlreadyDead()) {
                 sendMsg(1500389);
                 SkillEngine.getInstance()
                     .getSkill(getOwner(), 19968, 60, getOwner())
                     .useNoAnimationSkill();
                 Npc npc1 = (Npc) spawn(282604, 263f, 537f, 203f, (byte) 0);
                 Npc npc2 = (Npc) spawn(282604, 186f, 555f, 203f, (byte) 0);
                 npc1.getSpawn().setWalkerId("30028000014");
                 WalkManager.startWalking((NpcAI2) npc1.getAi2());
                 npc2.getSpawn().setWalkerId("30028000015");
                 WalkManager.startWalking((NpcAI2) npc2.getAi2());
                 startRun(npc1);
                 startRun(npc2);
               }
             }
           },
           3000);
 }
 @Override
 public void initTrigger() {
   if (!isBlocking) {
     ThreadPoolManager.getInstance().schedule(this, 5000);
   } else {
     this.run();
   }
 }
 private void startLifeTask() {
   ThreadPoolManager.getInstance()
       .schedule(
           new Runnable() {
             @Override
             public void run() {
               AI2Actions.deleteOwner(KatalamMercenariesAI2.this);
             }
           },
           7200000);
 }
 private void dead() {
   ThreadPoolManager.getInstance()
       .schedule(
           new Runnable() {
             @Override
             public void run() {
               getOwner().getController().die();
             }
           },
           16000);
 }
Пример #9
0
  private void startLifeTask() {
    ThreadPoolManager.getInstance()
        .schedule(
            new Runnable() {

              @Override
              public void run() {
                AI2Actions.deleteOwner(RaksangRubbleAI2.this);
              }
            },
            9000);
  }
Пример #10
0
  private void useskill() {
    ThreadPoolManager.getInstance()
        .schedule(
            new Runnable() {

              @Override
              public void run() {
                AI2Actions.useSkill(SinkingSandAI2.this, 20721);
                getOwner().getController().die();
              }
            },
            3000);
  }
 @Override
 protected void handleSpawned() {
   super.handleSpawned();
   ThreadPoolManager.getInstance()
       .schedule(
           new Runnable() {
             @Override
             public void run() {
               startLifeTask();
             }
           },
           1000);
 }
Пример #12
0
  private void despawn() {
    ThreadPoolManager.getInstance()
        .schedule(
            new Runnable() {

              @Override
              public void run() {
                if (!isAlreadyDead()) {
                  AI2Actions.deleteOwner(TiamatEyeAI2.this);
                }
              }
            },
            5000);
  }
  private void VritraBless() {
    VritraBlessTimer =
        ThreadPoolManager.getInstance()
            .scheduleAtFixedRate(
                new Runnable() {

                  @Override
                  public void run() {
                    VritraGeneralBless(20700);
                  }
                },
                3000,
                100000);
  }
 private void sendMessage(final int msgId, long delay) {
   if (delay == 0) {
     this.sendMsg(msgId);
   } else {
     ThreadPoolManager.getInstance()
         .schedule(
             new Runnable() {
               public void run() {
                 sendMsg(msgId);
               }
             },
             delay);
   }
 }
Пример #15
0
  @Override
  protected void handleSpawned() {
    super.handleSpawned();
    ThreadPoolManager.getInstance()
        .schedule(
            new Runnable() {

              @Override
              public void run() {
                SkillEngine.getInstance()
                    .getSkill(getOwner(), 19937, 46, getOwner())
                    .useNoAnimationSkill();
                startLifeTask();
              }
            },
            1000);
  }
Пример #16
0
  @Override
  protected void handleSpawned() {
    super.handleSpawned();
    ThreadPoolManager.getInstance()
        .schedule(
            new Runnable() {

              @Override
              public void run() {
                if (!isAlreadyDead()) {
                  SkillEngine.getInstance()
                      .getSkill(getOwner(), 19126, 46, getOwner())
                      .useNoAnimationSkill();
                }
              }
            },
            2000);
  }
 private void attackgenerator(final Npc generator, final Npc npc) {
   ThreadPoolManager.getInstance()
       .schedule(
           new Runnable() {
             @Override
             public void run() {
               if (!isInstanceDestroyed) {
                 npc.setTarget(generator);
                 ((AbstractAI) npc.getAi2()).setStateIfNot(AIState.WALKING);
                 npc.setState(1);
                 npc.getMoveController().moveToTargetObject();
                 PacketSendUtility.broadcastPacket(
                     npc, new SM_EMOTION(npc, EmotionType.START_EMOTE2, 0, npc.getObjectId()));
               }
             }
           },
           1000);
 }
 private void startPhase2Task() {
   phaseTask =
       ThreadPoolManager.getInstance()
           .scheduleAtFixedRate(
               new Runnable() {
                 @Override
                 public void run() {
                   if (isAlreadyDead()) {
                     cancelPhaseTask();
                   } else {
                     SkillEngine.getInstance()
                         .getSkill(getOwner(), 19729, 60, getOwner())
                         .useNoAnimationSkill();
                     sendMsg(1500392);
                   }
                 }
               },
               30000,
               30000);
 }
 public void startUregisterIronWallTask() {
   ThreadPoolManager.getInstance()
       .schedule(
           new Runnable() {
             @Override
             public void run() {
               registerAvailable = false;
               playersWithCooldown.clear();
               AutoGroupService.getInstance().unRegisterInstance(maskId);
               Iterator<Player> iter = World.getInstance().getPlayersIterator();
               while (iter.hasNext()) {
                 Player player = iter.next();
                 if (player.getLevel() > minlevel) {
                   PacketSendUtility.sendPacket(
                       player, new SM_AUTO_GROUP(maskId, SM_AUTO_GROUP.wnd_EntryIcon, true));
                 }
               }
             }
           },
           AutoGroupConfig.IRONWALL_TIMER * 60 * 1000);
 }
  private void SpawnArroundPlayer(final Player player) {

    if (spawnedArroundPlayer < MAX_TIME_SPAWN_ARROUND_PLAYER) {
      SpawnTask =
          ThreadPoolManager.getInstance()
              .schedule(
                  new Runnable() {
                    @Override
                    public void run() {
                      if (player.getEffectController().hasAbnormalEffect(21435)
                          || player.getEffectController().hasAbnormalEffect(21434)) {
                        SpawnFront(player);
                        SpawnRight(player);
                        SpawnLeft(player);
                        spawnedArroundPlayer++;
                        SpawnArroundPlayer(player);
                      } else cancelTask();
                    }
                  },
                  30000);
    }
  }
  @Override
  protected void handleSpawned() {
    super.handleSpawned();
    if (getNpcId() == 282744) {
      startSpawnTask();
    } else {
      SkillEngine.getInstance().getSkill(getOwner(), 20213, 60, getOwner()).useNoAnimationSkill();
      task =
          ThreadPoolManager.getInstance()
              .schedule(
                  new Runnable() {

                    @Override
                    public void run() {
                      if (!isAlreadyDead()) {
                        AI2Actions.deleteOwner(GoldenTatarParalysisEyeAI2.this);
                      }
                    }
                  },
                  2000);
    }
  }
  private void startFinalTimer() {
    sendMsg(1401892);
    this.sendMessage(1401875, 15 * 60 * 1000);
    this.sendMessage(1401876, 20 * 60 * 1000);
    this.sendMessage(1401877, 24 * 60 * 1000);

    failTask =
        ThreadPoolManager.getInstance()
            .schedule(
                new Runnable() {
                  @Override
                  public void run() {
                    sendMsg(1401878);
                    final Npc vera1 = instance.getNpc(231050);
                    if (vera1 != null) {
                      SkillEngine.getInstance()
                          .getSkill(vera1, 21442, 60, vera1)
                          .useNoAnimationSkill();
                    }
                  }
                },
                1500000);
  }
 private void startPhaseTask(final NpcAI2 ai) {
   phaseTask =
       ThreadPoolManager.getInstance()
           .scheduleAtFixedRate(
               new Runnable() {
                 @Override
                 public void run() {
                   if (isAlreadyDead()) {
                     cancelPhaseTask();
                   } else {
                     canThink = false;
                     EmoteManager.emoteStopAttacking(getOwner());
                     getSpawnTemplate().setWalkerId("B186C8F43FF13FDD50FA9483B7D8C2BEABAE7F5C");
                     WalkManager.startWalking(ai);
                     startRun(getOwner());
                     spawnHelpers(ai);
                     startSanctuaryEvent();
                   }
                 }
               },
               28000,
               28000);
 }
  private void startSpawnTask() {
    task =
        ThreadPoolManager.getInstance()
            .scheduleAtFixedRate(
                new Runnable() {

                  @Override
                  public void run() {
                    if (isAlreadyDead()) {
                      cancelTask();
                    } else {
                      spawnCount++;
                      WorldPosition p = getPosition();
                      spawn(282745, p.getX(), p.getY(), p.getZ(), p.getHeading());
                      if (spawnCount >= 10) {
                        cancelTask();
                        AI2Actions.deleteOwner(GoldenTatarParalysisEyeAI2.this);
                      }
                    }
                  }
                },
                14000,
                2000);
  }
 @Override
 public void onDie(Npc npc) {
   final List<Player> playerList = instance.getPlayersInside();
   switch (npc.getNpcId()) {
     case 231050:
       spawn(730868, 317f, 489.04999f, 607.64343f, (byte) 0);
       break;
     case 230413:
       sendMsg(1401904);
       spawn(230417, 476.74689f, 523.6272f, 598.8186f, (byte) 13); // Disabled GENERATEUR POST
       despawnNpc(npc);
       Powerdevice++;
       if (Powerdevice == 4) {
         spawn(701644, 435.42862f, 496.41296f, 604.8871f, (byte) 1);
       }
       break;
     case 230417:
       spawn(230413, 476.74689f, 523.6272f, 598.8186f, (byte) 13); // Balaur GENERATEUR POST
       despawnNpc(npc);
       break;
     case 230414:
       sendMsg(1401905);
       spawn(230418, 524.53607f, 427.29379f, 621.82062f, (byte) 15); // Disabled GENERATEUR NORD
       despawnNpc(npc);
       Powerdevice++;
       if (Powerdevice == 4) {
         spawn(701644, 435.42862f, 496.41296f, 604.8871f, (byte) 1);
       }
       break;
     case 230418:
       spawn(230414, 524.53607f, 427.29379f, 621.82062f, (byte) 15); // balaur GENERATEUR NORD
       despawnNpc(npc);
       break;
     case 230415:
       sendMsg(1401906);
       spawn(230419, 602.40997f, 556.41998f, 592.16406f, (byte) 113); // Disabled GENERATEUR SUD
       despawnNpc(npc);
       Powerdevice++;
       if (Powerdevice == 4) {
         spawn(701644, 435.42862f, 496.41296f, 604.8871f, (byte) 1);
       }
       break;
     case 230419:
       spawn(230415, 602.40997f, 556.41998f, 592.16406f, (byte) 113); // balaur GENERATEUR SUD
       despawnNpc(npc);
       break;
     case 230416:
       sendMsg(1401907);
       spawn(230420, 666.76001f, 474.20999f, 601.1673f, (byte) 117); // Disabled GENERATEUR Defense
       despawnNpc(npc);
       Powerdevice++;
       if (Powerdevice == 4) {
         spawn(701644, 435.42862f, 496.41296f, 604.8871f, (byte) 1);
       }
       break;
     case 230420:
       echec += 1;
       doors.get(47).setOpen(false);
       spawn(230416, 666.76001f, 474.20999f, 601.1673f, (byte) 117); // balaur GENERATEUR Defense
       despawnNpc(npc);
       break;
     case 233320:
       startFinalTimer();
       despawnNpc(npc);
       if (npc.getX() == 751.5975f || npc.getY() == 518.4685f || npc.getZ() == 578.5f) {
         if (!isStartTimer) {
           isStartTimer = true;
           startTime = System.currentTimeMillis();
           ThreadPoolManager.getInstance()
               .schedule(
                   new Runnable() {
                     @Override
                     public void run() {
                       for (Player player : playerList) {
                         PacketSendUtility.sendPacket(player, new SM_SYSTEM_MESSAGE(1401884));
                       }
                       attackgenerator(
                           getNpc(230420),
                           (Npc) spawn(233319, 697.05707f, 467.85675f, 599.68396f, (byte) 55));
                       attackgenerator(
                           getNpc(230420),
                           (Npc) spawn(231189, 695.08307f, 471.75702f, 599.80f, (byte) 55));
                       attackgenerator(
                           getNpc(230420),
                           (Npc) spawn(231190, 693.59186f, 462.29324f, 599.875f, (byte) 55));
                     }
                   },
                   300000);
         }
       }
       break;
   }
 }