Пример #1
0
  /**
   * Manage the PickUp Intention : Set the pick up target and Launch a Move To Pawn Task
   * (offset=20).<br>
   * <br>
   * <B><U> Actions</U> : </B><br>
   * <br>
   * <li>Set the AI pick up target
   * <li>Set the Intention of this AI to AI_INTENTION_PICK_UP
   * <li>Move the actor to Pawn server side AND client side by sending Server->Client packet
   *     MoveToPawn (broadcast) <br>
   *     <br>
   */
  @Override
  protected void onIntentionPickUp(L2Object object) {
    if (getIntention() == AI_INTENTION_REST) {
      // Cancel action client side by sending Server->Client packet ActionFailed to the L2Player
      // actor
      clientActionFailed();
      return;
    }

    // Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop
    // (broadcast)
    clientStopAutoAttack();

    if (object instanceof L2ItemInstance
        && ((L2ItemInstance) object).getLocation() != ItemLocation.VOID) return;

    // Set the Intention of this AbstractAI to AI_INTENTION_PICK_UP
    changeIntention(AI_INTENTION_PICK_UP, object, null);

    // Set the AI pick up target
    setTarget(object);

    if (object.getX() == 0 && object.getY() == 0) {
      _log.warn("Object in coords 0,0 - using a temporary fix");
      object.getPosition().setXYZ(getActor().getX(), getActor().getY(), getActor().getZ() + 5);
    }

    // Move the actor to Pawn server side AND client side by sending Server->Client packet
    // MoveToPawn (broadcast)
    moveToPawn(object, 20);
  }
Пример #2
0
  public ClearableReference(T referent) {
    super(referent);

    StringBuilder sb = new StringBuilder();
    sb.append("[ ");
    sb.append(Integer.toHexString(System.identityHashCode(referent)).toUpperCase());
    sb.append(" | ");
    sb.append(referent);
    if (referent instanceof L2Object) {
      L2Object obj = (L2Object) referent;
      sb.append(" | ");
      sb.append(obj.getObjectId()).append(" - ").append(obj.getName());
    }
    sb.append(" ]");

    _name = sb.toString();
  }