Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.Inventory


    }

    private List<TempItem> listItems(boolean remove)
    {
      L2RecipeInstance[] recipes = _recipeList.getRecipes();
      Inventory inv = _target.getInventory();
      List<TempItem> materials = new FastList<TempItem>();

      for (L2RecipeInstance recipe : recipes)
      {
        int quantity = _recipeList.isConsumable() ? (int) (recipe.getQuantity() * Config.RATE_CONSUMABLE_COST) : recipe.getQuantity();
        if (quantity > 0)
        {
          L2ItemInstance item = inv.getItemByItemId(recipe.getItemId());

          // check materials
          if (item==null || item.getCount() < quantity)
          {
            _target.sendMessage("You dont have the right elements for making this item"
                               + ((_recipeList.isConsumable() && Config.RATE_CONSUMABLE_COST != 1? ".\nDue to server rates you need "
                                                                                                     + Config.RATE_CONSUMABLE_COST
                                                                                                     + "x more material than listed in recipe"
                                                                                                     : ""));
            abort();
            return null;
          }

          // make new temporary object, just for counting puroses

          TempItem temp = new TempItem(item, quantity);
          materials.add(temp);
        }
      }

      if (remove)
      {
        for(TempItem tmp : materials)
          {
          inv.destroyItemByItemId("Manufacture", tmp.getItemId(), tmp.getQuantity(), _target, _player);
          }
      }
      return materials;
    }
View Full Code Here


  @Override
  public void giveAllToOwner()
  {
    try
    {
      Inventory petInventory = getInventory();
      L2ItemInstance[] items = petInventory.getItems();
      for (int i = 0; (i < items.length); i++)
      {
        L2ItemInstance giveit = items[i];
        if (((giveit.getItem().getWeight() * giveit.getCount())
            + getOwner().getInventory().getTotalWeight())
View Full Code Here

    else if (player.isMaryRequest())
    {
        // check for formalwear
      if(Config.L2JMOD_WEDDING_FORMALWEAR)
      {
        Inventory inv3 = player.getInventory();
        L2ItemInstance item3 = inv3.getPaperdollItem(10);
        if(null==item3)
        {
          player.setIsWearingFormalWear(false);
        }
        else
        {
            String strItem = Integer.toString(item3.getItemId());
            String frmWear = Integer.toString(6408);
            player.sendMessage(strItem);
            if(strItem.equals(frmWear))
            {
              player.setIsWearingFormalWear(true);
            }else{
              player.setIsWearingFormalWear(false);
            }
        }
      }
        if(Config.L2JMOD_WEDDING_FORMALWEAR && !player.isWearingFormalWear())
        {
            filename = "data/html/mods/Wedding_noformal.htm";
            sendHtmlMessage(player, filename, replace);
            return;
        }
        filename = "data/html/mods/Wedding_ask.htm";
        player.setMaryRequest(false);
        ptarget.setMaryRequest(false);
        replace = ptarget.getName();
        sendHtmlMessage(player, filename, replace);
        return;
    }
    else if (command.startsWith("AskWedding"))
    {
        // check for formalwear
      if(Config.L2JMOD_WEDDING_FORMALWEAR)
      {
        Inventory inv3 = player.getInventory();
        L2ItemInstance item3 = inv3.getPaperdollItem(10);

        if (null==item3)
        {
          player.setIsWearingFormalWear(false);
        }
View Full Code Here

  @Override
  public boolean testImpl(Env env)
  {
    if (!(env.player instanceof L2PcInstance))
      return false;
    Inventory inv = ((L2PcInstance)env.player).getInventory();
    L2ItemInstance item = inv.getPaperdollItem(_slot);
    if (item == null)
      return _itemId == 0;
    return item.getItemId() == _itemId && item.getEnchantLevel() >= _enchantLevel;
  }
View Full Code Here

  @Override
  public boolean testImpl(Env env)
  {
    if (!(env.player instanceof L2PcInstance))
      return false;
    Inventory inv = ((L2PcInstance)env.player).getInventory();
    return (_mask & inv.getWearedMask()) != 0;
  }
View Full Code Here

  @Override
  public boolean testImpl(Env env)
  {
    if (!(env.player instanceof L2PcInstance))
      return false;
    Inventory inv = ((L2PcInstance)env.player).getInventory();
    L2ItemInstance item = inv.getPaperdollItem(_slot);
    if (item == null)
      return false;
    return (item.getItem().getItemMask() & _mask) != 0;
  }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.Inventory

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.