Addition of instant teleporting methods.
This commit is contained in:
@ -115,8 +115,8 @@ public class NpcWalkerAI extends CreatureAI implements Runnable
|
||||
final int destinationX = _route.get(_currentPos).getMoveX();
|
||||
final int destinationY = _route.get(_currentPos).getMoveY();
|
||||
final int destinationZ = _route.get(_currentPos).getMoveZ();
|
||||
getActor().teleToLocation(destinationX, destinationY, destinationZ);
|
||||
|
||||
getActor().teleToLocation(destinationX, destinationY, destinationZ, false);
|
||||
super.onEvtArrivedBlocked(location);
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
}
|
||||
}
|
||||
|
||||
activeChar.teleToLocation(x, y, z, false);
|
||||
activeChar.teleToLocation(x, y, z);
|
||||
showTeleportWindow(activeChar);
|
||||
|
||||
return true;
|
||||
@ -482,7 +482,7 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
private void teleportTo(PlayerInstance activeChar, int x, int y, int z)
|
||||
{
|
||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
activeChar.teleToLocation(x, y, z, false);
|
||||
activeChar.teleToLocation(x, y, z);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You have been teleported to " + x + " " + y + " " + z);
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
final int y = player.getY();
|
||||
final int z = player.getZ();
|
||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
activeChar.teleToLocation(x, y, z, true);
|
||||
activeChar.teleToLocation(x, y, z);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You have teleported to character " + player.getName() + ".");
|
||||
}
|
||||
}
|
||||
|
@ -1077,7 +1077,7 @@ public class CTF implements EventTask
|
||||
{
|
||||
if (player.isOnline())
|
||||
{
|
||||
player.teleToLocation(_npcX, _npcY, _npcZ, false);
|
||||
player.teleToLocation(_npcX, _npcY, _npcZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1001,7 +1001,7 @@ public class DM implements EventTask
|
||||
{
|
||||
if (player.isOnline())
|
||||
{
|
||||
player.teleToLocation(_npcX, _npcY, _npcZ, false);
|
||||
player.teleToLocation(_npcX, _npcY, _npcZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1013,7 +1013,7 @@ public class TvT implements EventTask
|
||||
{
|
||||
if (player.isOnline())
|
||||
{
|
||||
player.teleToLocation(_npcX, _npcY, _npcZ, false);
|
||||
player.teleToLocation(_npcX, _npcY, _npcZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2600,8 +2600,8 @@ public class TvT implements EventTask
|
||||
playerToKick.setTitle(playerToKick._originalTitleTvT);
|
||||
playerToKick.broadcastUserInfo();
|
||||
playerToKick.sendMessage("You have been kicked from the TvT.");
|
||||
playerToKick.teleToLocation(_npcX, _npcY, _npcZ, false);
|
||||
playerToKick.teleToLocation((_npcX + Rnd.get(201)) - 100, (_npcY + Rnd.get(201)) - 100, _npcZ, false);
|
||||
playerToKick.teleToLocation(_npcX, _npcY, _npcZ);
|
||||
playerToKick.teleToLocation((_npcX + Rnd.get(201)) - 100, (_npcY + Rnd.get(201)) - 100, _npcZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class ObjectPosition
|
||||
LOGGER.warning("Object Id at bad coords: (x: " + getWorldPosition().getX() + ", y: " + getWorldPosition().getY() + ", z: " + getWorldPosition().getZ() + ").");
|
||||
if (_activeObject instanceof PlayerInstance)
|
||||
{
|
||||
((PlayerInstance) _activeObject).teleToLocation(0, 0, 0, false);
|
||||
((PlayerInstance) _activeObject).teleToLocation(0, 0, 0);
|
||||
((PlayerInstance) _activeObject).sendMessage("Error with your coords, Please ask a GM for help!");
|
||||
}
|
||||
else if (_activeObject instanceof Creature)
|
||||
|
@ -349,7 +349,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
if ((pet != null) && (pos != null))
|
||||
{
|
||||
pet.setFollowStatus(false);
|
||||
pet.teleToLocation(pos.getX() + Rnd.get(-100, 100), pos.getY() + Rnd.get(-100, 100), pos.getZ(), false);
|
||||
pet.teleToLocation(pos.getX() + Rnd.get(-100, 100), pos.getY() + Rnd.get(-100, 100), pos.getZ());
|
||||
pet.setFollowStatus(true);
|
||||
}
|
||||
}
|
||||
@ -542,8 +542,9 @@ 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)
|
||||
public void teleToLocation(int xValue, int yValue, int zValue, boolean allowRandomOffset, boolean instant)
|
||||
{
|
||||
if (Config.TW_DISABLE_GK)
|
||||
{
|
||||
@ -589,7 +590,7 @@ 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));
|
||||
broadcastPacket(new TeleportToLocation(this, x, y, z, getHeading(), instant));
|
||||
|
||||
// remove the object from its old location
|
||||
decayMe();
|
||||
@ -604,26 +605,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
revalidateZone(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Revalidate zone.
|
||||
* @param force the force
|
||||
*/
|
||||
public void revalidateZone(boolean force)
|
||||
public void teleToLocation(int x, int y, int z, boolean allowRandomOffset)
|
||||
{
|
||||
final WorldRegion region = getWorldRegion();
|
||||
if (region == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// This function is called too often from movement code.
|
||||
if (!force && (calculateDistanceSq3D(_lastZoneValidateLocation.getX(), _lastZoneValidateLocation.getY(), _lastZoneValidateLocation.getZ()) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE * Config.MAX_DRIFT_RANGE : 10000)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_lastZoneValidateLocation.setXYZ(getX(), getY(), getZ());
|
||||
|
||||
region.revalidateZones(this);
|
||||
teleToLocation(x, y, z, allowRandomOffset, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -673,6 +657,38 @@ 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
|
||||
*/
|
||||
public void revalidateZone(boolean force)
|
||||
{
|
||||
final WorldRegion region = getWorldRegion();
|
||||
if (region == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// This function is called too often from movement code.
|
||||
if (!force && (calculateDistanceSq3D(_lastZoneValidateLocation.getX(), _lastZoneValidateLocation.getY(), _lastZoneValidateLocation.getZ()) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE * Config.MAX_DRIFT_RANGE : 10000)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_lastZoneValidateLocation.setXYZ(getX(), getY(), getZ());
|
||||
|
||||
region.revalidateZones(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launch a physical attack against a target (Simple, Bow, Pole or Dual).<br>
|
||||
* <br>
|
||||
@ -6559,7 +6575,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
{
|
||||
LOGGER.warning("Player " + getName() + " at bad coords: (x: " + getX() + ", y: " + getY() + ", z: " + getZ() + ").");
|
||||
((PlayerInstance) this).sendMessage("Error with your coordinates! Please reboot your game fully!");
|
||||
((PlayerInstance) this).teleToLocation(80753, 145481, -3532, false); // Near Giran luxury shop
|
||||
((PlayerInstance) this).teleToLocation(80753, 145481, -3532); // Near Giran luxury shop
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -209,7 +209,7 @@ public class BoatInstance extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleToLocation(pathA.ntx, pathA.nty, pathA.ntz, false);
|
||||
player.teleToLocation(pathA.ntx, pathA.nty, pathA.ntz);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -242,7 +242,7 @@ public class BoatInstance extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleToLocation(pathB.ntx, pathB.nty, pathB.ntz, false);
|
||||
player.teleToLocation(pathB.ntx, pathB.nty, pathB.ntz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class CastleMagicianInstance extends NpcInstance
|
||||
return;
|
||||
}
|
||||
|
||||
player.teleToLocation(clanLeader.getX(), clanLeader.getY(), clanLeader.getZ(), false);
|
||||
player.teleToLocation(clanLeader.getX(), clanLeader.getY(), clanLeader.getZ());
|
||||
return;
|
||||
}
|
||||
final String filename = "data/html/castlemagician/magician-nogate.htm";
|
||||
|
@ -75,7 +75,7 @@ public class MonsterInstance extends Attackable
|
||||
final Spawn mobSpawn = getSpawn();
|
||||
if (!isInCombat() && !isAlikeDead() && !isDead() && (mobSpawn != null) && !isInsideRadius2D(mobSpawn.getX(), mobSpawn.getY(), mobSpawn.getZ(), Config.MAX_DRIFT_RANGE))
|
||||
{
|
||||
teleToLocation(mobSpawn.getX(), mobSpawn.getY(), mobSpawn.getZ(), false);
|
||||
teleToLocation(mobSpawn.getX(), mobSpawn.getY(), mobSpawn.getZ());
|
||||
}
|
||||
}, Config.MONSTER_RETURN_DELAY * 1000);
|
||||
}
|
||||
|
@ -5824,7 +5824,7 @@ public class PlayerInstance extends Playable
|
||||
sendMessage("You will be revived and teleported to team spot in " + (Config.TVT_REVIVE_DELAY / 1000) + " seconds!");
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
teleToLocation((TvT._teamsX.get(TvT._teams.indexOf(_teamNameTvT)) + Rnd.get(201)) - 100, (TvT._teamsY.get(TvT._teams.indexOf(_teamNameTvT)) + Rnd.get(201)) - 100, TvT._teamsZ.get(TvT._teams.indexOf(_teamNameTvT)), false);
|
||||
teleToLocation((TvT._teamsX.get(TvT._teams.indexOf(_teamNameTvT)) + Rnd.get(201)) - 100, (TvT._teamsY.get(TvT._teams.indexOf(_teamNameTvT)) + Rnd.get(201)) - 100, TvT._teamsZ.get(TvT._teams.indexOf(_teamNameTvT)));
|
||||
doRevive();
|
||||
}, Config.TVT_REVIVE_DELAY);
|
||||
}
|
||||
@ -5836,7 +5836,7 @@ public class PlayerInstance extends Playable
|
||||
sendMessage("You will be revived and teleported to team spot in " + (Config.TVT_REVIVE_DELAY / 1000) + " seconds!");
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
teleToLocation(TvT._teamsX.get(TvT._teams.indexOf(_teamNameTvT)), TvT._teamsY.get(TvT._teams.indexOf(_teamNameTvT)), TvT._teamsZ.get(TvT._teams.indexOf(_teamNameTvT)), false);
|
||||
teleToLocation(TvT._teamsX.get(TvT._teams.indexOf(_teamNameTvT)), TvT._teamsY.get(TvT._teams.indexOf(_teamNameTvT)), TvT._teamsZ.get(TvT._teams.indexOf(_teamNameTvT)));
|
||||
doRevive();
|
||||
broadcastPacket(new SocialAction(getObjectId(), 15));
|
||||
}, Config.TVT_REVIVE_DELAY);
|
||||
@ -5853,7 +5853,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
teleToLocation(CTF._teamsX.get(CTF._teams.indexOf(_teamNameCTF)), CTF._teamsY.get(CTF._teams.indexOf(_teamNameCTF)), CTF._teamsZ.get(CTF._teams.indexOf(_teamNameCTF)), false);
|
||||
teleToLocation(CTF._teamsX.get(CTF._teams.indexOf(_teamNameCTF)), CTF._teamsY.get(CTF._teams.indexOf(_teamNameCTF)), CTF._teamsZ.get(CTF._teams.indexOf(_teamNameCTF)));
|
||||
doRevive();
|
||||
}, 20000);
|
||||
}
|
||||
@ -5878,7 +5878,7 @@ public class PlayerInstance extends Playable
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
final Location ploc = DM.getPlayersSpawnLocation();
|
||||
teleToLocation(ploc.getX(), ploc.getY(), ploc.getZ(), false);
|
||||
teleToLocation(ploc.getX(), ploc.getY(), ploc.getZ());
|
||||
doRevive();
|
||||
}, Config.DM_REVIVE_DELAY);
|
||||
}
|
||||
@ -5891,7 +5891,7 @@ public class PlayerInstance extends Playable
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
final Location ploc = DM.getPlayersSpawnLocation();
|
||||
teleToLocation(ploc.getX(), ploc.getY(), ploc.getZ(), false);
|
||||
teleToLocation(ploc.getX(), ploc.getY(), ploc.getZ());
|
||||
doRevive();
|
||||
}, 20000);
|
||||
}
|
||||
@ -11130,7 +11130,7 @@ public class PlayerInstance extends Playable
|
||||
sendPacket(new ObservationMode(x, y, z));
|
||||
getKnownList().removeAllKnownObjects(); // reinit knownlist
|
||||
setXYZ(x, y, z);
|
||||
teleToLocation(x, y, z, false);
|
||||
teleToLocation(x, y, z);
|
||||
broadcastUserInfo();
|
||||
}
|
||||
|
||||
@ -11176,7 +11176,7 @@ public class PlayerInstance extends Playable
|
||||
_wasInvisible = getAppearance().isInvisible();
|
||||
getAppearance().setInvisible();
|
||||
|
||||
teleToLocation(x, y, z, false);
|
||||
teleToLocation(x, y, z);
|
||||
sendPacket(new ExOlympiadMode(3, this));
|
||||
broadcastUserInfo();
|
||||
}
|
||||
@ -12984,7 +12984,7 @@ public class PlayerInstance extends Playable
|
||||
if (getTrainedBeast() != null)
|
||||
{
|
||||
getTrainedBeast().getAI().stopFollow();
|
||||
getTrainedBeast().teleToLocation(getPosition().getX() + Rnd.get(-100, 100), getPosition().getY() + Rnd.get(-100, 100), getPosition().getZ(), false);
|
||||
getTrainedBeast().teleToLocation(getPosition().getX() + Rnd.get(-100, 100), getPosition().getY() + Rnd.get(-100, 100), getPosition().getZ());
|
||||
getTrainedBeast().getAI().startFollow(this);
|
||||
}
|
||||
|
||||
|
@ -376,24 +376,24 @@ class OlympiadGame
|
||||
_playerOne.setTarget(null);
|
||||
_playerTwo.setTarget(null);
|
||||
|
||||
_playerOne.teleToLocation(_stadiumPort[0] + 900, _stadiumPort[1], _stadiumPort[2], false);
|
||||
_playerOne.teleToLocation(_stadiumPort[0] + 900, _stadiumPort[1], _stadiumPort[2]);
|
||||
// teleport summon to
|
||||
if (_playerOne.getPet() != null)
|
||||
{
|
||||
final Summon summon = _playerOne.getPet();
|
||||
if (summon instanceof SummonInstance)
|
||||
{
|
||||
summon.teleToLocation(_stadiumPort[0] + 900, _stadiumPort[1], _stadiumPort[2], false);
|
||||
summon.teleToLocation(_stadiumPort[0] + 900, _stadiumPort[1], _stadiumPort[2]);
|
||||
}
|
||||
}
|
||||
_playerTwo.teleToLocation(_stadiumPort[0] - 900, _stadiumPort[1], _stadiumPort[2], false);
|
||||
_playerTwo.teleToLocation(_stadiumPort[0] - 900, _stadiumPort[1], _stadiumPort[2]);
|
||||
// teleport summon to
|
||||
if (_playerTwo.getPet() != null)
|
||||
{
|
||||
final Summon summon = _playerTwo.getPet();
|
||||
if (summon instanceof SummonInstance)
|
||||
{
|
||||
summon.teleToLocation(_stadiumPort[0] - 900, _stadiumPort[1], _stadiumPort[2], false);
|
||||
summon.teleToLocation(_stadiumPort[0] - 900, _stadiumPort[1], _stadiumPort[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,10 +18,6 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
|
||||
/**
|
||||
* format dddd sample 0000: 3a 69 08 10 48 02 c1 00 00 f7 56 00 00 89 ea ff :i..H.....V..... 0010: ff 0c b2 d8 61 ....a
|
||||
* @version $Revision: 1.3.2.1.2.3 $ $Date: 2005/03/27 15:29:39 $
|
||||
*/
|
||||
public class TeleportToLocation extends GameServerPacket
|
||||
{
|
||||
private final int _targetObjId;
|
||||
@ -29,29 +25,16 @@ public class TeleportToLocation extends GameServerPacket
|
||||
private final int _y;
|
||||
private final int _z;
|
||||
private final int _heading;
|
||||
private final boolean _instant;
|
||||
|
||||
/**
|
||||
* @param obj
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public TeleportToLocation(WorldObject obj, int x, int y, int z)
|
||||
{
|
||||
_targetObjId = obj.getObjectId();
|
||||
_x = x;
|
||||
_y = y;
|
||||
_z = z;
|
||||
_heading = obj.getPosition().getHeading();
|
||||
}
|
||||
|
||||
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
|
||||
@ -62,7 +45,7 @@ public class TeleportToLocation extends GameServerPacket
|
||||
writeD(_x);
|
||||
writeD(_y);
|
||||
writeD(_z);
|
||||
writeD(0x00); // isValidation ??
|
||||
writeD(_heading); // nYaw
|
||||
writeD(_instant ? 0x01 : 0x00);
|
||||
writeD(_heading);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user