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

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


   
    for (L2Object target2 : target_s)
    {
      L2Character target = (L2Character) target2;
      Formulas f = Formulas.getInstance();
      L2ItemInstance weapon = activeChar.getActiveWeaponInstance();
     
      if (activeChar instanceof L2PcInstance && target instanceof L2PcInstance && target.isAlikeDead() && target.isFakeDeath())
      {
        target.stopFakeDeath(null);
      }
      else if (target.isAlikeDead())
        continue;
     
      /*
       * if(target.isInvul()){ continue; }
       */
     
      // Calculate skill evasion
      // Formulas.getInstance();
      if (Formulas.calcPhysicalSkillEvasion(target, skill))
      {
        activeChar.sendPacket(new SystemMessage(SystemMessageId.ATTACK_FAILED));
        continue;
      }
     
      boolean dual = activeChar.isUsingDualWeapon();
      boolean shld = Formulas.calcShldUse(activeChar, target);
      // PDAM critical chance not affected by buffs, only by STR. Only some skills are meant to crit.
      boolean crit = false;
      if (skill.getBaseCritRate() > 0)
        crit = Formulas.calcCrit(skill.getBaseCritRate() * 10 * BaseStats.STR.calcBonus(activeChar));
     
      boolean soul = false;
      if (weapon != null)
        soul = (ss && weapon.getItemType() != L2WeaponType.DAGGER);
     
      if (!crit && (skill.getCondition() & L2Skill.COND_CRIT) != 0)
        damage = 0;
      else
        damage = (int) Formulas.calcPhysDam(activeChar, target, skill, shld, false, dual, soul);
View Full Code Here


  public void handleCommand(String command, L2PcInstance player, String parameters)
  {
    try
    {
      int objId = Integer.parseInt(parameters);
      L2ItemInstance item = player.getInventory().getItemByObjectId(objId);
      if(item == null)
        return;
      IItemHandler ih = ItemHandler.getInstance().getItemHandler(item.getItemId());
      if(ih == null || !(ih instanceof ExtractableItems))
        return;
      if(command.compareTo(_IDS[0]) == 0)
      {
        ((ExtractableItems) ih).doExtract(player, item, 1);
      }
      else if(command.compareTo(_IDS[1]) == 0)
      {
        ((ExtractableItems) ih).doExtract(player, item, item.getCount());
      }
    }
    catch(Exception e)
    {
      if(Config.ENABLE_ALL_EXCEPTIONS)
View Full Code Here

          L2PcInstance activeChar = (L2PcInstance) playable;
         
          if (activeChar.getInventory().getInventoryItemCount(potion, 0) > 0)
          {
           
            L2ItemInstance item = activeChar.getInventory().getItemByItemId(potion);
            activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
          }
          else
          {
            if (Config.DEBUG)
              _log.log(Level.WARNING, "Attention: playable " + playable.getName() + " has not potions " + potion + "!");
          }
        }
        else if (playable instanceof L2Summon)
        {
          L2Summon activeChar = (L2Summon) playable;
         
          if (activeChar.getInventory().getInventoryItemCount(potion, 0) > 0)
          {
            L2ItemInstance item = activeChar.getInventory().getItemByItemId(potion);
            activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
          }
          else
          {
            if (Config.DEBUG)
              _log.log(Level.WARNING, "Attention: playable " + playable.getName() + " has not potions " + potion + "!");
View Full Code Here

            return;
          }
          // }
        }
       
        L2ItemInstance weapon = activeChar.getActiveWeaponInstance();
        boolean soul = false;
        if (weapon != null)
        {
          soul = (ss && (weapon.getItemType() == L2WeaponType.DAGGER));
        }
       
        // byte shld = Formulas.getInstance().calcShldUse(activeChar, target, skill);
        boolean shld = Formulas.calcShldUse(activeChar, target);
       
View Full Code Here

  public boolean testImpl(Env env)
  {
    if(!(env.player instanceof L2PcInstance))
      return false;
    Inventory inv = ((L2PcInstance) env.player).getInventory();
    L2ItemInstance item = inv.getPaperdollItem(_slot);
    if(item == null)
      return _itemId == 0;
    return item.getItemId() == _itemId && item.getEnchantLevel() >= _enchantLevel;
  }
View Full Code Here

   *            transformation
   * @return L2ItemInstance corresponding to the new item or the updated item in inventory
   */
  public L2ItemInstance addItem(String process, L2ItemInstance item, L2PcInstance actor, L2Object reference)
  {
    L2ItemInstance olditem = getItemByItemId(item.getItemId());

    // If stackable item is found in inventory just add to current quantity
    if(olditem != null && olditem.isStackable())
    {
      int count = item.getCount();
      olditem.changeCount(process, count, actor, reference);
      olditem.setLastChange(L2ItemInstance.MODIFIED);

      // And destroys the item
      ItemTable.getInstance().destroyItem(process, item, actor, reference);
      item.updateDatabase();
      item = olditem;
View Full Code Here

   *            transformation
   * @return L2ItemInstance corresponding to the new item or the updated item in inventory
   */
  public L2ItemInstance addItem(String process, int itemId, int count, L2PcInstance actor, L2Object reference)
  {
    L2ItemInstance item = getItemByItemId(itemId);
   
    // If stackable item is found in inventory just add to current quantity
    if(item != null && item.isStackable())
    {
      item.changeCount(process, count, actor, reference);
      item.setLastChange(L2ItemInstance.MODIFIED);

      // Updates database
      if(itemId == 57 && count < 10000 * Config.RATE_DROP_ADENA)
      {
        // Small adena changes won't be saved to database all the time
        if(GameTimeController.getGameTicks() % 5 == 0)
        {
          item.updateDatabase();
        }
      }
      else
      {
        item.updateDatabase();
      }
    }
    // If item hasn't be found in inventory, create new one
    else
    {
      for(int i = 0; i < count; i++)
      {
        L2Item template = ItemTable.getInstance().getTemplate(itemId);

        if(template == null)
        {
          _log.log(Level.WARNING, (actor != null ? "[" + actor.getName() + "] " : "") + "Invalid ItemId requested: ", itemId);
          return null;
        }

        item = ItemTable.getInstance().createItem(process, itemId, template.isStackable() ? count : 1, actor, reference);
        item.setOwnerId(getOwnerId());
       
        if(process.equals("AutoLoot")){
          item.setLocation(ItemLocation.INVENTORY);
        }else
          item.setLocation(getBaseLocation());
       
        item.setLastChange(L2ItemInstance.ADDED);

        // Add item in inventory
        addItem(item);
        // Updates database
        item.updateDatabase();

        // If stackable, end loop as entire count is included in 1 instance of item
        if(template.isStackable() || !Config.MULTIPLE_ITEM_DROP)
        {
          break;
View Full Code Here

   
    //If ConditionUsingItemType is one between Light, Heavy or Magic
    if (_armor)
    {
      //Get the itemMask of the weared chest (if exists)
      L2ItemInstance chest = inv.getPaperdollItem(Inventory.PAPERDOLL_CHEST);
      if (chest == null)
        return false;
      int chestMask = chest.getItem().getItemMask();
     
      //If chest armor is different from the condition one return false
      if ((_mask & chestMask) == 0)
        return false;
     
      //So from here, chest armor matches conditions
     
      int chestBodyPart = chest.getItem().getBodyPart();
      //return True if chest armor is a Full Armor
      if (chestBodyPart == L2Item.SLOT_FULL_ARMOR)
        return true;
     
      L2ItemInstance legs = inv.getPaperdollItem(Inventory.PAPERDOLL_LEGS);
      if (legs == null)
        return false;
      int legMask = legs.getItem().getItemMask();
      //return true if legs armor matches too
      return (_mask & legMask) != 0;
    }
    return (_mask & inv.getWearedMask()) != 0;
  }
View Full Code Here

   * @return L2ItemInstance corresponding to the new weared item
   */
  public L2ItemInstance addWearItem(String process, int itemId, L2PcInstance actor, L2Object reference)
  {
    // Surch the item in the inventory of the player
    L2ItemInstance item = getItemByItemId(itemId);

    // There is such item already in inventory
    if(item != null)
      return item;

    // Create and Init the L2ItemInstance corresponding to the Item Identifier and quantity
    // Add the L2ItemInstance object to _allObjects of L2world
    item = ItemTable.getInstance().createItem(process, itemId, 1, actor, reference);

    // Set Item Properties
    item.setWear(true); // "Try On" Item -> Don't save it in database
    item.setOwnerId(getOwnerId());
    item.setLocation(getBaseLocation());
    item.setLastChange(L2ItemInstance.ADDED);

    // Add item in inventory and equip it if necessary (item location defined)
    addItem(item);

    // Calculate the weight loaded by player
View Full Code Here

    clientStopAutoAttack();
   
    // Abort the attack of the L2Character and send Server->Client ActionFailed packet
    if (_actor instanceof L2PcInstance)
    {
      L2ItemInstance rhand = ((L2PcInstance) _actor).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
      if ((rhand != null && rhand.getItemType() == L2WeaponType.BOW))
      {
        if (!_actor.isAttackingNow())
          _actor.abortAttack();
      }
      else
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance

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.