Package lineage2.gameserver.model.items

Examples of lineage2.gameserver.model.items.ItemInstance


        rewradItemCount = SafeMath.mulAndCheck(count, rewradItemCount);
        if (!activeChar.getInventory().destroyItemByItemId(itemId, count))
        {
          continue;
        }
        ItemInstance item = activeChar.getInventory().addItem(rewradItemId, rewradItemCount);
        if (item == null)
        {
          continue;
        }
        activeChar.sendPacket(SystemMessage2.obtainItems(rewradItemId, rewradItemCount, 0));
View Full Code Here


      {
        return false;
      }
      player = owner;
    }
    ItemInstance oldItem;
    if ((oldItem = player.getInventory().removeItemByItemId(_itemId, 1L)) == null)
    {
      return false;
    }
    player.setKarma(_playerKarma);
    player.setPkKills(_playerPkKills);
    player.setCursedWeaponEquippedId(0);
    player.setTransformation(0);
    player.setTransformationName(null);
    player.validateLocation(0);
    Skill skill = SkillTable.getInstance().getInfo(_skillId, player.getSkillLevel(_skillId));
    if (skill != null)
    {
      for (AddedSkill s : skill.getAddedSkills())
      {
        player.removeSkillById(s.id);
      }
    }
    player.removeSkillById(_skillId);
    player.abortAttack(true, false);
    zeroOwner();
    setState(CursedWeaponState.DROPPED);
    oldItem.dropToTheGround(player, Location.findPointToStay(player, 100));
    _loc = oldItem.getLoc();
    oldItem.setDropTime(0);
    _item = oldItem;
    player.sendPacket(new SystemMessage(SystemMessage.YOU_HAVE_DROPPED_S1).addItemName(oldItem.getItemId()));
    player.broadcastUserInfo();
    player.broadcastPacket(new Earthquake(player.getLoc(), 30, 12));
    return true;
  }
View Full Code Here

   */
  @Override
  protected void runImpl()
  {
    Player activeChar = getClient().getActiveChar();
    ItemInstance item = activeChar.getInventory().getItemByObjectId(_itemId);
    if (item == null)
    {
      activeChar.sendActionFailed();
      return;
    }
    if (!item.isAugmented())
    {
      activeChar.sendPacket(Msg.AUGMENTATION_REMOVAL_CAN_ONLY_BE_DONE_ON_AN_AUGMENTED_ITEM);
      return;
    }
    activeChar.sendPacket(new ExPutItemResultForVariationCancel(item));
View Full Code Here

    if (activeChar.isInTrade())
    {
      activeChar.sendActionFailed();
      return;
    }
    ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
    if (item == null)
    {
      activeChar.sendActionFailed();
      return;
    }
    if (item.isHeroWeapon())
    {
      activeChar.sendPacket(Msg.HERO_WEAPONS_CANNOT_BE_DESTROYED);
      return;
    }
    if (!item.canBeCrystallized(activeChar))
    {
      activeChar.sendActionFailed();
      return;
    }
    if (activeChar.isInStoreMode())
    {
      activeChar.sendPacket(Msg.WHILE_OPERATING_A_PRIVATE_STORE_OR_WORKSHOP_YOU_CANNOT_DISCARD_DESTROY_OR_TRADE_AN_ITEM);
      return;
    }
    if (activeChar.isFishing())
    {
      activeChar.sendPacket(Msg.YOU_CANNOT_DO_THAT_WHILE_FISHING);
      return;
    }
    if (activeChar.isInTrade())
    {
      activeChar.sendActionFailed();
      return;
    }
    int crystalAmount = item.getTemplate().getCrystalCount();
    int crystalId = item.getTemplate().getCrystalType().cry;
    int level = activeChar.getSkillLevel(Skill.SKILL_CRYSTALLIZE);
    boolean canCrystallize = true;
    Grade itemGrade = item.getTemplate().getItemGrade();
    switch (itemGrade)
    {
      case D:
      {
        if (level < 1)
        {
          canCrystallize = false;
        }
        break;
      }
      case C:
      {
        if (level < 2)
        {
          canCrystallize = false;
        }
        break;
      }
      case B:
      {
        if (level < 3)
        {
          canCrystallize = false;
        }
        break;
      }
      case A:
      {
        if (level < 4)
        {
          canCrystallize = false;
        }
        break;
      }
      case S:
      {
        if (level < 5)
        {
          canCrystallize = false;
        }
        break;
      }
      case S80:
      {
        if (level < 5)
        {
          canCrystallize = false;
        }
        break;
      }
      case S84:
      {
        if (level < 5)
        {
          canCrystallize = false;
        }
        break;
      }
      case R:
      {
        if (level < 6)
        {
          canCrystallize = false;
        }
        break;
      }
      case R95:
      {
        if (level < 6)
        {
          canCrystallize = false;
        }
        break;
      }
      case R99:
      {
        if (level < 6)
        {
          canCrystallize = false;
        }
        break;
      }
      default:
        break;
    }
    if (!canCrystallize)
    {
      activeChar.sendPacket(Msg.CANNOT_CRYSTALLIZE_CRYSTALLIZATION_SKILL_LEVEL_TOO_LOW);
      activeChar.sendActionFailed();
      return;
    }
    if (((item.getTemplate().getItemGrade() == Grade.R) || (item.getTemplate().getItemGrade() == Grade.R95) || (item.getTemplate().getItemGrade() == Grade.R99)) && (CrystallizationManager.isItemExistInTable(item)))
    {
      for (CrystallizationItem itemD : CrystallizationManager.getProductsForItem(item))
      {
        if (Rnd.chance(itemD.getChance()))
        {
View Full Code Here

      for (int i = 0; i < _count; i++)
      {
        int objectId = _items[i];
        long count = _itemQ[i];
        long price = _itemP[i];
        ItemInstance item = seller.getInventory().getItemByObjectId(objectId);
        if ((item == null) || (item.getCount() < count) || !item.canBeTraded(seller) || (item.getItemId() == ItemTemplate.ITEM_ID_ADENA))
        {
          continue;
        }
        temp = new TradeItem(item);
        temp.setCount(count);
View Full Code Here

        target.endDecayTask();
        continue;
      }
      for (RewardItem item : items)
      {
        ItemInstance sweep = ItemFunctions.createItem(item.itemId);
        sweep.setCount(item.count);
        if (player.isInParty() && player.getParty().isDistributeSpoilLoot())
        {
          player.getParty().distributeItem(player, sweep, null);
          continue;
        }
        if (!player.getInventory().validateCapacity(sweep) || !player.getInventory().validateWeight(sweep))
        {
          sweep.dropToTheGround(player, target);
          continue;
        }
        player.getInventory().addItem(sweep);
        SystemMessage smsg;
        if (item.count == 1)
View Full Code Here

    }
    Player player = null;
    if (info != null)
    {
      player = World.getPlayer(info.getOwnerId());
      ItemInstance item = null;
      if (player != null)
      {
        item = player.getInventory().getItemByObjectId(objectId);
      }
      if (item != null)
      {
        if (item.getItemId() == info.getItemId())
        {
          cache.put(new Element(item.getObjectId(), info = new ItemInfo(item)));
        }
      }
    }
    return info;
  }
View Full Code Here

    if (player.isInTrade())
    {
      player.sendActionFailed();
      return;
    }
    ItemInstance item = player.getInventory().getItemByObjectId(_objectId);
    if (item == null)
    {
      player.sendActionFailed();
      return;
    }
    if (item.isHeroWeapon())
    {
      player.sendPacket(Msg.HERO_WEAPONS_CANNOT_BE_DESTROYED);
      return;
    }
    if (!item.canBeCrystallized(player))
    {
      player.sendActionFailed();
      return;
    }
    if (player.isInStoreMode())
    {
      player.sendPacket(Msg.WHILE_OPERATING_A_PRIVATE_STORE_OR_WORKSHOP_YOU_CANNOT_DISCARD_DESTROY_OR_TRADE_AN_ITEM);
      return;
    }
    if (player.isFishing())
    {
      player.sendPacket(Msg.YOU_CANNOT_DO_THAT_WHILE_FISHING);
      return;
    }
    if (player.isInTrade())
    {
      player.sendActionFailed();
      return;
    }
    int crystalAmount = item.getTemplate().getCrystalCount();
    int crystalId = item.getTemplate().getCrystalType().cry;
    int level = player.getSkillLevel(Skill.SKILL_CRYSTALLIZE);
    boolean canCrystallize = true;
    Grade itemGrade = item.getTemplate().getItemGrade();
    switch (itemGrade)
    {
      case D:
      {
        if (level < 1)
        {
          canCrystallize = false;
        }
        break;
      }
      case C:
      {
        if (level < 2)
        {
          canCrystallize = false;
        }
        break;
      }
      case B:
      {
        if (level < 3)
        {
          canCrystallize = false;
        }
        break;
      }
      case A:
      {
        if (level < 4)
        {
          canCrystallize = false;
        }
        break;
      }
      case S:
      {
        if (level < 5)
        {
          canCrystallize = false;
        }
        break;
      }
      case S80:
      {
        if (level < 5)
        {
          canCrystallize = false;
        }
        break;
      }
      case S84:
      {
        if (level < 5)
        {
          canCrystallize = false;
        }
        break;
      }
      case R:
      {
        if (level < 6)
        {
          canCrystallize = false;
        }
        break;
      }
      case R95:
      {
        if (level < 6)
        {
          canCrystallize = false;
        }
        break;
      }
      case R99:
      {
        if (level < 6)
        {
          canCrystallize = false;
        }
        break;
      }
      default:
        break;
    }
    if (!canCrystallize)
    {
      player.sendPacket(Msg.CANNOT_CRYSTALLIZE_CRYSTALLIZATION_SKILL_LEVEL_TOO_LOW);
      player.sendActionFailed();
      return;
    }
    List<CrystallizationItem> temp = new ArrayList<>();
    temp.add(new CrystallizationItem(crystalId, crystalAmount, 100.0D));
    if (((item.getTemplate().getItemGrade() == Grade.R) || (item.getTemplate().getItemGrade() == Grade.R95) || (item.getTemplate().getItemGrade() == Grade.R99)) && (CrystallizationManager.isItemExistInTable(item)))
    {
      temp.addAll(CrystallizationManager.getProductsForItem(item));
    }
    player.sendPacket(new ExGetCrystalizingEstimation(temp));
  }
View Full Code Here

     * @param slot int
     * @return int
     */
    public int getPaperdollObjectId(int slot)
    {
      ItemInstance item = _paperdoll[slot];
      if (item != null)
      {
        return item.getObjectId();
      }
      return 0;
    }
View Full Code Here

     * @param slot int
     * @return int
     */
    public int getPaperdollAugmentationId(int slot)
    {
      ItemInstance item = _paperdoll[slot];
      if ((item != null) && item.isAugmented())
      {
        return item.getAugmentationId();
      }
      return 0;
    }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.items.ItemInstance

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.