Addition of instant teleporting methods.
This commit is contained in:
@@ -26,7 +26,6 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -92,8 +91,6 @@ public class Blink extends AbstractEffect
|
||||
|
||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effected.broadcastPacket(new FlyToLocation(effected, destination, _flyType, _flySpeed, _flyDelay, _animationSpeed));
|
||||
effected.setXYZ(destination);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
effected.teleToLocationInstant(destination);
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@ 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>
|
||||
@@ -55,15 +54,12 @@ public class BlinkSwap extends AbstractEffect
|
||||
effector.broadcastPacket(new FlyToLocation(effector, effectedLoc, FlyType.DUMMY));
|
||||
effector.abortAttack();
|
||||
effector.abortCast();
|
||||
effector.setXYZ(effectedLoc);
|
||||
effector.broadcastPacket(new ValidateLocation(effector));
|
||||
effector.teleToLocationInstant(effectedLoc);
|
||||
|
||||
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
effected.broadcastPacket(new FlyToLocation(effected, effectorLoc, FlyType.DUMMY));
|
||||
effected.abortAttack();
|
||||
effected.abortCast();
|
||||
effected.setXYZ(effectorLoc);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
effected.teleToLocationInstant(effectorLoc);
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@ 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.
|
||||
@@ -60,8 +59,6 @@ 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.setXYZ(destination);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
effected.teleToLocationInstant(destination);
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,6 @@ 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;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -141,9 +140,7 @@ public class KnockBack extends AbstractEffect
|
||||
{
|
||||
effected.setHeading(Util.calculateHeadingFrom(effected, effector));
|
||||
}
|
||||
effected.setXYZ(loc);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
effected.teleToLocationInstant(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@ 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.
|
||||
@@ -76,9 +75,7 @@ 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.setXYZ(effector.getX(), effector.getY(), GeoEngine.getInstance().getHeight(effector.getX(), effector.getY(), effector.getZ()) + 10);
|
||||
effected.broadcastPacket(new ValidateLocation(effected), false);
|
||||
effected.revalidateZone(true);
|
||||
effected.teleToLocationInstant(effector.getX(), effector.getY(), GeoEngine.getInstance().getHeight(effector.getX(), effector.getY(), effector.getZ()) + 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@ 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.
|
||||
@@ -95,9 +94,7 @@ public class TeleportToNpc extends AbstractEffect
|
||||
effected.broadcastPacket(new FlyToLocation(effected, location, FlyType.DUMMY));
|
||||
effected.abortAttack();
|
||||
effected.abortCast();
|
||||
effected.setXYZ(location);
|
||||
effected.broadcastPacket(new ValidateLocation(effected));
|
||||
effected.revalidateZone(true);
|
||||
effected.teleToLocationInstant(location);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -28,7 +28,6 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -87,14 +86,12 @@ 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.setXYZ(loc);
|
||||
effector.broadcastPacket(new ValidateLocation(effector));
|
||||
effected.revalidateZone(true);
|
||||
effector.teleToLocationInstant(loc);
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,6 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -76,14 +75,12 @@ 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.setXYZ(loc);
|
||||
effector.broadcastPacket(new ValidateLocation(effector));
|
||||
effected.revalidateZone(true);
|
||||
effector.teleToLocationInstant(loc);
|
||||
}
|
||||
}
|
||||
|
@@ -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