Addition of TeleportWithEffect script.
This commit is contained in:
parent
db463e2793
commit
ed93873609
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package ai.others;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import org.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
|
import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
|
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
|
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSkillFinishCast;
|
||||||
|
import org.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||||
|
|
||||||
|
import ai.AbstractNpcAI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TeleportWithEffect extends AbstractNpcAI
|
||||||
|
{
|
||||||
|
public TeleportWithEffect()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@RegisterEvent(EventType.ON_CREATURE_SKILL_FINISH_CAST)
|
||||||
|
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
|
||||||
|
public void OnCreatureSkillFinishCast(OnCreatureSkillFinishCast event)
|
||||||
|
{
|
||||||
|
if (event.getSkill() != CommonSkill.TELEPORT.getSkill())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final PlayerInstance player = event.getCaster().getActingPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Location location = player.getTeleportLocation();
|
||||||
|
if (location != null)
|
||||||
|
{
|
||||||
|
player.teleToLocation(location);
|
||||||
|
player.setTeleportLocation(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
new TeleportWithEffect();
|
||||||
|
}
|
||||||
|
}
|
@ -553,6 +553,8 @@ public class PlayerInstance extends Playable
|
|||||||
private Location _lastLoc;
|
private Location _lastLoc;
|
||||||
private boolean _observerMode = false;
|
private boolean _observerMode = false;
|
||||||
|
|
||||||
|
private Location _teleportLocation;
|
||||||
|
|
||||||
/** Stored from last ValidatePosition **/
|
/** Stored from last ValidatePosition **/
|
||||||
private final Location _lastServerPosition = new Location(0, 0, 0);
|
private final Location _lastServerPosition = new Location(0, 0, 0);
|
||||||
|
|
||||||
@ -10404,6 +10406,16 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTeleportLocation(Location location)
|
||||||
|
{
|
||||||
|
_teleportLocation = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getTeleportLocation()
|
||||||
|
{
|
||||||
|
return _teleportLocation;
|
||||||
|
}
|
||||||
|
|
||||||
public void setLastServerPosition(int x, int y, int z)
|
public void setLastServerPosition(int x, int y, int z)
|
||||||
{
|
{
|
||||||
_lastServerPosition.setXYZ(x, y, z);
|
_lastServerPosition.setXYZ(x, y, z);
|
||||||
|
@ -17,16 +17,15 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.teleports;
|
package org.l2jmobius.gameserver.network.clientpackets.teleports;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
||||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.effects.EffectFlag;
|
import org.l2jmobius.gameserver.model.effects.EffectFlag;
|
||||||
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
|
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
|
||||||
import org.l2jmobius.gameserver.model.siege.Castle;
|
import org.l2jmobius.gameserver.model.siege.Castle;
|
||||||
import org.l2jmobius.gameserver.model.skills.CommonSkill;
|
import org.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||||
import org.l2jmobius.gameserver.model.skills.SkillCaster;
|
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
@ -116,14 +115,8 @@ public class ExRequestTeleport implements IClientIncomingPacket
|
|||||||
|
|
||||||
player.abortCast();
|
player.abortCast();
|
||||||
player.stopMove(null);
|
player.stopMove(null);
|
||||||
player.setImmobilized(true);
|
|
||||||
|
|
||||||
SkillCaster.triggerCast(player, player, CommonSkill.TELEPORT.getSkill());
|
player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
|
||||||
|
player.doCast(CommonSkill.TELEPORT.getSkill());
|
||||||
ThreadPool.schedule(() ->
|
|
||||||
{
|
|
||||||
player.teleToLocation(teleport.getX(), teleport.getY(), teleport.getZ());
|
|
||||||
player.setImmobilized(false);
|
|
||||||
}, 2500);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user