Examples of NpcInstance


Examples of lineage2.gameserver.model.instances.NpcInstance

   * @param killer Creature
   */
  @Override
  protected void onEvtDead(Creature killer)
  {
    final NpcInstance actor = getActor();
    boolean isOverhit = false;
    if (actor instanceof MonsterInstance)
    {
      isOverhit = ((MonsterInstance) actor).getOverhitDamage() > 0;
    }
    final int npcId = actor.getNpcId();
    int nextId = 0;
    int type = 0;
    if ((npcId != getNextDoppler(npcId)) && (npcId != getNextVoid(npcId)))
    {
      type = 1;
      if (isOverhit)
      {
        if (Rnd.chance(70))
        {
          nextId = getNextDoppler(npcId);
        }
        else if (Rnd.chance(80))
        {
          nextId = getNextVoid(npcId);
        }
      }
      else if (Rnd.chance(65))
      {
        nextId = getNextDoppler(npcId);
      }
    }
    else if (npcId == getNextDoppler(npcId))
    {
      type = 2;
      if (isOverhit)
      {
        if (Rnd.chance(60))
        {
          nextId = getNextDoppler(npcId);
        }
        else if (Rnd.chance(90))
        {
          nextId = getNextVoid(npcId);
        }
      }
      else if (Rnd.chance(40))
      {
        nextId = getNextDoppler(npcId);
      }
      else if (Rnd.chance(50))
      {
        nextId = getNextVoid(npcId);
      }
    }
    else if (npcId == getNextVoid(npcId))
    {
      type = 3;
      if (isOverhit)
      {
        if (Rnd.chance(80))
        {
          nextId = getNextVoid(npcId);
        }
      }
      else if (Rnd.chance(50))
      {
        nextId = getNextVoid(npcId);
      }
    }
    final Reflection r = actor.getReflection();
    boolean spawnPossible = true;
    if (r instanceof KamalokaNightmare)
    {
      final KamalokaNightmare kama = (KamalokaNightmare) r;
      kama.addKilledKanabion(type);
View Full Code Here

Examples of lineage2.gameserver.model.instances.NpcInstance

      final SimpleSpawner sp = new SimpleSpawner(_nextId);
      sp.setLocx(_actor.getX());
      sp.setLocy(_actor.getY());
      sp.setLocz(_actor.getZ());
      sp.setReflection(_actor.getReflection());
      final NpcInstance npc = sp.doSpawn(true);
      npc.setHeading(PositionUtils.calculateHeadingFrom(npc, _player));
      npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, _player, 1000);
    }
View Full Code Here

Examples of lineage2.gameserver.model.instances.NpcInstance

   * @return boolean
   */
  @Override
  protected boolean thinkActive()
  {
    final NpcInstance actor = getActor();
    if (actor.isDead())
    {
      return true;
    }
    if (_def_think)
    {
View Full Code Here

Examples of lineage2.gameserver.model.instances.NpcInstance

   * @param damage int
   */
  @Override
  protected void onEvtAttacked(Creature attacker, int damage)
  {
    final NpcInstance actor = getActor();
    if (!actor.isDead() && _firstTimeAttacked)
    {
      _firstTimeAttacked = false;
      Functions.npcSay(actor, "Show yourselves!");
      for (int bro : BROTHERS)
      {
        try
        {
          NpcInstance npc = NpcHolder.getInstance().getTemplate(bro).getNewInstance();
          npc.setSpawnedLoc(((MonsterInstance) actor).getMinionPosition());
          npc.setReflection(actor.getReflection());
          npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp(), true);
          npc.spawnMe(npc.getSpawnedLoc());
          npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, attacker, Rnd.get(1, 100));
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
View Full Code Here

Examples of lineage2.gameserver.model.instances.NpcInstance

   * Method onEvtThink.
   */
  @Override
  protected void onEvtThink()
  {
    final NpcInstance actor = getActor();
    final List<Creature> around = World.getAroundCharacters(actor, 600, 300);
    if (around.isEmpty())
    {
      return;
    }
View Full Code Here

Examples of lineage2.gameserver.model.instances.NpcInstance

   * @param killer Creature
   */
  @Override
  public void onEvtDead(Creature killer)
  {
    final NpcInstance actor = getActor();
    super.onEvtDead(killer);
    actor.deleteMe();
    ThreadPoolManager.getInstance().schedule(new RunnableImpl()
    {
      @Override
      public void runImpl()
      {
        final NpcTemplate template = NpcHolder.getInstance().getTemplate(18601);
        if (template != null)
        {
          final NpcInstance a = template.getNewInstance();
          a.setCurrentHpMp(a.getMaxHp(), a.getMaxMp());
          a.spawnMe(actor.getLoc());
        }
      }
    }, 10000L);
  }
View Full Code Here

Examples of lineage2.gameserver.model.instances.NpcInstance

   * @return boolean
   */
  @Override
  protected boolean thinkActive()
  {
    final NpcInstance actor = getActor();
    if (actor.isDead())
    {
      return true;
    }
    if (_def_think)
    {
      if (doTask())
      {
        clearTasks();
      }
      return true;
    }
    if (super.thinkActive())
    {
      return true;
    }
    if ((System.currentTimeMillis() > wait_timeout) && ((current_point > -1) || Rnd.chance(5)))
    {
      if (!wait && (current_point == 31))
      {
        wait_timeout = System.currentTimeMillis() + 60000;
        wait = true;
        return true;
      }
      wait_timeout = 0;
      wait = false;
      current_point++;
      if (current_point >= points.length)
      {
        current_point = 0;
      }
      actor.setWalking();
      addTaskMove(points[current_point], true);
      doTask();
      return true;
    }
    if (randomAnimation())
View Full Code Here

Examples of lineage2.gameserver.model.instances.NpcInstance

   * @return boolean
   */
  @Override
  protected boolean thinkActive()
  {
    final NpcInstance actor = getActor();
    if (actor.isDead())
    {
      return true;
    }
    if (_def_think)
    {
View Full Code Here

Examples of lineage2.gameserver.model.instances.NpcInstance

   */
  @Override
  protected void onEvtSpawn()
  {
    super.onEvtSpawn();
    final NpcInstance actor = getActor();
    actor.getMinionList().addMinion(new MinionData(Servitors[Rnd.get(Servitors.length)], Rnd.get(2)));
    _lastMinionCount = Math.max(actor.getMinionList().getAliveMinions().size(), 1);
  }
View Full Code Here

Examples of lineage2.gameserver.model.instances.NpcInstance

          SimpleSpawner spawn = new SimpleSpawner(npcId);
          spawn.setTerritory(zone.getTerritory());
          spawn.setAmount(1);
          spawn.setReflection(player.getReflection());
          spawn.stopRespawn();
          NpcInstance mob = spawn.doSpawn(true);
          if (mob != null)
          {
            ThreadPoolManager.getInstance().schedule(new UnSpawnTask(spawn), despawn * 1000L);
            if (mob.isAggressive() && attackOnSpawn)
            {
              mob.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, player, 100);
            }
          }
        }
        catch (Exception e)
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.