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

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


   */
  public static void addFlagToPlayer(L2PcInstance _player)
  {
    // Remove items from the player hands (right, left, both)
    // This is NOT a BUG, I don't want them to see the icon they have 8D
    L2ItemInstance wpn = _player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
    if(wpn == null)
    {
      wpn = _player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
      if(wpn!=null)
        _player.getInventory().unEquipItemInBodySlotAndRecord(Inventory.PAPERDOLL_LRHAND);
View Full Code Here


   *
   * @param player the player
   */
  public static void removeFlagFromPlayer(L2PcInstance player)
  {
    L2ItemInstance wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
    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);
View Full Code Here

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

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

    int itemId = item.getItemId();

    if(activeChar.isParalyzed())
    {
      activeChar.sendMessage("You Cannot Use This While You Are Paralyzed");
      activeChar.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    if(activeChar.isInOlympiadMode())
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
      sm.addString(item.getItemName());
      activeChar.sendPacket(sm);
      sm = null;

      return;
    }

    // Check if Blessed Spiritshot can be used
    if(weaponInst == null || weaponItem.getSpiritShotCount() == 0)
    {
      if(!activeChar.getAutoSoulShot().containsKey(itemId))
      {
        activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SPIRITSHOTS));
      }

      return;
    }

    // Check if Blessed Spiritshot is already active (it can be charged over Spiritshot)
    if(weaponInst.getChargedSpiritshot() != L2ItemInstance.CHARGED_NONE)
      return;

    // Check for correct grade
    int weaponGrade = weaponItem.getCrystalType();
    if(weaponGrade == L2Item.CRYSTAL_NONE && itemId != 3947 || weaponGrade == L2Item.CRYSTAL_D && itemId != 3948 || weaponGrade == L2Item.CRYSTAL_C && itemId != 3949 || weaponGrade == L2Item.CRYSTAL_B && itemId != 3950 || weaponGrade == L2Item.CRYSTAL_A && itemId != 3951 || weaponGrade == L2Item.CRYSTAL_S && itemId != 3952)
    {
      if(!activeChar.getAutoSoulShot().containsKey(itemId))
      {
        activeChar.sendPacket(new SystemMessage(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH));
      }
      return;
    }

    // Consume Blessed Spiritshot if player has enough of them
    // TODO: test ss
    if(!Config.DONT_DESTROY_SS)
    {
      if(!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false))
      {
        if(activeChar.getAutoSoulShot().containsKey(itemId))
        {
          activeChar.removeAutoSoulShot(itemId);
          activeChar.sendPacket(new ExAutoSoulShot(itemId, 0));
          SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
          sm.addString(item.getItem().getName());
          activeChar.sendPacket(sm);
          sm = null;

          return;
        }

        activeChar.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS));
        return;
      }
    }

    // Charge Blessed Spiritshot
    weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT);

    // Send message to client
    activeChar.sendPacket(new SystemMessage(SystemMessageId.ENABLED_SPIRITSHOT));
    Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);

 
View Full Code Here

   * @param itemId : ID of the item to check enchantment
   * @return int
   */
  public int getEnchantLevel(int itemId)
  {
    L2ItemInstance enchanteditem = getPlayer().getInventory().getItemByItemId(itemId);

    if(enchanteditem == null)
      return 0;

    return enchanteditem.getEnchantLevel();
  }
View Full Code Here

      count = (int) (count * Config.RATE_QUESTS_REWARD);
    }

    // Set quantity of item
    // Add items to player's inventory
    L2ItemInstance item = getPlayer().getInventory().addItem("Quest", itemId, count, getPlayer(), getPlayer().getTarget());

    if(item == null)
      return;

    if(enchantlevel > 0)
    {
      item.setEnchantLevel(enchantlevel);
    }

    // If item for reward is gold, send message of gold reward to client
    if(itemId == 57)
    {
      SystemMessage smsg = new SystemMessage(SystemMessageId.EARNED_ADENA);
      smsg.addNumber(count);
      getPlayer().sendPacket(smsg);
      smsg = null;
    }
    // Otherwise, send message of object reward to client
    else
    {
      if(count > 1)
      {
        SystemMessage smsg = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
        smsg.addItemName(item.getItemId());
        smsg.addNumber(count);
        getPlayer().sendPacket(smsg);
        smsg = null;
      }
      else
      {
        SystemMessage smsg = new SystemMessage(SystemMessageId.EARNED_ITEM);
        smsg.addItemName(item.getItemId());
        getPlayer().sendPacket(smsg);
        smsg = null;
      }
    }
    getPlayer().sendPacket(new ItemList(getPlayer(), false));
View Full Code Here

   * @param count : Quantity of items to destroy
   */
  public void takeItems(int itemId, int count)
  {
    // Get object item from player's inventory list
    L2ItemInstance item = getPlayer().getInventory().getItemByItemId(itemId);

    if(item == null)
      return;
   
    if(getPlayer().isProcessingTransaction()){
      getPlayer().cancelActiveTrade();
    }

    // Tests on count value in order not to have negative value
    if(count < 0 || count > item.getCount())
    {
      count = item.getCount();
    }

    // Destroy the quantity of items wanted
    if(itemId == 57)
    {
      getPlayer().reduceAdena("Quest", count, getPlayer(), true);
    }
    else
    {
      // Fix for destroyed quest items
       if (item.isEquipped())
         getPlayer().getInventory().unEquipItemInBodySlotAndRecord(item.getItem().getBodyPart());
      
      getPlayer().destroyItemByItemId("Quest", itemId, count, getPlayer(), true);
    }

    //on quests, always refresh inventory
View Full Code Here

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

    L2PcInstance activeChar = (L2PcInstance) playable;
    L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
    L2Weapon weaponItem = activeChar.getActiveWeaponItem();
    int itemId = item.getItemId();

    // Check if Spiritshot can be used
    if(weaponInst == null || weaponItem.getSpiritShotCount() == 0)
    {
      if(!activeChar.getAutoSoulShot().containsKey(itemId))
      {
        activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SPIRITSHOTS));
      }
      return;
    }

    if(activeChar.isParalyzed())
    {
      activeChar.sendMessage("You Cannot Use This While You Are Paralyzed");
      activeChar.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    // Check if Spiritshot is already active
    if(weaponInst.getChargedSpiritshot() != L2ItemInstance.CHARGED_NONE)
      return;

    // Check for correct grade
    int weaponGrade = weaponItem.getCrystalType();
    if(weaponGrade == L2Item.CRYSTAL_NONE && itemId != 5790 && itemId != 2509 || weaponGrade == L2Item.CRYSTAL_D && itemId != 2510 || weaponGrade == L2Item.CRYSTAL_C && itemId != 2511 || weaponGrade == L2Item.CRYSTAL_B && itemId != 2512 || weaponGrade == L2Item.CRYSTAL_A && itemId != 2513 || weaponGrade == L2Item.CRYSTAL_S && itemId != 2514)
    {
      if(!activeChar.getAutoSoulShot().containsKey(itemId))
      {
        activeChar.sendPacket(new SystemMessage(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH));
      }
      return;
    }

    // Consume Spiritshot if player has enough of them
    // TODO: test ss
    if(!Config.DONT_DESTROY_SS)
    {
      if(!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false))
      {
        if(activeChar.getAutoSoulShot().containsKey(itemId))
        {
          activeChar.removeAutoSoulShot(itemId);
          activeChar.sendPacket(new ExAutoSoulShot(itemId, 0));

          SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
          sm.addString(item.getItem().getName());
          activeChar.sendPacket(sm);
        }
        else
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS));
        }
        return;
      }
    }
    weaponItem = null;

    // Charge Spiritshot
    weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_SPIRITSHOT);

    weaponInst = null;

    // Send message to client
    activeChar.sendPacket(new SystemMessage(SystemMessageId.ENABLED_SPIRITSHOT));
View Full Code Here

    _itemId = item_id;
  }

  public synchronized void spawnMe()
  {
    L2ItemInstance i;

    // Init the dropped L2ItemInstance and add it in the world as a visible object at the position where mob was last
    i = ItemTable.getInstance().createItem("Combat", _itemId, 1, null, null);
    i.spawnMe(_location.getX(), _location.getY(), _location.getZ());
    itemInstance = i;
    i = null;
  }
View Full Code Here

  public SpawnItemPoly(L2Object object)
  {
    if(object instanceof L2ItemInstance)
    {
      L2ItemInstance item = (L2ItemInstance) object;
      _objectId = object.getObjectId();
      _itemId = object.getPoly().getPolyId();
      _x = item.getX();
      _y = item.getY();
      _z = item.getZ();
      _stackable = item.isStackable() ? 0x01 : 0x00;
      _count = item.getCount();
    }
    else
    {
      _objectId = object.getObjectId();
      _itemId = object.getPoly().getPolyId();
View Full Code Here

  {
    int npcObjId = npc.getObjectId();
   
    L2Character target = isPet ? player.getPet() : player;
   
    L2ItemInstance VisitorsMark = player.getInventory().getItemByItemId(8064);
    L2ItemInstance FadedVisitorsMark = player.getInventory().getItemByItemId(8065);
    L2ItemInstance PagansMark = player.getInventory().getItemByItemId(8067);
   
    long mark1 = VisitorsMark == null ? 0 : VisitorsMark.getCount();
    long mark2 = FadedVisitorsMark == null ? 0 : FadedVisitorsMark.getCount();
    long mark3 = PagansMark == null ? 0 : PagansMark.getCount();
   
    if (mark1 == 0 && mark2 == 0 && mark3 == 0)
    {
      ((L2Attackable) npc).addDamageHate(target, 0, 999);
      npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
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.