Package com.l2jfrozen.gameserver.model.actor.instance

Examples of com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance$ScheduleConsumeManaTask


  public void updateSellList(L2PcInstance player, List<TradeItem> list)
  {
    Inventory playersInv = player.getInventory();
    TradeItem temp;
    L2ItemInstance temp2;

    int count = 0;
    while(count != list.size())
    {
      temp = list.get(count);
      temp2 = playersInv.getItemByObjectId(temp.getObjectId());

      if(temp2 == null)
      {
        list.remove(count);
        count = count - 1;
      }
      else
      {
        if(temp2.getCount() < temp.getCount())
        {
          temp.setCount(temp2.getCount());
        }

      }
      count++;
    }
View Full Code Here


    }
    return registered.add(new Pair(player, assist));
  }
 
  private void checkItems(L2PcInstance player){
    L2ItemInstance item;
    int slot;
    for(int i=1; i < 15; i++){
      item = player.getInventory().getPaperdollItem(i);
      if(item==null)
        continue;
      if(item.getItem().getItemGrade() == L2Item.CRYSTAL_S){
        slot = item.getItem().getBodyPart();
        switch(item.getEquipSlot()) {
          case 1:
            slot = L2Item.SLOT_L_EAR;
            break;
          case 2:
            slot = L2Item.SLOT_R_EAR;
View Full Code Here

      // player.sendPacket(new SystemMessage(SystemMessageId.FISHING_POLE_NOT_EQUIPPED));
      return;
    }
    weaponItem = null;

    L2ItemInstance lure = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
    if(lure == null)
    {
      // Bait not equiped.
      player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_FISH_HERE));
      SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
      sm.addString(skill.getName());
      player.sendPacket(sm);
      return;
    }

    player.SetLure(lure);
    lure = null;
    L2ItemInstance lure2 = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);

    if(lure2 == null || lure2.getCount() < 1) // Not enough bait.
    {
      player.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_BAIT));
      return;
    }
View Full Code Here

    {
      // either this cursed weapon is in the inventory of someone who has another cursed weapon equipped,
      // OR this cursed weapon is on the ground.
      if(_player != null && _player.getInventory().getItemByItemId(_itemId) != null)
      {
        L2ItemInstance rhand = _player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
        if (rhand != null)
        { 
          _player.getInventory().unEquipItemInSlotAndRecord(rhand.getEquipSlot());
        }
       
        // Destroy
        _player.getInventory().destroyItemByItemId("", _itemId, 1, _player, null);
        _player.store();
View Full Code Here

  {
    if(!(playable instanceof L2PcInstance))
      return;

    L2PcInstance activeChar = (L2PcInstance) playable;
    L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
    L2Weapon weaponItem = activeChar.getActiveWeaponItem();

    if(weaponInst == null || weaponItem.getItemType() != L2WeaponType.ROD)
      return;

    if(weaponInst.getChargedFishshot())
      // spiritshot is already active
      return;

    int FishshotId = item.getItemId();
    int grade = weaponItem.getCrystalType();
    int count = item.getCount();

    weaponItem = null;

    if(grade == L2Item.CRYSTAL_NONE && FishshotId != 6535 || grade == L2Item.CRYSTAL_D && FishshotId != 6536 || grade == L2Item.CRYSTAL_C && FishshotId != 6537 || grade == L2Item.CRYSTAL_B && FishshotId != 6538 || grade == L2Item.CRYSTAL_A && FishshotId != 6539 || grade == L2Item.CRYSTAL_S && FishshotId != 6540)
    {
      //1479 - This fishing shot is not fit for the fishing pole crystal.
      activeChar.sendPacket(new SystemMessage(SystemMessageId.WRONG_FISHINGSHOT_GRADE));
      return;
    }

    if(count < 1)
      return;

    weaponInst.setChargedFishshot(true);
    activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false);
    L2Object oldTarget = activeChar.getTarget();
    activeChar.setTarget(activeChar);

    weaponInst = null;
View Full Code Here

    }

    int itemId = 6645;
    int shotConsumption = 1;

    L2ItemInstance weaponInst = null;
    L2Weapon weaponItem = null;

    if(activePet instanceof L2PetInstance && !(activePet instanceof L2BabyPetInstance))
    {
      weaponInst = ((L2PetInstance) activePet).getActiveWeaponInstance();
      weaponItem = ((L2PetInstance) activePet).getActiveWeaponItem();

      if(weaponInst == null)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SOULSHOTS));
        return;
      }

      if(weaponInst.getChargedSoulshot() != L2ItemInstance.CHARGED_NONE)
        // SoulShots are already active.
        return;

      int shotCount = item.getCount();
      shotConsumption = weaponItem.getSoulShotCount();
      weaponItem = null;

      if(shotConsumption == 0)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SOULSHOTS));
        return;
      }

      if(!(shotCount > shotConsumption))
      {
        // Not enough Soulshots to use.
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SOULSHOTS_FOR_PET));
        return;
      }

      shotCount = 0;
      weaponInst.setChargedSoulshot(L2ItemInstance.CHARGED_SOULSHOT);
    }
    else
    {
      if(activePet.getChargedSoulShot() != L2ItemInstance.CHARGED_NONE)
        return;
View Full Code Here

  private void decreaseAlly(L2NpcInstance npc, L2PcInstance player)
  {
    if(player.getAllianceWithVarkaKetra() != 0)
    {
      L2ItemInstance mark = null;

      if(player.isAlliedWithKetra() && npc.getFactionId() == "ketra")
      {
        L2ItemInstance varkasBadgeSoldier = player.getInventory().getItemByItemId(7216);
        L2ItemInstance varkasBadgeOfficer = player.getInventory().getItemByItemId(7217);
        L2ItemInstance varkasBadgeCaptain = player.getInventory().getItemByItemId(7218);
        L2ItemInstance valorTotem = player.getInventory().getItemByItemId(7219);
        L2ItemInstance wisdomTotem = player.getInventory().getItemByItemId(7220);

        int varkasBadgeSoldierCount = varkasBadgeSoldier == null ? 0 : varkasBadgeSoldier.getCount();
        int varkasBadgeOfficerCount = varkasBadgeOfficer == null ? 0 : varkasBadgeOfficer.getCount();
        int varkasBadgeCaptainCount = varkasBadgeCaptain == null ? 0 : varkasBadgeCaptain.getCount();
        int valorTotemCount = valorTotem == null ? 0 : valorTotem.getCount();
        int wisdomTotemCount = wisdomTotem == null ? 0 : wisdomTotem.getCount();

        if(varkasBadgeSoldierCount > 0)
        {
          player.getInventory().destroyItemByItemId("ketrasBadgeSoldier", 7216, varkasBadgeSoldierCount, player, player.getTarget());
        }
        if(varkasBadgeOfficerCount > 0)
        {
          player.getInventory().destroyItemByItemId("ketrasBadgeOfficer", 7217, varkasBadgeOfficerCount, player, player.getTarget());
        }
        if(varkasBadgeCaptainCount > 0)
        {
          player.getInventory().destroyItemByItemId("ketrasBadgeCaptain", 7218, varkasBadgeCaptainCount, player, player.getTarget());
        }
        if(valorTotemCount > 0)
        {
          player.getInventory().destroyItemByItemId("valorTotem", 7219, valorTotemCount, player, player.getTarget());
        }
        if(wisdomTotemCount > 0)
        {
          player.getInventory().destroyItemByItemId("wisdomTotem", 7220, wisdomTotemCount, player, player.getTarget());
        }

        player.getInventory().destroyItemByItemId("Mark", ketraAllyMark[player.getAllianceWithVarkaKetra() - 1], 1, player, player.getTarget());
        player.setAllianceWithVarkaKetra(player.getAllianceWithVarkaKetra() - 1);
        if(player.getAllianceWithVarkaKetra() != 0)
        {
          mark = player.getInventory().addItem("Mark", ketraAllyMark[player.getAllianceWithVarkaKetra() - 1], 1, player, player);
        }
      }

      if(player.isAlliedWithVarka() && npc.getFactionId() == "varka")
      {
        L2ItemInstance ketrasBadgeSoldier = player.getInventory().getItemByItemId(7226);
        L2ItemInstance ketrasBadgeOfficer = player.getInventory().getItemByItemId(7227);
        L2ItemInstance ketrasBadgeCaptain = player.getInventory().getItemByItemId(7228);
        L2ItemInstance featherValor = player.getInventory().getItemByItemId(7229);
        L2ItemInstance featherWisdom = player.getInventory().getItemByItemId(7230);

        int ketrasBadgeSoldierCount = ketrasBadgeSoldier == null ? 0 : ketrasBadgeSoldier.getCount();
        int ketrasBadgeOfficerCount = ketrasBadgeOfficer == null ? 0 : ketrasBadgeOfficer.getCount();
        int ketrasBadgeCaptainCount = ketrasBadgeCaptain == null ? 0 : ketrasBadgeCaptain.getCount();
        int featherValorCount = featherValor == null ? 0 : featherValor.getCount();
        int featherWisdomCount = featherWisdom == null ? 0 : featherWisdom.getCount();

        if(ketrasBadgeSoldierCount > 0)
        {
          player.getInventory().destroyItemByItemId("ketrasBadgeSoldier", 7226, ketrasBadgeSoldierCount, player, player.getTarget());
        }
View Full Code Here

    int itemId = item.getItemId();
    boolean isBlessed = itemId == 6647;
    int shotConsumption = 1;

    L2ItemInstance weaponInst = null;
    L2Weapon weaponItem = null;

    if(activePet instanceof L2PetInstance && !(activePet instanceof L2BabyPetInstance))
    {
      weaponInst = ((L2PetInstance) activePet).getActiveWeaponInstance();
      weaponItem = ((L2PetInstance) activePet).getActiveWeaponItem();

      if(weaponInst == null)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SPIRITSHOTS));
        return;
      }

      if(weaponInst.getChargedSpiritshot() != L2ItemInstance.CHARGED_NONE)
        // SpiritShots are already active.
        return;

      int shotCount = item.getCount();
      shotConsumption = weaponItem.getSpiritShotCount();

      weaponItem = null;

      if(shotConsumption == 0)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SPIRITSHOTS));
        return;
      }

      if(!(shotCount > shotConsumption))
      {
        // Not enough SpiritShots to use.
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITHOTS_FOR_PET));
        return;
      }

      if(isBlessed)
      {
        weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT);
      }
      else
      {
        weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_SPIRITSHOT);
      }
    }
    else
    {
      if(activePet.getChargedSpiritShot() != L2ItemInstance.CHARGED_NONE)
View Full Code Here

   * @return true, if successful
   */
  public boolean playerIsEligible(L2PcInstance player, int itemId, int itemAmount)
  {
    String itemName = ItemTable.getInstance().getTemplate(itemId).getName();
    L2ItemInstance itemNeeded = player.getInventory().getItemByItemId(itemId);
   
    if (itemNeeded == null || itemNeeded.getCount() < itemAmount)
    {
      player.sendMessage("You need atleast " + itemAmount + "  [ " + itemName + " ] to request a Rebirth!");
      return false;
    }
   
View Full Code Here

  public void replaceItem(int itemID, int price)
  {
    for(int i = 0; i < _items.size(); i++)
    {
      L2ItemInstance item = _items.get(i);

      if(item.getItemId() == itemID)
      {
        item.setPriceToSell(price);
      }

      item = null;
    }
  }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.actor.instance.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.