Addition of TeleportToPlayer effect handler.
This commit is contained in:
parent
e54665ecc8
commit
0a79da9f18
@ -322,6 +322,7 @@ public final class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("TargetMeProbability", TargetMeProbability::new);
|
||||
EffectHandler.getInstance().registerHandler("Teleport", Teleport::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToNpc", TeleportToNpc::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToPlayer", TeleportToPlayer::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToSummon", TeleportToSummon::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToTarget", TeleportToTarget::new);
|
||||
EffectHandler.getInstance().registerHandler("FlyAway", FlyAway::new);
|
||||
|
123
L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java
vendored
Normal file
123
L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You 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.effecthandlers;
|
||||
|
||||
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.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
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 Mobius
|
||||
*/
|
||||
public class TeleportToPlayer extends AbstractEffect
|
||||
{
|
||||
public TeleportToPlayer(StatsSet params)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.TELEPORT_TO_TARGET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
|
||||
{
|
||||
if ((effected.getTarget() != null) && (effected.getTarget() != effected) && effected.getTarget().isPlayer())
|
||||
{
|
||||
final L2PcInstance target = (L2PcInstance) effected.getTarget();
|
||||
if (target.isAlikeDead())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_DEAD_AT_THE_MOMENT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInStoreMode())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_TRADING_OR_OPERATING_A_PRIVATE_STORE_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isRooted() || target.isInCombat())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ENGAGED_IN_COMBAT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInOlympiadMode())
|
||||
{
|
||||
effected.sendPacket(SystemMessageId.A_USER_PARTICIPATING_IN_THE_OLYMPIAD_CANNOT_USE_SUMMONING_OR_TELEPORTING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isFlyingMounted() || target.isCombatFlagEquipped())
|
||||
{
|
||||
effected.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.inObserverMode() || OlympiadManager.getInstance().isRegisteredInComp(target))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING2);
|
||||
sm.addCharName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || target.isInsideZone(ZoneId.JAIL))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
|
||||
sm.addString(target.getName());
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
final Instance instance = target.getInstanceWorld();
|
||||
if ((instance != null) && !instance.isPlayerSummonAllowed())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
|
||||
sm.addString(target.getName());
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
effected.teleToLocation(effected.getTarget(), true, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -290,6 +290,7 @@ TargetMe: Changes your enemy's target to you.
|
||||
TargetMeProbability: Changes your enemy's target to you with a given probability.
|
||||
Teleport: Teleports to a specified XYZ location.
|
||||
TeleportToNpc: Teleports to a specified Npc Id.
|
||||
TeleportToPlayer: Teleports to targeted player. (l2jmobius)
|
||||
TeleportToSummon: Teleports to your summon.
|
||||
TeleportToTarget: Teleports to your target.
|
||||
TransferDamageToPlayer: Transfers portion of incoming damage from target to you.
|
||||
|
@ -322,6 +322,7 @@ public final class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("TargetMeProbability", TargetMeProbability::new);
|
||||
EffectHandler.getInstance().registerHandler("Teleport", Teleport::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToNpc", TeleportToNpc::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToPlayer", TeleportToPlayer::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToSummon", TeleportToSummon::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToTarget", TeleportToTarget::new);
|
||||
EffectHandler.getInstance().registerHandler("FlyAway", FlyAway::new);
|
||||
|
123
L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java
vendored
Normal file
123
L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You 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.effecthandlers;
|
||||
|
||||
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.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
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 Mobius
|
||||
*/
|
||||
public class TeleportToPlayer extends AbstractEffect
|
||||
{
|
||||
public TeleportToPlayer(StatsSet params)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.TELEPORT_TO_TARGET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
|
||||
{
|
||||
if ((effected.getTarget() != null) && (effected.getTarget() != effected) && effected.getTarget().isPlayer())
|
||||
{
|
||||
final L2PcInstance target = (L2PcInstance) effected.getTarget();
|
||||
if (target.isAlikeDead())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_DEAD_AT_THE_MOMENT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInStoreMode())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_TRADING_OR_OPERATING_A_PRIVATE_STORE_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isRooted() || target.isInCombat())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ENGAGED_IN_COMBAT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInOlympiadMode())
|
||||
{
|
||||
effected.sendPacket(SystemMessageId.A_USER_PARTICIPATING_IN_THE_OLYMPIAD_CANNOT_USE_SUMMONING_OR_TELEPORTING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isFlyingMounted() || target.isCombatFlagEquipped())
|
||||
{
|
||||
effected.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.inObserverMode() || OlympiadManager.getInstance().isRegisteredInComp(target))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING2);
|
||||
sm.addCharName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || target.isInsideZone(ZoneId.JAIL))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
|
||||
sm.addString(target.getName());
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
final Instance instance = target.getInstanceWorld();
|
||||
if ((instance != null) && !instance.isPlayerSummonAllowed())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
|
||||
sm.addString(target.getName());
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
effected.teleToLocation(effected.getTarget(), true, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -290,6 +290,7 @@ TargetMe: Changes your enemy's target to you.
|
||||
TargetMeProbability: Changes your enemy's target to you with a given probability.
|
||||
Teleport: Teleports to a specified XYZ location.
|
||||
TeleportToNpc: Teleports to a specified Npc Id.
|
||||
TeleportToPlayer: Teleports to targeted player. (l2jmobius)
|
||||
TeleportToSummon: Teleports to your summon.
|
||||
TeleportToTarget: Teleports to your target.
|
||||
TransferDamageToPlayer: Transfers portion of incoming damage from target to you.
|
||||
|
@ -322,6 +322,7 @@ public final class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("TargetMeProbability", TargetMeProbability::new);
|
||||
EffectHandler.getInstance().registerHandler("Teleport", Teleport::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToNpc", TeleportToNpc::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToPlayer", TeleportToPlayer::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToSummon", TeleportToSummon::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToTarget", TeleportToTarget::new);
|
||||
EffectHandler.getInstance().registerHandler("FlyAway", FlyAway::new);
|
||||
|
123
L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java
vendored
Normal file
123
L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You 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.effecthandlers;
|
||||
|
||||
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.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
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 Mobius
|
||||
*/
|
||||
public class TeleportToPlayer extends AbstractEffect
|
||||
{
|
||||
public TeleportToPlayer(StatsSet params)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.TELEPORT_TO_TARGET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
|
||||
{
|
||||
if ((effected.getTarget() != null) && (effected.getTarget() != effected) && effected.getTarget().isPlayer())
|
||||
{
|
||||
final L2PcInstance target = (L2PcInstance) effected.getTarget();
|
||||
if (target.isAlikeDead())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_DEAD_AT_THE_MOMENT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInStoreMode())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_TRADING_OR_OPERATING_A_PRIVATE_STORE_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isRooted() || target.isInCombat())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ENGAGED_IN_COMBAT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInOlympiadMode())
|
||||
{
|
||||
effected.sendPacket(SystemMessageId.A_USER_PARTICIPATING_IN_THE_OLYMPIAD_CANNOT_USE_SUMMONING_OR_TELEPORTING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isFlyingMounted() || target.isCombatFlagEquipped())
|
||||
{
|
||||
effected.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.inObserverMode() || OlympiadManager.getInstance().isRegisteredInComp(target))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING2);
|
||||
sm.addCharName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || target.isInsideZone(ZoneId.JAIL))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
|
||||
sm.addString(target.getName());
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
final Instance instance = target.getInstanceWorld();
|
||||
if ((instance != null) && !instance.isPlayerSummonAllowed())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
|
||||
sm.addString(target.getName());
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
effected.teleToLocation(effected.getTarget(), true, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -290,6 +290,7 @@ TargetMe: Changes your enemy's target to you.
|
||||
TargetMeProbability: Changes your enemy's target to you with a given probability.
|
||||
Teleport: Teleports to a specified XYZ location.
|
||||
TeleportToNpc: Teleports to a specified Npc Id.
|
||||
TeleportToPlayer: Teleports to targeted player. (l2jmobius)
|
||||
TeleportToSummon: Teleports to your summon.
|
||||
TeleportToTarget: Teleports to your target.
|
||||
TransferDamageToPlayer: Transfers portion of incoming damage from target to you.
|
||||
|
@ -322,6 +322,7 @@ public final class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("TargetMeProbability", TargetMeProbability::new);
|
||||
EffectHandler.getInstance().registerHandler("Teleport", Teleport::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToNpc", TeleportToNpc::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToPlayer", TeleportToPlayer::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToSummon", TeleportToSummon::new);
|
||||
EffectHandler.getInstance().registerHandler("TeleportToTarget", TeleportToTarget::new);
|
||||
EffectHandler.getInstance().registerHandler("FlyAway", FlyAway::new);
|
||||
|
123
L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java
vendored
Normal file
123
L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You 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.effecthandlers;
|
||||
|
||||
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.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
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 Mobius
|
||||
*/
|
||||
public class TeleportToPlayer extends AbstractEffect
|
||||
{
|
||||
public TeleportToPlayer(StatsSet params)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.TELEPORT_TO_TARGET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstant()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
|
||||
{
|
||||
if ((effected.getTarget() != null) && (effected.getTarget() != effected) && effected.getTarget().isPlayer())
|
||||
{
|
||||
final L2PcInstance target = (L2PcInstance) effected.getTarget();
|
||||
if (target.isAlikeDead())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_DEAD_AT_THE_MOMENT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInStoreMode())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_TRADING_OR_OPERATING_A_PRIVATE_STORE_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isRooted() || target.isInCombat())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ENGAGED_IN_COMBAT_AND_CANNOT_BE_SUMMONED_OR_TELEPORTED);
|
||||
sm.addPcName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInOlympiadMode())
|
||||
{
|
||||
effected.sendPacket(SystemMessageId.A_USER_PARTICIPATING_IN_THE_OLYMPIAD_CANNOT_USE_SUMMONING_OR_TELEPORTING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isFlyingMounted() || target.isCombatFlagEquipped())
|
||||
{
|
||||
effected.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.inObserverMode() || OlympiadManager.getInstance().isRegisteredInComp(target))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING2);
|
||||
sm.addCharName(target);
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || target.isInsideZone(ZoneId.JAIL))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
|
||||
sm.addString(target.getName());
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
final Instance instance = target.getInstanceWorld();
|
||||
if ((instance != null) && !instance.isPlayerSummonAllowed())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
|
||||
sm.addString(target.getName());
|
||||
effected.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
effected.teleToLocation(effected.getTarget(), true, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -290,6 +290,7 @@ TargetMe: Changes your enemy's target to you.
|
||||
TargetMeProbability: Changes your enemy's target to you with a given probability.
|
||||
Teleport: Teleports to a specified XYZ location.
|
||||
TeleportToNpc: Teleports to a specified Npc Id.
|
||||
TeleportToPlayer: Teleports to targeted player. (l2jmobius)
|
||||
TeleportToSummon: Teleports to your summon.
|
||||
TeleportToTarget: Teleports to your target.
|
||||
TransferDamageToPlayer: Transfers portion of incoming damage from target to you.
|
||||
|
Loading…
Reference in New Issue
Block a user