Package l2p.gameserver.model

Examples of l2p.gameserver.model.L2Playable


  }

  @Override
  public void Cast(L2Skill skill, L2Character target, boolean forceUse, boolean dontMove)
  {
    L2Playable actor = getActor();
    if(actor == null)
    {
      return;
    }
    // Если скилл альтернативного типа (например, бутылка на хп),
    // то он может использоваться во время каста других скиллов, или во время атаки, или на бегу.
    // Поэтому пропускаем дополнительные проверки.
    if(skill.altUse() || skill.isToggle())
    {
      if(skill.isToggle() && actor.isToggleDisabled() || skill.isHandler() && actor.isPotionsDisabled())
      {
        clientActionFailed();
      }
      else
      {
        actor.altUseSkill(skill, target);
      }
      return;
    }
    // Если не можем кастовать, то использовать скилл позже
    if(actor.isActionsDisabled())
    {
      //if(!actor.isSkillDisabled(skill.getId()))
      setNextAction(nextAction.CAST, skill, target, forceUse, dontMove);
      clientActionFailed();
      return;
View Full Code Here


    }

    public void run()
    {
      _followTask = null;
      L2Playable actor = getActor();
      if(actor == null)
      {
        return;
      }
      if(getIntention() != AI_INTENTION_FOLLOW)
      {
        // Если пет прекратил преследование, меняем статус, чтобы не пришлось щелкать на кнопку следования 2 раза.
        if((actor.isPet() || actor.isSummon()) && getIntention() == AI_INTENTION_ACTIVE)
        {
          actor.setFollowStatus(false, false);
        }
        return;
      }
      L2Character target = (L2Character) _intention_arg0;
      Integer offset = (Integer) _intention_arg1;
      if(target == null || target.isAlikeDead() || actor.getDistance(target) > 4000)
      {
        setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
        return;
      }
      L2Player actor_player = actor.getPlayer();
      if(actor_player == null || !actor_player.isConnected() || (actor.isPet() || actor.isSummon()) && actor_player.getPet() != actor)
      {
        setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
        return;
      }
      if(!actor.isInRange(target, offset + 20) && (!actor.isFollow || actor.getFollowTarget() != target))
      {
        actor.followToCharacter(target, offset, false);
      }
      _followTask = ThreadPoolManager.getInstance().scheduleMove(this, 1000);
    }
View Full Code Here

    nextAction nextAction = _nextAction;
    Object nextAction_arg0 = _nextAction_arg0;
    Object nextAction_arg1 = _nextAction_arg1;
    boolean nextAction_arg2 = _nextAction_arg2;
    boolean nextAction_arg3 = _nextAction_arg3;
    L2Playable actor = getActor();
    if(nextAction == null || actor == null)
    {
      return false;
    }
    L2Skill skill;
    L2Character target;
    L2Object object;
    switch(nextAction)
    {
      case ATTACK:
        if(nextAction_arg0 == null)
        {
          return false;
        }
        target = (L2Character) nextAction_arg0;
        _forceUse = nextAction_arg2;
        _dontMove = nextAction_arg3;
        clearNextAction();
        setIntention(AI_INTENTION_ATTACK, target);
        break;
      case CAST:
        if(nextAction_arg0 == null || nextAction_arg1 == null)
        {
          return false;
        }
        skill = (L2Skill) nextAction_arg0;
        target = (L2Character) nextAction_arg1;
        _forceUse = nextAction_arg2;
        _dontMove = nextAction_arg3;
        clearNextAction();
        if(!skill.checkCondition(actor, target, _forceUse, _dontMove, true))
        {
          if(skill.getNextAction() == NextAction.ATTACK && !actor.equals(target))
          {
            setNextAction(l2p.gameserver.ai.L2PlayableAI.nextAction.ATTACK, target, null, _forceUse, false);
            return setNextIntention();
          }
          return false;
        }
        setIntention(AI_INTENTION_CAST, skill, target);
        break;
      case MOVE:
        if(nextAction_arg0 == null || nextAction_arg1 == null)
        {
          return false;
        }
        Location loc = (Location) nextAction_arg0;
        Integer offset = (Integer) nextAction_arg1;
        clearNextAction();
        actor.moveToLocation(loc, offset, nextAction_arg2);
        break;
      case REST:
        actor.sitDown();
        break;
      case INTERACT:
        if(nextAction_arg0 == null)
        {
          return false;
View Full Code Here

  }

  @Override
  protected void onEvtThink()
  {
    L2Playable actor = getActor();
    if(actor == null || thinking || actor.isActionsDisabled())
    {
      return;
    }
    thinking = true;
    try
View Full Code Here

  }

  @Override
  protected void onIntentionInteract(L2Object object)
  {
    L2Playable actor = getActor();
    if(actor == null)
    {
      return;
    }
    if(actor.isActionsDisabled())
    {
      setNextAction(nextAction.INTERACT, object, null, false, false);
      clientActionFailed();
      return;
    }
View Full Code Here

    onEvtThink();
  }

  protected void thinkInteract()
  {
    L2Playable actor = getActor();
    if(actor == null)
    {
      return;
    }
    L2Object target = (L2Object) _intention_arg0;
    if(target == null)
    {
      setIntention(AI_INTENTION_ACTIVE);
      return;
    }
    int range = (int) (Math.max(30, actor.getMinDistance(target)) + 20);
    if(actor.isInRangeZ(target, range))
    {
      if(actor.isPlayer())
      {
        ((L2Player) actor).doInteract(target);
      }
      setIntention(AI_INTENTION_ACTIVE);
    }
    else
    {
      actor.moveToLocation(target.getLoc(), 40, true);
      setNextAction(nextAction.INTERACT, target, null, false, false);
    }
  }
View Full Code Here

  }

  @Override
  protected void onIntentionPickUp(L2Object object)
  {
    L2Playable actor = getActor();
    if(actor == null)
    {
      return;
    }
    if(actor.isActionsDisabled())
    {
      setNextAction(nextAction.PICKUP, object, null, false, false);
      clientActionFailed();
      return;
    }
View Full Code Here

    onEvtThink();
  }

  protected void thinkPickUp()
  {
    final L2Playable actor = getActor();
    if(actor == null)
    {
      return;
    }
    final L2Object target = (L2Object) _intention_arg0;
    if(target == null)
    {
      setIntention(AI_INTENTION_ACTIVE);
      return;
    }
    if(actor.isInRange(target, 30) && Math.abs(actor.getZ() - target.getZ()) < 50)
    {
      if(actor.isPlayer() || actor.isPet())
      {
        actor.doPickupItem(target);
      }
      setIntention(AI_INTENTION_ACTIVE);
    }
    else
    {
      ThreadPoolManager.getInstance().executePathfind(new Runnable()
      {
        public void run()
        {
          actor.moveToLocation(target.getLoc(), 10, true);
          setNextAction(nextAction.PICKUP, target, null, false, false);
        }
      });
    }
  }
View Full Code Here

  {
    if(activeChar.getPlayer() == null)
    {
      return;
    }
    L2Playable playable = (L2Playable) activeChar;
    for(L2Character target : targets)
    {
      if(target != null)
      {
        if(!target.isPlayer())
        {
          continue;
        }
        L2Player player_target = (L2Player) target;
        for(L2NpcInstance npc : L2World.getAroundNpc(activeChar, getSkillRadius(), 200))
        {
          HateInfo hateInfo = playable.getHateList().get(npc);
          if(hateInfo == null || hateInfo.hate <= 0)
          {
            continue;
          }
          player_target.addDamageHate(npc, 0, hateInfo.hate + 100);
View Full Code Here

    public void objectLeaved(L2Zone zone, L2Object object)
    {
      L2Player player = object.getPlayer();
      if(_active && _hooks && player != null && (team1_live_list.contains(player) || team2_live_list.contains(player)))
      {
        L2Playable playable = (L2Playable) object;
        double angle = Util.convertHeadingToDegree(playable.getHeading()); // угол в градусах
        double radian = Math.toRadians(angle - 90); // угол в радианах
        playable.teleToLocation((int) (playable.getX() + 50 * Math.sin(radian)), (int) (playable.getY() - 50 * Math.cos(radian)), playable.getZ());
      }
    }
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.L2Playable

Copyright © 2018 www.massapicom. 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.