Fixed losing target with instant teleport.
This commit is contained in:
+20
-31
@@ -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
|
||||
|
||||
-4
@@ -121,10 +121,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
||||
player.stopMove(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setXYZ(_x, _y, _z);
|
||||
}
|
||||
player.sendPacket(new ValidateLocation(player));
|
||||
}
|
||||
|
||||
|
||||
+3
-5
@@ -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