Beispiel #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);
 }
  /**
   * 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);
  }
Beispiel #3
0
 /**
  * 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();
       }
     }
   }
 }