Merged with released L2J-Unity files.

This commit is contained in:
mobiusdev
2016-06-12 01:34:09 +00:00
parent e003e87887
commit 635557f5da
18352 changed files with 3245113 additions and 2892959 deletions

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class BuildAdvanceBaseSkillCondition implements ISkillCondition
{
public BuildAdvanceBaseSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
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.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
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.skills.ISkillCondition;
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;
/**
* @author Sdw
*/
public class BuildCampSkillCondition implements ISkillCondition
{
public BuildCampSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if ((caster == null) || !caster.isPlayer())
{
return false;
}
final L2PcInstance player = caster.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 canCreateBase;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class CanAddMaxEntranceInzoneSkillCondition implements ISkillCondition
{
public CanAddMaxEntranceInzoneSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author
*/
public class CanBookmarkAddSlotSkillCondition implements ISkillCondition
{
private final int _teleportBookmarkSlots;
public CanBookmarkAddSlotSkillCondition(StatsSet params)
{
_teleportBookmarkSlots = params.getInt("teleportBookmarkSlots");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final L2PcInstance player = caster.getActingPlayer();
if (player == null)
{
return false;
}
if ((player.getBookMarkSlot() + _teleportBookmarkSlots) > 9)
{
player.sendPacket(SystemMessageId.YOUR_NUMBER_OF_MY_TELEPORTS_SLOTS_HAS_REACHED_ITS_MAXIMUM_LIMIT);
return false;
}
return true;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class CanChangeVitalItemCountSkillCondition implements ISkillCondition
{
public CanChangeVitalItemCountSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class CanEnchantAttributeSkillCondition implements ISkillCondition
{
public CanEnchantAttributeSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
// TODO !
return true;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class CanMountForEventSkillCondition implements ISkillCondition
{
public CanMountForEventSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
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.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class CanRefuelAirshipSkillCondition implements ISkillCondition
{
private final int _amount;
public CanRefuelAirshipSkillCondition(StatsSet params)
{
_amount = params.getInt("amount");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
boolean canRefuelAirship = true;
final L2PcInstance player = caster.getActingPlayer();
if ((player == null) || (player.getAirShip() == null) || !(player.getAirShip() instanceof L2ControllableAirShipInstance) || ((player.getAirShip().getFuel() + _amount) > player.getAirShip().getMaxFuel()))
{
canRefuelAirship = false;
}
return canRefuelAirship;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class CanRestoreVitalPointSkillCondition implements ISkillCondition
{
public CanRestoreVitalPointSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class CanSummonCubicSkillCondition implements ISkillCondition
{
public CanSummonCubicSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if (!caster.isPlayer() || caster.isAlikeDead() || caster.getActingPlayer().inObserverMode())
{
return false;
}
final L2PcInstance player = caster.getActingPlayer();
if (player.inObserverMode() || player.isMounted())
{
return false;
}
return true;
}
}

View File

@ -0,0 +1,80 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* @author Sdw
*/
public class CanSummonMultiSkillCondition implements ISkillCondition
{
private final int _summonPoints;
public CanSummonMultiSkillCondition(StatsSet params)
{
_summonPoints = params.getInt("summonPoints");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final L2PcInstance player = caster.getActingPlayer();
if (player == null)
{
return false;
}
boolean canSummon = true;
final int servitorSize = player.getServitors().size();
if ((servitorSize == 1) && (player.getSummonPoints() == 0))
{
canSummon = false;
}
else if (servitorSize > 4)
{
canSummon = false;
}
else if (player.isFlyingMounted() || player.isMounted() || player.inObserverMode() || player.isTeleporting())
{
canSummon = false;
}
else if (player.isInAirShip())
{
player.sendPacket(SystemMessageId.A_SERVITOR_OR_PET_CANNOT_BE_SUMMONED_WHILE_ON_AN_AIRSHIP);
canSummon = false;
}
else if ((player.getSummonPoints() + _summonPoints) > player.getMaxSummonPoints())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_USE_THE_S1_SKILL_DUE_TO_INSUFFICIENT_SUMMON_POINTS);
sm.addSkillName(skill);
player.sendPacket(sm);
canSummon = false;
}
return canSummon;
}
}

View File

@ -0,0 +1,84 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
/**
* @author Sdw
*/
public class CanSummonPetSkillCondition implements ISkillCondition
{
public CanSummonPetSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final L2PcInstance player = caster.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.getActiveTradeList() != null) || player.hasItemRequest() || (player.getPrivateStoreType() != PrivateStoreType.NONE))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_SUMMON_DURING_A_TRADE_OR_WHILE_USING_A_PRIVATE_STORE);
canSummon = false;
}
else if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_SUMMON_DURING_COMBAT);
canSummon = false;
}
else if (player.isInAirShip())
{
player.sendPacket(SystemMessageId.A_SERVITOR_OR_PET_CANNOT_BE_SUMMONED_WHILE_ON_AN_AIRSHIP);
canSummon = false;
}
else if (player.isFlyingMounted() || player.isMounted() || player.inObserverMode() || player.isTeleporting())
{
canSummon = false;
}
return canSummon;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.instancemanager.CastleManager;
import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
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.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author Sdw
*/
public class CanSummonSiegeGolemSkillCondition implements ISkillCondition
{
public CanSummonSiegeGolemSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if ((caster == null) || !caster.isPlayer())
{
return false;
}
final L2PcInstance player = caster.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 canSummonSiegeGolem;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author Sdw
*/
public class CanSummonSkillCondition implements ISkillCondition
{
public CanSummonSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final L2PcInstance player = caster.getActingPlayer();
if (player == null)
{
return false;
}
boolean canSummon = true;
if (player.hasServitors())
{
canSummon = false;
}
else if (player.isFlyingMounted() || player.isMounted() || player.inObserverMode() || player.isTeleporting())
{
canSummon = false;
}
else if (player.isInAirShip())
{
player.sendPacket(SystemMessageId.A_SERVITOR_OR_PET_CANNOT_BE_SUMMONED_WHILE_ON_AN_AIRSHIP);
canSummon = false;
}
return canSummon;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class CanTransformInDominionSkillCondition implements ISkillCondition
{
public CanTransformInDominionSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author Sdw
*/
public class CanTransformSkillCondition implements ISkillCondition
{
// TODO: What to do with this?
// private final int _transformId;
public CanTransformSkillCondition(StatsSet params)
{
// _transformId = params.getInt("transformId");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
boolean canTransform = true;
final L2PcInstance player = caster.getActingPlayer();
if ((player == null) || player.isAlikeDead() || player.isCursedWeaponEquipped())
{
canTransform = false;
}
else if (player.isSitting())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
canTransform = false;
}
else if (player.isTransformed())
{
player.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
canTransform = false;
}
else if (player.isInWater())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
canTransform = false;
}
else if (player.isFlyingMounted() || player.isMounted())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
canTransform = false;
}
return canTransform;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author Sdw
*/
public class CanUntransformSkillCondition implements ISkillCondition
{
public CanUntransformSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
boolean canUntransform = true;
final L2PcInstance player = caster.getActingPlayer();
if (player == null)
{
canUntransform = false;
}
else if (player.isAlikeDead() || player.isCursedWeaponEquipped())
{
canUntransform = false;
}
else if (player.isFlyingMounted() && !player.isInsideZone(ZoneId.LANDING))
{
player.sendPacket(SystemMessageId.YOU_ARE_TOO_HIGH_TO_PERFORM_THIS_ACTION_PLEASE_LOWER_YOUR_ALTITUDE_AND_TRY_AGAIN); // TODO: check if message is retail like.
canUntransform = false;
}
return canUntransform;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class CanUseInBattlefieldSkillCondition implements ISkillCondition
{
public CanUseInBattlefieldSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class CanUseInDragonLairSkillCondition implements ISkillCondition
{
public CanUseInDragonLairSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class CanUseSwoopCannonSkillCondition implements ISkillCondition
{
public CanUseSwoopCannonSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class CanUseVitalityConsumeItemSkillCondition implements ISkillCondition
{
public CanUseVitalityConsumeItemSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class CannotUseInTransformSkillCondition implements ISkillCondition
{
private final int _transformId;
public CannotUseInTransformSkillCondition(StatsSet params)
{
_transformId = params.getInt("transformId", -1);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return (_transformId > 0) ? caster.getTransformationId() != _transformId : !caster.isTransformed();
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.SkillConditionAffectType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class CheckLevelSkillCondition implements ISkillCondition
{
private final int _minLevel;
private final int _maxLevel;
private final SkillConditionAffectType _affectType;
public CheckLevelSkillCondition(StatsSet params)
{
_minLevel = params.getInt("minLevel");
_maxLevel = params.getInt("maxLevel");
_affectType = params.getEnum("affectType", SkillConditionAffectType.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
switch (_affectType)
{
case CASTER:
{
return (caster.getLevel() >= _minLevel) && (caster.getLevel() <= _maxLevel);
}
case TARGET:
{
if ((target != null) && target.isPlayer())
{
return (target.getActingPlayer().getLevel() >= _minLevel) && (target.getActingPlayer().getLevel() <= _maxLevel);
}
break;
}
}
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class CheckSexSkillCondition implements ISkillCondition
{
private final boolean _isFemale;
public CheckSexSkillCondition(StatsSet params)
{
_isFemale = params.getBoolean("isFemale");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.isPlayer() && (caster.getActingPlayer().getAppearance().getSex() == _isFemale);
}
}

View File

@ -0,0 +1,54 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author UnAfraid
*/
public class ConsumeBodySkillCondition implements ISkillCondition
{
public ConsumeBodySkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if ((target != null) && target.isMonster())
{
final L2MonsterInstance monster = (L2MonsterInstance) target;
if (monster.isDead() && monster.isSpawned())
{
return true;
}
}
if (caster.isPlayer())
{
caster.sendPacket(SystemMessageId.INVALID_TARGET);
}
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class EnergySavedSkillCondition implements ISkillCondition
{
private final int _amount;
public EnergySavedSkillCondition(StatsSet params)
{
_amount = params.getInt("amount");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.getActingPlayer().getCharges() >= _amount;
}
}

View File

@ -0,0 +1,92 @@
/*
* 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 handlers.skillconditionhandlers;
import java.util.List;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
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.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class EquipArmorSkillCondition implements ISkillCondition
{
private int _armorTypesMask = 0;
public EquipArmorSkillCondition(StatsSet params)
{
final List<ArmorType> armorTypes = params.getEnumList("armorType", ArmorType.class);
if (armorTypes != null)
{
for (ArmorType armorType : armorTypes)
{
_armorTypesMask |= armorType.mask();
}
}
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if ((caster == null) || !caster.isPlayer())
{
return false;
}
final Inventory inv = caster.getInventory();
// 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 ((_armorTypesMask & 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 (_armorTypesMask & legMask) != 0;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.type.ArmorType;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class EquipShieldSkillCondition implements ISkillCondition
{
public EquipShieldSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final L2Item shield = caster.getSecondaryWeaponItem();
return (shield != null) && (shield.getItemType() == ArmorType.SHIELD);
}
}

View File

@ -0,0 +1,54 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.skillconditionhandlers;
import java.util.List;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.type.WeaponType;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class EquipWeaponSkillCondition implements ISkillCondition
{
private int _weaponTypesMask = 0;
public EquipWeaponSkillCondition(StatsSet params)
{
final List<WeaponType> weaponTypes = params.getEnumList("weaponType", WeaponType.class);
if (weaponTypes != null)
{
for (WeaponType weaponType : weaponTypes)
{
_weaponTypesMask |= weaponType.mask();
}
}
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final L2Item weapon = caster.getActiveWeaponItem();
return (weapon != null) && ((weapon.getItemMask() & _weaponTypesMask) != 0);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.zone.ZoneId;
/**
* @author UnAfraid
*/
public class NotInUnderwaterSkillCondition implements ISkillCondition
{
public NotInUnderwaterSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return !caster.isInsideZone(ZoneId.WATER);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
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.items.type.WeaponType;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class Op2hWeaponSkillCondition implements ISkillCondition
{
private final List<WeaponType> _weaponTypes = new ArrayList<>();
public Op2hWeaponSkillCondition(StatsSet params)
{
final List<String> weaponTypes = params.getList("weaponTypes", String.class);
if (weaponTypes != null)
{
weaponTypes.stream().map(WeaponType::valueOf).forEach(_weaponTypes::add);
}
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final L2Weapon weapon = caster.getActiveWeaponItem();
if (weapon == null)
{
return false;
}
return _weaponTypes.stream().anyMatch(weaponType -> (weapon.getItemType() == weaponType) && ((weapon.getBodyPart() & L2Item.SLOT_LR_HAND) != 0));
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpAgathionEnergySkillCondition implements ISkillCondition
{
public OpAgathionEnergySkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.SkillConditionAffectType;
import com.l2jmobius.gameserver.enums.SkillConditionAlignment;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpAlignmentSkillCondition implements ISkillCondition
{
private final SkillConditionAffectType _affectType;
private final SkillConditionAlignment _alignment;
public OpAlignmentSkillCondition(StatsSet params)
{
_affectType = params.getEnum("affectType", SkillConditionAffectType.class);
_alignment = params.getEnum("alignment", SkillConditionAlignment.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
switch (_affectType)
{
case CASTER:
{
return _alignment.test(caster.getActingPlayer());
}
case TARGET:
{
if ((target != null) && target.isPlayer())
{
return _alignment.test(target.getActingPlayer());
}
break;
}
}
return false;
}
}

View File

@ -0,0 +1,75 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.GeoData;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.Util;
/**
* @author Sdw
*/
public class OpBlinkSkillCondition implements ISkillCondition
{
private final int _angle;
private final int _range;
public OpBlinkSkillCondition(StatsSet params)
{
switch (params.getEnum("direction", Position.class))
{
case BACK:
{
_angle = 0;
break;
}
case FRONT:
{
_angle = 180;
break;
}
default:
{
_angle = -1;
break;
}
}
_range = params.getInt("range");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final double angle = Util.convertHeadingToDegree(caster.getHeading());
final double radian = Math.toRadians(angle);
final double course = Math.toRadians(_angle);
final int x1 = (int) (Math.cos(Math.PI + radian + course) * _range);
final int y1 = (int) (Math.sin(Math.PI + radian + course) * _range);
final int x = caster.getX() + x1;
final int y = caster.getY() + y1;
final int z = caster.getZ();
return GeoData.getInstance().canMove(caster.getX(), caster.getY(), caster.getZ(), x, y, z, caster.getInstanceWorld());
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author Sdw
*/
public class OpCallPcSkillCondition implements ISkillCondition
{
public OpCallPcSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
boolean canCallPlayer = true;
final L2PcInstance player = caster.getActingPlayer();
if (player == null)
{
canCallPlayer = false;
}
else if (player.isInOlympiadMode())
{
player.sendPacket(SystemMessageId.A_USER_PARTICIPATING_IN_THE_OLYMPIAD_CANNOT_USE_SUMMONING_OR_TELEPORTING);
canCallPlayer = false;
}
else if (player.inObserverMode())
{
canCallPlayer = false;
}
else if (player.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || player.isInsideZone(ZoneId.JAIL) || player.isFlyingMounted())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
canCallPlayer = false;
}
return canCallPlayer;
}
}

View File

@ -0,0 +1,39 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpCanEscapeSkillCondition implements ISkillCondition
{
public OpCanEscapeSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return !caster.cannotEscape();
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2AirShipInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpCanNotUseAirshipSkillCondition implements ISkillCondition
{
public OpCanNotUseAirshipSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.isPlayer() && !(caster.getActingPlayer().getVehicle() instanceof L2AirShipInstance);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpCannotUseTargetWithPrivateStoreSkillCondition implements ISkillCondition
{
public OpCannotUseTargetWithPrivateStoreSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if ((target != null) && target.isPlayer() && (target.getActingPlayer().getPrivateStoreType() != PrivateStoreType.NONE))
{
return false;
}
return true;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.items.L2Weapon;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpChangeWeaponSkillCondition implements ISkillCondition
{
public OpChangeWeaponSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final L2Weapon weaponItem = caster.getActiveWeaponItem();
if (weaponItem == null)
{
return false;
}
if (weaponItem.getChangeWeaponId() == 0)
{
return false;
}
if (caster.getActingPlayer().hasItemRequest())
{
return false;
}
return true;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpCheckAbnormalSkillCondition implements ISkillCondition
{
private final AbnormalType _type;
private final int _level;
private final boolean _hasAbnormal;
public OpCheckAbnormalSkillCondition(StatsSet params)
{
_type = params.getEnum("type", AbnormalType.class);
_level = params.getInt("level");
_hasAbnormal = params.getBoolean("hasAbnormal");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if (target.isCharacter())
{
final BuffInfo info = ((L2Character) target).getEffectList().getBuffInfoByAbnormalType(_type);
if (_hasAbnormal)
{
return (info != null) && (info.getSkill().getAbnormalLvl() >= _level);
}
return (info == null) || (info.getSkill().getAbnormalLvl() < _level);
}
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpCheckAccountTypeSkillCondition implements ISkillCondition
{
public OpCheckAccountTypeSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpCheckCastRangeSkillCondition implements ISkillCondition
{
private final int _distance;
public OpCheckCastRangeSkillCondition(StatsSet params)
{
_distance = params.getInt("distance") * params.getInt("distance");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return (target != null) && (caster.calculateDistance(target, true, true) >= _distance);
}
}

View File

@ -0,0 +1,65 @@
/*
* 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 handlers.skillconditionhandlers;
import java.util.List;
import com.l2jmobius.gameserver.enums.SkillConditionAffectType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpCheckClassListSkillCondition implements ISkillCondition
{
private final List<ClassId> _classIds;
private final SkillConditionAffectType _affectType;
private final boolean _isWithin;
public OpCheckClassListSkillCondition(StatsSet params)
{
_classIds = params.getEnumList("classIds", ClassId.class);
_affectType = params.getEnum("affectType", SkillConditionAffectType.class);
_isWithin = params.getBoolean("isWithin");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
switch (_affectType)
{
case CASTER:
{
return caster.isPlayer() && (_isWithin == _classIds.stream().anyMatch(classId -> classId == caster.getActingPlayer().getClassId()));
}
case TARGET:
{
if ((target != null) && !target.isPlayer())
{
return _isWithin == _classIds.stream().anyMatch(classId -> classId == target.getActingPlayer().getClassId());
}
break;
}
}
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.SkillConditionAffectType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpCheckClassSkillCondition implements ISkillCondition
{
private final ClassId _classId;
private final SkillConditionAffectType _affectType;
private final boolean _isWithin;
public OpCheckClassSkillCondition(StatsSet params)
{
_classId = params.getEnum("classId", ClassId.class);
_affectType = params.getEnum("affectType", SkillConditionAffectType.class);
_isWithin = params.getBoolean("isWithin");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
switch (_affectType)
{
case CASTER:
{
return caster.isPlayer() && (_isWithin == (_classId == caster.getActingPlayer().getClassId()));
}
case TARGET:
{
if ((target != null) && !target.isPlayer())
{
return _isWithin == (_classId == target.getActingPlayer().getClassId());
}
break;
}
}
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpCheckCrtEffectSkillCondition implements ISkillCondition
{
public OpCheckCrtEffectSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return (target != null) && target.isNpc() && ((L2Npc) target).getTemplate().canBeCrt();
}
}

View File

@ -0,0 +1,77 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
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.skills.ISkillCondition;
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;
/**
* @author Sdw
*/
public class OpCheckFlagSkillCondition implements ISkillCondition
{
public OpCheckFlagSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if (!caster.isPlayer())
{
return false;
}
final L2PcInstance player = caster.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() != target)
{
player.sendPacket(SystemMessageId.INVALID_TARGET);
canTakeFort = false;
}
else if (!Util.checkIfInRange(200, player, target, true))
{
player.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
canTakeFort = false;
}
return canTakeFort;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpCheckOnGoingEventCampaignSkillCondition implements ISkillCondition
{
public OpCheckOnGoingEventCampaignSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpCheckPcbangPointSkillCondition implements ISkillCondition
{
public OpCheckPcbangPointSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import java.util.List;
import com.l2jmobius.gameserver.data.xml.impl.ClanHallData;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.entity.ClanHall;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpCheckResidenceSkillCondition implements ISkillCondition
{
private final List<Integer> _residencesId;
private final boolean _isWithin;
public OpCheckResidenceSkillCondition(StatsSet params)
{
_residencesId = params.getList("residencesId", Integer.class);
_isWithin = params.getBoolean("isWithin");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if (caster.isPlayer())
{
final L2Clan clan = caster.getActingPlayer().getClan();
if (clan != null)
{
final ClanHall clanHall = ClanHallData.getInstance().getClanHallByClan(clan);
if (clanHall != null)
{
return _isWithin ? _residencesId.contains(clanHall.getResidenceId()) : !_residencesId.contains(clanHall.getResidenceId());
}
}
}
return false;
}
}

View File

@ -0,0 +1,60 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.SkillConditionAffectType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpCheckSkillSkillCondition implements ISkillCondition
{
private final int _skillId;
private final SkillConditionAffectType _affectType;
public OpCheckSkillSkillCondition(StatsSet params)
{
_skillId = params.getInt("skillId");
_affectType = params.getEnum("affectType", SkillConditionAffectType.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
switch (_affectType)
{
case CASTER:
{
return caster.getSkillLevel(_skillId) > 0;
}
case TARGET:
{
if ((target != null) && !target.isPlayer())
{
return target.getActingPlayer().getSkillLevel(_skillId) > 0;
}
break;
}
}
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.SkillConditionCompanionType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpCompanionSkillCondition implements ISkillCondition
{
private final SkillConditionCompanionType _type;
public OpCompanionSkillCondition(StatsSet params)
{
_type = params.getEnum("type", SkillConditionCompanionType.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if (target != null)
{
switch (_type)
{
case PET:
{
return target.isPet();
}
case MY_SUMMON:
{
return target.isSummon() && (caster.getServitor(target.getObjectId()) != null);
}
}
}
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpEnchantRangeSkillCondition implements ISkillCondition
{
public OpEnchantRangeSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* TODO: Verify me, also should Quest items be counted?
* @author UnAfraid
*/
public class OpEncumberedSkillCondition implements ISkillCondition
{
private final int _slotsPercent;
private final int _weightPercent;
public OpEncumberedSkillCondition(StatsSet params)
{
_slotsPercent = params.getInt("slotsPercent");
_weightPercent = params.getInt("weightPercent");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if (!caster.isPlayer())
{
return false;
}
final L2PcInstance player = caster.getActingPlayer();
final int currentSlotsPercent = calcPercent(player.getInventoryLimit(), player.getInventory().getSize(item -> !item.isQuestItem()));
final int currentWeightPercent = calcPercent(player.getMaxLoad(), player.getCurrentLoad());
return (currentSlotsPercent >= _slotsPercent) && (currentWeightPercent >= _weightPercent);
}
private int calcPercent(int max, int current)
{
return 100 - ((current * 100) / max);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author UnAfraid
*/
public class OpEnergyMaxSkillCondition implements ISkillCondition
{
private final int _amount;
public OpEnergyMaxSkillCondition(StatsSet params)
{
_amount = params.getInt("amount");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if (caster.getActingPlayer().getCharges() >= _amount)
{
caster.sendPacket(SystemMessageId.YOUR_FORCE_HAS_REACHED_MAXIMUM_CAPACITY);
return false;
}
return true;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.SkillConditionAffectType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpEquipItemSkillCondition implements ISkillCondition
{
private final int _itemId;
private final SkillConditionAffectType _affectType;
public OpEquipItemSkillCondition(StatsSet params)
{
_itemId = params.getInt("itemId");
_affectType = params.getEnum("affectType", SkillConditionAffectType.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
switch (_affectType)
{
case CASTER:
{
return caster.getInventory().getItems(L2ItemInstance::isEquipped, i -> i.getId() == _itemId).size() > 0;
}
case TARGET:
{
if ((target != null) && target.isPlayer())
{
return target.getActingPlayer().getInventory().getItems(L2ItemInstance::isEquipped, i -> i.getId() == _itemId).size() > 0;
}
}
case BOTH:
{
if ((target != null) && target.isPlayer())
{
return (caster.getInventory().getItems(L2ItemInstance::isEquipped, i -> i.getId() == _itemId).size() > 0) && (target.getActingPlayer().getInventory().getItems(L2ItemInstance::isEquipped, i -> i.getId() == _itemId).size() > 0);
}
}
}
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import java.util.List;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpExistNpcSkillCondition implements ISkillCondition
{
private final List<Integer> _npcIds;
private final int _range;
private final boolean _isAround;
public OpExistNpcSkillCondition(StatsSet params)
{
_npcIds = params.getList("npcIds", Integer.class);
_range = params.getInt("range");
_isAround = params.getBoolean("isAround");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final List<L2Npc> npcs = L2World.getInstance().getVisibleObjects(caster, L2Npc.class, _range);
return _isAround == npcs.stream().anyMatch(npc -> _npcIds.contains(npc.getId()));
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpFishingCastSkillCondition implements ISkillCondition
{
public OpFishingCastSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpFishingPumpingSkillCondition implements ISkillCondition
{
public OpFishingPumpingSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpFishingReelingSkillCondition implements ISkillCondition
{
public OpFishingReelingSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,39 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpHaveSummonSkillCondition implements ISkillCondition
{
public OpHaveSummonSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.hasServitors();
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpHaveSummonedNpcSkillCondition implements ISkillCondition
{
private final int _npcId;
public OpHaveSummonedNpcSkillCondition(StatsSet params)
{
_npcId = params.getInt("npcId");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.getSummonedNpcs().stream().anyMatch(n -> n.getId() == _npcId);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.data.xml.impl.ClanHallData;
import com.l2jmobius.gameserver.enums.ResidenceType;
import com.l2jmobius.gameserver.instancemanager.CastleManager;
import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpHomeSkillCondition implements ISkillCondition
{
private final ResidenceType _type;
public OpHomeSkillCondition(StatsSet params)
{
_type = params.getEnum("type", ResidenceType.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if (caster.isPlayer())
{
final L2Clan clan = caster.getActingPlayer().getClan();
if (clan != null)
{
switch (_type)
{
case CASTLE:
{
return CastleManager.getInstance().getCastleByOwner(clan) != null;
}
case FORTRESS:
{
return FortManager.getInstance().getFortByOwner(clan) != null;
}
case CLANHALL:
{
return ClanHallData.getInstance().getClanHallByClan(clan) != null;
}
}
}
}
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpInSiegeTimeSkillCondition implements ISkillCondition
{
public OpInSiegeTimeSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpInstantzoneSkillCondition implements ISkillCondition
{
private final int _instanceId;
public OpInstantzoneSkillCondition(StatsSet params)
{
_instanceId = params.getInt("instanceId");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final Instance instance = caster.getInstanceWorld();
return (instance != null) && (instance.getTemplateId() == _instanceId);
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpMainjobSkillCondition implements ISkillCondition
{
public OpMainjobSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.isPlayer() && !caster.getActingPlayer().isSubClassActive();
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpNeedAgathionSkillCondition implements ISkillCondition
{
public OpNeedAgathionSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.isPlayer() && (caster.getActingPlayer().getAgathionId() != 0);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
{
private final List<Integer> _npcIds = new ArrayList<>();
public OpNeedSummonOrPetSkillCondition(StatsSet params)
{
final List<String> npcIds = params.getList("npcIds", String.class);
if (npcIds != null)
{
npcIds.stream().map(Integer::valueOf).forEach(_npcIds::add);
}
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final L2Summon pet = caster.getPet();
final Collection<L2Summon> summons = caster.getServitors().values();
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(npcId -> _npcIds.contains(npcId));
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpNotCursedSkillCondition implements ISkillCondition
{
public OpNotCursedSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.isPlayer() && !caster.getActingPlayer().isCursedWeaponEquipped();
}
}

View File

@ -0,0 +1,39 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpNotInstantzoneSkillCondition implements ISkillCondition
{
public OpNotInstantzoneSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.getInstanceId() == 0;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpNotOlympiadSkillCondition implements ISkillCondition
{
public OpNotOlympiadSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return (caster.isPlayer() && !caster.getActingPlayer().isInOlympiadMode());
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpNotTerritorySkillCondition implements ISkillCondition
{
public OpNotTerritorySkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.zone.ZoneId;
/**
* @author UnAfraid
*/
public class OpPeacezoneSkillCondition implements ISkillCondition
{
public OpPeacezoneSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.isInsideZone(ZoneId.PEACE);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.SkillConditionAffectType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpPkcountSkillCondition implements ISkillCondition
{
private final SkillConditionAffectType _affectType;
public OpPkcountSkillCondition(StatsSet params)
{
_affectType = params.getEnum("affectType", SkillConditionAffectType.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
switch (_affectType)
{
case CASTER:
{
return caster.isPlayer() && (caster.getActingPlayer().getPkKills() > 0);
}
case TARGET:
{
if ((target != null) && target.isPlayer())
{
return target.getActingPlayer().getPkKills() > 0;
}
break;
}
}
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpPledgeSkillCondition implements ISkillCondition
{
private final int _level;
public OpPledgeSkillCondition(StatsSet params)
{
_level = params.getInt("level");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final L2Clan clan = caster.getClan();
return (clan != null) && (clan.getLevel() >= _level);
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpRestartPointSkillCondition implements ISkillCondition
{
public OpRestartPointSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,113 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
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.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* @author Sdw
*/
public class OpResurrectionSkillCondition implements ISkillCondition
{
public OpResurrectionSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
boolean canResurrect = true;
if (target == caster)
{
return canResurrect;
}
if (target.isPlayer())
{
final L2PcInstance player = target.getActingPlayer();
if (!player.isDead())
{
canResurrect = false;
if (caster.isPlayer())
{
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
msg.addSkillName(skill);
caster.sendPacket(msg);
}
}
else if (player.isResurrectionBlocked())
{
canResurrect = false;
if (caster.isPlayer())
{
caster.sendPacket(SystemMessageId.REJECT_RESURRECTION);
}
}
else if (player.isReviveRequested())
{
canResurrect = false;
if (caster.isPlayer())
{
caster.sendPacket(SystemMessageId.RESURRECTION_HAS_ALREADY_BEEN_PROPOSED);
}
}
}
else if (target.isSummon())
{
final L2Summon summon = (L2Summon) target;
final L2PcInstance player = target.getActingPlayer();
if (!summon.isDead())
{
canResurrect = false;
if (caster.isPlayer())
{
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
msg.addSkillName(skill);
caster.sendPacket(msg);
}
}
else if (summon.isResurrectionBlocked())
{
canResurrect = false;
if (caster.isPlayer())
{
caster.sendPacket(SystemMessageId.REJECT_RESURRECTION);
}
}
else if ((player != null) && player.isRevivingPet())
{
canResurrect = false;
if (caster.isPlayer())
{
caster.sendPacket(SystemMessageId.RESURRECTION_HAS_ALREADY_BEEN_PROPOSED);
}
}
}
return canResurrect;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpSiegeHammerSkillCondition implements ISkillCondition
{
public OpSiegeHammerSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpSkillAcquireSkillCondition implements ISkillCondition
{
final int _skillId;
private final boolean _hasLearned;
public OpSkillAcquireSkillCondition(StatsSet params)
{
_skillId = params.getInt("skillId");
_hasLearned = params.getBoolean("hasLearned");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final int skillLevel = caster.getSkillLevel(_skillId);
return _hasLearned ? skillLevel != -1 : skillLevel == -1;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpSkillSkillCondition implements ISkillCondition
{
private final int _skillId;
private final int _skillLevel;
private final boolean _hasLearned;
public OpSkillSkillCondition(StatsSet params)
{
_skillId = params.getInt("skillId");
_skillLevel = params.getInt("skillLevel");
_hasLearned = params.getBoolean("hasLearned");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final Skill requestedSkill = caster.getKnownSkill(_skillId);
if (_hasLearned)
{
return (requestedSkill != null) && (requestedSkill.getLevel() == _skillLevel);
}
return (requestedSkill == null) || (requestedSkill.getLevel() != _skillLevel);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpSocialClassSkillCondition implements ISkillCondition
{
private final int _socialClass;
public OpSocialClassSkillCondition(StatsSet params)
{
_socialClass = params.getInt("socialClass");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.isPlayer() && (caster.getActingPlayer().getPledgeClass() >= _socialClass);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author UnAfraid
*/
public class OpSoulMaxSkillCondition implements ISkillCondition
{
public OpSoulMaxSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final int maxSouls = (int) caster.getStat().getValue(Stats.MAX_SOULS);
return caster.isPlayable() && (caster.getActingPlayer().getChargedSouls() < maxSouls);
}
}

View File

@ -0,0 +1,39 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpSubjobSkillCondition implements ISkillCondition
{
public OpSubjobSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.isPlayer() && caster.getActingPlayer().isSubClassActive();
}
}

View File

@ -0,0 +1,80 @@
/*
* 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 handlers.skillconditionhandlers;
import java.util.concurrent.atomic.AtomicBoolean;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
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.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author Sdw
*/
public class OpSweeperSkillCondition implements ISkillCondition
{
public OpSweeperSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
final AtomicBoolean canSweep = new AtomicBoolean(false);
if (caster.getActingPlayer() != null)
{
final L2PcInstance sweeper = caster.getActingPlayer();
if (skill != null)
{
skill.forEachTargetAffected(sweeper, target, o ->
{
if (o.isAttackable())
{
final L2Attackable a = (L2Attackable) o;
if (a.isDead())
{
if (a.isSpoiled())
{
canSweep.set(a.checkSpoilOwner(sweeper, true));
if (canSweep.get())
{
canSweep.set(!a.isOldCorpse(sweeper, Config.CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY, true));
}
if (canSweep.get())
{
canSweep.set(sweeper.getInventory().checkInventorySlotsAndWeight(a.getSpoilLootItems(), true, true));
}
}
else
{
sweeper.sendPacket(SystemMessageId.SWEEPER_FAILED_TARGET_NOT_SPOILED);
}
}
}
});
}
}
return canSweep.get();
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpTargetAllItemTypeSkillCondition implements ISkillCondition
{
public OpTargetAllItemTypeSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpTargetArmorTypeSkillCondition implements ISkillCondition
{
public OpTargetArmorTypeSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpTargetMyPledgeAcademySkillCondition implements ISkillCondition
{
public OpTargetMyPledgeAcademySkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if ((caster.getClan() == null) || (target == null) || !target.isPlayer())
{
return false;
}
final L2PcInstance targetPlayer = target.getActingPlayer();
return targetPlayer.isAcademyMember() && (targetPlayer.getClan() == caster.getClan());
}
}

View File

@ -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 handlers.skillconditionhandlers;
import java.util.List;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpTargetNpcSkillCondition implements ISkillCondition
{
private final List<Integer> _npcId;
public OpTargetNpcSkillCondition(StatsSet params)
{
_npcId = params.getList("npcIds", Integer.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return (target != null) && target.isNpc() && _npcId.contains(target.getId());
}
}

View File

@ -0,0 +1,39 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpTargetPcSkillCondition implements ISkillCondition
{
public OpTargetPcSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return (target != null) && target.isPlayer();
}
}

View File

@ -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 handlers.skillconditionhandlers;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.items.L2Weapon;
import com.l2jmobius.gameserver.model.items.type.WeaponType;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpTargetWeaponAttackTypeSkillCondition implements ISkillCondition
{
private final List<WeaponType> _weaponTypes = new ArrayList<>();
public OpTargetWeaponAttackTypeSkillCondition(StatsSet params)
{
final List<String> weaponTypes = params.getList("weaponTypes", String.class);
if (weaponTypes != null)
{
weaponTypes.stream().map(WeaponType::valueOf).forEach(_weaponTypes::add);
}
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if ((target == null) || !target.isCharacter())
{
return false;
}
final L2Character targetCreature = (L2Character) target;
final L2Weapon weapon = targetCreature.getActiveWeaponItem();
return _weaponTypes.stream().anyMatch(weaponType -> weaponType == weapon.getItemType());
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpTerritorySkillCondition implements ISkillCondition
{
public OpTerritorySkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2ChestInstance;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class OpUnlockSkillCondition implements ISkillCondition
{
public OpUnlockSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return (target != null) && (target.isDoor() || (target instanceof L2ChestInstance));
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpUseFirecrackerSkillCondition implements ISkillCondition
{
public OpUseFirecrackerSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class OpUsePraseedSkillCondition implements ISkillCondition
{
public OpUsePraseedSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.MountType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class OpWyvernSkillCondition implements ISkillCondition
{
public OpWyvernSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.isPlayer() && (caster.getActingPlayer().getMountType() == MountType.WYVERN);
}
}

View File

@ -0,0 +1,76 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.instancemanager.CastleManager;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
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.skills.ISkillCondition;
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;
/**
* @author UnAfraid
*/
public class PossessHolythingSkillCondition implements ISkillCondition
{
public PossessHolythingSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
if ((caster == null) || !caster.isPlayer())
{
return false;
}
final L2PcInstance player = caster.getActingPlayer();
boolean canTakeCastle = true;
if (player.isAlikeDead() || player.isCursedWeaponEquipped() || !player.isClanLeader())
{
canTakeCastle = false;
}
final Castle castle = CastleManager.getInstance().getCastle(player);
SystemMessage sm;
if ((castle == null) || (castle.getResidenceId() <= 0) || !castle.getSiege().isInProgress() || (castle.getSiege().getAttackerClan(player.getClan()) == null))
{
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
sm.addSkillName(skill);
player.sendPacket(sm);
canTakeCastle = false;
}
else if (!castle.getArtefacts().contains(target))
{
player.sendPacket(SystemMessageId.INVALID_TARGET);
canTakeCastle = false;
}
else if (!Util.checkIfInRange(skill.getCastRange(), player, target, true))
{
player.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
canTakeCastle = false;
}
return canTakeCastle;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.SkillConditionPercentType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class RemainCpPerSkillCondition implements ISkillCondition
{
private final int _amount;
private final SkillConditionPercentType _percentType;
public RemainCpPerSkillCondition(StatsSet params)
{
_amount = params.getInt("amount");
_percentType = params.getEnum("percentType", SkillConditionPercentType.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return _percentType.test(caster.getCurrentCpPercent(), _amount);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.SkillConditionAffectType;
import com.l2jmobius.gameserver.enums.SkillConditionPercentType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class RemainHpPerSkillCondition implements ISkillCondition
{
private final int _amount;
private final SkillConditionPercentType _percentType;
private final SkillConditionAffectType _affectType;
public RemainHpPerSkillCondition(StatsSet params)
{
_amount = params.getInt("amount");
_percentType = params.getEnum("percentType", SkillConditionPercentType.class);
_affectType = params.getEnum("affectType", SkillConditionAffectType.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
switch (_affectType)
{
case CASTER:
{
return _percentType.test(caster.getCurrentHpPercent(), _amount);
}
case TARGET:
{
if ((target != null) && target.isCharacter())
{
return _percentType.test(((L2Character) target).getCurrentHpPercent(), _amount);
}
break;
}
}
return false;
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.enums.SkillConditionPercentType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class RemainMpPerSkillCondition implements ISkillCondition
{
private final int _amount;
private final SkillConditionPercentType _percentType;
public RemainMpPerSkillCondition(StatsSet params)
{
_amount = params.getInt("amount");
_percentType = params.getEnum("percentType", SkillConditionPercentType.class);
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return _percentType.test(caster.getCurrentMpPercent(), _amount);
}
}

View File

@ -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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class SoulSavedSkillCondition implements ISkillCondition
{
private final int _amount;
public SoulSavedSkillCondition(StatsSet params)
{
_amount = params.getInt("amount");
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return caster.isPlayer() && (caster.getActingPlayer().getChargedSouls() >= _amount);
}
}

View File

@ -0,0 +1,40 @@
/*
* 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 handlers.skillconditionhandlers;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author
*/
public class TargetItemCrystalTypeSkillCondition implements ISkillCondition
{
public TargetItemCrystalTypeSkillCondition(StatsSet params)
{
}
@Override
public boolean canUse(L2Character caster, Skill skill, L2Object target)
{
return false;
}
}

Some files were not shown because too many files have changed in this diff Show More