Fixed losing target with instant teleport.
This commit is contained in:
@@ -26,6 +26,7 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -91,6 +92,8 @@ public class Blink extends AbstractEffect
|
||||
|
||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effected.broadcastPacket(new FlyToLocation(effected, destination, _flyType, _flySpeed, _flyDelay, _animationSpeed));
|
||||
effected.teleToLocationInstant(destination);
|
||||
effected.setXYZ(destination);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
|
||||
/**
|
||||
* This Blink effect switches the location of the caster and the target.<br>
|
||||
@@ -54,12 +55,15 @@ public class BlinkSwap extends AbstractEffect
|
||||
effector.broadcastPacket(new FlyToLocation(effector, effectedLoc, FlyType.DUMMY));
|
||||
effector.abortAttack();
|
||||
effector.abortCast();
|
||||
effector.teleToLocationInstant(effectedLoc);
|
||||
effector.setXYZ(effectedLoc);
|
||||
effector.broadcastPacket(new ValidateLocation(effector));
|
||||
|
||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effected.broadcastPacket(new FlyToLocation(effected, effectorLoc, FlyType.DUMMY));
|
||||
effected.abortAttack();
|
||||
effected.abortCast();
|
||||
effected.teleToLocationInstant(effectorLoc);
|
||||
effected.setXYZ(effectorLoc);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
|
||||
/**
|
||||
* Throw Up effect implementation.
|
||||
@@ -59,6 +60,8 @@ public class FlyAway extends AbstractEffect
|
||||
final Location destination = GeoEngine.getInstance().getValidLocation(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceWorld());
|
||||
|
||||
effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.THROW_UP));
|
||||
effected.teleToLocationInstant(destination);
|
||||
effected.setXYZ(destination);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
}
|
||||
}
|
||||
|
@@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -186,7 +187,9 @@ public class KnockBack extends AbstractEffect
|
||||
{
|
||||
effected.setHeading(Util.calculateHeadingFrom(effected, effector));
|
||||
}
|
||||
effected.teleToLocationInstant(loc);
|
||||
effected.setXYZ(loc);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
|
||||
World.getInstance().forEachVisibleObjectInRange(effected, PlayerInstance.class, 1200, nearby ->
|
||||
{
|
||||
|
@@ -25,6 +25,7 @@ import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
|
||||
/**
|
||||
* An effect that pulls effected target back to the effector.
|
||||
@@ -75,7 +76,9 @@ public class PullBack extends AbstractEffect
|
||||
if (GeoEngine.getInstance().canMoveToTarget(effected.getX(), effected.getY(), effected.getZ(), effector.getX(), effector.getY(), effector.getZ(), effected.getInstanceWorld()))
|
||||
{
|
||||
effected.broadcastPacket(new FlyToLocation(effected, effector, _type, _speed, _delay, _animationSpeed));
|
||||
effected.teleToLocationInstant(effector.getX(), effector.getY(), GeoEngine.getInstance().getHeight(effector.getX(), effector.getY(), effector.getZ()) + 10);
|
||||
effected.setXYZ(effector.getX(), effector.getY(), GeoEngine.getInstance().getHeight(effector.getX(), effector.getY(), effector.getZ()) + 10);
|
||||
effected.broadcastPacket(new ValidateLocation(effected), false);
|
||||
effected.revalidateZone(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
|
||||
/**
|
||||
* Teleport player/party to summoned npc effect implementation.
|
||||
@@ -94,7 +95,9 @@ public class TeleportToNpc extends AbstractEffect
|
||||
effected.broadcastPacket(new FlyToLocation(effected, location, FlyType.DUMMY));
|
||||
effected.abortAttack();
|
||||
effected.abortCast();
|
||||
effected.teleToLocationInstant(location);
|
||||
effected.setXYZ(location);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -28,6 +28,7 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -86,12 +87,14 @@ public class TeleportToSummon extends AbstractEffect
|
||||
final int y = (int) (py + (25 * Math.sin(ph)));
|
||||
final int z = summon.getZ();
|
||||
|
||||
final Location loc = GeoEngine.getInstance().getValidLocation(effector.getX(), effector.getY(), effector.getZ(), x, y, z, effector.getInstanceWorld());
|
||||
final Location loc = GeoEngine.getInstance().getValidLocation(effector.getX(), effector.getY(), effector.getZ(), x, y, z,effector.getInstanceWorld());
|
||||
|
||||
effector.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effector.broadcastPacket(new FlyToLocation(effector, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));
|
||||
effector.abortAttack();
|
||||
effector.abortCast();
|
||||
effector.teleToLocationInstant(loc);
|
||||
effector.setXYZ(loc);
|
||||
effector.broadcastPacket(new ValidateLocation(effector));
|
||||
effected.revalidateZone(true);
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -75,12 +76,14 @@ public class TeleportToTarget extends AbstractEffect
|
||||
final int y = (int) (py + (25 * Math.sin(ph)));
|
||||
final int z = effected.getZ();
|
||||
|
||||
final Location loc = GeoEngine.getInstance().getValidLocation(effector.getX(), effector.getY(), effector.getZ(), x, y, z, effector.getInstanceWorld());
|
||||
final Location loc = GeoEngine.getInstance().getValidLocation(effector.getX(), effector.getY(), effector.getZ(), x, y, z,effector.getInstanceWorld());
|
||||
|
||||
effector.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effector.broadcastPacket(new FlyToLocation(effector, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));
|
||||
effector.abortAttack();
|
||||
effector.abortCast();
|
||||
effector.teleToLocationInstant(loc);
|
||||
effector.setXYZ(loc);
|
||||
effector.broadcastPacket(new ValidateLocation(effector));
|
||||
effected.revalidateZone(true);
|
||||
}
|
||||
}
|
||||
|
@@ -758,9 +758,8 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* @param zValue
|
||||
* @param headingValue
|
||||
* @param instanceValue
|
||||
* @param instant
|
||||
*/
|
||||
public void teleToLocation(int xValue, int yValue, int zValue, int headingValue, Instance instanceValue, boolean instant)
|
||||
public void teleToLocation(int xValue, int yValue, int zValue, int headingValue, Instance instanceValue)
|
||||
{
|
||||
int x = xValue;
|
||||
int y = yValue;
|
||||
@@ -785,7 +784,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare creature for teleport
|
||||
// Prepare creature for teleport.
|
||||
if (_isPendingRevive)
|
||||
{
|
||||
doRevive();
|
||||
@@ -805,54 +804,54 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
getAI().setIntention(AI_INTENTION_ACTIVE);
|
||||
|
||||
// Adjust position a bit
|
||||
z += 5;
|
||||
|
||||
// Send teleport packet to player and visible players
|
||||
broadcastPacket(new TeleportToLocation(this, x, y, z, heading, instant));
|
||||
|
||||
// remove the object from its old location
|
||||
// Remove the object from its old location.
|
||||
decayMe();
|
||||
|
||||
// Change instance world
|
||||
// Adjust position a bit.
|
||||
z += 5;
|
||||
|
||||
// Send teleport packet where needed.
|
||||
broadcastPacket(new TeleportToLocation(this, x, y, z, heading));
|
||||
|
||||
// Change instance world.
|
||||
if (getInstanceWorld() != instance)
|
||||
{
|
||||
setInstance(instance);
|
||||
}
|
||||
|
||||
// Set the x,y,z position of the WorldObject and if necessary modify its _worldRegion
|
||||
// Set the x,y,z position of the WorldObject and if necessary modify its _worldRegion.
|
||||
setXYZ(x, y, z);
|
||||
|
||||
// temporary fix for heading on teleport
|
||||
// Also adjust heading.
|
||||
if (heading != 0)
|
||||
{
|
||||
setHeading(heading);
|
||||
}
|
||||
|
||||
// Send teleport finished packet to player
|
||||
// Send teleport finished packet to player.
|
||||
sendPacket(new ExTeleportToLocationActivate(this));
|
||||
|
||||
// allow recall of the detached characters
|
||||
// Allow recall of the detached characters.
|
||||
if (!isPlayer() || ((getActingPlayer().getClient() != null) && getActingPlayer().getClient().isDetached()))
|
||||
{
|
||||
onTeleported();
|
||||
}
|
||||
|
||||
revalidateZone(true);
|
||||
}
|
||||
|
||||
public void teleToLocation(int x, int y, int z)
|
||||
{
|
||||
teleToLocation(x, y, z, 0, getInstanceWorld(), false);
|
||||
teleToLocation(x, y, z, 0, getInstanceWorld());
|
||||
}
|
||||
|
||||
public void teleToLocation(int x, int y, int z, Instance instance)
|
||||
{
|
||||
teleToLocation(x, y, z, 0, instance, false);
|
||||
teleToLocation(x, y, z, 0, instance);
|
||||
}
|
||||
|
||||
public void teleToLocation(int x, int y, int z, int heading)
|
||||
{
|
||||
teleToLocation(x, y, z, heading, getInstanceWorld(), false);
|
||||
teleToLocation(x, y, z, heading, getInstanceWorld());
|
||||
}
|
||||
|
||||
public void teleToLocation(int x, int y, int z, int heading, boolean randomOffset)
|
||||
@@ -879,7 +878,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
x += Rnd.get(-randomOffset, randomOffset);
|
||||
y += Rnd.get(-randomOffset, randomOffset);
|
||||
}
|
||||
teleToLocation(x, y, z, heading, instance, false);
|
||||
teleToLocation(x, y, z, heading, instance);
|
||||
}
|
||||
|
||||
public void teleToLocation(ILocational loc)
|
||||
@@ -889,7 +888,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
public void teleToLocation(ILocational loc, Instance instance)
|
||||
{
|
||||
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), instance, false);
|
||||
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), instance);
|
||||
}
|
||||
|
||||
public void teleToLocation(ILocational loc, int randomOffset)
|
||||
@@ -922,16 +921,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
teleToLocation(MapRegionManager.getInstance().getTeleToLocation(this, teleportWhere), true, instance);
|
||||
}
|
||||
|
||||
public void teleToLocationInstant(ILocational loc)
|
||||
{
|
||||
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), getHeading() /* Use the current heading */, getInstanceWorld(), true);
|
||||
}
|
||||
|
||||
public void teleToLocationInstant(int x, int y, int z)
|
||||
{
|
||||
teleToLocation(x, y, z, getHeading(), getInstanceWorld(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launch a physical attack against a target (Simple, Bow, Pole or Dual).<br>
|
||||
* <br>
|
||||
|
@@ -890,7 +890,7 @@ public abstract class Summon extends Playable
|
||||
public void onTeleported()
|
||||
{
|
||||
super.onTeleported();
|
||||
sendPacket(new TeleportToLocation(this, getX(), getY(), getZ(), getHeading(), false));
|
||||
sendPacket(new TeleportToLocation(this, getX(), getY(), getZ(), getHeading()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -121,10 +121,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
||||
player.stopMove(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setXYZ(_x, _y, _z);
|
||||
}
|
||||
player.sendPacket(new ValidateLocation(player));
|
||||
}
|
||||
|
||||
|
@@ -27,16 +27,14 @@ public class TeleportToLocation implements IClientOutgoingPacket
|
||||
private final int _y;
|
||||
private final int _z;
|
||||
private final int _heading;
|
||||
private final boolean _instant;
|
||||
|
||||
public TeleportToLocation(WorldObject obj, int x, int y, int z, int heading, boolean instant)
|
||||
public TeleportToLocation(WorldObject obj, int x, int y, int z, int heading)
|
||||
{
|
||||
_targetObjId = obj.getObjectId();
|
||||
_x = x;
|
||||
_y = y;
|
||||
_z = z;
|
||||
_heading = heading;
|
||||
_instant = instant;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,9 +46,9 @@ public class TeleportToLocation implements IClientOutgoingPacket
|
||||
packet.writeD(_x);
|
||||
packet.writeD(_y);
|
||||
packet.writeD(_z);
|
||||
packet.writeD(_instant ? 0x01 : 0x00);
|
||||
packet.writeD(0x00); // Fade 0, Instant 1.
|
||||
packet.writeD(_heading);
|
||||
packet.writeD(0x00); // Unknown
|
||||
packet.writeD(0x00); // Unknown.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user