Examples of ItemContainer


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

        if (player == null) return;
    L2PcInstance target = L2PcInstance.load(_objectID);
    PcFreight freight = target.getFreight();
    getClient().getActiveChar().setActiveWarehouse(freight);
    target.deleteMe();
        ItemContainer warehouse = player.getActiveWarehouse();
        if (warehouse == null) return;
    L2FolkInstance manager = player.getLastFolkNPC();
        if ((manager == null || !player.isInsideRadius(manager, L2NpcInstance.INTERACTION_DISTANCE, false, false)) && !player.isGM()) return;

        if (warehouse instanceof PcFreight && Config.GM_DISABLE_TRANSACTION && player.getAccessLevel() >= Config.GM_TRANSACTION_MIN && player.getAccessLevel() <= Config.GM_TRANSACTION_MAX)
        {
            player.sendMessage("Transactions are disable for your Access Level");
            return;
        }

        // Alt game - Karma punishment
        if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && player.getKarma() > 0) return;

        // Freight price from config or normal price per item slot (30)
    int fee = _count * Config.ALT_GAME_FREIGHT_PRICE;
    int currentAdena = player.getAdena();
        int slots = 0;

    for (Item i : _items)
    {
      int objectId = i.id;
      int count = i.count;

      // Check validity of requested item
      L2ItemInstance item = player.checkItemManipulation(objectId, count, "deposit");
            if (item == null)
            {
              _log.warning("Error depositing a warehouse object for char "+player.getName()+" (validity check)");
              i.id = 0;
              i.count = 0;
              continue;
            }

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

      // Calculate needed adena and slots
      if (item.getItemId() == 57) currentAdena -= count;
            if (!item.isStackable()) slots += count;
            else if (warehouse.getItemByItemId(item.getItemId()) == null) slots++;
    }

        // Item Max Limit Check
        if (!warehouse.validateCapacity(slots))
        {
            sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
            return;
        }

View Full Code Here

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

  @Override
  protected void runImpl()
  {
    L2PcInstance player = getClient().getActiveChar();
        if (player == null) return;
        ItemContainer warehouse = player.getActiveWarehouse();
        if (warehouse == null) return;
    L2FolkInstance manager = player.getLastFolkNPC();
        if ((manager == null || !player.isInsideRadius(manager, L2NpcInstance.INTERACTION_DISTANCE, false, false)) && !player.isGM()) return;

        if ((warehouse instanceof ClanWarehouse) && Config.GM_DISABLE_TRANSACTION && player.getAccessLevel() >= Config.GM_TRANSACTION_MIN && player.getAccessLevel() <= Config.GM_TRANSACTION_MAX)
        {
            player.sendMessage("Transactions are disable for your Access Level");
            return;
        }

        // Alt game - Karma punishment
        if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && player.getKarma() > 0) return;

        // Freight price from config or normal price per item slot (30)
    int fee = _count * 30;
    int currentAdena = player.getAdena();
        int slots = 0;

    for (int i = 0; i < _count; i++)
    {
      int objectId = _items[i * 2 + 0];
      int count = _items[i * 2 + 1];

      // Check validity of requested item
      L2ItemInstance item = player.checkItemManipulation(objectId, count, "deposit");
            if (item == null)
            {
              _log.warning("Error depositing a warehouse object for char "+player.getName()+" (validity check)");
              _items[i * 2 + 0] = 0;
              _items[i * 2 + 1] = 0;
              continue;
            }

            if ((warehouse instanceof ClanWarehouse) && !item.isTradeable() || item.getItemType() == L2EtcItemType.QUEST) return;
            // Calculate needed adena and slots
            if (item.getItemId() == 57) currentAdena -= count;
            if (!item.isStackable()) slots += count;
            else if (warehouse.getItemByItemId(item.getItemId()) == null) slots++;
    }

        // Item Max Limit Check
        if (!warehouse.validateCapacity(slots))
        {
            sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
            return;
        }

View Full Code Here

Examples of org.openbp.core.model.item.ItemContainer

    ItemTypeDescriptor itd = getItemTypeDescriptor(item.getItemType());
    if (itd.isContainedItem())
    {
      // Item is wrapped by a container class in its xml file
      obj = new ItemContainer(item);
    }

    // Dirty hack:
    // Castor doesn't support CDATA sections. So we write a dummy string and replace that
    // dummy string for the actual CDATA-escaped string when writing the xml to the file.
View Full Code Here

Examples of org.openbp.core.model.item.ItemContainer

    try
    {
      if (itd.isContainedItem())
      {
        // Item is wrapped by a container class in its xml file
        ItemContainer container = (ItemContainer) XMLDriver.getInstance().deserializeStream(ItemContainer.class, in);
        item = container.getItem();
      }
      else
      {
        item = (Item) XMLDriver.getInstance().deserializeStream(itd.getItemClass(), in);
      }
View Full Code Here

Examples of org.openbp.core.model.item.ItemContainer

    try
    {
      if (itd.isContainedItem())
      {
        // Item is wrapped by a container class in its xml file
        ItemContainer container = (ItemContainer) driver.deserializeResource(ItemContainer.class, itemDescriptorResource);
        item = container.getItem();
      }
      else
      {
        item = (Item) driver.deserializeResource(itd.getItemClass(), itemDescriptorResource);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.