Examples of Playable


Examples of lineage2.gameserver.model.Playable

  /**
   * Method thinkPickUp.
   */
  protected void thinkPickUp()
  {
    final Playable actor = getActor();
    final GameObject target = (GameObject) _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().execute(new RunnableImpl()
      {
        @Override
        public void runImpl()
        {
          actor.moveToLocation(target.getLoc(), 10, true);
          setNextAction(nextAction.PICKUP, target, null, false, false);
        }
      });
    }
  }
View Full Code Here

Examples of lineage2.gameserver.model.Playable

   * Method thinkAttack.
   * @param checkRange boolean
   */
  protected void thinkAttack(boolean checkRange)
  {
    Playable actor = getActor();
    Player player = actor.getPlayer();
    if (player == null)
    {
      setIntention(AI_INTENTION_ACTIVE);
      return;
    }
    if (actor.isActionsDisabled() || actor.isAttackingDisabled())
    {
      actor.sendActionFailed();
      return;
    }
    boolean isPosessed = (actor instanceof Summon) && ((Summon) actor).isDepressed();
    Creature attack_target = getAttackTarget();
    if ((attack_target == null) || attack_target.isDead() || (!isPosessed && !(_forceUse ? attack_target.isAttackable(actor) : attack_target.isAutoAttackable(actor))))
    {
      setIntention(AI_INTENTION_ACTIVE);
      actor.sendActionFailed();
      return;
    }
    if (!checkRange)
    {
      clientStopMoving();
      actor.doAttack(attack_target);
      return;
    }
    int range = actor.getPhysicalAttackRange();
    if (range < 10)
    {
      range = 10;
    }
    boolean canSee = GeoEngine.canSeeTarget(actor, attack_target, false);
    if (!canSee && ((range > 200) || (Math.abs(actor.getZ() - attack_target.getZ()) > 200)))
    {
      actor.sendPacket(SystemMsg.CANNOT_SEE_TARGET);
      setIntention(AI_INTENTION_ACTIVE);
      actor.sendActionFailed();
      return;
    }
    range += actor.getMinDistance(attack_target);
    if (actor.isFakeDeath())
    {
      actor.breakFakeDeath();
    }
    if (actor.isInRangeZ(attack_target, range))
    {
      if (!canSee)
      {
        actor.sendPacket(SystemMsg.CANNOT_SEE_TARGET);
        setIntention(AI_INTENTION_ACTIVE);
        actor.sendActionFailed();
        return;
      }
      clientStopMoving(false);
      actor.doAttack(attack_target);
    }
    else if (!_dontMove)
    {
      ThreadPoolManager.getInstance().execute(new ExecuteFollow(attack_target, range - 20));
    }
    else
    {
      actor.sendActionFailed();
    }
  }
View Full Code Here

Examples of lineage2.gameserver.model.Playable

   * Method thinkCast.
   * @param checkRange boolean
   */
  protected void thinkCast(boolean checkRange)
  {
    Playable actor = getActor();
    Creature target = getAttackTarget();
    if ((_skill.getSkillType() == SkillType.CRAFT) || _skill.isToggle())
    {
      if (_skill.checkCondition(actor, target, _forceUse, _dontMove, true))
      {
        actor.doCast(_skill, target, _forceUse);
      }
      return;
    }
    if ((target == null) || ((target.isDead() != _skill.getCorpse()) && !_skill.isNotTargetAoE()))
    {
      setIntention(AI_INTENTION_ACTIVE);
      actor.sendActionFailed();
      return;
    }
    if (!checkRange)
    {
      if ((_skill.getNextAction() == NextAction.ATTACK) && !actor.equals(target))
      {
        setNextAction(nextAction.ATTACK, target, null, _forceUse, false);
      }
      else
      {
        clearNextAction();
      }
      clientStopMoving();
      if (_skill.checkCondition(actor, target, _forceUse, _dontMove, true))
      {
        actor.doCast(_skill, target, _forceUse);
      }
      else
      {
        setNextIntention();
        if (getIntention() == CtrlIntention.AI_INTENTION_ATTACK)
        {
          thinkAttack(true);
        }
      }
      return;
    }
    int range = actor.getMagicalAttackRange(_skill);
    if (range < 10)
    {
      range = 10;
    }
    boolean canSee = (_skill.getSkillType() == SkillType.TAKECASTLE) || (_skill.getSkillType() == SkillType.TAKEFORTRESS) || GeoEngine.canSeeTarget(actor, target, actor.isFlying());
    boolean noRangeSkill = _skill.getCastRange() == 32767;
    if (!noRangeSkill && !canSee && ((range > 200) || (Math.abs(actor.getZ() - target.getZ()) > 200)))
    {
      actor.sendPacket(SystemMsg.CANNOT_SEE_TARGET);
      setIntention(AI_INTENTION_ACTIVE);
      actor.sendActionFailed();
      return;
    }
    range += actor.getMinDistance(target);
    if (actor.isFakeDeath())
    {
      actor.breakFakeDeath();
    }
    if (actor.isInRangeZ(target, range) || noRangeSkill)
    {
      if (!noRangeSkill && !canSee)
      {
        actor.sendPacket(SystemMsg.CANNOT_SEE_TARGET);
        setIntention(AI_INTENTION_ACTIVE);
        actor.sendActionFailed();
        return;
      }
      if ((_skill.getNextAction() == NextAction.ATTACK) && !actor.equals(target))
      {
        setNextAction(nextAction.ATTACK, target, null, _forceUse, false);
      }
      else
      {
        clearNextAction();
      }
      if (_skill.checkCondition(actor, target, _forceUse, _dontMove, true))
      {
        clientStopMoving(false);
        actor.doCast(_skill, target, _forceUse);
      }
      else
      {
        setNextIntention();
        if (getIntention() == CtrlIntention.AI_INTENTION_ATTACK)
        {
          thinkAttack(true);
        }
      }
    }
    else if (!_dontMove)
    {
      ThreadPoolManager.getInstance().execute(new ExecuteFollow(target, range - 20));
    }
    else
    {
      actor.sendPacket(Msg.YOUR_TARGET_IS_OUT_OF_RANGE);
      setIntention(AI_INTENTION_ACTIVE);
      actor.sendActionFailed();
    }
  }
View Full Code Here

Examples of lineage2.gameserver.model.Playable

   * Method lockTarget.
   * @param target Creature
   */
  public void lockTarget(Creature target)
  {
    Playable actor = getActor();
    if ((target == null) || target.isDead())
    {
      actor.setAggressionTarget(null);
    }
    else if (actor.getAggressionTarget() == null)
    {
      actor.getTarget();
      actor.setAggressionTarget(target);
      actor.setTarget(target);
      clearNextAction();
    }
  }
View Full Code Here

Examples of lineage2.gameserver.model.Playable

   * @param dontMove boolean
   */
  @Override
  public void Attack(GameObject target, boolean forceUse, boolean dontMove)
  {
    Playable actor = getActor();
    if (target.isCreature() && (actor.isActionsDisabled() || actor.isAttackingDisabled()))
    {
      setNextAction(nextAction.ATTACK, target, null, forceUse, false);
      actor.sendActionFailed();
      return;
    }
    _dontMove = dontMove;
    _forceUse = forceUse;
    clearNextAction();
View Full Code Here

Examples of lineage2.gameserver.model.Playable

   * @param dontMove boolean
   */
  @Override
  public void Cast(Skill skill, Creature target, boolean forceUse, boolean dontMove)
  {
    Playable actor = getActor();
    if (skill.altUse() || skill.isToggle())
    {
      if (((skill.isToggle() && !skill.isAwakeningToggle())|| skill.isHandler()) && (actor.isOutOfControl() || actor.isStunned() || actor.isSleeping() || actor.isParalyzed() || actor.isAlikeDead() || actor.isAirBinded() || actor.isKnockedBack() || actor.isKnockedDown() || actor.isPulledNow()))
      {
        clientActionFailed();
      }
      else
      {
        actor.altUseSkill(skill, target);
      }
      return;
    }
    if (actor.isActionsDisabled())
    {
      setNextAction(nextAction.CAST, skill, target, forceUse, dontMove);
      clientActionFailed();
      return;
    }
View Full Code Here

Examples of lineage2.gameserver.model.Playable

     * Method runImpl.
     */
    @Override
    public void runImpl()
    {
      Playable actor = getActor();
      if (getIntention() != AI_INTENTION_FOLLOW)
      {
        if (actor.isClone() && getIntention() == AI_INTENTION_ACTIVE)
        {
          ((ClonePlayer) actor).setFollowMode(false);
        }
        else if ((actor.isPet() || actor.isServitor()) && (getIntention() == AI_INTENTION_ACTIVE))
        {
          ((Summon) actor).setFollowMode(false);
        }
        return;
      }
      Creature target = (Creature) _intention_arg0;
      int offset = _intention_arg1 instanceof Integer ? (Integer) _intention_arg1 : 0;
      if ((target == null) || target.isAlikeDead() || (actor.getDistance(target) > 4000))
      {
        setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
        return;
      }
      Player player = actor.getPlayer();
      if ((player == null) || player.isLogoutStarted() || ((actor.isPet() || actor.isServitor()) && !player.getSummonList().contains(actor) && !actor.isClone()))
      {
        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().schedule(this, 250L);
    }
View Full Code Here

Examples of lineage2.gameserver.model.Playable

    {
      if (info.damage <= 1)
      {
        continue;
      }
      Playable attacker = (Playable) info.attacker;
      Player player = attacker.getPlayer();
      RewardInfo reward = rewards.get(player);
      if (reward == null)
      {
        rewards.put(player, new RewardInfo(player, info.damage));
      }
      else
      {
        reward.addDamage(info.damage);
      }
    }
    Player[] attackers = rewards.keySet().toArray(new Player[rewards.size()]);
    double[] xpsp = new double[2];
    for (Player attacker : attackers)
    {
      if (attacker.isDead())
      {
        continue;
      }
      RewardInfo reward = rewards.get(attacker);
      if (reward == null)
      {
        continue;
      }
      Party party = attacker.getParty();
      int maxHp = getMaxHp();
      xpsp[0] = 0.;
      xpsp[1] = 0.;
      if (party == null)
      {
        int damage = Math.min(reward._dmg, maxHp);
        if (damage > 0)
        {
          if (isInRangeZ(attacker, Config.ALT_PARTY_DISTRIBUTION_RANGE))
          {
            xpsp = calculateExpAndSp(attacker.getLevel(), damage);
          }
          xpsp[0] = applyOverhit(killer, xpsp[0]);
          attacker.addExpAndCheckBonus(this, (long) xpsp[0], (long) xpsp[1], 1.);
        }
        rewards.remove(attacker);
      }
      else
      {
View Full Code Here

Examples of lineage2.gameserver.model.Playable

    if (!target.isPlayable())
    {
      activeChar.sendPacket(Msg.INVALID_TARGET);
      return;
    }
    Playable playable = (Playable) target;
    playable.addExpAndSp(exp, sp);
    activeChar.sendMessage("Added " + exp + " experience and " + sp + " SP to " + playable.getName() + ".");
  }
View Full Code Here

Examples of lineage2.gameserver.model.Playable

  {
    if ((playable == null) || (count < 1))
    {
      return;
    }
    Playable player;
    if (playable.isServitor())
    {
      player = playable.getPlayer();
    }
    else
    {
      player = playable;
    }
    ItemTemplate t = ItemHolder.getInstance().getTemplate(itemId);
    if (t.isStackable())
    {
      player.getInventory().addItem(itemId, count);
    }
    else
    {
      for (long i = 0; i < count; i++)
      {
        player.getInventory().addItem(itemId, 1);
      }
    }
    if (notify)
    {
      player.sendPacket(SystemMessage2.obtainItems(itemId, count, 0));
    }
  }
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.