Merged with released L2J-Unity files.
This commit is contained in:
@ -1,146 +1,152 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class Condition.
|
||||
* @author mkizub
|
||||
*/
|
||||
public abstract class Condition implements ConditionListener
|
||||
{
|
||||
private ConditionListener _listener;
|
||||
private String _msg;
|
||||
private int _msgId;
|
||||
private boolean _addName = false;
|
||||
private boolean _result;
|
||||
|
||||
/**
|
||||
* Sets the message.
|
||||
* @param msg the new message
|
||||
*/
|
||||
public final void setMessage(String msg)
|
||||
{
|
||||
_msg = msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message.
|
||||
* @return the message
|
||||
*/
|
||||
public final String getMessage()
|
||||
{
|
||||
return _msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message id.
|
||||
* @param msgId the new message id
|
||||
*/
|
||||
public final void setMessageId(int msgId)
|
||||
{
|
||||
_msgId = msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message id.
|
||||
* @return the message id
|
||||
*/
|
||||
public final int getMessageId()
|
||||
{
|
||||
return _msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the name.
|
||||
*/
|
||||
public final void addName()
|
||||
{
|
||||
_addName = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is adds the name.
|
||||
* @return true, if is adds the name
|
||||
*/
|
||||
public final boolean isAddName()
|
||||
{
|
||||
return _addName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the listener.
|
||||
* @param listener the new listener
|
||||
*/
|
||||
void setListener(ConditionListener listener)
|
||||
{
|
||||
_listener = listener;
|
||||
notifyChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the listener.
|
||||
* @return the listener
|
||||
*/
|
||||
final ConditionListener getListener()
|
||||
{
|
||||
return _listener;
|
||||
}
|
||||
|
||||
public final boolean test(L2Character caster, L2Character target, Skill skill)
|
||||
{
|
||||
return test(caster, target, skill, null);
|
||||
}
|
||||
|
||||
public final boolean test(L2Character caster, L2Character target, L2Item item)
|
||||
{
|
||||
return test(caster, target, null, null);
|
||||
}
|
||||
|
||||
public final boolean test(L2Character caster, L2Character target, Skill skill, L2Item item)
|
||||
{
|
||||
final boolean res = testImpl(caster, target, skill, item);
|
||||
if ((_listener != null) && (res != _result))
|
||||
{
|
||||
_result = res;
|
||||
notifyChanged();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the condition.
|
||||
* @param effector the effector
|
||||
* @param effected the effected
|
||||
* @param skill the skill
|
||||
* @param item the item
|
||||
* @return {@code true} if successful, {@code false} otherwise
|
||||
*/
|
||||
public abstract boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item);
|
||||
|
||||
@Override
|
||||
public void notifyChanged()
|
||||
{
|
||||
if (_listener != null)
|
||||
{
|
||||
_listener.notifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.OneDayRewardDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class Condition.
|
||||
* @author mkizub
|
||||
*/
|
||||
public abstract class Condition implements ConditionListener
|
||||
{
|
||||
private ConditionListener _listener;
|
||||
private String _msg;
|
||||
private int _msgId;
|
||||
private boolean _addName = false;
|
||||
private boolean _result;
|
||||
|
||||
/**
|
||||
* Sets the message.
|
||||
* @param msg the new message
|
||||
*/
|
||||
public final void setMessage(String msg)
|
||||
{
|
||||
_msg = msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message.
|
||||
* @return the message
|
||||
*/
|
||||
public final String getMessage()
|
||||
{
|
||||
return _msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message id.
|
||||
* @param msgId the new message id
|
||||
*/
|
||||
public final void setMessageId(int msgId)
|
||||
{
|
||||
_msgId = msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message id.
|
||||
* @return the message id
|
||||
*/
|
||||
public final int getMessageId()
|
||||
{
|
||||
return _msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the name.
|
||||
*/
|
||||
public final void addName()
|
||||
{
|
||||
_addName = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is adds the name.
|
||||
* @return true, if is adds the name
|
||||
*/
|
||||
public final boolean isAddName()
|
||||
{
|
||||
return _addName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the listener.
|
||||
* @param listener the new listener
|
||||
*/
|
||||
void setListener(ConditionListener listener)
|
||||
{
|
||||
_listener = listener;
|
||||
notifyChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the listener.
|
||||
* @return the listener
|
||||
*/
|
||||
final ConditionListener getListener()
|
||||
{
|
||||
return _listener;
|
||||
}
|
||||
|
||||
public final boolean test(L2Character caster, L2Character target, Skill skill)
|
||||
{
|
||||
return test(caster, target, skill, null);
|
||||
}
|
||||
|
||||
public final boolean test(L2Character caster, L2Character target, L2Item item)
|
||||
{
|
||||
return test(caster, target, null, null);
|
||||
}
|
||||
|
||||
public final boolean test(L2Character caster, OneDayRewardDataHolder onewayreward)
|
||||
{
|
||||
return test(caster, null, null, null);
|
||||
}
|
||||
|
||||
public final boolean test(L2Character caster, L2Character target, Skill skill, L2Item item)
|
||||
{
|
||||
final boolean res = testImpl(caster, target, skill, item);
|
||||
if ((_listener != null) && (res != _result))
|
||||
{
|
||||
_result = res;
|
||||
notifyChanged();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the condition.
|
||||
* @param effector the effector
|
||||
* @param effected the effected
|
||||
* @param skill the skill
|
||||
* @param item the item
|
||||
* @return {@code true} if successful, {@code false} otherwise
|
||||
*/
|
||||
public abstract boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item);
|
||||
|
||||
@Override
|
||||
public void notifyChanged()
|
||||
{
|
||||
if (_listener != null)
|
||||
{
|
||||
_listener.notifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,63 +1,73 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.L2Weapon;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionChangeWeapon.
|
||||
* @author nBd
|
||||
*/
|
||||
public class ConditionChangeWeapon extends Condition
|
||||
{
|
||||
private final boolean _required;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition change weapon.
|
||||
* @param required the required
|
||||
*/
|
||||
public ConditionChangeWeapon(boolean required)
|
||||
{
|
||||
_required = required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_required)
|
||||
{
|
||||
final L2Weapon weaponItem = effector.getActiveWeaponItem();
|
||||
if ((weaponItem == null) || (weaponItem.getChangeWeaponId() == 0) || effector.getActingPlayer().hasItemRequest())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.L2Weapon;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionChangeWeapon.
|
||||
* @author nBd
|
||||
*/
|
||||
public class ConditionChangeWeapon extends Condition
|
||||
{
|
||||
private final boolean _required;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition change weapon.
|
||||
* @param required the required
|
||||
*/
|
||||
public ConditionChangeWeapon(boolean required)
|
||||
{
|
||||
_required = required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_required)
|
||||
{
|
||||
final L2Weapon weaponItem = effector.getActiveWeaponItem();
|
||||
if (weaponItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (weaponItem.getChangeWeaponId() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (effector.getActingPlayer().hasItemRequest())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +1,50 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.util.Rnd;
|
||||
|
||||
/**
|
||||
* The Class ConditionGameChance.
|
||||
* @author Advi
|
||||
*/
|
||||
public class ConditionGameChance extends Condition
|
||||
{
|
||||
private final int _chance;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition game chance.
|
||||
* @param chance the chance
|
||||
*/
|
||||
public ConditionGameChance(int chance)
|
||||
{
|
||||
_chance = chance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return Rnd.get(100) < _chance;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionGameChance.
|
||||
* @author Advi
|
||||
*/
|
||||
public class ConditionGameChance extends Condition
|
||||
{
|
||||
private final int _chance;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition game chance.
|
||||
* @param chance the chance
|
||||
*/
|
||||
public ConditionGameChance(int chance)
|
||||
{
|
||||
_chance = chance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return Rnd.get(100) < _chance;
|
||||
}
|
||||
}
|
||||
|
@ -1,68 +1,66 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.GameTimeController;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionGameTime.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionGameTime extends Condition
|
||||
{
|
||||
/**
|
||||
* The Enum CheckGameTime.
|
||||
*/
|
||||
public enum CheckGameTime
|
||||
{
|
||||
NIGHT
|
||||
}
|
||||
|
||||
private final CheckGameTime _check;
|
||||
private final boolean _required;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition game time.
|
||||
* @param check the check
|
||||
* @param required the required
|
||||
*/
|
||||
public ConditionGameTime(CheckGameTime check, boolean required)
|
||||
{
|
||||
_check = check;
|
||||
_required = required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
switch (_check)
|
||||
{
|
||||
case NIGHT:
|
||||
{
|
||||
return GameTimeController.getInstance().isNight() == _required;
|
||||
}
|
||||
}
|
||||
return !_required;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.GameTimeController;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionGameTime.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionGameTime extends Condition
|
||||
{
|
||||
/**
|
||||
* The Enum CheckGameTime.
|
||||
*/
|
||||
public enum CheckGameTime
|
||||
{
|
||||
NIGHT
|
||||
}
|
||||
|
||||
private final CheckGameTime _check;
|
||||
private final boolean _required;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition game time.
|
||||
* @param check the check
|
||||
* @param required the required
|
||||
*/
|
||||
public ConditionGameTime(CheckGameTime check, boolean required)
|
||||
{
|
||||
_check = check;
|
||||
_required = required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
switch (_check)
|
||||
{
|
||||
case NIGHT:
|
||||
return GameTimeController.getInstance().isNight() == _required;
|
||||
}
|
||||
return !_required;
|
||||
}
|
||||
}
|
||||
|
@ -1,56 +1,63 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionLogicNot.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionLogicNot extends Condition
|
||||
{
|
||||
private final Condition _condition;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition logic not.
|
||||
* @param condition the condition
|
||||
*/
|
||||
public ConditionLogicNot(Condition condition)
|
||||
{
|
||||
_condition = condition;
|
||||
if (getListener() != null)
|
||||
{
|
||||
_condition.setListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void setListener(ConditionListener listener)
|
||||
{
|
||||
_condition.setListener(listener != null ? this : null);
|
||||
super.setListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return !_condition.test(effector, effected, skill, item);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionLogicNot.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionLogicNot extends Condition
|
||||
{
|
||||
private final Condition _condition;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition logic not.
|
||||
* @param condition the condition
|
||||
*/
|
||||
public ConditionLogicNot(Condition condition)
|
||||
{
|
||||
_condition = condition;
|
||||
if (getListener() != null)
|
||||
{
|
||||
_condition.setListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void setListener(ConditionListener listener)
|
||||
{
|
||||
if (listener != null)
|
||||
{
|
||||
_condition.setListener(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
_condition.setListener(null);
|
||||
}
|
||||
super.setListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return !_condition.test(effector, effected, skill, item);
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,60 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerActiveEffectId.
|
||||
*/
|
||||
public class ConditionPlayerActiveEffectId extends Condition
|
||||
{
|
||||
private final int _effectId;
|
||||
private final int _effectLvl;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active effect id.
|
||||
* @param effectId the effect id
|
||||
*/
|
||||
public ConditionPlayerActiveEffectId(int effectId)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active effect id.
|
||||
* @param effectId the effect id
|
||||
* @param effectLevel the effect level
|
||||
*/
|
||||
public ConditionPlayerActiveEffectId(int effectId, int effectLevel)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = effectLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final BuffInfo info = effector.getEffectList().getBuffInfoBySkillId(_effectId);
|
||||
return (info != null) && ((_effectLvl == -1) || (_effectLvl <= info.getSkill().getLevel()));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerActiveEffectId.
|
||||
*/
|
||||
public class ConditionPlayerActiveEffectId extends Condition
|
||||
{
|
||||
|
||||
private final int _effectId;
|
||||
private final int _effectLvl;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active effect id.
|
||||
* @param effectId the effect id
|
||||
*/
|
||||
public ConditionPlayerActiveEffectId(int effectId)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active effect id.
|
||||
* @param effectId the effect id
|
||||
* @param effectLevel the effect level
|
||||
*/
|
||||
public ConditionPlayerActiveEffectId(int effectId, int effectLevel)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = effectLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final BuffInfo info = effector.getEffectList().getBuffInfoBySkillId(_effectId);
|
||||
return ((info != null) && ((_effectLvl == -1) || (_effectLvl <= info.getSkill().getLevel())));
|
||||
}
|
||||
}
|
||||
|
@ -1,65 +1,64 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerActiveSkillId.
|
||||
* @author DrHouse
|
||||
*/
|
||||
public class ConditionPlayerActiveSkillId extends Condition
|
||||
{
|
||||
private final int _skillId;
|
||||
private final int _skillLevel;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active skill id.
|
||||
* @param skillId the skill id
|
||||
*/
|
||||
public ConditionPlayerActiveSkillId(int skillId)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active skill id.
|
||||
* @param skillId the skill id
|
||||
* @param skillLevel the skill level
|
||||
*/
|
||||
public ConditionPlayerActiveSkillId(int skillId, int skillLevel)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = skillLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
for (Skill sk : effector.getAllSkills())
|
||||
{
|
||||
if ((sk != null) && (sk.getId() == _skillId) && ((_skillLevel == -1) || (_skillLevel <= sk.getLevel())))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerActiveSkillId.
|
||||
* @author DrHouse
|
||||
*/
|
||||
public class ConditionPlayerActiveSkillId extends Condition
|
||||
{
|
||||
private final int _skillId;
|
||||
private final int _skillLevel;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active skill id.
|
||||
* @param skillId the skill id
|
||||
*/
|
||||
public ConditionPlayerActiveSkillId(int skillId)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active skill id.
|
||||
* @param skillId the skill id
|
||||
* @param skillLevel the skill level
|
||||
*/
|
||||
public ConditionPlayerActiveSkillId(int skillId, int skillLevel)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = skillLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final Skill knownSkill = effector.getKnownSkill(_skillId);
|
||||
if (knownSkill != null)
|
||||
{
|
||||
return (_skillLevel == -1) || (_skillLevel <= knownSkill.getLevel());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,97 +1,86 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerBaseStats.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionPlayerBaseStats extends Condition
|
||||
{
|
||||
private final BaseStat _stat;
|
||||
private final int _value;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player base stats.
|
||||
* @param player the player
|
||||
* @param stat the stat
|
||||
* @param value the value
|
||||
*/
|
||||
public ConditionPlayerBaseStats(L2Character player, BaseStat stat, int value)
|
||||
{
|
||||
super();
|
||||
_stat = stat;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
switch (_stat)
|
||||
{
|
||||
case Int:
|
||||
{
|
||||
return player.getINT() >= _value;
|
||||
}
|
||||
case Str:
|
||||
{
|
||||
return player.getSTR() >= _value;
|
||||
}
|
||||
case Con:
|
||||
{
|
||||
return player.getCON() >= _value;
|
||||
}
|
||||
case Dex:
|
||||
{
|
||||
return player.getDEX() >= _value;
|
||||
}
|
||||
case Men:
|
||||
{
|
||||
return player.getMEN() >= _value;
|
||||
}
|
||||
case Wit:
|
||||
{
|
||||
return player.getWIT() >= _value;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
enum BaseStat
|
||||
{
|
||||
Int,
|
||||
Str,
|
||||
Con,
|
||||
Dex,
|
||||
Men,
|
||||
Wit
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerBaseStats.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionPlayerBaseStats extends Condition
|
||||
{
|
||||
|
||||
private final BaseStat _stat;
|
||||
private final int _value;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player base stats.
|
||||
* @param player the player
|
||||
* @param stat the stat
|
||||
* @param value the value
|
||||
*/
|
||||
public ConditionPlayerBaseStats(L2Character player, BaseStat stat, int value)
|
||||
{
|
||||
super();
|
||||
_stat = stat;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
switch (_stat)
|
||||
{
|
||||
case Int:
|
||||
return player.getINT() >= _value;
|
||||
case Str:
|
||||
return player.getSTR() >= _value;
|
||||
case Con:
|
||||
return player.getCON() >= _value;
|
||||
case Dex:
|
||||
return player.getDEX() >= _value;
|
||||
case Men:
|
||||
return player.getMEN() >= _value;
|
||||
case Wit:
|
||||
return player.getWIT() >= _value;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
enum BaseStat
|
||||
{
|
||||
Int,
|
||||
Str,
|
||||
Con,
|
||||
Dex,
|
||||
Men,
|
||||
Wit
|
||||
}
|
||||
|
@ -1,70 +1,64 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.TvTEvent;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Call Pc condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCallPc extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCallPc(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canCallPlayer = true;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
canCallPlayer = false;
|
||||
}
|
||||
else if (player.isInOlympiadMode())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION);
|
||||
canCallPlayer = false;
|
||||
}
|
||||
else if (player.inObserverMode())
|
||||
{
|
||||
canCallPlayer = false;
|
||||
}
|
||||
else if (!TvTEvent.onEscapeUse(player.getObjectId()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
|
||||
canCallPlayer = false;
|
||||
}
|
||||
else if (player.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || player.isInsideZone(ZoneId.JAIL) || player.isFlyingMounted())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
|
||||
canCallPlayer = false;
|
||||
}
|
||||
return _val == canCallPlayer;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Call Pc condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCallPc extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCallPc(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canCallPlayer = true;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
canCallPlayer = false;
|
||||
}
|
||||
else if (player.isInOlympiadMode())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION);
|
||||
canCallPlayer = false;
|
||||
}
|
||||
else if (player.inObserverMode())
|
||||
{
|
||||
canCallPlayer = false;
|
||||
}
|
||||
else if (player.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || player.isInsideZone(ZoneId.JAIL) || player.isFlyingMounted())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
|
||||
canCallPlayer = false;
|
||||
}
|
||||
return (_val == canCallPlayer);
|
||||
}
|
||||
}
|
||||
|
@ -1,101 +1,106 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Player Can Create Base condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanCreateBase extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanCreateBase(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
boolean canCreateBase = !player.isAlikeDead() && !player.isCursedWeaponEquipped() && (player.getClan() != null);
|
||||
final Castle castle = CastleManager.getInstance().getCastle(player);
|
||||
final Fort fort = FortManager.getInstance().getFort(player);
|
||||
final SystemMessage sm;
|
||||
if ((castle == null) && (fort == null))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canCreateBase = false;
|
||||
}
|
||||
else if (((castle != null) && !castle.getSiege().isInProgress()) || ((fort != null) && !fort.getSiege().isInProgress()))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canCreateBase = false;
|
||||
}
|
||||
else if (((castle != null) && (castle.getSiege().getAttackerClan(player.getClan()) == null)) || ((fort != null) && (fort.getSiege().getAttackerClan(player.getClan()) == null)))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canCreateBase = false;
|
||||
}
|
||||
else if (!player.isClanLeader())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canCreateBase = false;
|
||||
}
|
||||
else if (((castle != null) && (castle.getSiege().getAttackerClan(player.getClan()).getNumFlags() >= SiegeManager.getInstance().getFlagMaxCount())) || ((fort != null) && (fort.getSiege().getAttackerClan(player.getClan()).getNumFlags() >= FortSiegeManager.getInstance().getFlagMaxCount())))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canCreateBase = false;
|
||||
}
|
||||
else if (!player.isInsideZone(ZoneId.HQ))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_SET_UP_A_BASE_HERE);
|
||||
canCreateBase = false;
|
||||
}
|
||||
return _val == canCreateBase;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Player Can Create Base condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanCreateBase extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanCreateBase(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
boolean canCreateBase = true;
|
||||
if (player.isAlikeDead() || player.isCursedWeaponEquipped() || (player.getClan() == null))
|
||||
{
|
||||
canCreateBase = false;
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastle(player);
|
||||
final Fort fort = FortManager.getInstance().getFort(player);
|
||||
final SystemMessage sm;
|
||||
if ((castle == null) && (fort == null))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canCreateBase = false;
|
||||
}
|
||||
else if (((castle != null) && !castle.getSiege().isInProgress()) || ((fort != null) && !fort.getSiege().isInProgress()))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canCreateBase = false;
|
||||
}
|
||||
else if (((castle != null) && (castle.getSiege().getAttackerClan(player.getClan()) == null)) || ((fort != null) && (fort.getSiege().getAttackerClan(player.getClan()) == null)))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canCreateBase = false;
|
||||
}
|
||||
else if (!player.isClanLeader())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canCreateBase = false;
|
||||
}
|
||||
else if (((castle != null) && (castle.getSiege().getAttackerClan(player.getClan()).getNumFlags() >= SiegeManager.getInstance().getFlagMaxCount())) || ((fort != null) && (fort.getSiege().getAttackerClan(player.getClan()).getNumFlags() >= FortSiegeManager.getInstance().getFlagMaxCount())))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canCreateBase = false;
|
||||
}
|
||||
else if (!player.isInsideZone(ZoneId.HQ))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_SET_UP_A_BASE_HERE);
|
||||
canCreateBase = false;
|
||||
}
|
||||
return (_val == canCreateBase);
|
||||
}
|
||||
}
|
||||
|
@ -1,82 +1,87 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Can Create Outpost condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanCreateOutpost extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanCreateOutpost(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
boolean canCreateOutpost = !player.isAlikeDead() && !player.isCursedWeaponEquipped() && (player.getClan() != null);
|
||||
final Castle castle = CastleManager.getInstance().getCastle(player);
|
||||
final Fort fort = FortManager.getInstance().getFort(player);
|
||||
if ((castle == null) && (fort == null))
|
||||
{
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
|
||||
if (((fort != null) && (fort.getResidenceId() == 0)) || ((castle != null) && (castle.getResidenceId() == 0)))
|
||||
{
|
||||
player.sendMessage("You must be on fort or castle ground to construct an outpost or flag.");
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
else if (((fort != null) && !fort.getZone().isActive()) || ((castle != null) && !castle.getZone().isActive()))
|
||||
{
|
||||
player.sendMessage("You can only construct an outpost or flag on siege field.");
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
else if (!player.isClanLeader())
|
||||
{
|
||||
player.sendMessage("You must be a clan leader to construct an outpost or flag.");
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
else if (!player.isInsideZone(ZoneId.HQ))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_SET_UP_A_BASE_HERE);
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
return _val == canCreateOutpost;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Can Create Outpost condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanCreateOutpost extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanCreateOutpost(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
boolean canCreateOutpost = true;
|
||||
if (player.isAlikeDead() || player.isCursedWeaponEquipped() || (player.getClan() == null))
|
||||
{
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastle(player);
|
||||
final Fort fort = FortManager.getInstance().getFort(player);
|
||||
if ((castle == null) && (fort == null))
|
||||
{
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
|
||||
if (((fort != null) && (fort.getResidenceId() == 0)) || ((castle != null) && (castle.getResidenceId() == 0)))
|
||||
{
|
||||
player.sendMessage("You must be on fort or castle ground to construct an outpost or flag.");
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
else if (((fort != null) && !fort.getZone().isActive()) || ((castle != null) && !castle.getZone().isActive()))
|
||||
{
|
||||
player.sendMessage("You can only construct an outpost or flag on siege field.");
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
else if (!player.isClanLeader())
|
||||
{
|
||||
player.sendMessage("You must be a clan leader to construct an outpost or flag.");
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
else if (!player.isInsideZone(ZoneId.HQ))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_SET_UP_A_BASE_HERE);
|
||||
canCreateOutpost = false;
|
||||
}
|
||||
return (_val == canCreateOutpost);
|
||||
}
|
||||
}
|
||||
|
@ -1,79 +1,68 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.TvTEvent;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Player Can Escape condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanEscape extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanEscape(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canTeleport = true;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (!TvTEvent.onEscapeUse(player.getObjectId()))
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (player.isInDuel())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (player.isAfraid())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (player.isCombatFlagEquipped())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (player.isFlying() || player.isFlyingMounted())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (player.isInOlympiadMode())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if ((GrandBossManager.getInstance().getZone(player) != null) && !player.canOverrideCond(PcCondOverride.SKILL_CONDITIONS))
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
return _val == canTeleport;
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Player Can Escape condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanEscape extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanEscape(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canTeleport = true;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (player.isInDuel())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (player.isControlBlocked())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (player.isCombatFlagEquipped())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (player.isFlying() || player.isFlyingMounted())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (player.isInOlympiadMode())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
return (_val == canTeleport);
|
||||
}
|
||||
}
|
@ -1,117 +1,113 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Player Can Resurrect condition implementation.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ConditionPlayerCanResurrect extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanResurrect(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
// Need skill rework for fix that properly
|
||||
if (skill.getAffectRange() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (effected == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
boolean canResurrect = true;
|
||||
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
final L2PcInstance player = effected.getActingPlayer();
|
||||
if (!player.isDead())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
msg.addSkillName(skill);
|
||||
effector.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
else if (player.isResurrectionBlocked())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.REJECT_RESURRECTION);
|
||||
}
|
||||
}
|
||||
else if (player.isReviveRequested())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.RESURRECTION_HAS_ALREADY_BEEN_PROPOSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (effected.isSummon())
|
||||
{
|
||||
final L2Summon summon = (L2Summon) effected;
|
||||
final L2PcInstance player = summon.getOwner();
|
||||
if (!summon.isDead())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
msg.addSkillName(skill);
|
||||
effector.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
else if (summon.isResurrectionBlocked())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.REJECT_RESURRECTION);
|
||||
}
|
||||
}
|
||||
else if ((player != null) && player.isRevivingPet())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.RESURRECTION_HAS_ALREADY_BEEN_PROPOSED); // Resurrection is already been proposed.
|
||||
}
|
||||
}
|
||||
}
|
||||
return _val == canResurrect;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Player Can Resurrect condition implementation.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ConditionPlayerCanResurrect extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanResurrect(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
// Need skill rework for fix that properly
|
||||
if (skill.getAffectRange() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
boolean canResurrect = true;
|
||||
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
final L2PcInstance player = effected.getActingPlayer();
|
||||
if (!player.isDead())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
msg.addSkillName(skill);
|
||||
effector.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
else if (player.isResurrectionBlocked())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.REJECT_RESURRECTION);
|
||||
}
|
||||
}
|
||||
else if (player.isReviveRequested())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.RESURRECTION_HAS_ALREADY_BEEN_PROPOSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (effected.isSummon())
|
||||
{
|
||||
final L2Summon summon = (L2Summon) effected;
|
||||
final L2PcInstance player = summon.getOwner();
|
||||
if (!summon.isDead())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
msg.addSkillName(skill);
|
||||
effector.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
else if (summon.isResurrectionBlocked())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.REJECT_RESURRECTION);
|
||||
}
|
||||
}
|
||||
else if ((player != null) && player.isRevivingPet())
|
||||
{
|
||||
canResurrect = false;
|
||||
if (effector.isPlayer())
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.RESURRECTION_HAS_ALREADY_BEEN_PROPOSED); // Resurrection is already been proposed.
|
||||
}
|
||||
}
|
||||
}
|
||||
return (_val == canResurrect);
|
||||
}
|
||||
}
|
||||
|
@ -1,67 +1,67 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Can Summon condition implementation.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerCanSummonPet extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanSummonPet(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean canSummon = true;
|
||||
|
||||
if (Config.RESTORE_PET_ON_RECONNECT && CharSummonTable.getInstance().getPets().containsKey(player.getObjectId()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_MULTIPLE_PETS_AT_THE_SAME_TIME);
|
||||
canSummon = false;
|
||||
}
|
||||
else if (player.hasPet())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_MULTIPLE_PETS_AT_THE_SAME_TIME);
|
||||
canSummon = false;
|
||||
}
|
||||
else if (player.isFlyingMounted() || player.isMounted() || player.inObserverMode() || player.isTeleporting())
|
||||
{
|
||||
canSummon = false;
|
||||
}
|
||||
return _val == canSummon;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Can Summon condition implementation.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerCanSummonPet extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanSummonPet(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean canSummon = true;
|
||||
|
||||
if (Config.RESTORE_PET_ON_RECONNECT && CharSummonTable.getInstance().getPets().containsKey(player.getObjectId()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_MULTIPLE_PETS_AT_THE_SAME_TIME);
|
||||
canSummon = false;
|
||||
}
|
||||
else if (player.hasPet())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_MULTIPLE_PETS_AT_THE_SAME_TIME);
|
||||
canSummon = false;
|
||||
}
|
||||
else if (player.isFlyingMounted() || player.isMounted() || player.inObserverMode() || player.isTeleporting())
|
||||
{
|
||||
canSummon = false;
|
||||
}
|
||||
return (_val == canSummon);
|
||||
}
|
||||
}
|
||||
|
@ -1,76 +1,81 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Can Summon Siege Golem implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanSummonSiegeGolem extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanSummonSiegeGolem(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
boolean canSummonSiegeGolem = !player.isAlikeDead() && !player.isCursedWeaponEquipped() && (player.getClan() != null);
|
||||
final Castle castle = CastleManager.getInstance().getCastle(player);
|
||||
final Fort fort = FortManager.getInstance().getFort(player);
|
||||
if ((castle == null) && (fort == null))
|
||||
{
|
||||
canSummonSiegeGolem = false;
|
||||
}
|
||||
|
||||
if (((fort != null) && (fort.getResidenceId() == 0)) || ((castle != null) && (castle.getResidenceId() == 0)))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
canSummonSiegeGolem = false;
|
||||
}
|
||||
else if (((castle != null) && !castle.getSiege().isInProgress()) || ((fort != null) && !fort.getSiege().isInProgress()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
canSummonSiegeGolem = false;
|
||||
}
|
||||
else if ((player.getClanId() != 0) && (((castle != null) && (castle.getSiege().getAttackerClan(player.getClanId()) == null)) || ((fort != null) && (fort.getSiege().getAttackerClan(player.getClanId()) == null))))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
canSummonSiegeGolem = false;
|
||||
}
|
||||
return _val == canSummonSiegeGolem;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Can Summon Siege Golem implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanSummonSiegeGolem extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanSummonSiegeGolem(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
boolean canSummonSiegeGolem = true;
|
||||
if (player.isAlikeDead() || player.isCursedWeaponEquipped() || (player.getClan() == null))
|
||||
{
|
||||
canSummonSiegeGolem = false;
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastle(player);
|
||||
final Fort fort = FortManager.getInstance().getFort(player);
|
||||
if ((castle == null) && (fort == null))
|
||||
{
|
||||
canSummonSiegeGolem = false;
|
||||
}
|
||||
|
||||
if (((fort != null) && (fort.getResidenceId() == 0)) || ((castle != null) && (castle.getResidenceId() == 0)))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
canSummonSiegeGolem = false;
|
||||
}
|
||||
else if (((castle != null) && !castle.getSiege().isInProgress()) || ((fort != null) && !fort.getSiege().isInProgress()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
canSummonSiegeGolem = false;
|
||||
}
|
||||
else if ((player.getClanId() != 0) && (((castle != null) && (castle.getSiege().getAttackerClan(player.getClanId()) == null)) || ((fort != null) && (fort.getSiege().getAttackerClan(player.getClanId()) == null))))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
canSummonSiegeGolem = false;
|
||||
}
|
||||
return (_val == canSummonSiegeGolem);
|
||||
}
|
||||
}
|
||||
|
@ -1,87 +1,89 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Checks Sweeper conditions:
|
||||
* <ul>
|
||||
* <li>Minimum checks, player not null, skill not null.</li>
|
||||
* <li>Checks if the target isn't null, is dead and spoiled.</li>
|
||||
* <li>Checks if the sweeper player is the target spoiler, or is in the spoiler party.</li>
|
||||
* <li>Checks if the corpse is too old.</li>
|
||||
* <li>Checks inventory limit and weight max load won't be exceed after sweep.</li>
|
||||
* </ul>
|
||||
* If two or more conditions aren't meet at the same time, one message per condition will be shown.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerCanSweep extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanSweep(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canSweep = false;
|
||||
if (effector.getActingPlayer() != null)
|
||||
{
|
||||
final L2PcInstance sweeper = effector.getActingPlayer();
|
||||
if (skill != null)
|
||||
{
|
||||
final L2Object[] targets = skill.getTargetList(sweeper);
|
||||
if (targets != null)
|
||||
{
|
||||
L2Attackable target;
|
||||
for (L2Object objTarget : targets)
|
||||
{
|
||||
if (objTarget instanceof L2Attackable)
|
||||
{
|
||||
target = (L2Attackable) objTarget;
|
||||
if (target.isDead())
|
||||
{
|
||||
if (target.isSpoiled())
|
||||
{
|
||||
canSweep = target.checkSpoilOwner(sweeper, true);
|
||||
canSweep &= !target.isOldCorpse(sweeper, Config.CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY, true);
|
||||
canSweep &= sweeper.getInventory().checkInventorySlotsAndWeight(target.getSpoilLootItems(), true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
sweeper.sendPacket(SystemMessageId.SWEEPER_FAILED_TARGET_NOT_SPOILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return _val == canSweep;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Checks Sweeper conditions:
|
||||
* <ul>
|
||||
* <li>Minimum checks, player not null, skill not null.</li>
|
||||
* <li>Checks if the target isn't null, is dead and spoiled.</li>
|
||||
* <li>Checks if the sweeper player is the target spoiler, or is in the spoiler party.</li>
|
||||
* <li>Checks if the corpse is too old.</li>
|
||||
* <li>Checks inventory limit and weight max load won't be exceed after sweep.</li>
|
||||
* </ul>
|
||||
* If two or more conditions aren't meet at the same time, one message per condition will be shown.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerCanSweep extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanSweep(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final AtomicBoolean canSweep = new AtomicBoolean(false);
|
||||
if (effector.getActingPlayer() != null)
|
||||
{
|
||||
final L2PcInstance sweeper = effector.getActingPlayer();
|
||||
if (skill != null)
|
||||
{
|
||||
skill.forEachTargetAffected(sweeper, effected, o ->
|
||||
{
|
||||
if (o instanceof L2Attackable)
|
||||
{
|
||||
final L2Attackable target = (L2Attackable) o;
|
||||
if (target.isDead())
|
||||
{
|
||||
if (target.isSpoiled())
|
||||
{
|
||||
canSweep.set(target.checkSpoilOwner(sweeper, true));
|
||||
if (canSweep.get())
|
||||
{
|
||||
canSweep.set(!target.isOldCorpse(sweeper, Config.CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY, true));
|
||||
}
|
||||
if (canSweep.get())
|
||||
{
|
||||
canSweep.set(sweeper.getInventory().checkInventorySlotsAndWeight(target.getSpoilLootItems(), true, true));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sweeper.sendPacket(SystemMessageId.SWEEPER_FAILED_TARGET_NOT_SPOILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return (_val == canSweep.get());
|
||||
}
|
||||
}
|
||||
|
@ -1,79 +1,85 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerCanSwitchSubclass extends Condition
|
||||
{
|
||||
private final int _subIndex;
|
||||
|
||||
public ConditionPlayerCanSwitchSubclass(int subIndex)
|
||||
{
|
||||
_subIndex = subIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canSwitchSub = true;
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if ((player == null) || player.isAlikeDead())
|
||||
{
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (((_subIndex != 0) && (player.getSubClasses().get(_subIndex) == null)) || (player.getClassIndex() == _subIndex))
|
||||
{
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (!player.isInventoryUnder90(true))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.A_SUBCLASS_CANNOT_BE_CREATED_OR_CHANGED_BECAUSE_YOU_HAVE_EXCEEDED_YOUR_INVENTORY_LIMIT);
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (player.getWeightPenalty() >= 2)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.A_SUBCLASS_CANNOT_BE_CREATED_OR_CHANGED_WHILE_YOU_ARE_OVER_YOUR_WEIGHT_LIMIT);
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (player.isAllSkillsDisabled())
|
||||
{
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (player.isAffected(EffectFlag.MUTED))
|
||||
{
|
||||
canSwitchSub = false;
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CHANGE_THE_CLASS_BECAUSE_OF_IDENTITY_CRISIS);
|
||||
}
|
||||
else if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player) || (player.getPvpFlag() > 0) || (player.getInstanceId() > 0) || player.isTransformed() || player.isMounted())
|
||||
{
|
||||
canSwitchSub = false;
|
||||
}
|
||||
|
||||
return canSwitchSub;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.ceremonyofchaos.CeremonyOfChaosEvent;
|
||||
import com.l2jmobius.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerCanSwitchSubclass extends Condition
|
||||
{
|
||||
private final int _subIndex;
|
||||
|
||||
public ConditionPlayerCanSwitchSubclass(int subIndex)
|
||||
{
|
||||
_subIndex = subIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canSwitchSub = true;
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if ((player == null) || player.isAlikeDead())
|
||||
{
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (((_subIndex != 0) && (player.getSubClasses().get(_subIndex) == null)) || (player.getClassIndex() == _subIndex))
|
||||
{
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (!player.isInventoryUnder90(true))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.A_SUBCLASS_CANNOT_BE_CREATED_OR_CHANGED_BECAUSE_YOU_HAVE_EXCEEDED_YOUR_INVENTORY_LIMIT);
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (player.getWeightPenalty() >= 2)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.A_SUBCLASS_CANNOT_BE_CREATED_OR_CHANGED_WHILE_YOU_ARE_OVER_YOUR_WEIGHT_LIMIT);
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (player.isOnEvent(CeremonyOfChaosEvent.class))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CHANGE_YOUR_SUBCLASS_WHILE_REGISTERED_IN_THE_CEREMONY_OF_CHAOS);
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (player.isAllSkillsDisabled())
|
||||
{
|
||||
canSwitchSub = false;
|
||||
}
|
||||
else if (player.isAffected(EffectFlag.MUTED))
|
||||
{
|
||||
canSwitchSub = false;
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CHANGE_THE_CLASS_BECAUSE_OF_IDENTITY_CRISIS);
|
||||
}
|
||||
else if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player) || (player.getPvpFlag() > 0) || player.isInInstance() || player.isTransformed() || player.isMounted())
|
||||
{
|
||||
canSwitchSub = false;
|
||||
}
|
||||
|
||||
return canSwitchSub;
|
||||
}
|
||||
}
|
||||
|
@ -1,72 +1,78 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Player Can Take Castle condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanTakeCastle extends Condition
|
||||
{
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
|
||||
if (player.isAlikeDead() || player.isCursedWeaponEquipped() || !player.isClanLeader())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastle(player);
|
||||
SystemMessage sm;
|
||||
if ((castle == null) || (castle.getResidenceId() <= 0) || !castle.getSiege().isInProgress() || (castle.getSiege().getAttackerClan(player.getClan()) == null))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
return false;
|
||||
}
|
||||
else if (!castle.getArtefacts().contains(effected))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
return false;
|
||||
}
|
||||
else if (!Util.checkIfInRange(skill.getCastRange(), player, effected, true))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
|
||||
return false;
|
||||
}
|
||||
castle.getSiege().announceToPlayer(SystemMessage.getSystemMessage(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED), false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Player Can Take Castle condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanTakeCastle extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanTakeCastle(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
boolean canTakeCastle = true;
|
||||
if (player.isAlikeDead() || player.isCursedWeaponEquipped() || !player.isClanLeader())
|
||||
{
|
||||
canTakeCastle = false;
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastle(player);
|
||||
SystemMessage sm;
|
||||
if ((castle == null) || (castle.getResidenceId() <= 0) || !castle.getSiege().isInProgress() || (castle.getSiege().getAttackerClan(player.getClan()) == null))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canTakeCastle = false;
|
||||
}
|
||||
else if (!castle.getArtefacts().contains(effected))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
canTakeCastle = false;
|
||||
}
|
||||
else if (!Util.checkIfInRange(skill.getCastRange(), player, effected, true))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
|
||||
canTakeCastle = false;
|
||||
}
|
||||
return (_val == canTakeCastle);
|
||||
}
|
||||
}
|
||||
|
@ -1,73 +1,78 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Player Can Take Fort condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanTakeFort extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanTakeFort(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
boolean canTakeFort = !player.isAlikeDead() && !player.isCursedWeaponEquipped() && player.isClanLeader();
|
||||
final Fort fort = FortManager.getInstance().getFort(player);
|
||||
final SystemMessage sm;
|
||||
if ((fort == null) || (fort.getResidenceId() <= 0) || !fort.getSiege().isInProgress() || (fort.getSiege().getAttackerClan(player.getClan()) == null))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canTakeFort = false;
|
||||
}
|
||||
else if (fort.getFlagPole() != effected)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
canTakeFort = false;
|
||||
}
|
||||
else if (!Util.checkIfInRange(200, player, effected, true))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
|
||||
canTakeFort = false;
|
||||
}
|
||||
return _val == canTakeFort;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Player Can Take Fort condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanTakeFort extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanTakeFort(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
boolean canTakeFort = true;
|
||||
if (player.isAlikeDead() || player.isCursedWeaponEquipped() || !player.isClanLeader())
|
||||
{
|
||||
canTakeFort = false;
|
||||
}
|
||||
|
||||
final Fort fort = FortManager.getInstance().getFort(player);
|
||||
final SystemMessage sm;
|
||||
if ((fort == null) || (fort.getResidenceId() <= 0) || !fort.getSiege().isInProgress() || (fort.getSiege().getAttackerClan(player.getClan()) == null))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canTakeFort = false;
|
||||
}
|
||||
else if (fort.getFlagPole() != effected)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
canTakeFort = false;
|
||||
}
|
||||
else if (!Util.checkIfInRange(200, player, effected, true))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
|
||||
canTakeFort = false;
|
||||
}
|
||||
return (_val == canTakeFort);
|
||||
}
|
||||
}
|
||||
|
@ -1,69 +1,69 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Can Transform condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanTransform extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanTransform(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canTransform = true;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if ((player == null) || player.isAlikeDead() || player.isCursedWeaponEquipped())
|
||||
{
|
||||
canTransform = false;
|
||||
}
|
||||
else if (player.isSitting())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
|
||||
canTransform = false;
|
||||
}
|
||||
else if (player.isTransformed() || player.isInStance())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
|
||||
canTransform = false;
|
||||
}
|
||||
else if (player.isInWater())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
|
||||
canTransform = false;
|
||||
}
|
||||
else if (player.isFlyingMounted() || player.isMounted())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
|
||||
canTransform = false;
|
||||
}
|
||||
return _val == canTransform;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Can Transform condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanTransform extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanTransform(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canTransform = true;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if ((player == null) || player.isAlikeDead() || player.isCursedWeaponEquipped())
|
||||
{
|
||||
canTransform = false;
|
||||
}
|
||||
else if (player.isSitting())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
|
||||
canTransform = false;
|
||||
}
|
||||
else if (player.isTransformed())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
|
||||
canTransform = false;
|
||||
}
|
||||
else if (player.isInWater())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
|
||||
canTransform = false;
|
||||
}
|
||||
else if (player.isFlyingMounted() || player.isMounted())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
|
||||
canTransform = false;
|
||||
}
|
||||
return (_val == canTransform);
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,59 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Can Untransform condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanUntransform extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanUntransform(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canUntransform = true;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
canUntransform = false;
|
||||
}
|
||||
else if (player.isAlikeDead() || player.isCursedWeaponEquipped())
|
||||
{
|
||||
canUntransform = false;
|
||||
}
|
||||
else if ((player.isTransformed() || player.isInStance()) && player.isFlyingMounted() && !player.isInsideZone(ZoneId.LANDING))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_TOO_HIGH_TO_PERFORM_THIS_ACTION_PLEASE_LOWER_YOUR_ALTITUDE_AND_TRY_AGAIN); // TODO: check if message is retail like.
|
||||
canUntransform = false;
|
||||
}
|
||||
return _val == canUntransform;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Player Can Untransform condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanUntransform extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanUntransform(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canUntransform = true;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
canUntransform = false;
|
||||
}
|
||||
else if (player.isAlikeDead() || player.isCursedWeaponEquipped())
|
||||
{
|
||||
canUntransform = false;
|
||||
}
|
||||
else if (player.isFlyingMounted() && !player.isInsideZone(ZoneId.LANDING))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_TOO_HIGH_TO_PERFORM_THIS_ACTION_PLEASE_LOWER_YOUR_ALTITUDE_AND_TRY_AGAIN); // TODO: check if message is retail like.
|
||||
canUntransform = false;
|
||||
}
|
||||
return (_val == canUntransform);
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +1,61 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Condition implementation to verify player's abnormal type and level.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerCheckAbnormal extends Condition
|
||||
{
|
||||
private final AbnormalType _type;
|
||||
private final int _level;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player check abnormal.
|
||||
* @param type the abnormal type
|
||||
*/
|
||||
public ConditionPlayerCheckAbnormal(AbnormalType type)
|
||||
{
|
||||
_type = type;
|
||||
_level = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player check abnormal.
|
||||
* @param type the abnormal type
|
||||
* @param level the abnormal level
|
||||
*/
|
||||
public ConditionPlayerCheckAbnormal(AbnormalType type, int level)
|
||||
{
|
||||
_type = type;
|
||||
_level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final BuffInfo info = effector.getEffectList().getBuffInfoByAbnormalType(_type);
|
||||
return (info != null) && ((_level == -1) || (_level >= info.getSkill().getAbnormalLvl()));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Condition implementation to verify player's abnormal type and level.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerCheckAbnormal extends Condition
|
||||
{
|
||||
private final AbnormalType _type;
|
||||
private final int _level;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player check abnormal.
|
||||
* @param type the abnormal type
|
||||
*/
|
||||
public ConditionPlayerCheckAbnormal(AbnormalType type)
|
||||
{
|
||||
_type = type;
|
||||
_level = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player check abnormal.
|
||||
* @param type the abnormal type
|
||||
* @param level the abnormal level
|
||||
*/
|
||||
public ConditionPlayerCheckAbnormal(AbnormalType type, int level)
|
||||
{
|
||||
_type = type;
|
||||
_level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final BuffInfo info = effector.getEffectList().getBuffInfoByAbnormalType(_type);
|
||||
return ((info != null) && ((_level == -1) || (_level >= info.getSkill().getAbnormalLvl())));
|
||||
}
|
||||
}
|
||||
|
@ -1,46 +1,46 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerClassIdRestriction.
|
||||
*/
|
||||
public class ConditionPlayerClassIdRestriction extends Condition
|
||||
{
|
||||
private final List<Integer> _classIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player class id restriction.
|
||||
* @param classId the class id
|
||||
*/
|
||||
public ConditionPlayerClassIdRestriction(List<Integer> classId)
|
||||
{
|
||||
_classIds = classId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && _classIds.contains(effector.getActingPlayer().getClassId().getId());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerClassIdRestriction.
|
||||
*/
|
||||
public class ConditionPlayerClassIdRestriction extends Condition
|
||||
{
|
||||
private final List<Integer> _classIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player class id restriction.
|
||||
* @param classId the class id
|
||||
*/
|
||||
public ConditionPlayerClassIdRestriction(List<Integer> classId)
|
||||
{
|
||||
_classIds = classId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (_classIds.contains(effector.getActingPlayer().getClassId().getId()));
|
||||
}
|
||||
}
|
||||
|
@ -1,46 +1,41 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerHasServitor.
|
||||
* @author Zealar
|
||||
*/
|
||||
public class ConditionPlayerHasServitor extends Condition
|
||||
{
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!effector.getActingPlayer().hasSummon())
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.YOU_CANNOT_USE_THE_SKILL_BECAUSE_THE_SERVITOR_HAS_NOT_BEEN_SUMMONED);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
public class ConditionPlayerDualclass extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerDualclass(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return effector.getActingPlayer().isDualClassActive() == _val;
|
||||
}
|
||||
}
|
@ -1,68 +1,68 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerHasClanHall.
|
||||
* @author MrPoke
|
||||
*/
|
||||
public final class ConditionPlayerHasClanHall extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _clanHall;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player has clan hall.
|
||||
* @param clanHall the clan hall
|
||||
*/
|
||||
public ConditionPlayerHasClanHall(ArrayList<Integer> clanHall)
|
||||
{
|
||||
_clanHall = clanHall;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2Clan clan = effector.getActingPlayer().getClan();
|
||||
if (clan == null)
|
||||
{
|
||||
return (_clanHall.size() == 1) && (_clanHall.get(0) == 0);
|
||||
}
|
||||
|
||||
// All Clan Hall
|
||||
if ((_clanHall.size() == 1) && (_clanHall.get(0) == -1))
|
||||
{
|
||||
return clan.getHideoutId() > 0;
|
||||
}
|
||||
return _clanHall.contains(clan.getHideoutId());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerHasClanHall.
|
||||
* @author MrPoke
|
||||
*/
|
||||
public final class ConditionPlayerHasClanHall extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _clanHall;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player has clan hall.
|
||||
* @param clanHall the clan hall
|
||||
*/
|
||||
public ConditionPlayerHasClanHall(ArrayList<Integer> clanHall)
|
||||
{
|
||||
_clanHall = clanHall;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2Clan clan = effector.getActingPlayer().getClan();
|
||||
if (clan == null)
|
||||
{
|
||||
return ((_clanHall.size() == 1) && (_clanHall.get(0) == 0));
|
||||
}
|
||||
|
||||
// All Clan Hall
|
||||
if ((_clanHall.size() == 1) && (_clanHall.get(0) == -1))
|
||||
{
|
||||
return clan.getHideoutId() > 0;
|
||||
}
|
||||
return _clanHall.contains(clan.getHideoutId());
|
||||
}
|
||||
}
|
||||
|
@ -1,64 +1,64 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerHasFreeSummonPoints extends Condition
|
||||
{
|
||||
private final int _summonPoints;
|
||||
|
||||
public ConditionPlayerHasFreeSummonPoints(int summonPoints)
|
||||
{
|
||||
_summonPoints = summonPoints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean canSummon = true;
|
||||
|
||||
if ((_summonPoints == 0) && player.hasServitors())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_USE_THE_S1_SKILL_DUE_TO_INSUFFICIENT_SUMMON_POINTS);
|
||||
canSummon = false;
|
||||
}
|
||||
else if ((player.getUsedSummonPoints() + _summonPoints) > player.getMaxSummonPoints())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_USE_THE_S1_SKILL_DUE_TO_INSUFFICIENT_SUMMON_POINTS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canSummon = false;
|
||||
}
|
||||
|
||||
return canSummon;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerHasFreeSummonPoints extends Condition
|
||||
{
|
||||
private final int _summonPoints;
|
||||
|
||||
public ConditionPlayerHasFreeSummonPoints(int summonPoints)
|
||||
{
|
||||
_summonPoints = summonPoints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean canSummon = true;
|
||||
|
||||
if ((_summonPoints == 0) && player.hasServitors())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_USE_THE_S1_SKILL_DUE_TO_INSUFFICIENT_SUMMON_POINTS);
|
||||
canSummon = false;
|
||||
}
|
||||
else if ((player.getSummonPoints() + _summonPoints) > player.getMaxSummonPoints())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_USE_THE_S1_SKILL_DUE_TO_INSUFFICIENT_SUMMON_POINTS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
canSummon = false;
|
||||
}
|
||||
|
||||
return canSummon;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerHasFreeTeleportBookmarkSlots extends Condition
|
||||
{
|
||||
private final int _teleportBookmarkSlots;
|
||||
|
||||
public ConditionPlayerHasFreeTeleportBookmarkSlots(int teleportBookmarkSlots)
|
||||
{
|
||||
_teleportBookmarkSlots = teleportBookmarkSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((player.getBookMarkSlot() + _teleportBookmarkSlots) > 9)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOUR_NUMBER_OF_MY_TELEPORTS_SLOTS_HAS_REACHED_ITS_MAXIMUM_LIMIT);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,47 +1,47 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.TvTEvent;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerTvTEvent.
|
||||
*/
|
||||
public class ConditionPlayerTvTEvent extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player tv t event.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerTvTEvent(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
return (player == null) || !TvTEvent.isStarted() ? !_val : TvTEvent.isPlayerParticipant(player.getObjectId()) == _val;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerHasSummon extends Condition
|
||||
{
|
||||
private final boolean _hasSummon;
|
||||
|
||||
public ConditionPlayerHasSummon(boolean hasSummon)
|
||||
{
|
||||
_hasSummon = hasSummon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _hasSummon == player.hasSummon();
|
||||
}
|
||||
}
|
@ -1,40 +1,41 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerImmobile extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerImmobile(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return _val == !effector.isMovementDisabled();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerImmobile extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerImmobile(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final boolean isImmobile = !effector.isMovementDisabled();
|
||||
return _val == isImmobile;
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,44 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author NviX
|
||||
*/
|
||||
public class ConditionTargetHp extends Condition
|
||||
{
|
||||
private final int _hp;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target hp.
|
||||
* @param hp the hp
|
||||
*/
|
||||
public ConditionTargetHp(int hp)
|
||||
{
|
||||
_hp = hp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effected != null) && (((effected.getCurrentHp() * 100) / effected.getMaxHp()) <= _hp);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerInInstance extends Condition
|
||||
{
|
||||
public final boolean _inInstance;
|
||||
|
||||
public ConditionPlayerInInstance(boolean inInstance)
|
||||
{
|
||||
_inInstance = inInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (effector.getInstanceId() == 0) ? !_inInstance : _inInstance;
|
||||
}
|
||||
}
|
@ -1,60 +1,55 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.instancezone.InstanceWorld;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerInstanceId.
|
||||
*/
|
||||
public class ConditionPlayerInstanceId extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _instanceIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player instance id.
|
||||
* @param instanceIds the instance ids
|
||||
*/
|
||||
public ConditionPlayerInstanceId(ArrayList<Integer> instanceIds)
|
||||
{
|
||||
_instanceIds = instanceIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int instanceId = effector.getInstanceId();
|
||||
if (instanceId <= 0)
|
||||
{
|
||||
return false; // player not in instance
|
||||
}
|
||||
|
||||
final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(effector.getActingPlayer());
|
||||
return (world != null) && (world.getInstanceId() == instanceId) && _instanceIds.contains(world.getTemplateId());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerInstanceId.
|
||||
*/
|
||||
public class ConditionPlayerInstanceId extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _instanceIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player instance id.
|
||||
* @param instanceIds the instance ids
|
||||
*/
|
||||
public ConditionPlayerInstanceId(ArrayList<Integer> instanceIds)
|
||||
{
|
||||
_instanceIds = instanceIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Instance instance = player.getInstanceWorld();
|
||||
return (instance == null) ? false : _instanceIds.contains(instance.getTemplateId());
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +1,50 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerInvSize.
|
||||
* @author Kerberos
|
||||
*/
|
||||
public class ConditionPlayerInvSize extends Condition
|
||||
{
|
||||
private final int _size;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player inv size.
|
||||
* @param size the size
|
||||
*/
|
||||
public ConditionPlayerInvSize(int size)
|
||||
{
|
||||
_size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() == null) || (effector.getActingPlayer().getInventory().getSize(false) <= (effector.getActingPlayer().getInventoryLimit() - _size));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerInvSize.
|
||||
* @author Kerberos
|
||||
*/
|
||||
public class ConditionPlayerInvSize extends Condition
|
||||
{
|
||||
|
||||
private final int _size;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player inv size.
|
||||
* @param size the size
|
||||
*/
|
||||
public ConditionPlayerInvSize(int size)
|
||||
{
|
||||
_size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() != null)
|
||||
{
|
||||
return effector.getActingPlayer().getInventory().getSize(i -> !i.isQuestItem()) <= (effector.getActingPlayer().getInventoryLimit() - _size);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,48 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerIsClanLeader.
|
||||
*/
|
||||
public class ConditionPlayerIsClanLeader extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player is clan leader.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerIsClanLeader(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (effector.getActingPlayer().isClanLeader() == _val);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerIsClanLeader.
|
||||
*/
|
||||
public class ConditionPlayerIsClanLeader extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player is clan leader.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerIsClanLeader(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (effector.getActingPlayer().isClanLeader() == _val);
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,48 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerIsHero.
|
||||
*/
|
||||
public class ConditionPlayerIsHero extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player is hero.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerIsHero(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (effector.getActingPlayer().isHero() == _val);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerIsHero.
|
||||
*/
|
||||
public class ConditionPlayerIsHero extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player is hero.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerIsHero(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (effector.getActingPlayer().isHero() == _val);
|
||||
}
|
||||
}
|
||||
|
@ -1,41 +1,42 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerIsInCombat extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerIsInCombat(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return _val == !AttackStanceTaskManager.getInstance().hasAttackStanceTask(effector);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerIsInCombat extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerIsInCombat(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final boolean isInCombat = !AttackStanceTaskManager.getInstance().hasAttackStanceTask(effector);
|
||||
return _val == isInCombat;
|
||||
}
|
||||
}
|
||||
|
@ -1,46 +1,50 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.CastleSide;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerIsOnSide.
|
||||
* @author St3eT
|
||||
*/
|
||||
public class ConditionPlayerIsOnSide extends Condition
|
||||
{
|
||||
private final CastleSide _side;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player race.
|
||||
* @param side the allowed Castle side.
|
||||
*/
|
||||
public ConditionPlayerIsOnSide(CastleSide side)
|
||||
{
|
||||
_side = side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector != null) && effector.isPlayer() && (effector.getActingPlayer().getPlayerSide() == _side);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.CastleSide;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerIsOnSide.
|
||||
* @author St3eT
|
||||
*/
|
||||
public class ConditionPlayerIsOnSide extends Condition
|
||||
{
|
||||
private final CastleSide _side;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player race.
|
||||
* @param side the allowed Castle side.
|
||||
*/
|
||||
public ConditionPlayerIsOnSide(CastleSide side)
|
||||
{
|
||||
_side = side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return effector.getActingPlayer().getPlayerSide() == _side;
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +1,45 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerLevelRange extends Condition
|
||||
{
|
||||
private final int[] _levels;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player levels range.
|
||||
* @param levels the {@code levels} range.
|
||||
*/
|
||||
public ConditionPlayerLevelRange(int[] levels)
|
||||
{
|
||||
_levels = levels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final int level = effector.getLevel();
|
||||
return (level >= _levels[0]) && (level <= _levels[1]);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerLevelRange extends Condition
|
||||
{
|
||||
private final int[] _levels;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player levels range.
|
||||
* @param levels the {@code levels} range.
|
||||
*/
|
||||
public ConditionPlayerLevelRange(int[] levels)
|
||||
{
|
||||
_levels = levels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final int level = effector.getLevel();
|
||||
return ((level >= _levels[0]) && (level <= _levels[1]));
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,48 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerPkCount.
|
||||
*/
|
||||
public class ConditionPlayerPkCount extends Condition
|
||||
{
|
||||
public final int _pk;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player pk count.
|
||||
* @param pk the pk
|
||||
*/
|
||||
public ConditionPlayerPkCount(int pk)
|
||||
{
|
||||
_pk = pk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getPkKills() <= _pk);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerPkCount.
|
||||
*/
|
||||
public class ConditionPlayerPkCount extends Condition
|
||||
{
|
||||
public final int _pk;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player pk count.
|
||||
* @param pk the pk
|
||||
*/
|
||||
public ConditionPlayerPkCount(int pk)
|
||||
{
|
||||
_pk = pk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return effector.getActingPlayer().getPkKills() <= _pk;
|
||||
}
|
||||
}
|
||||
|
@ -1,49 +1,54 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerPledgeClass.
|
||||
* @author MrPoke
|
||||
*/
|
||||
public final class ConditionPlayerPledgeClass extends Condition
|
||||
{
|
||||
private final int _pledgeClass;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player pledge class.
|
||||
* @param pledgeClass the pledge class
|
||||
*/
|
||||
public ConditionPlayerPledgeClass(int pledgeClass)
|
||||
{
|
||||
_pledgeClass = pledgeClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getClan() != null) && ((_pledgeClass == -1) ? effector.getActingPlayer().isClanLeader() : (effector.getActingPlayer().getPledgeClass() >= _pledgeClass));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerPledgeClass.
|
||||
* @author MrPoke
|
||||
*/
|
||||
public final class ConditionPlayerPledgeClass extends Condition
|
||||
{
|
||||
|
||||
private final int _pledgeClass;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player pledge class.
|
||||
* @param pledgeClass the pledge class
|
||||
*/
|
||||
public ConditionPlayerPledgeClass(int pledgeClass)
|
||||
{
|
||||
_pledgeClass = pledgeClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector.getActingPlayer() == null) || (effector.getActingPlayer().getClan() == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (_pledgeClass == -1) ? effector.getActingPlayer().isClanLeader() : (effector.getActingPlayer().getPledgeClass() >= _pledgeClass);
|
||||
}
|
||||
}
|
||||
|
@ -1,47 +1,51 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerRace.
|
||||
* @author mkizub, Zoey76
|
||||
*/
|
||||
public class ConditionPlayerRace extends Condition
|
||||
{
|
||||
private final Race[] _races;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player race.
|
||||
* @param races the list containing the allowed races.
|
||||
*/
|
||||
public ConditionPlayerRace(Race[] races)
|
||||
{
|
||||
_races = races;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector != null) && effector.isPlayer() && Util.contains(_races, effector.getActingPlayer().getRace());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.commons.util.CommonUtil;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerRace.
|
||||
* @author mkizub, Zoey76
|
||||
*/
|
||||
public class ConditionPlayerRace extends Condition
|
||||
{
|
||||
private final Race[] _races;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player race.
|
||||
* @param races the list containing the allowed races.
|
||||
*/
|
||||
public ConditionPlayerRace(Race[] races)
|
||||
{
|
||||
_races = races;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return CommonUtil.contains(_races, effector.getActingPlayer().getRace());
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +1,63 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Exist NPC condition.
|
||||
* @author UnAfraid, Zoey76
|
||||
*/
|
||||
public class ConditionPlayerRangeFromNpc extends Condition
|
||||
{
|
||||
/** NPC Ids. */
|
||||
private final int[] _npcIds;
|
||||
/** Radius to check. */
|
||||
private final int _radius;
|
||||
/** Expected value. */
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerRangeFromNpc(int[] npcIds, int radius, boolean val)
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
_radius = radius;
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean existNpc = false;
|
||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
||||
{
|
||||
for (L2Character target : effector.getKnownList().getKnownCharactersInRadius(_radius))
|
||||
{
|
||||
if (target.isNpc() && Util.contains(_npcIds, target.getId()))
|
||||
{
|
||||
existNpc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return existNpc == _val;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.commons.util.CommonUtil;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Exist NPC condition.
|
||||
* @author UnAfraid, Zoey76
|
||||
*/
|
||||
public class ConditionPlayerRangeFromNpc extends Condition
|
||||
{
|
||||
/** NPC Ids. */
|
||||
private final int[] _npcIds;
|
||||
/** Radius to check. */
|
||||
private final int _radius;
|
||||
/** Expected value. */
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerRangeFromNpc(int[] npcIds, int radius, boolean val)
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
_radius = radius;
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean existNpc = false;
|
||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
||||
{
|
||||
for (L2Npc target : L2World.getInstance().getVisibleObjects(effector, L2Npc.class, _radius))
|
||||
{
|
||||
if (CommonUtil.contains(_npcIds, target.getId()))
|
||||
{
|
||||
existNpc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return existNpc == _val;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.commons.util.CommonUtil;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Condition which checks if you are within the given range of a summoned by you npc.
|
||||
* @author Nik
|
||||
*/
|
||||
public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
||||
{
|
||||
/** NPC Ids. */
|
||||
private final int[] _npcIds;
|
||||
/** Radius to check. */
|
||||
private final int _radius;
|
||||
/** Expected value. */
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerRangeFromSummonedNpc(int[] npcIds, int radius, boolean val)
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
_radius = radius;
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean existNpc = false;
|
||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
||||
{
|
||||
for (L2Npc target : L2World.getInstance().getVisibleObjects(effector, L2Npc.class, _radius))
|
||||
{
|
||||
if (CommonUtil.contains(_npcIds, target.getId()) && (effector == target.getSummoner()))
|
||||
{
|
||||
existNpc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return existNpc == _val;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerServitorNpcId.
|
||||
*/
|
||||
public class ConditionPlayerServitorNpcId extends Condition
|
||||
{
|
||||
private final List<Integer> _npcIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player servitor npc id.
|
||||
* @param npcIds the npc ids
|
||||
*/
|
||||
public ConditionPlayerServitorNpcId(List<Integer> npcIds)
|
||||
{
|
||||
if ((npcIds.size() == 1) && (npcIds.get(0) == 0))
|
||||
{
|
||||
_npcIds = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector.getActingPlayer() == null) || !effector.getActingPlayer().hasSummon())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_npcIds == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
for (L2Summon summon : effector.getServitors().values())
|
||||
{
|
||||
if (_npcIds.contains(summon.getId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,45 +1,49 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSex.
|
||||
*/
|
||||
public class ConditionPlayerSex extends Condition
|
||||
{
|
||||
// male 0 female 1
|
||||
private final int _sex;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player sex.
|
||||
* @param sex the sex
|
||||
*/
|
||||
public ConditionPlayerSex(int sex)
|
||||
{
|
||||
_sex = sex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && ((effector.getActingPlayer().getAppearance().getSex() ? 1 : 0) == _sex);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSex.
|
||||
*/
|
||||
public class ConditionPlayerSex extends Condition
|
||||
{
|
||||
// male 0 female 1
|
||||
private final int _sex;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player sex.
|
||||
* @param sex the sex
|
||||
*/
|
||||
public ConditionPlayerSex(int sex)
|
||||
{
|
||||
_sex = sex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (effector.getActingPlayer().getAppearance().getSex() ? 1 : 0) == _sex;
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,48 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSiegeSide.
|
||||
*/
|
||||
public class ConditionPlayerSiegeSide extends Condition
|
||||
{
|
||||
private final int _siegeSide;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player siege side.
|
||||
* @param side the side
|
||||
*/
|
||||
public ConditionPlayerSiegeSide(int side)
|
||||
{
|
||||
_siegeSide = side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getSiegeSide() == _siegeSide);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSiegeSide.
|
||||
*/
|
||||
public class ConditionPlayerSiegeSide extends Condition
|
||||
{
|
||||
private final int _siegeSide;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player siege side.
|
||||
* @param side the side
|
||||
*/
|
||||
public ConditionPlayerSiegeSide(int side)
|
||||
{
|
||||
_siegeSide = side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return effector.getActingPlayer().getSiegeSide() == _siegeSide;
|
||||
}
|
||||
}
|
||||
|
@ -1,91 +1,88 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.base.PlayerState;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerState.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionPlayerState extends Condition
|
||||
{
|
||||
private final PlayerState _check;
|
||||
private final boolean _required;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player state.
|
||||
* @param check the player state to be verified.
|
||||
* @param required the required value.
|
||||
*/
|
||||
public ConditionPlayerState(PlayerState check, boolean required)
|
||||
{
|
||||
_check = check;
|
||||
_required = required;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2Character character = effector;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
switch (_check)
|
||||
{
|
||||
case RESTING:
|
||||
{
|
||||
return player != null ? player.isSitting() == _required : !_required;
|
||||
}
|
||||
case MOVING:
|
||||
{
|
||||
return character.isMoving() == _required;
|
||||
}
|
||||
case RUNNING:
|
||||
{
|
||||
return character.isRunning() == _required;
|
||||
}
|
||||
case STANDING:
|
||||
{
|
||||
return player != null ? _required != (player.isSitting() || player.isMoving()) : _required != character.isMoving();
|
||||
}
|
||||
case FLYING:
|
||||
{
|
||||
return character.isFlying() == _required;
|
||||
}
|
||||
case BEHIND:
|
||||
{
|
||||
return character.isBehindTarget() == _required;
|
||||
}
|
||||
case FRONT:
|
||||
{
|
||||
return character.isInFrontOfTarget() == _required;
|
||||
}
|
||||
case CHAOTIC:
|
||||
{
|
||||
return player != null ? (player.getReputation() < 0) == _required : !_required;
|
||||
}
|
||||
case OLYMPIAD:
|
||||
{
|
||||
return player != null ? player.isInOlympiadMode() == _required : !_required;
|
||||
}
|
||||
}
|
||||
return !_required;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.base.PlayerState;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerState.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionPlayerState extends Condition
|
||||
{
|
||||
private final PlayerState _check;
|
||||
private final boolean _required;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player state.
|
||||
* @param check the player state to be verified.
|
||||
* @param required the required value.
|
||||
*/
|
||||
public ConditionPlayerState(PlayerState check, boolean required)
|
||||
{
|
||||
_check = check;
|
||||
_required = required;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
switch (_check)
|
||||
{
|
||||
case RESTING:
|
||||
if (player != null)
|
||||
{
|
||||
return (player.isSitting() == _required);
|
||||
}
|
||||
return !_required;
|
||||
case MOVING:
|
||||
return effector.isMoving() == _required;
|
||||
case RUNNING:
|
||||
return effector.isRunning() == _required;
|
||||
case STANDING:
|
||||
if (player != null)
|
||||
{
|
||||
return (_required != (player.isSitting() || player.isMoving()));
|
||||
}
|
||||
return (_required != effector.isMoving());
|
||||
case FLYING:
|
||||
return (effector.isFlying() == _required);
|
||||
case BEHIND:
|
||||
return (effector.isBehindTarget() == _required);
|
||||
case FRONT:
|
||||
return (effector.isInFrontOfTarget() == _required);
|
||||
case CHAOTIC:
|
||||
if (player != null)
|
||||
{
|
||||
return ((player.getReputation() < 0) == _required);
|
||||
}
|
||||
return !_required;
|
||||
case OLYMPIAD:
|
||||
if (player != null)
|
||||
{
|
||||
return (player.isInOlympiadMode() == _required);
|
||||
}
|
||||
return !_required;
|
||||
}
|
||||
return !_required;
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,48 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSubclass.
|
||||
*/
|
||||
public class ConditionPlayerSubclass extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player subclass.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerSubclass(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() == null) || (effector.getActingPlayer().isSubClassActive() == _val);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSubclass.
|
||||
*/
|
||||
public class ConditionPlayerSubclass extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player subclass.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerSubclass(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return effector.getActingPlayer().isSubClassActive() == _val;
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +1,46 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* This condition becomes true whether the player is transformed and the transformation Id match the parameter or<br>
|
||||
* the parameter is -1 which returns true if player is transformed regardless the transformation Id.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerTransformationId extends Condition
|
||||
{
|
||||
private final int _id;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player is transformed.
|
||||
* @param id the transformation Id.
|
||||
*/
|
||||
public ConditionPlayerTransformationId(int id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
return (player != null) && (_id == -1 ? player.isTransformed() : player.getTransformationId() == _id);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* This condition becomes true whether the player is transformed and the transformation Id match the parameter or<br>
|
||||
* the parameter is -1 which returns true if player is transformed regardless the transformation Id.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerTransformationId extends Condition
|
||||
{
|
||||
private final int _id;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player is transformed.
|
||||
* @param id the transformation Id.
|
||||
*/
|
||||
public ConditionPlayerTransformationId(int id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return _id == -1 ? effector.isTransformed() : effector.getTransformationId() == _id;
|
||||
}
|
||||
}
|
||||
|
@ -1,43 +1,47 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author Nyaran
|
||||
*/
|
||||
public class ConditionPlayerVehicleMounted extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerVehicleMounted(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() == null) || (effector.getActingPlayer().isInVehicle() == _val);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author Nyaran
|
||||
*/
|
||||
public class ConditionPlayerVehicleMounted extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerVehicleMounted(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return (effector.getActingPlayer().isInVehicle() == _val);
|
||||
}
|
||||
}
|
||||
|
@ -1,52 +1,53 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerWeight.
|
||||
* @author Kerberos
|
||||
*/
|
||||
public class ConditionPlayerWeight extends Condition
|
||||
{
|
||||
private final int _weight;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player weight.
|
||||
* @param weight the weight
|
||||
*/
|
||||
public ConditionPlayerWeight(int weight)
|
||||
{
|
||||
_weight = weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if ((player != null) && (player.getMaxLoad() > 0))
|
||||
{
|
||||
final int weightproc = ((player.getCurrentLoad() - player.getBonusWeightPenalty()) * 100) / player.getMaxLoad();
|
||||
return (weightproc < _weight) || player.getDietMode();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerWeight.
|
||||
* @author Kerberos
|
||||
*/
|
||||
public class ConditionPlayerWeight extends Condition
|
||||
{
|
||||
|
||||
private final int _weight;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player weight.
|
||||
* @param weight the weight
|
||||
*/
|
||||
public ConditionPlayerWeight(int weight)
|
||||
{
|
||||
_weight = weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if ((player != null) && (player.getMaxLoad() > 0))
|
||||
{
|
||||
final int weightproc = (((player.getCurrentLoad() - player.getBonusWeightPenalty()) * 100) / player.getMaxLoad());
|
||||
return (weightproc < _weight) || player.getDietMode();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,166 +1,167 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionSiegeZone.
|
||||
* @author Gigiikun
|
||||
*/
|
||||
public final class ConditionSiegeZone extends Condition
|
||||
{
|
||||
// conditional values
|
||||
public static final int COND_NOT_ZONE = 0x0001;
|
||||
public static final int COND_CAST_ATTACK = 0x0002;
|
||||
public static final int COND_CAST_DEFEND = 0x0004;
|
||||
public static final int COND_CAST_NEUTRAL = 0x0008;
|
||||
public static final int COND_FORT_ATTACK = 0x0010;
|
||||
public static final int COND_FORT_DEFEND = 0x0020;
|
||||
public static final int COND_FORT_NEUTRAL = 0x0040;
|
||||
|
||||
private final int _value;
|
||||
private final boolean _self;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition siege zone.
|
||||
* @param value the value
|
||||
* @param self the self
|
||||
*/
|
||||
public ConditionSiegeZone(int value, boolean self)
|
||||
{
|
||||
_value = value;
|
||||
_self = self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2Character target = _self ? effector : effected;
|
||||
final Castle castle = CastleManager.getInstance().getCastle(target);
|
||||
final Fort fort = FortManager.getInstance().getFort(target);
|
||||
|
||||
if ((castle == null) && (fort == null))
|
||||
{
|
||||
return (_value & COND_NOT_ZONE) != 0;
|
||||
}
|
||||
if (castle != null)
|
||||
{
|
||||
return checkIfOk(target, castle, _value);
|
||||
}
|
||||
return checkIfOk(target, fort, _value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ok.
|
||||
* @param activeChar the active char
|
||||
* @param castle the castle
|
||||
* @param value the value
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean checkIfOk(L2Character activeChar, Castle castle, int value)
|
||||
{
|
||||
if ((activeChar == null) || !(activeChar instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance player = (L2PcInstance) activeChar;
|
||||
|
||||
if ((castle == null) || (castle.getResidenceId() <= 0))
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!castle.getZone().isActive())
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (((value & COND_CAST_ATTACK) != 0) && player.isRegisteredOnThisSiegeField(castle.getResidenceId()) && (player.getSiegeState() == 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_CAST_DEFEND) != 0) && player.isRegisteredOnThisSiegeField(castle.getResidenceId()) && (player.getSiegeState() == 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_CAST_NEUTRAL) != 0) && (player.getSiegeState() == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ok.
|
||||
* @param activeChar the active char
|
||||
* @param fort the fort
|
||||
* @param value the value
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean checkIfOk(L2Character activeChar, Fort fort, int value)
|
||||
{
|
||||
if ((activeChar == null) || !(activeChar instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance player = (L2PcInstance) activeChar;
|
||||
|
||||
if ((fort == null) || (fort.getResidenceId() <= 0))
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!fort.getZone().isActive())
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (((value & COND_FORT_ATTACK) != 0) && player.isRegisteredOnThisSiegeField(fort.getResidenceId()) && (player.getSiegeState() == 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_FORT_DEFEND) != 0) && player.isRegisteredOnThisSiegeField(fort.getResidenceId()) && (player.getSiegeState() == 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_FORT_NEUTRAL) != 0) && (player.getSiegeState() == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionSiegeZone.
|
||||
* @author Gigiikun
|
||||
*/
|
||||
public final class ConditionSiegeZone extends Condition
|
||||
{
|
||||
// conditional values
|
||||
public static final int COND_NOT_ZONE = 0x0001;
|
||||
public static final int COND_CAST_ATTACK = 0x0002;
|
||||
public static final int COND_CAST_DEFEND = 0x0004;
|
||||
public static final int COND_CAST_NEUTRAL = 0x0008;
|
||||
public static final int COND_FORT_ATTACK = 0x0010;
|
||||
public static final int COND_FORT_DEFEND = 0x0020;
|
||||
public static final int COND_FORT_NEUTRAL = 0x0040;
|
||||
|
||||
private final int _value;
|
||||
private final boolean _self;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition siege zone.
|
||||
* @param value the value
|
||||
* @param self the self
|
||||
*/
|
||||
public ConditionSiegeZone(int value, boolean self)
|
||||
{
|
||||
_value = value;
|
||||
_self = self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2Character target = _self ? effector : effected;
|
||||
final Castle castle = CastleManager.getInstance().getCastle(target);
|
||||
final Fort fort = FortManager.getInstance().getFort(target);
|
||||
|
||||
if ((castle == null) && (fort == null))
|
||||
{
|
||||
return (_value & COND_NOT_ZONE) != 0;
|
||||
}
|
||||
if (castle != null)
|
||||
{
|
||||
return checkIfOk(target, castle, _value);
|
||||
}
|
||||
return checkIfOk(target, fort, _value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ok.
|
||||
* @param activeChar the active char
|
||||
* @param castle the castle
|
||||
* @param value the value
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean checkIfOk(L2Character activeChar, Castle castle, int value)
|
||||
{
|
||||
if ((activeChar == null) || !(activeChar instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance player = (L2PcInstance) activeChar;
|
||||
|
||||
if (((castle == null) || (castle.getResidenceId() <= 0)))
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!castle.getZone().isActive())
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (((value & COND_CAST_ATTACK) != 0) && player.isRegisteredOnThisSiegeField(castle.getResidenceId()) && (player.getSiegeState() == 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_CAST_DEFEND) != 0) && player.isRegisteredOnThisSiegeField(castle.getResidenceId()) && (player.getSiegeState() == 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_CAST_NEUTRAL) != 0) && (player.getSiegeState() == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ok.
|
||||
* @param activeChar the active char
|
||||
* @param fort the fort
|
||||
* @param value the value
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean checkIfOk(L2Character activeChar, Fort fort, int value)
|
||||
{
|
||||
if ((activeChar == null) || !(activeChar instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance player = (L2PcInstance) activeChar;
|
||||
|
||||
if (((fort == null) || (fort.getResidenceId() <= 0)))
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!fort.getZone().isActive())
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (((value & COND_FORT_ATTACK) != 0) && player.isRegisteredOnThisSiegeField(fort.getResidenceId()) && (player.getSiegeState() == 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_FORT_DEFEND) != 0) && player.isRegisteredOnThisSiegeField(fort.getResidenceId()) && (player.getSiegeState() == 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_FORT_NEUTRAL) != 0) && (player.getSiegeState() == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,61 +1,61 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionSlotItemId.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionSlotItemId extends ConditionInventory
|
||||
{
|
||||
private final int _itemId;
|
||||
private final int _enchantLevel;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition slot item id.
|
||||
* @param slot the slot
|
||||
* @param itemId the item id
|
||||
* @param enchantLevel the enchant level
|
||||
*/
|
||||
public ConditionSlotItemId(int slot, int itemId, int enchantLevel)
|
||||
{
|
||||
super(slot);
|
||||
_itemId = itemId;
|
||||
_enchantLevel = enchantLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2ItemInstance itemSlot = effector.getInventory().getPaperdollItem(_slot);
|
||||
if (itemSlot != null)
|
||||
{
|
||||
return (itemSlot.getId() == _itemId) && (itemSlot.getEnchantLevel() >= _enchantLevel);
|
||||
}
|
||||
return _itemId == 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionSlotItemId.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionSlotItemId extends ConditionInventory
|
||||
{
|
||||
private final int _itemId;
|
||||
private final int _enchantLevel;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition slot item id.
|
||||
* @param slot the slot
|
||||
* @param itemId the item id
|
||||
* @param enchantLevel the enchant level
|
||||
*/
|
||||
public ConditionSlotItemId(int slot, int itemId, int enchantLevel)
|
||||
{
|
||||
super(slot);
|
||||
_itemId = itemId;
|
||||
_enchantLevel = enchantLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2ItemInstance itemSlot = effector.getInventory().getPaperdollItem(_slot);
|
||||
if (itemSlot == null)
|
||||
{
|
||||
return _itemId == 0;
|
||||
}
|
||||
return (itemSlot.getId() == _itemId) && (itemSlot.getEnchantLevel() >= _enchantLevel);
|
||||
}
|
||||
}
|
||||
|
@ -1,54 +1,58 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionSlotItemType.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionSlotItemType extends ConditionInventory
|
||||
{
|
||||
private final int _mask;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition slot item type.
|
||||
* @param slot the slot
|
||||
* @param mask the mask
|
||||
*/
|
||||
public ConditionSlotItemType(int slot, int mask)
|
||||
{
|
||||
super(slot);
|
||||
_mask = mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2ItemInstance itemSlot = effector.getInventory().getPaperdollItem(_slot);
|
||||
return (itemSlot != null) && ((itemSlot.getItem().getItemMask() & _mask) != 0);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionSlotItemType.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionSlotItemType extends ConditionInventory
|
||||
{
|
||||
private final int _mask;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition slot item type.
|
||||
* @param slot the slot
|
||||
* @param mask the mask
|
||||
*/
|
||||
public ConditionSlotItemType(int slot, int mask)
|
||||
{
|
||||
super(slot);
|
||||
_mask = mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2ItemInstance itemSlot = effector.getInventory().getPaperdollItem(_slot);
|
||||
if (itemSlot == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (itemSlot.getItem().getItemMask() & _mask) != 0;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,6 @@ public class ConditionTargetAbnormalType extends Condition
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return effected.getEffectList().getBuffInfoByAbnormalType(_abnormalType) != null;
|
||||
return effected.hasAbnormalType(_abnormalType);
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,63 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetActiveEffectId.
|
||||
*/
|
||||
public class ConditionTargetActiveEffectId extends Condition
|
||||
{
|
||||
private final int _effectId;
|
||||
private final int _effectLvl;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active effect id.
|
||||
* @param effectId the effect id
|
||||
*/
|
||||
public ConditionTargetActiveEffectId(int effectId)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active effect id.
|
||||
* @param effectId the effect id
|
||||
* @param effectLevel the effect level
|
||||
*/
|
||||
public ConditionTargetActiveEffectId(int effectId, int effectLevel)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = effectLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final BuffInfo info = effected.getEffectList().getBuffInfoBySkillId(_effectId);
|
||||
return (info != null) && ((_effectLvl == -1) || (_effectLvl <= info.getSkill().getLevel()));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetActiveEffectId.
|
||||
*/
|
||||
public class ConditionTargetActiveEffectId extends Condition
|
||||
{
|
||||
private final int _effectId;
|
||||
private final int _effectLvl;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active effect id.
|
||||
* @param effectId the effect id
|
||||
*/
|
||||
public ConditionTargetActiveEffectId(int effectId)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active effect id.
|
||||
* @param effectId the effect id
|
||||
* @param effectLevel the effect level
|
||||
*/
|
||||
public ConditionTargetActiveEffectId(int effectId, int effectLevel)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = effectLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final BuffInfo info = effected.getEffectList().getBuffInfoBySkillId(_effectId);
|
||||
if ((info != null) && ((_effectLvl == -1) || (_effectLvl <= info.getSkill().getLevel())))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,64 +1,63 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetActiveSkillId.
|
||||
*/
|
||||
public class ConditionTargetActiveSkillId extends Condition
|
||||
{
|
||||
private final int _skillId;
|
||||
private final int _skillLevel;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active skill id.
|
||||
* @param skillId the skill id
|
||||
*/
|
||||
public ConditionTargetActiveSkillId(int skillId)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active skill id.
|
||||
* @param skillId the skill id
|
||||
* @param skillLevel the skill level
|
||||
*/
|
||||
public ConditionTargetActiveSkillId(int skillId, int skillLevel)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = skillLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
for (Skill sk : effected.getAllSkills())
|
||||
{
|
||||
if ((sk != null) && (sk.getId() == _skillId) && ((_skillLevel == -1) || (_skillLevel <= sk.getLevel())))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetActiveSkillId.
|
||||
*/
|
||||
public class ConditionTargetActiveSkillId extends Condition
|
||||
{
|
||||
private final int _skillId;
|
||||
private final int _skillLevel;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active skill id.
|
||||
* @param skillId the skill id
|
||||
*/
|
||||
public ConditionTargetActiveSkillId(int skillId)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active skill id.
|
||||
* @param skillId the skill id
|
||||
* @param skillLevel the skill level
|
||||
*/
|
||||
public ConditionTargetActiveSkillId(int skillId, int skillLevel)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = skillLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final Skill knownSkill = effected.getKnownSkill(_skillId);
|
||||
if (knownSkill != null)
|
||||
{
|
||||
return (_skillLevel == -1) || (_skillLevel <= knownSkill.getLevel());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,51 +1,55 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetAggro.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetAggro extends Condition
|
||||
{
|
||||
private final boolean _isAggro;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target aggro.
|
||||
* @param isAggro the is aggro
|
||||
*/
|
||||
public ConditionTargetAggro(boolean isAggro)
|
||||
{
|
||||
_isAggro = isAggro;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected instanceof L2MonsterInstance)
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
return (effected instanceof L2PcInstance) && (((L2PcInstance) effected).getReputation() < 0);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetAggro.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetAggro extends Condition
|
||||
{
|
||||
private final boolean _isAggro;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target aggro.
|
||||
* @param isAggro the is aggro
|
||||
*/
|
||||
public ConditionTargetAggro(boolean isAggro)
|
||||
{
|
||||
_isAggro = isAggro;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected instanceof L2MonsterInstance)
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected instanceof L2PcInstance)
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionTargetCheckCrtEffect extends Condition
|
||||
{
|
||||
private final boolean _isCrtEffect;
|
||||
|
||||
public ConditionTargetCheckCrtEffect(boolean isCrtEffect)
|
||||
{
|
||||
_isCrtEffect = isCrtEffect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected.isNpc())
|
||||
{
|
||||
return ((L2Npc) effected).getTemplate().canBeCrt() == _isCrtEffect;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,46 +1,46 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetClassIdRestriction.
|
||||
*/
|
||||
public class ConditionTargetClassIdRestriction extends Condition
|
||||
{
|
||||
private final List<Integer> _classIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target class id restriction.
|
||||
* @param classId the class id
|
||||
*/
|
||||
public ConditionTargetClassIdRestriction(List<Integer> classId)
|
||||
{
|
||||
_classIds = classId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return effected.isPlayer() && _classIds.contains(effected.getActingPlayer().getClassId().getId());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetClassIdRestriction.
|
||||
*/
|
||||
public class ConditionTargetClassIdRestriction extends Condition
|
||||
{
|
||||
private final List<Integer> _classIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target class id restriction.
|
||||
* @param classId the class id
|
||||
*/
|
||||
public ConditionTargetClassIdRestriction(List<Integer> classId)
|
||||
{
|
||||
_classIds = classId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return effected.isPlayer() && (_classIds.contains(effected.getActingPlayer().getClassId().getId()));
|
||||
}
|
||||
}
|
||||
|
@ -1,51 +1,51 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetInvSize.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionTargetInvSize extends Condition
|
||||
{
|
||||
private final int _size;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player inv size.
|
||||
* @param size the size
|
||||
*/
|
||||
public ConditionTargetInvSize(int size)
|
||||
{
|
||||
_size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effected == null) || !effected.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final L2PcInstance target = effected.getActingPlayer();
|
||||
return target.getInventory().getSize(false) <= (target.getInventoryLimit() - _size);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetInvSize.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionTargetInvSize extends Condition
|
||||
{
|
||||
private final int _size;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player inv size.
|
||||
* @param size the size
|
||||
*/
|
||||
public ConditionTargetInvSize(int size)
|
||||
{
|
||||
_size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effected != null) && effected.isPlayer())
|
||||
{
|
||||
final L2PcInstance target = effected.getActingPlayer();
|
||||
return target.getInventory().getSize(i -> !i.isQuestItem()) <= (target.getInventoryLimit() - _size);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +1,49 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetLevel.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetLevel extends Condition
|
||||
{
|
||||
private final int _level;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target level.
|
||||
* @param level the level
|
||||
*/
|
||||
public ConditionTargetLevel(int level)
|
||||
{
|
||||
_level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effected != null) && (effected.getLevel() >= _level);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetLevel.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetLevel extends Condition
|
||||
{
|
||||
private final int _level;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target level.
|
||||
* @param level the level
|
||||
*/
|
||||
public ConditionTargetLevel(int level)
|
||||
{
|
||||
_level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return effected.getLevel() >= _level;
|
||||
}
|
||||
}
|
||||
|
@ -1,46 +1,50 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetNpcId.
|
||||
*/
|
||||
public class ConditionTargetNpcId extends Condition
|
||||
{
|
||||
private final List<Integer> _npcIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target npc id.
|
||||
* @param npcIds the npc ids
|
||||
*/
|
||||
public ConditionTargetNpcId(List<Integer> npcIds)
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effected != null) && (effected.isNpc() || effected.isDoor()) && _npcIds.contains(effected.getId());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetNpcId.
|
||||
*/
|
||||
public class ConditionTargetNpcId extends Condition
|
||||
{
|
||||
private final List<Integer> _npcIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target npc id.
|
||||
* @param npcIds the npc ids
|
||||
*/
|
||||
public ConditionTargetNpcId(List<Integer> npcIds)
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effected != null) && (effected.isNpc() || effected.isDoor()))
|
||||
{
|
||||
return _npcIds.contains(effected.getId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +1,49 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.InstanceType;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetNpcType.
|
||||
*/
|
||||
public class ConditionTargetNpcType extends Condition
|
||||
{
|
||||
private final InstanceType[] _npcType;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target npc type.
|
||||
* @param type the type
|
||||
*/
|
||||
public ConditionTargetNpcType(InstanceType[] type)
|
||||
{
|
||||
_npcType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effected != null) && effected.getInstanceType().isTypes(_npcType);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.InstanceType;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetNpcType.
|
||||
*/
|
||||
public class ConditionTargetNpcType extends Condition
|
||||
{
|
||||
private final InstanceType[] _npcType;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target npc type.
|
||||
* @param type the type
|
||||
*/
|
||||
public ConditionTargetNpcType(InstanceType[] type)
|
||||
{
|
||||
_npcType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return effected.getInstanceType().isTypes(_npcType);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionTargetPlayer extends Condition
|
||||
{
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return effected.isPlayer();
|
||||
}
|
||||
}
|
@ -1,51 +1,57 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.L2Weapon;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetUsesWeaponKind.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetUsesWeaponKind extends Condition
|
||||
{
|
||||
private final int _weaponMask;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target uses weapon kind.
|
||||
* @param weaponMask the weapon mask
|
||||
*/
|
||||
public ConditionTargetUsesWeaponKind(int weaponMask)
|
||||
{
|
||||
_weaponMask = weaponMask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final L2Weapon weapon = effected.getActiveWeaponItem();
|
||||
return (weapon != null) && ((weapon.getItemType().mask() & _weaponMask) != 0);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.L2Weapon;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetUsesWeaponKind.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetUsesWeaponKind extends Condition
|
||||
{
|
||||
private final int _weaponMask;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target uses weapon kind.
|
||||
* @param weaponMask the weapon mask
|
||||
*/
|
||||
public ConditionTargetUsesWeaponKind(int weaponMask)
|
||||
{
|
||||
_weaponMask = weaponMask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2Weapon weapon = effected.getActiveWeaponItem();
|
||||
if (weapon == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (weapon.getItemType().mask() & _weaponMask) != 0;
|
||||
}
|
||||
}
|
||||
|
@ -1,54 +1,55 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetWeight.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionTargetWeight extends Condition
|
||||
{
|
||||
private final int _weight;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player weight.
|
||||
* @param weight the weight
|
||||
*/
|
||||
public ConditionTargetWeight(int weight)
|
||||
{
|
||||
_weight = weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effected != null) && effected.isPlayer())
|
||||
{
|
||||
final L2PcInstance target = effected.getActingPlayer();
|
||||
if (!target.getDietMode() && (target.getMaxLoad() > 0))
|
||||
{
|
||||
return (((target.getCurrentLoad() - target.getBonusWeightPenalty()) * 100) / target.getMaxLoad()) < _weight;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetWeight.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionTargetWeight extends Condition
|
||||
{
|
||||
private final int _weight;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player weight.
|
||||
* @param weight the weight
|
||||
*/
|
||||
public ConditionTargetWeight(int weight)
|
||||
{
|
||||
_weight = weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effected != null) && effected.isPlayer())
|
||||
{
|
||||
final L2PcInstance target = effected.getActingPlayer();
|
||||
if (!target.getDietMode() && (target.getMaxLoad() > 0))
|
||||
{
|
||||
final int weightproc = (((target.getCurrentLoad() - target.getBonusWeightPenalty()) * 100) / target.getMaxLoad());
|
||||
return (weightproc < _weight);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,86 +1,91 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.ArmorType;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionUsingItemType.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionUsingItemType extends Condition
|
||||
{
|
||||
private final boolean _armor;
|
||||
private final int _mask;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition using item type.
|
||||
* @param mask the mask
|
||||
*/
|
||||
public ConditionUsingItemType(int mask)
|
||||
{
|
||||
_mask = mask;
|
||||
_armor = (_mask & (ArmorType.MAGIC.mask() | ArmorType.LIGHT.mask() | ArmorType.HEAVY.mask())) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Inventory inv = effector.getInventory();
|
||||
// If ConditionUsingItemType is one between Light, Heavy or Magic
|
||||
if (!_armor)
|
||||
{
|
||||
return (_mask & inv.getWearedMask()) != 0;
|
||||
}
|
||||
|
||||
// Get the itemMask of the weared chest (if exists)
|
||||
final L2ItemInstance chest = inv.getPaperdollItem(Inventory.PAPERDOLL_CHEST);
|
||||
if (chest == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final 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
|
||||
|
||||
final int chestBodyPart = chest.getItem().getBodyPart();
|
||||
// return True if chest armor is a Full Armor
|
||||
if (chestBodyPart == L2Item.SLOT_FULL_ARMOR)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// check legs armor
|
||||
final L2ItemInstance legs = inv.getPaperdollItem(Inventory.PAPERDOLL_LEGS);
|
||||
return (legs != null) && ((_mask & legs.getItem().getItemMask()) != 0);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.ArmorType;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionUsingItemType.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionUsingItemType extends Condition
|
||||
{
|
||||
private final boolean _armor;
|
||||
private final int _mask;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition using item type.
|
||||
* @param mask the mask
|
||||
*/
|
||||
public ConditionUsingItemType(int mask)
|
||||
{
|
||||
_mask = mask;
|
||||
_armor = (_mask & (ArmorType.MAGIC.mask() | ArmorType.LIGHT.mask() | ArmorType.HEAVY.mask())) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Inventory inv = effector.getInventory();
|
||||
// If ConditionUsingItemType is one between Light, Heavy or Magic
|
||||
if (_armor)
|
||||
{
|
||||
// Get the itemMask of the weared chest (if exists)
|
||||
final L2ItemInstance chest = inv.getPaperdollItem(Inventory.PAPERDOLL_CHEST);
|
||||
if (chest == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final 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
|
||||
|
||||
final int chestBodyPart = chest.getItem().getBodyPart();
|
||||
// return True if chest armor is a Full Armor
|
||||
if (chestBodyPart == L2Item.SLOT_FULL_ARMOR)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// check legs armor
|
||||
final L2ItemInstance legs = inv.getPaperdollItem(Inventory.PAPERDOLL_LEGS);
|
||||
if (legs == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final int legMask = legs.getItem().getItemMask();
|
||||
// return true if legs armor matches too
|
||||
return (_mask & legMask) != 0;
|
||||
}
|
||||
return (_mask & inv.getWearedMask()) != 0;
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +1,49 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionUsingSkill.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionUsingSkill extends Condition
|
||||
{
|
||||
private final int _skillId;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition using skill.
|
||||
* @param skillId the skill id
|
||||
*/
|
||||
public ConditionUsingSkill(int skillId)
|
||||
{
|
||||
_skillId = skillId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (skill != null) && (skill.getId() == _skillId);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionUsingSkill.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionUsingSkill extends Condition
|
||||
{
|
||||
private final int _skillId;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition using skill.
|
||||
* @param skillId the skill id
|
||||
*/
|
||||
public ConditionUsingSkill(int skillId)
|
||||
{
|
||||
_skillId = skillId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (skill == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return skill.getId() == _skillId;
|
||||
}
|
||||
}
|
||||
|
@ -1,40 +1,46 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class ConditionUsingSlotType extends Condition
|
||||
{
|
||||
private final int _mask;
|
||||
|
||||
public ConditionUsingSlotType(int mask)
|
||||
{
|
||||
_mask = mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector != null) && effector.isPlayer() && ((effector.getActiveWeaponItem().getBodyPart() & _mask) != 0);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class ConditionUsingSlotType extends Condition
|
||||
{
|
||||
private final int _mask;
|
||||
|
||||
public ConditionUsingSlotType(int mask)
|
||||
{
|
||||
_mask = mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (effector.getActiveWeaponItem().getBodyPart() & _mask) != 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public interface ICondition
|
||||
{
|
||||
boolean test(L2Character creature, L2Object object);
|
||||
}
|
Reference in New Issue
Block a user