Package lineage2.gameserver.model.items

Examples of lineage2.gameserver.model.items.ItemInstance


        OlympiadHistoryManager.getInstance().saveHistory(h);
      }
    }
    for (Player player : winnerTeam.getPlayers())
    {
      ItemInstance item = player.getInventory().addItem(Config.ALT_OLY_BATTLE_REWARD_ITEM, getType().getReward());
      player.sendPacket(SystemMessage2.obtainItems(item.getItemId(), getType().getReward(), 0));
      player.sendChanges();
    }
    List<Player> teamsPlayers = new ArrayList<>();
    teamsPlayers.addAll(winnerTeam.getPlayers());
    teamsPlayers.addAll(looseTeam.getPlayers());
View Full Code Here


          Inventory inv = ((Playable) activeChar).getInventory();
          if (inv == null)
          {
            inv = player.getInventory();
          }
          ItemInstance requiredItems = inv.getItemByItemId(_itemConsumeId[i]);
          if ((requiredItems == null) || (requiredItems.getCount() < _itemConsume[i]))
          {
            if (activeChar == player)
            {
              player.sendPacket(isHandler() ? SystemMsg.INCORRECT_ITEM_COUNT : SystemMsg.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);
            }
View Full Code Here

  @Override
  public void onBypassFeedback(Player player, String command)
  {
    if (command.startsWith("open_gate"))
    {
      ItemInstance hallsKey = player.getInventory().getItemByItemId(HALLS_KEY);
      if (hallsKey == null)
      {
        showHtmlFile(player, "Gatekeeper-no.htm");
      }
      else if (FourSepulchersManager.isAttackTime())
      {
        switch (getNpcId())
        {
          case 31929:
          case 31934:
          case 31939:
          case 31944:
            if (!FourSepulchersSpawn.isShadowAlive(getNpcId()))
            {
              FourSepulchersSpawn.spawnShadow(getNpcId());
            }
        }
        openNextDoor(getNpcId());
        if (player.getParty() != null)
        {
          for (Player mem : player.getParty().getPartyMembers())
          {
            hallsKey = mem.getInventory().getItemByItemId(HALLS_KEY);
            if (hallsKey != null)
            {
              Functions.removeItem(mem, HALLS_KEY, hallsKey.getCount());
            }
          }
        }
        else
        {
          Functions.removeItem(player, HALLS_KEY, hallsKey.getCount());
        }
      }
    }
    else
    {
View Full Code Here

    final NpcInstance actor = getActor();
    if (actor == null)
    {
      return;
    }
    ItemInstance closestItem = null;
    if (_nextEat < System.currentTimeMillis())
    {
      for (GameObject obj : World.getAroundObjects(actor, 20, 200))
      {
        if (obj.isItem() && ((ItemInstance) obj).isStackable())
        {
          closestItem = (ItemInstance) obj;
        }
      }
      if (closestItem != null)
      {
        closestItem.deleteMe();
        actor.altUseSkill(s_display_bug_of_fortune1, actor);
        Functions.npcSayInRange(actor, 600, NpcString.YUMYUM_YUMYUM);
        i_ai0++;
        if ((i_ai0 > 1) && (i_ai0 <= 10))
        {
View Full Code Here

    {
      return true;
    }
    if (!actor.isMoving && (_nextEat < System.currentTimeMillis()))
    {
      ItemInstance closestItem = null;
      for (GameObject obj : World.getAroundObjects(actor, MAX_RADIUS, 200))
      {
        if (obj.isItem() && ((ItemInstance) obj).isStackable())
        {
          closestItem = (ItemInstance) obj;
        }
      }
      if (closestItem != null)
      {
        actor.moveToLocation(closestItem.getLoc(), 0, true);
      }
    }
    return false;
  }
View Full Code Here

  @Override
  public void onStart()
  {
    super.onStart();
    Player player = (Player) _effected;
    ItemInstance wpn = player.getActiveWeaponInstance();
    if (wpn != null)
    {
      player.getInventory().unEquipItem(wpn);
      player.sendDisarmMessage(wpn);
    }
View Full Code Here

    mail.setReceiverName(receiver.getName());
    mail.setTopic(title);
    mail.setBody(body);
    for (Map.Entry<Integer, Long> itm : items.entrySet())
    {
      ItemInstance item = ItemFunctions.createItem(itm.getKey());
      item.setLocation(ItemInstance.ItemLocation.MAIL);
      item.setCount(itm.getValue());
      item.save();
      mail.addAttachment(item);
    }
    mail.setType(Mail.SenderType.NEWS_INFORMER);
    mail.setUnread(true);
    mail.setExpireTime((720 * 3600) + (int) (System.currentTimeMillis() / 1000L));
View Full Code Here

   * Method createNewItemInstance.
   * @return ItemInstance
   */
  public final ItemInstance createNewItemInstance()
  {
    final ItemInstance item = ItemFunctions.createItem(getItemId());
    item.setEnchantLevel(getEnchantLevel());
    if (getAugmentationId() != 0)
    {
      item.setAugmentationId(getAugmentationId());
    }
    return item;
  }
View Full Code Here

   * @param objectId int
   * @return ItemInstance * @throws SQLException
   */
  private ItemInstance load0(int objectId) throws SQLException
  {
    ItemInstance item = null;
    Connection con = null;
    PreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
View Full Code Here

   * @param rset ResultSet
   * @return ItemInstance * @throws SQLException
   */
  private ItemInstance load0(ResultSet rset) throws SQLException
  {
    ItemInstance item = null;
    if (rset.next())
    {
      int objectId = rset.getInt(1);
      item = new ItemInstance(objectId);
      item.setOwnerId(rset.getInt(2));
      item.setItemId(rset.getInt(3));
      item.setCount(rset.getLong(4));
      item.setEnchantLevel(rset.getInt(5));
      item.setLocName(rset.getString(6));
      item.setLocData(rset.getInt(7));
      item.setCustomType1(rset.getInt(8));
      item.setCustomType2(rset.getInt(9));
      item.setLifeTime(rset.getInt(10));
      item.setCustomFlags(rset.getInt(11));
      item.setAugmentationId(rset.getInt(12));
      item.getAttributes().setFire(rset.getInt(13));
      item.getAttributes().setWater(rset.getInt(14));
      item.getAttributes().setWind(rset.getInt(15));
      item.getAttributes().setEarth(rset.getInt(16));
      item.getAttributes().setHoly(rset.getInt(17));
      item.getAttributes().setUnholy(rset.getInt(18));
      item.setAgathionEnergy(rset.getInt(19));
      item.setVisualId(rset.getInt(20));
    }
    return item;
  }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.items.ItemInstance

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.