Package lineage2.gameserver.instancemanager.commission

Examples of lineage2.gameserver.instancemanager.commission.CommissionItemContainer


  {
    List<CommissionItemInfo> items = new ArrayList<>(10);
    Connection con = null;
    PreparedStatement statement = null;
    ResultSet rset = null;
    CommissionItemContainer container = CommissionShopManager.getInstance().getContainer();
    container.readLock();
    try
    {
      con = DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(SELECT_PLAYER_REGISTERED_ITEMS_SQL_QUERY);
      statement.setInt(1, player.getObjectId());
      rset = statement.executeQuery();
      while (rset.next())
      {
        int objectId = rset.getInt("obj_id");
        ItemInstance item;
        if ((item = container.getItemByObjectId(objectId)) == null)
        {
          continue;
        }
        CommissionItemInfo itemInfo = new CommissionItemInfo(item);
        itemInfo.setAuctionId(rset.getLong("auction_id"));
        itemInfo.setRegisteredPrice(rset.getLong("price"));
        itemInfo.setExItemType(ExItemType.valueOf(rset.getString("item_type")));
        itemInfo.setSaleDays(rset.getInt("sale_days"));
        itemInfo.setSaleEndTime(rset.getLong("sale_end_time"));
        itemInfo.setSellerName(rset.getString("seller_name"));
        items.add(itemInfo);
      }
    }
    catch (Exception e)
    {
      _log.info("CommissionShopDAO.getRegisteredItemsFor: " + e, e);
    }
    finally
    {
      container.readUnlock();
      DbUtils.closeQuietly(con, statement, rset);
    }
    return items;
  }
View Full Code Here


      if ((i + 1) < types.length)
      {
        type += ",";
      }
    }
    CommissionItemContainer container = CommissionShopManager.getInstance().getContainer();
    container.readLock();
    try
    {
      con = DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(SELECT_REGISTERED_ITEMS);
      statement.setString(1, type);
      rset = statement.executeQuery();
      int i = 0;
      List<CommissionItemInfo> list = new ArrayList<>(120);
      items.add(list);
      while (rset.next() && (i <= 999))
      {
        int objectId = rset.getInt("obj_id");
        ItemInstance item;
        if ((item = container.getItemByObjectId(objectId)) == null)
        {
          continue;
        }
        if (((rareType == 1) && !item.getTemplate().isBlessed()) || ((rareType == 0) && item.getTemplate().isBlessed()))
        {
          continue;
        }
        if ((grade > -1) && (item.getTemplate().getItemGrade().ordinal() != grade))
        {
          continue;
        }
        if (!searchName.isEmpty() && !rset.getString("item_name").toLowerCase().contains(searchName.toLowerCase()))
        {
          continue;
        }
        CommissionItemInfo itemInfo = new CommissionItemInfo(item);
        itemInfo.setAuctionId(rset.getLong("auction_id"));
        itemInfo.setRegisteredPrice(rset.getLong("price"));
        itemInfo.setExItemType(ExItemType.valueOf(rset.getString("item_type")));
        itemInfo.setSaleDays(rset.getInt("sale_days"));
        itemInfo.setSaleEndTime(rset.getLong("sale_end_time"));
        itemInfo.setSellerName(rset.getString("seller_name"));
        list.add(itemInfo);
        if ((i != 0) && ((i % 120) == 0))
        {
          list = new ArrayList<>(120);
          items.add(list);
        }
        i++;
      }
    }
    catch (Exception e)
    {
      _log.info("CommissionShopDAO.getRegisteredItems: " + e, e);
    }
    finally
    {
      container.readUnlock();
      DbUtils.closeQuietly(con, statement, rset);
    }
    return items;
  }
View Full Code Here

   */
  public CommissionItemInfo getCommissionItemInfo(long auctionId, ExItemType exItemType)
  {
    CommissionItemInfo itemInfo = null;
    ResultSet rset = null;
    CommissionItemContainer container = CommissionShopManager.getInstance().getContainer();
    container.readLock();
    try (
        Connection con = DatabaseFactory.getInstance().getConnection();
        PreparedStatement statement = con.prepareStatement(SELECT_COMMISSION_ITEM_INFO);
    )
    {
      statement.setLong(1, auctionId);
      statement.setString(2, exItemType.name());
      rset = statement.executeQuery();
      while (rset.next())
      {
        int objectId = rset.getInt("obj_id");
        ItemInstance item;
        if ((item = container.getItemByObjectId(objectId)) == null)
        {
          return null;
        }
        itemInfo = new CommissionItemInfo(item);
        itemInfo.setAuctionId(auctionId);
        itemInfo.setRegisteredPrice(rset.getLong("price"));
        itemInfo.setExItemType(exItemType);
        itemInfo.setSaleDays(rset.getInt("sale_days"));
        itemInfo.setSaleEndTime(rset.getLong("sale_end_time"));
        itemInfo.setSellerName(rset.getString("seller_name"));
      }
    }
    catch (Exception e)
    {
      _log.info("CommissionShopDAO.getCommissionItemInfo(long,int): " + e, e);
    }
    finally
    {
      container.readUnlock();
      DbUtils.closeQuietly(rset);
    }
    return itemInfo;
  }
View Full Code Here

  {
    List<CommissionItemInfo> list = new ArrayList<>();
    Connection con = null;
    PreparedStatement statement = null;
    ResultSet rset = null;
    CommissionItemContainer container = CommissionShopManager.getInstance().getContainer();
    container.writeLock();
    try
    {
      con = DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(SELECT_EXPIRED_ITEMS);
      statement.setLong(1, expireTime);
      rset = statement.executeQuery();
      while (rset.next())
      {
        int objectId = rset.getInt("obj_id");
        ItemInstance item;
        if ((item = container.getItemByObjectId(objectId)) == null)
        {
          continue;
        }
        CommissionItemInfo itemInfo = new CommissionItemInfo(item);
        itemInfo.setAuctionId(rset.getLong("auction_id"));
        itemInfo.setRegisteredPrice(rset.getLong("price"));
        itemInfo.setExItemType(ExItemType.valueOf(rset.getString("item_type")));
        itemInfo.setSaleDays(rset.getInt("sale_days"));
        itemInfo.setSaleEndTime(rset.getLong("sale_end_time"));
        itemInfo.setSellerName(rset.getString("seller_name"));
        list.add(itemInfo);
      }
    }
    catch (Exception e)
    {
      _log.info("CommissionShopDAO.removeExpiredItems(long): " + e, e);
    }
    finally
    {
      container.writeUnlock();
      DbUtils.closeQuietly(con, statement, rset);
    }
    return list;
  }
View Full Code Here

    {
      teleportHome();
      return false;
    }
    clearTasks();
    Creature target = prepareTarget();
    if (target == null)
    {
      return false;
    }
    if (!BaiumManager.getZone().checkIfInZone(target))
View Full Code Here

      kama.addKilledKanabion(type);
      spawnPossible = kama.isSpawnPossible();
    }
    if (spawnPossible && (nextId > 0))
    {
      Creature player = null;
      if (!killer.isPlayer())
      {
        for (Player pl : World.getAroundPlayers(actor))
        {
          player = pl;
View Full Code Here

  {
    if (param.length < 4)
    {
      throw new IllegalArgumentException();
    }
    final Player player = getSelf();
    if (player == null)
    {
      return;
    }
    final long price = Long.parseLong(param[param.length - 1]);
    if (!NpcInstance.canBypassCheck(player, player.getLastNpc()))
    {
      return;
    }
    if ((price > 0) && (player.getAdena() < price))
    {
      player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
      return;
    }
    if (player.getMountType() == 2)
    {
      player.sendMessage("Телепортаци�? верхом на виверне невозможна.");
      return;
    }
    if (player.getLastNpc() != null)
    {
      final int npcId = player.getLastNpc().getNpcId();
      switch (npcId)
      {
        case 30483:
          if (player.getLevel() >= Config.CRUMA_GATEKEEPER_LVL)
          {
            show("teleporter/30483-no.htm", player);
            return;
          }
          break;
        case 32864:
        case 32865:
        case 32866:
        case 32867:
        case 32868:
        case 32869:
        case 32870:
          if (player.getLevel() < 80)
          {
            show("teleporter/" + npcId + "-no.htm", player);
            return;
          }
          break;
      }
    }
    final int x = Integer.parseInt(param[0]);
    final int y = Integer.parseInt(param[1]);
    final int z = Integer.parseInt(param[2]);
    final int castleId = (param.length > 4) ? Integer.parseInt(param[3]) : 0;
    if (player.getReflection().isDefault())
    {
      final Castle castle = (castleId > 0) ? ResidenceHolder.getInstance().getResidence(Castle.class, castleId) : null;
      if ((castle != null) && castle.getSiegeEvent().isInProgress())
      {
        player.sendPacket(Msg.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
        return;
      }
    }
    final Location pos = Location.findPointToStay(x, y, z, 50, 100, player.getGeoIndex());
    if (price > 0)
    {
      player.reduceAdena(price, true);
    }
    player.teleToLocation(pos);
  }
View Full Code Here

  {
    if (param.length < 5)
    {
      throw new IllegalArgumentException();
    }
    final Player player = getSelf();
    if (player == null)
    {
      return;
    }
    final long count = Long.parseLong(param[3]);
    final int item = Integer.parseInt(param[4]);
    if (!NpcInstance.canBypassCheck(player, player.getLastNpc()))
    {
      return;
    }
    if (count > 0)
    {
      if (!player.getInventory().destroyItemByItemId(item, count))
      {
        player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_REQUIRED_ITEMS);
        return;
      }
      player.sendPacket(SystemMessage2.removeItems(item, count));
    }
    final int x = Integer.parseInt(param[0]);
    final int y = Integer.parseInt(param[1]);
    final int z = Integer.parseInt(param[2]);
    final Location pos = Location.findPointToStay(x, y, z, 20, 70, player.getGeoIndex());
    player.teleToLocation(pos);
  }
View Full Code Here

  {
    if (param.length < 5)
    {
      throw new IllegalArgumentException();
    }
    final Player player = getSelf();
    if (player == null)
    {
      return;
    }
    player.setReflection(Integer.parseInt(param[4]));
    Gatekeeper(param);
  }
View Full Code Here

   * Method TokenJump.
   * @param param String[]
   */
  public void TokenJump(String[] param)
  {
    final Player player = getSelf();
    if (player == null)
    {
      return;
    }
    if (player.getLevel() <= 19)
    {
      QuestGatekeeper(param);
    }
    else
    {
View Full Code Here

TOP

Related Classes of lineage2.gameserver.instancemanager.commission.CommissionItemContainer

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.