From 0a79da9f1851ae1e4672189f24b668e0758671d4 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 27 Oct 2017 14:00:45 +0000 Subject: [PATCH] Addition of TeleportToPlayer effect handler. --- .../scripts/handlers/EffectMasterHandler.java | 1 + .../effecthandlers/TeleportToPlayer.java | 123 ++++++++++++++++++ .../game/data/stats/skills/documentation.txt | 1 + .../scripts/handlers/EffectMasterHandler.java | 1 + .../effecthandlers/TeleportToPlayer.java | 123 ++++++++++++++++++ .../game/data/stats/skills/documentation.txt | 1 + .../scripts/handlers/EffectMasterHandler.java | 1 + .../effecthandlers/TeleportToPlayer.java | 123 ++++++++++++++++++ .../game/data/stats/skills/documentation.txt | 1 + .../scripts/handlers/EffectMasterHandler.java | 1 + .../effecthandlers/TeleportToPlayer.java | 123 ++++++++++++++++++ .../game/data/stats/skills/documentation.txt | 1 + 12 files changed, 500 insertions(+) create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java create mode 100644 L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java index a44f0db440..087630c862 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -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); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java new file mode 100644 index 0000000000..7e474a8594 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java @@ -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 . + */ +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); + } + } +} diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt index 6c4cfa4585..cface0300e 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt @@ -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. diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java index a44f0db440..087630c862 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -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); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java new file mode 100644 index 0000000000..7e474a8594 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java @@ -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 . + */ +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); + } + } +} diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt index 6c4cfa4585..cface0300e 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt @@ -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. diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java index a44f0db440..087630c862 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -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); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java new file mode 100644 index 0000000000..7e474a8594 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java @@ -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 . + */ +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); + } + } +} diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt index 6c4cfa4585..cface0300e 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt @@ -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. diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java index a44f0db440..087630c862 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -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); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java new file mode 100644 index 0000000000..7e474a8594 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java @@ -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 . + */ +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); + } + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt index 6c4cfa4585..cface0300e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt @@ -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.