Project update.
This commit is contained in:
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +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 java.util.Set;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.CategoryType;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Condition Category Type implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionCategoryType extends Condition
|
||||
{
|
||||
private final Set<CategoryType> _categoryTypes;
|
||||
|
||||
public ConditionCategoryType(Set<CategoryType> categoryTypes)
|
||||
{
|
||||
_categoryTypes = categoryTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
for (CategoryType type : _categoryTypes)
|
||||
{
|
||||
if (effector.isInCategory(type))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (weaponItem.getChangeWeaponId() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (effector.getActingPlayer().hasItemRequest())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
}
|
||||
}
|
@ -0,0 +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.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;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionInventory.
|
||||
* @author mkizub
|
||||
*/
|
||||
public abstract class ConditionInventory extends Condition
|
||||
{
|
||||
protected final int _slot;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition inventory.
|
||||
* @param slot the slot
|
||||
*/
|
||||
public ConditionInventory(int slot)
|
||||
{
|
||||
_slot = slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public abstract boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item);
|
||||
}
|
@ -0,0 +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 ConditionItemId.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionItemId extends Condition
|
||||
{
|
||||
private final int _itemId;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition item id.
|
||||
* @param itemId the item id
|
||||
*/
|
||||
public ConditionItemId(int itemId)
|
||||
{
|
||||
_itemId = itemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (item != null) && (item.getId() == _itemId);
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
/**
|
||||
* The listener interface for receiving condition events.<br>
|
||||
* The class that is interested in processing a condition event implements this interface,<br>
|
||||
* and the object created with that class is registered with a component using the component's<br>
|
||||
* <code>addConditionListener<code> method.<br>
|
||||
* When the condition event occurs, that object's appropriate method is invoked.
|
||||
* @author mkizub
|
||||
*/
|
||||
public interface ConditionListener
|
||||
{
|
||||
/**
|
||||
* Notify changed.
|
||||
*/
|
||||
public void notifyChanged();
|
||||
}
|
@ -0,0 +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.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionLogicAnd.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionLogicAnd extends Condition
|
||||
{
|
||||
private static Condition[] _emptyConditions = new Condition[0];
|
||||
public Condition[] conditions = _emptyConditions;
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
* @param condition the condition
|
||||
*/
|
||||
public void add(Condition condition)
|
||||
{
|
||||
if (condition == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (getListener() != null)
|
||||
{
|
||||
condition.setListener(this);
|
||||
}
|
||||
final int len = conditions.length;
|
||||
final Condition[] tmp = new Condition[len + 1];
|
||||
System.arraycopy(conditions, 0, tmp, 0, len);
|
||||
tmp[len] = condition;
|
||||
conditions = tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
void setListener(ConditionListener listener)
|
||||
{
|
||||
if (listener != null)
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
c.setListener(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
c.setListener(null);
|
||||
}
|
||||
}
|
||||
super.setListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
if (!c.test(effector, effected, skill, item))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -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.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);
|
||||
}
|
||||
}
|
@ -0,0 +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.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionLogicOr.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionLogicOr extends Condition
|
||||
{
|
||||
private static Condition[] _emptyConditions = new Condition[0];
|
||||
public Condition[] conditions = _emptyConditions;
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
* @param condition the condition
|
||||
*/
|
||||
public void add(Condition condition)
|
||||
{
|
||||
if (condition == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (getListener() != null)
|
||||
{
|
||||
condition.setListener(this);
|
||||
}
|
||||
final int len = conditions.length;
|
||||
final Condition[] tmp = new Condition[len + 1];
|
||||
System.arraycopy(conditions, 0, tmp, 0, len);
|
||||
tmp[len] = condition;
|
||||
conditions = tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
void setListener(ConditionListener listener)
|
||||
{
|
||||
if (listener != null)
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
c.setListener(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
c.setListener(null);
|
||||
}
|
||||
}
|
||||
super.setListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
if (c.test(effector, effected, skill, item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionMinDistance.
|
||||
* @author Didldak
|
||||
*/
|
||||
public class ConditionMinDistance extends Condition
|
||||
{
|
||||
private final int _sqDistance;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition min distance.
|
||||
* @param sqDistance the sq distance
|
||||
*/
|
||||
public ConditionMinDistance(int sqDistance)
|
||||
{
|
||||
_sqDistance = sqDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effected != null) && (effector.calculateDistance(effected, true, true) >= _sqDistance);
|
||||
}
|
||||
}
|
@ -0,0 +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.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())));
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
if (sk.getId() == _skillId)
|
||||
{
|
||||
if ((_skillLevel == -1) || (_skillLevel <= sk.getLevel()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerAgathionId.
|
||||
*/
|
||||
public class ConditionPlayerAgathionId extends Condition
|
||||
{
|
||||
private final int _agathionId;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player agathion id.
|
||||
* @param agathionId the agathion id
|
||||
*/
|
||||
public ConditionPlayerAgathionId(int agathionId)
|
||||
{
|
||||
_agathionId = agathionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getAgathionId() == _agathionId);
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
@ -0,0 +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 = 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);
|
||||
}
|
||||
}
|
@ -0,0 +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 = 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);
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
@ -0,0 +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.actor.instance.L2ControllableAirShipInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Player Can Refuel Airship condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionPlayerCanRefuelAirship extends Condition
|
||||
{
|
||||
private final int _val;
|
||||
|
||||
public ConditionPlayerCanRefuelAirship(int val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean canRefuelAirship = true;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if ((player == null) || (player.getAirShip() == null) || !(player.getAirShip() instanceof L2ControllableAirShipInstance) || ((player.getAirShip().getFuel() + _val) > player.getAirShip().getMaxFuel()))
|
||||
{
|
||||
canRefuelAirship = false;
|
||||
}
|
||||
return canRefuelAirship;
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
@ -0,0 +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);
|
||||
}
|
||||
}
|
@ -0,0 +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.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Player Can Summon condition implementation.
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ConditionPlayerCanSummonServitor extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionPlayerCanSummonServitor(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 (player.isFlyingMounted() || player.isMounted() || player.inObserverMode() || player.isTeleporting())
|
||||
{
|
||||
canSummon = false;
|
||||
}
|
||||
else if (player.getServitors().size() >= 4)
|
||||
{
|
||||
canSummon = false;
|
||||
}
|
||||
return canSummon == _val;
|
||||
}
|
||||
}
|
@ -0,0 +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 = 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);
|
||||
}
|
||||
}
|
@ -0,0 +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.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);
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
@ -0,0 +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 = 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);
|
||||
}
|
||||
}
|
@ -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 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);
|
||||
}
|
||||
}
|
@ -0,0 +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);
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerCharges.
|
||||
*/
|
||||
public class ConditionPlayerCharges extends Condition
|
||||
{
|
||||
private final int _charges;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player charges.
|
||||
* @param charges the charges
|
||||
*/
|
||||
public ConditionPlayerCharges(int charges)
|
||||
{
|
||||
_charges = charges;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getCharges() >= _charges);
|
||||
}
|
||||
}
|
@ -0,0 +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())));
|
||||
}
|
||||
}
|
@ -0,0 +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()));
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerCloakStatus.
|
||||
*/
|
||||
public class ConditionPlayerCloakStatus extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player cloak status.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerCloakStatus(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getInventory().canEquipCloak() == _val);
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerCp.
|
||||
*/
|
||||
public class ConditionPlayerCp extends Condition
|
||||
{
|
||||
private final int _cp;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player cp.
|
||||
* @param cp the cp
|
||||
*/
|
||||
public ConditionPlayerCp(int cp)
|
||||
{
|
||||
_cp = cp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector != null) && (((effector.getCurrentCp() * 100) / effector.getMaxCp()) >= _cp);
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerFlyMounted.
|
||||
* @author kerberos
|
||||
*/
|
||||
public class ConditionPlayerFlyMounted extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player fly mounted.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerFlyMounted(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) ? effector.getActingPlayer().isFlyingMounted() == _val : true;
|
||||
}
|
||||
}
|
@ -0,0 +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 java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerGrade.
|
||||
* @author Gigiikun
|
||||
*/
|
||||
public final class ConditionPlayerGrade extends Condition
|
||||
{
|
||||
protected static final Logger _log = Logger.getLogger(ConditionPlayerGrade.class.getName());
|
||||
// conditional values
|
||||
public static final int COND_NO_GRADE = 0x0001;
|
||||
public static final int COND_D_GRADE = 0x0002;
|
||||
public static final int COND_C_GRADE = 0x0004;
|
||||
public static final int COND_B_GRADE = 0x0008;
|
||||
public static final int COND_A_GRADE = 0x0010;
|
||||
public static final int COND_S_GRADE = 0x0020;
|
||||
public static final int COND_S80_GRADE = 0x0040;
|
||||
public static final int COND_S84_GRADE = 0x0080;
|
||||
|
||||
private final int _value;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player grade.
|
||||
* @param value the value
|
||||
*/
|
||||
public ConditionPlayerGrade(int value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (_value == (byte) effector.getActingPlayer().getExpertiseLevel());
|
||||
}
|
||||
}
|
@ -0,0 +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.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 ConditionPlayerHasCastle.
|
||||
* @author MrPoke
|
||||
*/
|
||||
public final class ConditionPlayerHasCastle extends Condition
|
||||
{
|
||||
private final int _castle;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player has castle.
|
||||
* @param castle the castle
|
||||
*/
|
||||
public ConditionPlayerHasCastle(int castle)
|
||||
{
|
||||
_castle = castle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 _castle == 0;
|
||||
}
|
||||
|
||||
// Any castle
|
||||
if (_castle == -1)
|
||||
{
|
||||
return clan.getCastleId() > 0;
|
||||
}
|
||||
return clan.getCastleId() == _castle;
|
||||
}
|
||||
}
|
@ -0,0 +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());
|
||||
}
|
||||
}
|
@ -0,0 +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.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 ConditionPlayerHasFort.
|
||||
* @author MrPoke
|
||||
*/
|
||||
public final class ConditionPlayerHasFort extends Condition
|
||||
{
|
||||
private final int _fort;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player has fort.
|
||||
* @param fort the fort
|
||||
*/
|
||||
public ConditionPlayerHasFort(int fort)
|
||||
{
|
||||
_fort = fort;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 _fort == 0;
|
||||
}
|
||||
|
||||
// Any fortress
|
||||
if (_fort == -1)
|
||||
{
|
||||
return clan.getFortId() > 0;
|
||||
}
|
||||
return clan.getFortId() == _fort;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
}
|
||||
}
|
@ -0,0 +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.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerHasPet.
|
||||
*/
|
||||
public class ConditionPlayerHasPet extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _controlItemIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player has pet.
|
||||
* @param itemIds the item ids
|
||||
*/
|
||||
public ConditionPlayerHasPet(ArrayList<Integer> itemIds)
|
||||
{
|
||||
if ((itemIds.size() == 1) && (itemIds.get(0) == 0))
|
||||
{
|
||||
_controlItemIds = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_controlItemIds = itemIds;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
final L2Summon pet = effector.getActingPlayer().getPet();
|
||||
if ((effector.getActingPlayer() == null) || (pet == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_controlItemIds == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
final L2ItemInstance controlItem = ((L2PetInstance) pet).getControlItem();
|
||||
return (controlItem != null) && _controlItemIds.contains(controlItem.getId());
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerHp.
|
||||
* @author mr
|
||||
*/
|
||||
public class ConditionPlayerHp extends Condition
|
||||
{
|
||||
private final int _hp;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player hp.
|
||||
* @param hp the hp
|
||||
*/
|
||||
public ConditionPlayerHp(int hp)
|
||||
{
|
||||
_hp = hp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector != null) && (((effector.getCurrentHp() * 100) / effector.getMaxHp()) <= _hp);
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
final boolean isImmobile = !effector.isMovementDisabled();
|
||||
return _val == isImmobile;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.instancemanager.ZoneManager;
|
||||
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.model.zone.L2ZoneType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ConditionPlayerInsideZoneId extends Condition
|
||||
{
|
||||
private final List<Integer> _zones;
|
||||
|
||||
public ConditionPlayerInsideZoneId(List<Integer> zones)
|
||||
{
|
||||
_zones = zones;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (L2ZoneType zone : ZoneManager.getInstance().getZones(effector))
|
||||
{
|
||||
if (_zones.contains(zone.getId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +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 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());
|
||||
if ((world == null) || (world.getInstanceId() != instanceId))
|
||||
{
|
||||
return false; // player in the different instance
|
||||
}
|
||||
return _instanceIds.contains(world.getTemplateId());
|
||||
}
|
||||
}
|
@ -0,0 +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 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(false) <= (effector.getActingPlayer().getInventoryLimit() - _size);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (effector.getActingPlayer().isClanLeader() == _val);
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (effector.getActingPlayer().isHero() == _val);
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
final boolean isInCombat = !AttackStanceTaskManager.getInstance().hasAttackStanceTask(effector);
|
||||
return _val == isInCombat;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return effector.getActingPlayer().getPlayerSide() == _side;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerLandingZone.
|
||||
* @author kerberos
|
||||
*/
|
||||
public class ConditionPlayerLandingZone extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player landing zone.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerLandingZone(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return effector.isInsideZone(ZoneId.LANDING) == _val;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerLevel.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionPlayerLevel extends Condition
|
||||
{
|
||||
private final int _level;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player level.
|
||||
* @param level the level
|
||||
*/
|
||||
public ConditionPlayerLevel(int level)
|
||||
{
|
||||
_level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return effector.getLevel() >= _level;
|
||||
}
|
||||
}
|
@ -0,0 +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]));
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerMp.
|
||||
*/
|
||||
public class ConditionPlayerMp extends Condition
|
||||
{
|
||||
private final int _mp;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player mp.
|
||||
* @param mp the mp
|
||||
*/
|
||||
public ConditionPlayerMp(int mp)
|
||||
{
|
||||
_mp = mp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return ((effector.getCurrentMp() * 100) / effector.getMaxMp()) <= _mp;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return effector.getActingPlayer().getPkKills() <= _pk;
|
||||
}
|
||||
}
|
@ -0,0 +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.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);
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Util.contains(_races, effector.getActingPlayer().getRace());
|
||||
}
|
||||
}
|
@ -0,0 +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.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;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (effector.getActingPlayer().getAppearance().getSex() ? 1 : 0) == _sex;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return effector.getActingPlayer().getSiegeSide() == _siegeSide;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSouls.
|
||||
*/
|
||||
public class ConditionPlayerSouls extends Condition
|
||||
{
|
||||
private final int _souls;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player souls.
|
||||
* @param souls the souls
|
||||
*/
|
||||
public ConditionPlayerSouls(int souls)
|
||||
{
|
||||
_souls = souls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getChargedSouls() >= _souls);
|
||||
}
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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:
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
return (player.isSitting() == _required);
|
||||
}
|
||||
return !_required;
|
||||
}
|
||||
case MOVING:
|
||||
{
|
||||
return character.isMoving() == _required;
|
||||
}
|
||||
case RUNNING:
|
||||
{
|
||||
return character.isRunning() == _required;
|
||||
}
|
||||
case STANDING:
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
return (_required != (player.isSitting() || player.isMoving()));
|
||||
}
|
||||
return (_required != character.isMoving());
|
||||
}
|
||||
case FLYING:
|
||||
{
|
||||
return (character.isFlying() == _required);
|
||||
}
|
||||
case BEHIND:
|
||||
{
|
||||
return (character.isBehindTarget() == _required);
|
||||
}
|
||||
case FRONT:
|
||||
{
|
||||
return (character.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;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if (effector.getActingPlayer() == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return effector.getActingPlayer().isSubClassActive() == _val;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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();
|
||||
if (player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_id == -1)
|
||||
{
|
||||
return player.isTransformed();
|
||||
}
|
||||
return player.getTransformationId() == _id;
|
||||
}
|
||||
}
|
@ -0,0 +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.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();
|
||||
if ((player == null) || !TvTEvent.isStarted())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
return (TvTEvent.isPlayerParticipant(player.getObjectId()) == _val);
|
||||
}
|
||||
}
|
@ -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.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);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +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 _itemId == 0;
|
||||
}
|
||||
return (itemSlot.getId() == _itemId) && (itemSlot.getEnchantLevel() >= _enchantLevel);
|
||||
}
|
||||
}
|
@ -0,0 +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);
|
||||
if (itemSlot == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (itemSlot.getItem().getItemMask() & _mask) != 0;
|
||||
}
|
||||
}
|
@ -0,0 +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.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetAbnormal.
|
||||
* @author janiii
|
||||
*/
|
||||
public class ConditionTargetAbnormalType extends Condition
|
||||
{
|
||||
private final AbnormalType _abnormalType;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target abnormal type.
|
||||
* @param abnormalType the abnormal type
|
||||
*/
|
||||
public ConditionTargetAbnormalType(AbnormalType abnormalType)
|
||||
{
|
||||
_abnormalType = abnormalType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return effected.getEffectList().getBuffInfoByAbnormalType(_abnormalType) != null;
|
||||
}
|
||||
}
|
@ -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.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;
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
if (sk.getId() == _skillId)
|
||||
{
|
||||
if ((_skillLevel == -1) || (_skillLevel <= sk.getLevel()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
}
|
||||
if (effected instanceof L2PcInstance)
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +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 java.util.List;
|
||||
|
||||
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 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)
|
||||
{
|
||||
if (!(effected instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (_classIds.contains((effected.getActingPlayer()).getClassId().getId()));
|
||||
}
|
||||
}
|
@ -0,0 +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 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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +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())
|
||||
{
|
||||
final L2PcInstance target = effected.getActingPlayer();
|
||||
return target.getInventory().getSize(false) <= (target.getInventoryLimit() - _size);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if (effected == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return effected.getLevel() >= _level;
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ConditionTargetLevelRange extends Condition
|
||||
{
|
||||
private final int[] _levels;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target levels range.
|
||||
* @param levels the {@code levels} range.
|
||||
*/
|
||||
public ConditionTargetLevelRange(int[] levels)
|
||||
{
|
||||
_levels = levels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final int level = effected.getLevel();
|
||||
return ((level >= _levels[0]) && (level <= _levels[1]));
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Target My Party Except Me condition implementation.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public class ConditionTargetMyPartyExceptMe extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
public ConditionTargetMyPartyExceptMe(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
boolean isPartyMember = true;
|
||||
final L2PcInstance player = effector.getActingPlayer();
|
||||
if ((player == null) || (effected == null) || !effected.isPlayer())
|
||||
{
|
||||
isPartyMember = false;
|
||||
}
|
||||
else if (player == effected)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_ON_YOURSELF);
|
||||
isPartyMember = false;
|
||||
}
|
||||
else if (!player.isInParty() || !player.getParty().equals(effected.getParty()))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(skill);
|
||||
player.sendPacket(sm);
|
||||
isPartyMember = false;
|
||||
}
|
||||
return (_val == isPartyMember);
|
||||
}
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetNone.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetNone extends Condition
|
||||
{
|
||||
/**
|
||||
* Instantiates a new condition target none.
|
||||
*/
|
||||
public ConditionTargetNone()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effected == null);
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if ((effected != null) && (effected.isNpc() || effected.isDoor()))
|
||||
{
|
||||
return _npcIds.contains(effected.getId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if (effected == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return effected.getInstanceType().isTypes(_npcType);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author DS
|
||||
*/
|
||||
public class ConditionTargetPlayable extends Condition
|
||||
{
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (effected instanceof L2Playable);
|
||||
}
|
||||
}
|
@ -0,0 +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.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 ConditionTargetRace.
|
||||
* @author Zealar
|
||||
*/
|
||||
public class ConditionTargetRace extends Condition
|
||||
{
|
||||
private final Race _race;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target race.
|
||||
* @param race containing the allowed race.
|
||||
*/
|
||||
public ConditionTargetRace(Race race)
|
||||
{
|
||||
_race = race;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return _race == effected.getRace();
|
||||
}
|
||||
}
|
@ -0,0 +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();
|
||||
if (weapon == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (weapon.getItemType().mask() & _weaponMask) != 0;
|
||||
}
|
||||
}
|
@ -0,0 +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))
|
||||
{
|
||||
final int weightproc = (((target.getCurrentLoad() - target.getBonusWeightPenalty()) * 100) / target.getMaxLoad());
|
||||
return (weightproc < _weight);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if (skill == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return skill.getId() == _skillId;
|
||||
}
|
||||
}
|
@ -0,0 +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)
|
||||
{
|
||||
if ((effector == null) || !effector.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (effector.getActiveWeaponItem().getBodyPart() & _mask) != 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* The Class ConditionWithSkill.
|
||||
* @author Steuf
|
||||
*/
|
||||
public class ConditionWithSkill extends Condition
|
||||
{
|
||||
private final boolean _skill;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition with skill.
|
||||
* @param skill the skill
|
||||
*/
|
||||
public ConditionWithSkill(boolean skill)
|
||||
{
|
||||
_skill = skill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
return (skill != null) == _skill;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user