Package net.sf.l2j.gameserver.templates

Examples of net.sf.l2j.gameserver.templates.L2Item


      {
        Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" sent a false BuyList list_id.",Config.DEFAULT_PUNISH);
        return;
      }

            L2Item template = ItemTable.getInstance().getTemplate(itemId);

            if (template == null) continue;
            if (count > Integer.MAX_VALUE || (!template.isStackable() && count > 1))
      {
        Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" tried to purchase invalid quantity of items at the same time.",Config.DEFAULT_PUNISH);
        SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
        sendPacket(sm);
        sm = null;

        return;
      }

      if (_listId < 1000000)
      {
        //list = TradeController.getInstance().getBuyList(_listId);
        price = list.getPriceForItemId(itemId);
                if (itemId >= 3960 && itemId <= 4026) price *= Config.RATE_SIEGE_GUARDS_PRICE;

      }
/* TODO: Disabled until Leaseholders are rewritten ;-)
      } else {
        L2ItemInstance li = merchant.findLeaseItem(itemId, 0);
        if (li == null || li.getCount() < cnt) {
          cnt = li.getCount();
          if (cnt <= 0) {
            items.remove(i);
            continue;
          }
          items.get(i).setCount((int)cnt);
        }
        price = li.getPriceToSell(); // lease holder sells the item
        weight = li.getItem().getWeight();
      }

*/
      if (price < 0)
      {
        _log.warning("ERROR, no price found .. wrong buylist ??");
                sendPacket(new ActionFailed());
                return;
      }

      if(price == 0 && !player.isGM() && Config.ONLY_GM_ITEMS_FREE)
      {
        player.sendMessage("Ohh Cheat dont work? You have a problem now!");
        Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" tried buy item for 0 adena.", Config.DEFAULT_PUNISH);
        return;
      }

      subTotal += (long)count * price;  // Before tax
      tax = (int)(subTotal * taxRate);
            if (subTotal + tax > Integer.MAX_VALUE)
            {
                Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" tried to purchase over "+Integer.MAX_VALUE+" adena worth of goods.", Config.DEFAULT_PUNISH);
                return;
            }

            weight += (long)count * template.getWeight();
      if (!template.isStackable()) slots += count;
            else if (player.getInventory().getItemByItemId(itemId) == null) slots++;
    }

    if (weight > Integer.MAX_VALUE || weight < 0 || !player.getInventory().validateWeight((int)weight))
    {
View Full Code Here


       
        if (weaponId < 1)
            return null;
       
        // Get the weapon item equiped in the right hand of the L2NpcInstance
        L2Item item = ItemTable.getInstance().getTemplate(getTemplate().rhand);
       
        if (!(item instanceof L2Weapon))
            return null;
       
        return (L2Weapon)item;
View Full Code Here

       
        if (weaponId < 1)
            return null;
       
        // Get the weapon item equiped in the right hand of the L2NpcInstance
        L2Item item = ItemTable.getInstance().getTemplate(getTemplate().lhand);
       
        if (!(item instanceof L2Weapon))
            return null;
       
        return (L2Weapon)item;
View Full Code Here

      if (residual < count)
        return;

      totalPrice += count * price;

      L2Item template = ItemTable.getInstance().getTemplate(seedId);
      totalWeight += count * template.getWeight();
      if (!template.isStackable())
        slots += count;
      else if (player.getInventory().getItemByItemId(seedId) == null)
        slots++;
    }

View Full Code Here

        {
            _log.warning(_owner.getName() + ": Attempt to modify locked TradeList!");
            return null;
        }

        L2Item item = ItemTable.getInstance().getTemplate(itemId);
        if (item == null)
        {
            _log.warning(_owner.getName() + ": Attempt to add invalid item to TradeList!");
            return null;
        }

  if (!item.isTradeable() || item.getItemType() == L2EtcItemType.QUEST) return null;

        if (!item.isStackable() && count > 1)
        {
            _log.warning(_owner.getName() + ": Attempt to add non-stackable item to TradeList with count > 1!");
            return null;
        }
View Full Code Here

        int slots = 0;

        for (TradeItem item : _items)
        {
            if (item == null) continue;
            L2Item template = ItemTable.getInstance().getTemplate(item.getItem().getItemId());
            if (template == null) continue;
            if (!template.isStackable()) slots += item.getCount();
            else if (partner.getInventory().getItemByItemId(item.getItem().getItemId()) == null)
                slots++;
        }

        return slots;
View Full Code Here

        int weight = 0;

        for (TradeItem item : _items)
        {
            if (item == null) continue;
            L2Item template = ItemTable.getInstance().getTemplate(item.getItem().getItemId());
            if (template == null) continue;
            weight += item.getCount() * template.getWeight();
        }

        return weight;
    }
View Full Code Here

        int weight = 0;

        for (ItemRequest item : items)
        {
            if (item == null) continue;
            L2Item template = ItemTable.getInstance().getTemplate(item.getItemId());
            if (template == null) continue;
            weight += item.getCount() * template.getWeight();
            if (!template.isStackable()) slots += item.getCount();
            else if (player.getInventory().getItemByItemId(item.getItemId()) == null) slots++;
        }

        if (!player.getInventory().validateWeight(weight))
        {
View Full Code Here

            return;

          L2Skill passiveSkill = null;
          L2Skill enchant4Skill = null;

      L2Item it = item.getItem();

      if(it instanceof L2Weapon)
      {
        passiveSkill = ((L2Weapon)it).getSkill();
        enchant4Skill= ((L2Weapon)it).getEnchant4Skill();
View Full Code Here

            return;
         
      L2Skill passiveSkill = null;
      L2Skill enchant4Skill = null;
     
      L2Item it = item.getItem();
     
      if(it instanceof L2Weapon)
      {
        passiveSkill = ((L2Weapon)it).getSkill();
       
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.templates.L2Item

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.