Package l2p.gameserver.model.items

Examples of l2p.gameserver.model.items.L2ItemInstance$LazyUpdateInDb


  }

  @Override
  public boolean consumeItem(int itemConsumeId, int itemCount)
  {
    L2ItemInstance item = getInventory().getItemByItemId(itemConsumeId);
    return !(item == null || item.getCount() < itemCount) && getInventory().destroyItem(item, itemCount, false) != null;
  }
View Full Code Here


    if(!object.isItem())
    {
      owner.sendActionFailed();
      return;
    }
    L2ItemInstance target = (L2ItemInstance) object;
    if(target.isCursed())
    {
      owner.sendPacket(new SystemMessage(SystemMessage.YOU_HAVE_FAILED_TO_PICK_UP_S1).addItemName(target.getItemId()));
      return;
    }
    synchronized(target)
    {
      if(!target.isVisible())
      {
        owner.sendActionFailed();
        return;
      }
      if(getInventory().getTotalWeight() + target.getItem().getWeight() * target.getCount() > getMaxLoad())
      {
        owner.sendPacket(Msg.EXCEEDED_PET_INVENTORYS_WEIGHT_LIMIT);
        return;
      }
      if(target.isHerb())
      {
        L2Skill[] skills = target.getItem().getAttachedSkills();
        if(skills != null && skills.length > 0)
        {
          for(L2Skill skill : skills)
          {
            altUseSkill(skill, this);
          }
        }
        target.deleteMe();
        return;
      }
      if(!target.pickupMe(this))
      {
        owner.sendActionFailed();
        return;
      }
    }
    if(owner.getParty() == null || owner.getParty().getLootDistribution() == L2Party.ITEM_LOOTER)
    {
      owner.sendPacket(SystemMessage.obtainItemsBy(target, "Your pet"));
      target.setCustomFlags(target.getCustomFlags() | L2ItemInstance.FLAG_PET_EQUIPPED, true);
      synchronized(_inventory)
      {
        _inventory.addItem(target);
      }
      sendItemList();
View Full Code Here

    L2Player owner = getPlayer();
    synchronized(_inventory)
    {
      for(L2ItemInstance i : _inventory.getItems())
      {
        L2ItemInstance item = _inventory.dropItem(i, i.getCount(), false);
        if(owner != null)
        {
          owner.getInventory().addItem(item);
        }
        else
        {
          item.dropMe(this, getLoc().changeZ(25));
        }
      }
      _inventory.getItemsList().clear();
    }
  }
View Full Code Here

    }
  }

  public void updateControlItem()
  {
    L2ItemInstance controlItem = getControlItem();
    if(controlItem == null)
    {
      return;
    }
    controlItem.setEnchantLevel(_level);
    controlItem.setCustomType2(getName() == null ? 0 : 1);
    L2Player owner = getPlayer();
    if(owner != null)
    {
      owner.sendPacket(new InventoryUpdate().addModifiedItem(controlItem));
    }
View Full Code Here

        continue;
      }
      // If the killer succeeds or it is a boss mob, level up the crystal
      if(levelPartyCrystals || Rnd.chance(Config.ChanceLevelUpSA))
      {
        L2ItemInstance oldCrystal = player.getInventory().getItemByItemId(oldCrystalId);
        if(oldCrystal == null)
        {
          continue;
        }
        // Baylor с 50% шансом апает курсед кристал
        if((getNpcId() == 29099 || getNpcId() == 29103) && Rnd.chance(50))
        {
          newCrystalId = getCursedCrystal(newCrystalId);
        }
        player.sendPacket(SystemMessage.removeItems(oldCrystal.getItemId(), 1), Msg.THE_SOUL_CRYSTAL_SUCCEEDED_IN_ABSORBING_A_SOUL, SystemMessage.obtainItems(newCrystalId, 1, 0));
        player.getInventory().destroyItem(oldCrystal, 1, true);
        player.getInventory().addItem(ItemTable.getInstance().createItem(newCrystalId));
        // извещаем окружающих если получен кристал выше 10-ого уровня
        if(!(player.isGM() && player.isInvisible()))
        {
View Full Code Here

  }

  public L2ItemInstance takeHarvest()
  {
    harvestLock.lock();
    final L2ItemInstance harvest = _harvestItem;
    _harvestItem = null;
    _seeded = null;
    seederStoreId = 0;
    harvestLock.unlock();
    return harvest;
View Full Code Here

    {
      double mod = calcStat(Stats.DROP, 1., lastAttacker, null);
      final GArray<ItemToDrop> spoils = getTemplate().getDropData().rollSpoil(levelDiff, this, player, mod);
      for(final ItemToDrop spoil : spoils)
      {
        final L2ItemInstance dropit = ItemTable.getInstance().createItem(spoil.itemId);
        dropit.setCount(spoil.count);
        spoiled.add(dropit);
      }
    }
    if(spoiled.size() > 0)
    {
View Full Code Here

      player.reduceAdena(cost[priceId - 1], true);
      SystemMessage sm = new SystemMessage(SystemMessage.ACQUIRED__S1_S2);
      sm.addNumber(_raceNumber);
      sm.addItemName(4443);
      player.sendPacket(sm);
      L2ItemInstance item = ItemTable.getInstance().createItem(4443);
      item.setEnchantLevel(_raceNumber);
      item.setCustomType1(ticket);
      item.setCustomType2(cost[priceId - 1] / 100);
      player.getInventory().addItem(item);
      return;
    }
    html.replace("1race", String.valueOf(_raceNumber));
    player.sendPacket(html);
View Full Code Here

    {
      show("Питомец должен быть вызван.", player);
      return;
    }
    L2Item item = ItemTable.getInstance().getTemplate(Config.SERVICES_CHANGE_PET_NAME_ITEM);
    L2ItemInstance pay = player.getInventory().getItemByItemId(item.getItemId());
    if(pay != null && pay.getCount() >= Config.SERVICES_CHANGE_PET_NAME_PRICE)
    {
      player.getInventory().destroyItem(pay, Config.SERVICES_CHANGE_PET_NAME_PRICE, true);
      pl_pet.setName(pl_pet.getTemplate().name);
      pl_pet.broadcastPetInfo();
      L2PetInstance _pet = (L2PetInstance) pl_pet;
      L2ItemInstance controlItem = _pet.getControlItem();
      if(controlItem != null)
      {
        controlItem.setCustomType2(1);
        controlItem.setPriceToSell(0);
        controlItem.updateDatabase();
        _pet.updateControlItem();
      }
      show("Имя стерто.", player);
    }
    else if(Config.SERVICES_CHANGE_PET_NAME_ITEM == 57)
View Full Code Here

    {
      show("Пет должен быть вызван.", player);
      return;
    }
    L2Item item = ItemTable.getInstance().getTemplate(Config.SERVICES_EXCHANGE_BABY_PET_ITEM);
    L2ItemInstance pay = player.getInventory().getItemByItemId(item.getItemId());
    if(pay != null && pay.getCount() >= Config.SERVICES_EXCHANGE_BABY_PET_PRICE)
    {
      player.getInventory().destroyItem(pay, Config.SERVICES_EXCHANGE_BABY_PET_PRICE, true);
      L2ItemInstance control = player.getInventory().getItemByObjectId(player.getPet().getControlItemObjId());
      control.setItemId(L2Pet.IMPROVED_BABY_COUGAR.getControlItemId());
      control.updateDatabase(true, true);
      player.sendPacket(new ItemList(player, false));
      player.getPet().unSummon();
      show("Пет изменен.", player);
    }
    else if(Config.SERVICES_EXCHANGE_BABY_PET_ITEM == 57)
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.items.L2ItemInstance$LazyUpdateInDb

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.