Addition of instant teleporting methods.
This commit is contained in:
@@ -758,8 +758,9 @@ 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)
|
||||
public void teleToLocation(int xValue, int yValue, int zValue, int headingValue, Instance instanceValue, boolean instant)
|
||||
{
|
||||
int x = xValue;
|
||||
int y = yValue;
|
||||
@@ -808,7 +809,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
z += 5;
|
||||
|
||||
// Send teleport packet to player and visible players
|
||||
broadcastPacket(new TeleportToLocation(this, x, y, z, heading));
|
||||
broadcastPacket(new TeleportToLocation(this, x, y, z, heading, instant));
|
||||
|
||||
// remove the object from its old location
|
||||
decayMe();
|
||||
@@ -841,17 +842,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
public void teleToLocation(int x, int y, int z)
|
||||
{
|
||||
teleToLocation(x, y, z, 0, getInstanceWorld());
|
||||
teleToLocation(x, y, z, 0, getInstanceWorld(), false);
|
||||
}
|
||||
|
||||
public void teleToLocation(int x, int y, int z, Instance instance)
|
||||
{
|
||||
teleToLocation(x, y, z, 0, instance);
|
||||
teleToLocation(x, y, z, 0, instance, false);
|
||||
}
|
||||
|
||||
public void teleToLocation(int x, int y, int z, int heading)
|
||||
{
|
||||
teleToLocation(x, y, z, heading, getInstanceWorld());
|
||||
teleToLocation(x, y, z, heading, getInstanceWorld(), false);
|
||||
}
|
||||
|
||||
public void teleToLocation(int x, int y, int z, int heading, boolean randomOffset)
|
||||
@@ -878,7 +879,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);
|
||||
teleToLocation(x, y, z, heading, instance, false);
|
||||
}
|
||||
|
||||
public void teleToLocation(ILocational loc)
|
||||
@@ -888,7 +889,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);
|
||||
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), instance, false);
|
||||
}
|
||||
|
||||
public void teleToLocation(ILocational loc, int randomOffset)
|
||||
@@ -921,6 +922,16 @@ 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()));
|
||||
sendPacket(new TeleportToLocation(this, getX(), getY(), getZ(), getHeading(), false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -27,14 +27,16 @@ 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)
|
||||
public TeleportToLocation(WorldObject obj, int x, int y, int z, int heading, boolean instant)
|
||||
{
|
||||
_targetObjId = obj.getObjectId();
|
||||
_x = x;
|
||||
_y = y;
|
||||
_z = z;
|
||||
_heading = heading;
|
||||
_instant = instant;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +48,7 @@ public class TeleportToLocation implements IClientOutgoingPacket
|
||||
packet.writeD(_x);
|
||||
packet.writeD(_y);
|
||||
packet.writeD(_z);
|
||||
packet.writeD(0x00); // isValidation ??
|
||||
packet.writeD(_instant ? 0x01 : 0x00);
|
||||
packet.writeD(_heading);
|
||||
packet.writeD(0x00); // Unknown
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user