Package ai

Source Code of ai.Rogin

package ai;

import l2p.extensions.scripts.Functions;
import l2p.gameserver.ai.DefaultAI;
import l2p.gameserver.model.L2Character;
import l2p.gameserver.model.instances.L2NpcInstance;
import l2p.util.Location;
import l2p.util.Rnd;

public class Rogin extends DefaultAI
{
  static final Location[] points = {new Location(115756, -183472, -1480), new Location(115866, -183287, -1480),
    new Location(116280, -182918, -1520), new Location(116587, -184306, -1568), new Location(116392, -184090, -1560),
    new Location(117083, -182538, -1528), new Location(117802, -182541, -1528), new Location(116720, -182479, -1528),
    new Location(115857, -183295, -1480), new Location(115756, -183472, -1480)};
  private int current_point = -1;
  private long wait_timeout = 0;
  private boolean wait = false;

  public Rogin(L2Character actor)
  {
    super(actor);
  }

  @Override
  public boolean isGlobalAI()
  {
    return true;
  }

  @Override
  protected boolean thinkActive()
  {
    L2NpcInstance actor = getActor();
    if(actor == null || actor.isDead())
    {
      return true;
    }
    if(_def_think)
    {
      doTask();
      return true;
    }
    if(System.currentTimeMillis() > wait_timeout && (current_point > -1 || Rnd.chance(5)))
    {
      if(!wait)
      {
        switch(current_point)
        {
          case 3:
            wait_timeout = System.currentTimeMillis() + 15000;
            Functions.npcSay(actor, "Вы случайно не встречали сегодня Torocco?");
            wait = true;
            return true;
          case 6:
            wait_timeout = System.currentTimeMillis() + 15000;
            Functions.npcSay(actor, "Кто нибудь видел Torocco?");
            wait = true;
            return true;
          case 7:
            wait_timeout = System.currentTimeMillis() + 15000;
            Functions.npcSay(actor, "Где же этот дурень прячется?");
            wait = true;
            return true;
          case 8:
            wait_timeout = System.currentTimeMillis() + 60000;
            wait = true;
            return true;
        }
      }
      wait_timeout = 0;
      wait = false;
      current_point++;
      if(current_point >= points.length)
      {
        current_point = 0;
      }
      addTaskMove(points[current_point], true);
      doTask();
      return true;
    }
    if(randomAnimation())
    {
      return true;
    }
    return false;
  }

  @Override
  protected void onEvtAttacked(L2Character attacker, int damage)
  {
  }

  @Override
  protected void onEvtAggression(L2Character target, int aggro)
  {
  }
}
TOP

Related Classes of ai.Rogin

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.