Package net.sf.l2j.gameserver.model

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


        sendPacket(sm);
        sm = null;
        return;
      }

      L2ItemInstance item = player.checkItemManipulation(objectId, count, "sell");
          if (item == null || (!item.getItem().isSellable())) continue;

            totalPrice += item.getReferencePrice() * count /2;
            if (totalPrice > 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;
            }
View Full Code Here


  @Override
  protected
  void runImpl()
  {
    L2PcInstance activeChar = getClient().getActiveChar();
    L2ItemInstance targetItem = (L2ItemInstance)L2World.getInstance().findObject(_targetItemObjId);
    L2ItemInstance refinerItem = (L2ItemInstance)L2World.getInstance().findObject(_refinerItemObjId);

    if (targetItem == null || refinerItem == null) return;

    int itemGrade = targetItem.getItem().getItemGrade();
    int refinerItemId = refinerItem.getItem().getItemId();

    // is the item a life stone?
    if (refinerItemId < 8723 || refinerItemId > 8762)
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM));
View Full Code Here

  @Override
  protected void runImpl()
  {
    L2World world = L2World.getInstance();
    L2ItemInstance item = (L2ItemInstance)world.findObject(_objectId);
    if (item == null || getClient().getActiveChar() == null)
        return;
    if(getClient().getActiveChar().getPet() instanceof L2SummonInstance)
    {
      sendPacket(new ActionFailed());
View Full Code Here

    {
      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;
        }

        // Check if enough adena and charge the fee
        if (currentAdena < fee || !player.reduceAdena("Warehouse", fee, player.getLastFolkNPC(), false))
        {
            sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
            return;
        }

        // Proceed to the transfer
    InventoryUpdate playerIU = Config.FORCE_INVENTORY_UPDATE ? null : new InventoryUpdate();
    for (int i = 0; i < _count; i++)
    {
      int objectId = _items[i * 2 + 0];
      int count = _items[i * 2 + 1];

      // check for an invalid item
      if (objectId == 0 && count == 0) continue;

      L2ItemInstance oldItem = player.getInventory().getItemByObjectId(objectId);
            if (oldItem == null)
            {
                _log.warning("Error depositing a warehouse object for char "+player.getName()+" (olditem == null)");
                continue;
            }

            int itemId = oldItem.getItemId();

            if ((itemId >= 6611 && itemId <= 6621) || itemId == 6842)
                continue;

      L2ItemInstance newItem = player.getInventory().transferItem("Warehouse", objectId, count, warehouse, player, player.getLastFolkNPC());
            if (newItem == null)
            {
              _log.warning("Error depositing a warehouse object for char "+player.getName()+" (newitem == null)");
              continue;
            }
View Full Code Here

      }
      player.sendPacket(new ActionFailed());
      return;
    }
    L2Weapon weaponItem = player.getActiveWeaponItem();
    L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
    if(weaponInst == null || weaponItem == null)
      return;
    int SS = 1;
    int pen = 0;
    if (weaponInst.getChargedFishshot()) SS = 2;
    double gradebonus = 1 + weaponItem.getCrystalType() * 0.1;
    int dmg = (int)(skill.getPower()*gradebonus*SS);
    if (player.getSkillLevel(1315) <= skill.getLevel()-2) //1315 - Fish Expertise
    {//Penalty
      player.sendPacket(new SystemMessage(SystemMessageId.REELING_PUMPING_3_LEVELS_HIGHER_THAN_FISHING_PENALTY));
            pen = 50;
      int penatlydmg = dmg - pen;
      if (player.isGM()) player.sendMessage("Dmg w/o penalty = " +dmg);
      dmg = penatlydmg;
    }
    if (SS > 1)
    {
      weaponInst.setChargedFishshot(false);
    }
    if (skill.getSkillType() == SkillType.REELING)//Realing
    {
      fish.useRealing(dmg, pen);
    }
View Full Code Here

        if (associatedParty == null)
            return;

        L2PcInstance partyLeader = associatedParty.getPartyMembers().get(0);
        L2ItemInstance addedOfferings = partyLeader.getInventory().addItem("Sign", SevenSignsFestival.FESTIVAL_OFFERING_ID, _bonusMultiplier, partyLeader, this);

        InventoryUpdate iu = new InventoryUpdate();

        if (addedOfferings.getCount() != _bonusMultiplier)
            iu.addModifiedItem(addedOfferings);
        else
            iu.addNewItem(addedOfferings);

        partyLeader.sendPacket(iu);
View Full Code Here

    {
        // 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);
        }
        else
        {
            String frmWear = Integer.toString(6408);
            String strItem = null;
             strItem = Integer.toString(item3.getItemId());

            if(null != strItem && strItem.equals(frmWear))
            {
              player.setIsWearingFormalWear(true);
            }else{
View Full Code Here

        if (activeChar.isAlikeDead()) return;

        boolean ss = false;
        boolean bss = false;

        L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();

        /* if (activeChar instanceof L2PcInstance)
        {
            if (weaponInst == null)
            {
                SystemMessage sm2 = new SystemMessage(SystemMessage.S1_S2);
                sm2.addString("You must equip a weapon before casting a spell.");
                activeChar.sendPacket(sm2);
                return;
            }
        } */

        if (weaponInst != null)
        {
            if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
            {
                bss = true;
                weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
            }
            else if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_SPIRITSHOT)
            {
                ss = true;
                weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
            }
        }
        // If there is no weapon equipped, check for an active summon.
        else if (activeChar instanceof L2Summon)
        {
View Full Code Here

        {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_TRADE_DISCARD_DROP_ITEM_WHILE_IN_SHOPMODE));
            return;
        }

    L2ItemInstance itemToRemove = activeChar.getInventory().getItemByObjectId(_objectId);
    // if we cant find requested item, its actualy a cheat!
    if (itemToRemove == null)
      return;

    // Cannot discard item that the skill is consumming
    if (activeChar.isCastingNow())
    {
      if (activeChar.getCurrentSkill() != null && activeChar.getCurrentSkill().getSkill().getItemConsumeId() == itemToRemove.getItemId())
      {
              activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISCARD_THIS_ITEM));
              return;
      }
    }

    int itemId = itemToRemove.getItemId();
    if (itemToRemove.isWear() || !itemToRemove.isDestroyable() || CursedWeaponsManager.getInstance().isCursed(itemId))
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISCARD_THIS_ITEM));
      return;
    }

        if(!itemToRemove.isStackable() && count > 1)
        {
            Util.handleIllegalPlayerAction(activeChar,"[RequestDestroyItem] count > 1 but item is not stackable! oid: "+_objectId+" owner: "+activeChar.getName(),Config.DEFAULT_PUNISH);
            return;
        }

    if (_count > itemToRemove.getCount())
      count = itemToRemove.getCount();


    if (itemToRemove.isEquipped())
    {
      L2ItemInstance[] unequiped =
        activeChar.getInventory().unEquipItemInSlotAndRecord(itemToRemove.getEquipSlot());
      InventoryUpdate iu = new InventoryUpdate();
      for (int i = 0; i < unequiped.length; i++)
      {
        activeChar.checkSSMatch(null, unequiped[i]);

        iu.addModifiedItem(unequiped[i]);
      }
      activeChar.sendPacket(iu);
      activeChar.broadcastUserInfo();
    }

    if (L2PetDataTable.isPetItem(itemId))
    {
      java.sql.Connection con = null;
      try
      {
        if (activeChar.getPet() != null && activeChar.getPet().getControlItemId() == _objectId)
        {
          activeChar.getPet().unSummon(activeChar);
        }

        // if it's a pet control item, delete the pet
        con = L2DatabaseFactory.getInstance().getConnection();
        PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?");
        statement.setInt(1, _objectId);
        statement.execute();
        statement.close();
      }
      catch (Exception e)
      {
        _log.log(Level.WARNING, "could not delete pet objectid: ", e);
      }
      finally
      {
        try { con.close(); } catch (Exception e) {}
      }
    }

    L2ItemInstance removedItem = activeChar.getInventory().destroyItem("Destroy", _objectId, count, activeChar, null);

    if(removedItem == null)
      return;

    if (!Config.FORCE_INVENTORY_UPDATE)
    {
      InventoryUpdate iu = new InventoryUpdate();
      if (removedItem.getCount() == 0) iu.addRemovedItem(removedItem);
      else iu.addModifiedItem(removedItem);

      //client.getConnection().sendPacket(iu);
      activeChar.sendPacket(iu);
    }
View Full Code Here

  protected
  void runImpl()
  {
    L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) return;
    L2ItemInstance targetItem = (L2ItemInstance)L2World.getInstance().findObject(_targetItemObjId);
    L2ItemInstance refinerItem = (L2ItemInstance)L2World.getInstance().findObject(_refinerItemObjId);
    L2ItemInstance gemstoneItem = (L2ItemInstance)L2World.getInstance().findObject(_gemstoneItemObjId);

    if (targetItem == null || refinerItem == null || gemstoneItem == null ||
        targetItem.getOwnerId() != activeChar.getObjectId() ||
        refinerItem.getOwnerId() != activeChar.getObjectId() ||
        gemstoneItem.getOwnerId() != activeChar.getObjectId() ||
        activeChar.getLevel() < 46) // must be lvl 46
    {
      activeChar.sendPacket(new ExVariationResult(0,0,0));
      activeChar.sendPacket(new SystemMessage(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS));
      return;
View Full Code Here

TOP

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

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.