Package l2p.gameserver.skills.conditions

Source Code of l2p.gameserver.skills.conditions.ConditionSlotItemId

package l2p.gameserver.skills.conditions;

import l2p.gameserver.model.L2Player;
import l2p.gameserver.model.items.Inventory;
import l2p.gameserver.model.items.L2ItemInstance;
import l2p.gameserver.skills.Env;

public final class ConditionSlotItemId extends ConditionInventory
{
  private final int _itemId;
  private final int _enchantLevel;

  public ConditionSlotItemId(short slot, int itemId, int enchantLevel)
  {
    super(slot);
    _itemId = itemId;
    _enchantLevel = enchantLevel;
  }

  @Override
  protected boolean testImpl(Env env)
  {
    if(!env.character.isPlayer())
    {
      return false;
    }
    Inventory inv = ((L2Player) env.character).getInventory();
    L2ItemInstance item = inv.getPaperdollItem(_slot);
    if(item == null)
    {
      return _itemId == 0;
    }
    return item.getItemId() == _itemId && item.getEnchantLevel() >= _enchantLevel;
  }
}
TOP

Related Classes of l2p.gameserver.skills.conditions.ConditionSlotItemId

TOP
Copyright © 2018 www.massapi.com. 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.