Package l2p.gameserver.skills.conditions

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

package l2p.gameserver.skills.conditions;

import l2p.gameserver.model.L2Character;
import l2p.gameserver.model.L2Effect;
import l2p.gameserver.skills.Env;
import l2p.util.GArray;

public class ConditionPlayerHasBuffId extends Condition
{
  private final int _id;
  private final int _level;

  public ConditionPlayerHasBuffId(int id, int level)
  {
    _id = id;
    _level = level;
  }

  @Override
  protected boolean testImpl(Env env)
  {
    L2Character character = env.character;
    if(character == null)
    {
      return false;
    }
    if(_level == -1)
    {
      return character.getEffectList().getEffectsBySkillId(_id) != null;
    }
    GArray<L2Effect> el = character.getEffectList().getEffectsBySkillId(_id);
    if(el == null)
    {
      return false;
    }
    for(L2Effect effect : el)
    {
      if(effect != null && effect.getSkill().getLevel() >= _level)
      {
        return true;
      }
    }
    return false;
  }
}
TOP

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

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.