Package com.l2jfrozen.gameserver.network.serverpackets

Examples of com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate


      {
        itemToRemove.getAugmentation().removeBoni(activeChar);
      }

      L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(itemToRemove.getEquipSlot());
      InventoryUpdate iu = new InventoryUpdate();

      for(L2ItemInstance element : unequiped)
      {
        iu.addModifiedItem(element);
      }
      activeChar.sendPacket(iu);
      // activeChar.updatePDef();
      // activeChar.updatePAtk();
      // activeChar.updateMDef();
      // activeChar.updateMAtk();
      // activeChar.updateAccuracy();
      // activeChar.updateCriticalChance();
    }

    // remove from inventory
    L2ItemInstance removedItem = activeChar.getInventory().destroyItem("Crystalize", _objectId, _count, activeChar, null);

    // add crystals
    int crystalId = itemToRemove.getItem().getCrystalItemId();
    int crystalAmount = itemToRemove.getCrystalCount();
    L2ItemInstance createditem = activeChar.getInventory().addItem("Crystalize", crystalId, crystalAmount, activeChar, itemToRemove);

    SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
    sm.addItemName(crystalId);
    sm.addNumber(crystalAmount);
    activeChar.sendPacket(sm);
    sm = null;

    // send inventory update
    if(!Config.FORCE_INVENTORY_UPDATE)
    {
      InventoryUpdate iu = new InventoryUpdate();
      if(removedItem.getCount() == 0)
      {
        iu.addRemovedItem(removedItem);
      }
      else
      {
        iu.addModifiedItem(removedItem);
      }

      if(createditem.getCount() != crystalAmount)
      {
        iu.addModifiedItem(createditem);
      }
      else
      {
        iu.addNewItem(createditem);
      }

      activeChar.sendPacket(iu);
    }
    else
View Full Code Here


      item.setCount(1);
      item.setEnchantLevel(_raceNumber);
      item.setCustomType1(ticket);
      item.setCustomType2(_cost[priceId - 1] / 100);
      player.getInventory().addItem("Race", item, player, this);
      InventoryUpdate iu = new InventoryUpdate();
      iu.addItem(item);
      L2ItemInstance adenaupdate = player.getInventory().getItemByItemId(57);
      iu.addModifiedItem(adenaupdate);
      player.sendPacket(iu);
      iu = null;
      item = null;
      return;
    }
View Full Code Here

      sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
      return;
    }

    // Proceed to the transfer
    InventoryUpdate playerIU = Config.FORCE_INVENTORY_UPDATE ? null : new InventoryUpdate();
    for(Item i : _items)
    {
      int objectId = i.id;
      int count = i.count;

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

      if(playerIU != null)
      {
        if(oldItem.getCount() > 0 && oldItem != newItem)
        {
          playerIU.addModifiedItem(oldItem);
        }
        else
        {
          playerIU.addRemovedItem(oldItem);
        }
      }
    }

    // Send updated item list to the player
View Full Code Here

      // if an "invisible" item has changed (Jewels, helmet),
      // we dont need to send broadcast packet to all other users
      if (!((item.getItem().getBodyPart() & L2Item.SLOT_HEAD) > 0 || (item.getItem().getBodyPart() & L2Item.SLOT_NECK) > 0 || (item.getItem().getBodyPart() & L2Item.SLOT_L_EAR) > 0 || (item.getItem().getBodyPart() & L2Item.SLOT_R_EAR) > 0 || (item.getItem().getBodyPart() & L2Item.SLOT_L_FINGER) > 0 || (item.getItem().getBodyPart() & L2Item.SLOT_R_FINGER) > 0))
      {
        activeChar.broadcastUserInfo();
        InventoryUpdate iu = new InventoryUpdate();
        iu.addItems(Arrays.asList(items));
        activeChar.sendPacket(iu);
      }
      else if ((item.getItem().getBodyPart() & L2Item.SLOT_HEAD) > 0)
      {
        InventoryUpdate iu = new InventoryUpdate();
        iu.addItems(Arrays.asList(items));
        activeChar.sendPacket(iu);
        activeChar.sendPacket(new UserInfo(activeChar));
      }
      else
      {
View Full Code Here

      sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL));
      return;
    }

    // Proceed the purchase
    InventoryUpdate playerIU = new InventoryUpdate();
    _procureList = manor.getCastle().getCropProcure(CastleManorManager.PERIOD_CURRENT);

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

      if(count < 0)
      {
        count = 0;
      }

      int rewradItemId = L2Manor.getInstance().getRewardItem(itemId, manor.getCastle().getCrop(itemId, CastleManorManager.PERIOD_CURRENT).getReward());

      int rewradItemCount = 1; //L2Manor.getInstance().getRewardAmount(itemId, manor.getCastle().getCropReward(itemId));

      rewradItemCount = count / rewradItemCount;

      // Add item to Inventory and adjust update packet
      L2ItemInstance item = player.getInventory().addItem("Manor", rewradItemId, rewradItemCount, player, manor);
      L2ItemInstance iteme = player.getInventory().destroyItemByItemId("Manor", itemId, count, player, manor);

      if(item == null || iteme == null)
      {
        continue;
      }

      playerIU.addRemovedItem(iteme);
      if(item.getCount() > rewradItemCount)
      {
        playerIU.addModifiedItem(item);
      }
      else
      {
        playerIU.addNewItem(item);
      }

      // Send Char Buy Messages
      SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
      sm.addItemName(rewradItemId);
View Full Code Here

      sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
      return;
    }

    // Proceed the wear
    InventoryUpdate playerIU = new InventoryUpdate();
    for(int i = 0; i < _count; i++)
    {
      int itemId = _items[i];

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

      // If player doesn't own this item : Add this L2ItemInstance to Inventory and set properties lastchanged to ADDED and _wear to True
      // If player already own this item : Return its L2ItemInstance (will not be destroy because property _wear set to False)
      L2ItemInstance item = player.getInventory().addWearItem("Wear", itemId, player, merchant);

      // Equip player with this item (set its location)
      player.getInventory().equipItemAndRecord(item);

      // Add this Item in the InventoryUpdate Server->Client Packet
      playerIU.addItem(item);
    }

    // Send the InventoryUpdate Server->Client Packet to the player
    // Add Items in player inventory and equip them
    player.sendPacket(playerIU);
View Full Code Here

        player.getInventory().unEquipItemInSlotAndRecord(armorType);
        itemInstance.setEnchantLevel(ench);
        player.getInventory().equipItemAndRecord(itemInstance);

        // send packets
        InventoryUpdate iu = new InventoryUpdate();
        iu.addModifiedItem(itemInstance);
        player.sendPacket(iu);
        player.broadcastPacket(new CharInfo(player));
        player.sendPacket(new UserInfo(player));

        iu = null;
View Full Code Here

      {
        result = " (" + playerOneHp + "hp vs " + playerTwoHp + "hp - "
                + _damageP1 + "dmg vs " + _damageP2 + "dmg) "
                + _playerOneName + " win " + pointDiff + " points";
        L2ItemInstance item = _playerOne.getInventory().addItem("Olympiad", Config.ALT_OLY_BATTLE_REWARD_ITEM, _gpreward, _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(_gpreward);
        _playerOne.sendPacket(sm);
      }
      catch (Exception e)
      {
      }
    }
    else if (_playerOne == null
            || _playerOne.isOnline() == 0
            || (playerOneHp == 0 && playerTwoHp != 0)
            || (_damageP2 > _damageP1 && playerOneHp != 0 && playerTwoHp != 0))
    {
      playerTwoStat.set(POINTS, playerTwoPoints + pointDiff);
      playerOneStat.set(POINTS, playerOnePoints - pointDiff);
      playerTwoStat.set(COMP_WON, playerTwoWon + 1);
      playerOneStat.set(COMP_LOST, playerOneLost + 1);
     
      _sm.addString(_playerTwoName);
      broadcastMessage(_sm, true);
      _sm2.addString(_playerTwoName);
      _sm2.addNumber(pointDiff);
      broadcastMessage(_sm2, false);
      _sm3.addString(_playerOneName);
      _sm3.addNumber(pointDiff);
      broadcastMessage(_sm3, false);
      winner = _playerTwoName + " won";
     
      try
      {
        result = " (" + playerOneHp + "hp vs " + playerTwoHp + "hp - "
                + _damageP1 + "dmg vs " + _damageP2 + "dmg) "
                + _playerTwoName + " win " + pointDiff + " points";
        L2ItemInstance item = _playerTwo.getInventory().addItem("Olympiad", Config.ALT_OLY_BATTLE_REWARD_ITEM, _gpreward, _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(_gpreward);
View Full Code Here

    player._haveFlagCTF = false;
    if(wpn != null)
    {
      L2ItemInstance[] unequiped = player.getInventory().unEquipItemInBodySlotAndRecord(wpn.getItem().getBodyPart());
      player.getInventory().destroyItemByItemId("", CTF._FLAG_IN_HAND_ITEM_ID, 1, player, null);
      InventoryUpdate iu = new InventoryUpdate();
      for(L2ItemInstance element : unequiped)
        iu.addModifiedItem(element);
      player.sendPacket(iu);
      player.sendPacket(new ItemList(player, true)); // Get your weapon back now ...
      player.abortAttack();
      player.broadcastUserInfo();
    }
View Full Code Here

      
      getPlayer().destroyItemByItemId("Quest", itemId, count, getPlayer(), true);
    }

    //on quests, always refresh inventory
    InventoryUpdate u = new InventoryUpdate();
    u.addItem(item);
    getPlayer().sendPacket(u);
   
    item = null;
  }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate

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.