Package net.sf.l2j.gameserver.model

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


          party.removePartyMember(player);
        }

        //Remove Hero Weapons
        // check to prevent the using of weapon/shield on strider/wyvern
        L2ItemInstance wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
        if (wpn == null) wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
        if (wpn != null &&
            (
                (wpn.getItemId() >= 6611 && wpn.getItemId() <= 6621) ||
                wpn.getItemId() == 6842
            )
          )
        {
          L2ItemInstance[] unequiped = player.getInventory().unEquipItemInBodySlotAndRecord(wpn.getItem().getBodyPart());
          InventoryUpdate iu = new InventoryUpdate();
          for (int i = 0; i < unequiped.length; i++)
            iu.addModifiedItem(unequiped[i]);
          player.sendPacket(iu);
          player.abortAttack();
View Full Code Here


                broadcastMessage(_sm3, true);

                _playerOne =  L2World.getInstance().getPlayer(_playerOneName); // why this...
                try {
              result=" ("+playerOneHp+"hp vs "+playerTwoHp+"hp - "+hpDiffOne+" vs "+hpDiffTwo+") "+_playerOneName+" win "+pointDiff+" points";
              L2ItemInstance item = _playerOne.getInventory().addItem("Olympiad", 6651, 30, _playerOne, null);
              InventoryUpdate iu = new InventoryUpdate();
              iu.addModifiedItem(item);
              _playerOne.sendPacket(iu);

              SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
              sm.addItemName(item.getItemId());
              sm.addNumber(30);
              _playerOne.sendPacket(sm);
                } catch (Exception e) { }
        }
            else if (playerOneHp==0 || hpDiffOne > hpDiffTwo)
        {
              int pointDiff;
              pointDiff = (playerOnePoints / 3);
          playerTwoStat.set(POINTS, playerTwoPoints + pointDiff);
          playerOneStat.set(POINTS, playerOnePoints - pointDiff);
               
                _sm.addString(_playerTwo.getName());
                broadcastMessage(_sm, true);
                _sm2.addString(_playerTwo.getName());
                _sm2.addNumber(pointDiff);
                broadcastMessage(_sm2, true);
                _sm3.addString(_playerOne.getName());
                _sm3.addNumber(pointDiff);
                broadcastMessage(_sm3, true);

                _playerTwo =  L2World.getInstance().getPlayer(_playerTwoName); // why this...
                try {
                  result=" ("+playerOneHp+"hp vs "+playerTwoHp+"hp - "+hpDiffOne+" vs "+hpDiffTwo+") "+_playerTwoName+" win "+pointDiff+" points";
                  L2ItemInstance item = _playerTwo.getInventory().addItem("Olympiad", 6651, 30, _playerTwo, null);
                  InventoryUpdate iu = new InventoryUpdate();
                  iu.addModifiedItem(item);
                  _playerTwo.sendPacket(iu);

                  SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
                  sm.addItemName(item.getItemId());
                  sm.addNumber(30);
                  _playerTwo.sendPacket(sm);
                } catch (Exception e) { }
        }
        else
View Full Code Here

            int itemId = rset.getInt("item_id");
            int price = rset.getInt("price");
            int count = rset.getInt("count");
            int currentCount = rset.getInt("currentCount");
            int time = rset.getInt("time");
            L2ItemInstance item = ItemTable.getInstance().createDummyItem(itemId);
            if (item == null)
            {
              rset.close();
              statement.close();
              continue;
            }
            if(count > -1){
              item.setCountDecrease(true);
              LimitedItem = true;
            }
            item.setPriceToSell(price);
            item.setTime(time);
            item.setInitCount(count);
            if(currentCount>-1)
              item.setCount(currentCount);
            else
              item.setCount(count);
            buy1.addItem(item);
            buy1.setNpcId(rset1.getString("npc_id"));
            try
            {
              while (rset.next())
              {
                dummyItemCount++;
                itemId = rset.getInt("item_id");
                price = rset.getInt("price");
                count = rset.getInt("count");
                time = rset.getInt("time");
                currentCount = rset.getInt("currentCount");
                L2ItemInstance item2 = ItemTable.getInstance().createDummyItem(itemId);
                if (item2 == null) continue;
                if(count > -1){
                  item2.setCountDecrease(true);
                  LimitedItem = true;
                }
                item2.setPriceToSell(price);
                item2.setTime(time);
                item2.setInitCount(count);
                if(currentCount>-1)
                  item2.setCount(currentCount);
                else
                  item2.setCount(count);
                buy1.addItem(item2);
              }
            } catch (Exception e)
            {
              _log.warning("TradeController: Problem with buylist " + buy1.getListId() + " item " + itemId);
View Full Code Here

    L2TradeList buy1 = new L2TradeList(listId);
    while (st.hasMoreTokens())
    {
      int itemId = Integer.parseInt(st.nextToken());
      int price = Integer.parseInt(st.nextToken());
      L2ItemInstance item = ItemTable.getInstance().createDummyItem(itemId);
      item.setPriceToSell(price);
      buy1.addItem(item);
      itemCreated++;
    }

    _lists.put(new Integer(buy1.getListId()), buy1);
View Full Code Here

      if (messageList.length < 2 || !_excludeProcess.contains(messageList[1])) return true;
    }
    if (_excludeItemType != null)
    {
//      if (record.getParameters() == null || record.getParameters().length == 0 || !(record.getParameters()[0] instanceof L2ItemInstance)) return true;
      L2ItemInstance item = ((L2ItemInstance)record.getParameters()[0]);
      if (!_excludeItemType.contains(item.getItemType().toString())) return true;
    }
    return (_excludeProcess == null && _excludeItemType == null);
  }
View Full Code Here

     * Returns the pet's currently equipped weapon (if any).
     */
  @Override
  public L2Weapon getActiveWeaponItem()
  {
        L2ItemInstance weapon = getActiveWeaponInstance();

        if (weapon == null)
            return null;

        return (L2Weapon)weapon.getItem();
  }
View Full Code Here

     * @return boolean informing if the action was successfull
   */
  @Override
  public boolean destroyItem(String process, int objectId, int count, L2Object reference, boolean sendMessage)
    {
        L2ItemInstance item = _inventory.destroyItem(process, objectId, count, getOwner(), reference);

    if (item == null)
    {
            if (sendMessage)
                getOwner().sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_ITEMS));

      return false;
    }

      // Send Pet inventory update packet
    PetInventoryUpdate petIU = new PetInventoryUpdate();
    petIU.addItem(item);
      getOwner().sendPacket(petIU);

    if (sendMessage)
    {
            SystemMessage sm = new SystemMessage(SystemMessageId.DISSAPEARED_ITEM);
            sm.addNumber(count);
            sm.addItemName(item.getItemId());
            getOwner().sendPacket(sm);
    }
        return true;
    }
View Full Code Here

     * @return boolean informing if the action was successfull
   */
  @Override
  public boolean destroyItemByItemId(String process, int itemId, int count, L2Object reference, boolean sendMessage)
  {
        L2ItemInstance item = _inventory.destroyItemByItemId(process, itemId, count, getOwner(), reference);

    if (item == null)
    {
            if (sendMessage) getOwner().sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_ITEMS));
      return false;
View Full Code Here

      _logPet.warning("trying to pickup wrong target."+object);
      getOwner().sendPacket(new ActionFailed());
      return;
    }

    L2ItemInstance target = (L2ItemInstance) object;

    // Herbs
    if ( target.getItemId() > 8599 && target.getItemId() < 8615 )
    {
          SystemMessage smsg = new SystemMessage(SystemMessageId.FAILED_TO_PICKUP_S1);
            smsg.addItemName(target.getItemId());
            getOwner().sendPacket(smsg);
      return;
    }
    // Cursed weapons
    if ( CursedWeaponsManager.getInstance().isCursed(target.getItemId()) )
    {
          SystemMessage smsg = new SystemMessage(SystemMessageId.FAILED_TO_PICKUP_S1);
            smsg.addItemName(target.getItemId());
            getOwner().sendPacket(smsg);
      return;
    }

    synchronized (target)
    {
      if (!target.isVisible())
      {
        getOwner().sendPacket(new ActionFailed());
        return;
      }

            if (target.getOwnerId() != 0 && target.getOwnerId() != getOwner().getObjectId() && !getOwner().isInLooterParty(target.getOwnerId()))
            {
                getOwner().sendPacket(new ActionFailed());

                if (target.getItemId() == 57)
                {
                    SystemMessage smsg = new SystemMessage(SystemMessageId.FAILED_TO_PICKUP_S1_ADENA);
                    smsg.addNumber(target.getCount());
                    getOwner().sendPacket(smsg);
                }
                else if (target.getCount() > 1)
                {
                    SystemMessage smsg = new SystemMessage(SystemMessageId.FAILED_TO_PICKUP_S2_S1_S);
                    smsg.addItemName(target.getItemId());
                    smsg.addNumber(target.getCount());
                    getOwner().sendPacket(smsg);
                }
                else
                {
                    SystemMessage smsg = new SystemMessage(SystemMessageId.FAILED_TO_PICKUP_S1);
                    smsg.addItemName(target.getItemId());
                    getOwner().sendPacket(smsg);
                }

                return;
            }
            if(target.getItemLootShedule() != null
              && (target.getOwnerId() == getOwner().getObjectId() || getOwner().isInLooterParty(target.getOwnerId())))
            target.resetOwnerTimer();

            target.pickupMe(this);

            if(Config.SAVE_DROPPED_ITEM) // item must be removed from ItemsOnGroundManager if is active
          ItemsOnGroundManager.getInstance().removeObject(target);
    }
View Full Code Here

   * @param reference : L2Object Object referencing current action like NPC selling item or previous item in transformation
     * @return L2ItemInstance corresponding to the new item or the updated item in inventory
     */
    public L2ItemInstance transferItem(String process, int objectId, int count, Inventory target, L2PcInstance actor, L2Object reference)
    {
      L2ItemInstance oldItem = getInventory().getItemByObjectId(objectId);
      L2ItemInstance newItem = getInventory().transferItem(process, objectId, count, target, actor, reference);

    if (newItem == null) return null;

      // Send inventory update packet
    PetInventoryUpdate petIU = new PetInventoryUpdate();
      if (oldItem.getCount() > 0 && oldItem != newItem) petIU.addModifiedItem(oldItem);
      else petIU.addRemovedItem(oldItem);
    getOwner().sendPacket(petIU);

      // Send target update packet
      if (target instanceof PcInventory)
      {
        L2PcInstance targetPlayer = ((PcInventory)target).getOwner();
        InventoryUpdate playerUI = new InventoryUpdate();
        if (newItem.getCount() > count) playerUI.addModifiedItem(newItem);
          else playerUI.addNewItem(newItem);
        targetPlayer.sendPacket(playerUI);

        // Update current load as well
        StatusUpdate playerSU = new StatusUpdate(targetPlayer.getObjectId());
        playerSU.addAttribute(StatusUpdate.CUR_LOAD, targetPlayer.getCurrentLoad());
        targetPlayer.sendPacket(playerSU);
      }
      else if (target instanceof PetInventory)
      {
        petIU = new PetInventoryUpdate();
          if (newItem.getCount() > count) petIU.addRemovedItem(newItem);
          else petIU.addNewItem(newItem);
        ((PetInventory)target).getOwner().getOwner().sendPacket(petIU);
    }
      return newItem;
    }
View Full Code Here

TOP

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

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.