Fixed losing target with instant teleport.
This commit is contained in:
@@ -542,9 +542,8 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
* @param yValue the y
|
||||
* @param zValue the z
|
||||
* @param allowRandomOffset the allow random offset
|
||||
* @param instant
|
||||
*/
|
||||
public void teleToLocation(int xValue, int yValue, int zValue, boolean allowRandomOffset, boolean instant)
|
||||
public void teleToLocation(int xValue, int yValue, int zValue, boolean allowRandomOffset)
|
||||
{
|
||||
if (Config.TW_DISABLE_GK)
|
||||
{
|
||||
@@ -562,15 +561,15 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
}
|
||||
}
|
||||
|
||||
// Stop movement
|
||||
// Abort any client actions, casting and remove target.
|
||||
stopMove(null, false);
|
||||
abortAttack();
|
||||
abortCast();
|
||||
|
||||
setTeleporting(true);
|
||||
setTarget(null);
|
||||
|
||||
// Remove from world regions zones
|
||||
setTeleporting(true);
|
||||
|
||||
// Remove from world regions zones.
|
||||
final WorldRegion region = getWorldRegion();
|
||||
if (region != null)
|
||||
{
|
||||
@@ -579,6 +578,10 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
||||
|
||||
// Remove the object from its old location.
|
||||
decayMe();
|
||||
|
||||
// Adjust position a bit.
|
||||
int x = xValue;
|
||||
int y = yValue;
|
||||
int z = zValue;
|
||||
@@ -589,15 +592,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
}
|
||||
z += 5;
|
||||
|
||||
// Send a Server->Client packet TeleportToLocationt to the Creature AND to all PlayerInstance in the _KnownPlayers of the Creature
|
||||
broadcastPacket(new TeleportToLocation(this, x, y, z, getHeading(), instant));
|
||||
// Send teleport packet where needed.
|
||||
broadcastPacket(new TeleportToLocation(this, x, y, z, getHeading()));
|
||||
|
||||
// remove the object from its old location
|
||||
decayMe();
|
||||
|
||||
// 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.
|
||||
getPosition().setXYZ(x, y, z);
|
||||
if (!(this instanceof PlayerInstance))
|
||||
|
||||
if (!isPlayer())
|
||||
{
|
||||
onTeleported();
|
||||
}
|
||||
@@ -605,11 +606,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
revalidateZone(true);
|
||||
}
|
||||
|
||||
public void teleToLocation(int x, int y, int z, boolean allowRandomOffset)
|
||||
{
|
||||
teleToLocation(x, y, z, allowRandomOffset, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tele to location.
|
||||
* @param x the x
|
||||
@@ -657,16 +653,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
teleToLocation(MapRegionData.getInstance().getTeleToLocation(this, teleportWhere), true);
|
||||
}
|
||||
|
||||
public void teleToLocationInstant(Location loc)
|
||||
{
|
||||
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), false, true);
|
||||
}
|
||||
|
||||
public void teleToLocationInstant(int x, int y, int z)
|
||||
{
|
||||
teleToLocation(x, y, z, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Revalidate zone.
|
||||
* @param force the force
|
||||
|
@@ -111,10 +111,6 @@ public class ValidatePosition extends GameClientPacket
|
||||
player.stopMove(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setXYZ(_x, _y, _z);
|
||||
}
|
||||
player.sendPacket(new ValidateLocation(player));
|
||||
}
|
||||
|
||||
|
@@ -25,16 +25,14 @@ public class TeleportToLocation extends GameServerPacket
|
||||
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
|
||||
@@ -45,7 +43,7 @@ public class TeleportToLocation extends GameServerPacket
|
||||
writeD(_x);
|
||||
writeD(_y);
|
||||
writeD(_z);
|
||||
writeD(_instant ? 0x01 : 0x00);
|
||||
writeD(0x00); // Fade 0, Instant 1.
|
||||
writeD(_heading);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user