コード例 #1
0
  @Override
  protected void runImpl() {
    final L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) {
      return;
    }

    final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
    if ((request == null) || request.isProcessing()) {
      return;
    }

    request.setEnchantingItem(_objectId);

    final L2ItemInstance item = request.getEnchantingItem();
    final L2ItemInstance scroll = request.getEnchantingScroll();
    if ((item == null) || (scroll == null)) {
      return;
    }

    final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
    if ((scrollTemplate == null) || !scrollTemplate.isValid(item, null)) {
      activeChar.sendPacket(SystemMessageId.DOES_NOT_FIT_STRENGTHENING_CONDITIONS_OF_THE_SCROLL);
      activeChar.removeRequest(request.getClass());
      activeChar.sendPacket(new ExPutEnchantTargetItemResult(0));
      if (scrollTemplate == null) {
        _log.log(
            Level.WARNING,
            getClass().getSimpleName() + ": Undefined scroll have been used id: " + scroll.getId());
      }
      return;
    }
    request.setTimestamp(System.currentTimeMillis());
    activeChar.sendPacket(new ExPutEnchantTargetItemResult(_objectId));
  }
コード例 #2
0
  @Override
  protected void runImpl() {
    final L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) {
      return;
    }

    final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
    if ((request == null) || request.isProcessing()) {
      return;
    }

    final L2ItemInstance supportItem = request.getSupportItem();
    if ((supportItem == null) || (supportItem.getCount() < 1)) {
      request.setSupportItem(L2PcInstance.ID_NONE);
    }

    request.setTimestamp(System.currentTimeMillis());
    activeChar.sendPacket(ExRemoveEnchantSupportItemResult.STATIC_PACKET);
  }