Better pacing method for revalidate zones.

This commit is contained in:
MobiusDevelopment 2021-03-16 23:00:53 +00:00
parent 0997eff21b
commit 510bb0fc2b
46 changed files with 225 additions and 729 deletions

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1785,23 +1785,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1791,23 +1791,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1793,23 +1793,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1803,23 +1803,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1796,23 +1796,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1796,23 +1796,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1796,23 +1796,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3138,23 +3138,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1808,23 +1808,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3138,23 +3138,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1803,23 +1803,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3138,23 +3138,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1803,23 +1803,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -200,6 +200,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
private boolean _blocked;
private boolean _meditated;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private boolean _advanceFlag = false;
private int _advanceMultiplier = 1;
@ -584,8 +585,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
revalidateZone(true);
}
protected byte _zoneValidateCounter = 4;
/**
* Revalidate zone.
* @param force the force
@ -598,23 +597,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (getDistanceSq(_lastZoneValidateLocation.getX(), _lastZoneValidateLocation.getY(), _lastZoneValidateLocation.getZ()) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE * Config.MAX_DRIFT_RANGE : 10000)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(getX(), getY(), getZ());
region.revalidateZones(this);
}

View File

@ -115,6 +115,7 @@ import org.l2jmobius.gameserver.model.Timestamp;
import org.l2jmobius.gameserver.model.TradeList;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.WorldRegion;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Playable;
@ -304,7 +305,6 @@ public class PlayerInstance extends Playable
private long _pvpFlagLasts;
private byte _siegeState = 0;
private int _curWeightPenalty = 0;
private byte _zoneValidateCounter = 4;
private boolean _isIn7sDungeon = false;
private int _heroConsecutiveKillCount = 0;
private boolean _isPvpHero = false;
@ -1720,35 +1720,25 @@ public class PlayerInstance extends Playable
public void revalidateZone(boolean force)
{
// Cannot validate if not in a world region (happens during teleport)
if (getWorldRegion() == null)
final WorldRegion region = getWorldRegion();
if (region == null)
{
return;
}
// This function is called too often from movement code.
if (!force && (getDistanceSq(_lastZoneValidateLocation.getX(), _lastZoneValidateLocation.getY(), _lastZoneValidateLocation.getZ()) < 10000))
{
return;
}
_lastZoneValidateLocation.setXYZ(getX(), getY(), getZ());
region.revalidateZones(this);
if (Config.ALLOW_WATER)
{
checkWaterState();
}
// This function is called very often from movement code
if (force)
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
}
getWorldRegion().revalidateZones(this);
}
/**

View File

@ -202,6 +202,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
private boolean _blocked;
private boolean _meditated;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private boolean _advanceFlag = false;
private int _advanceMultiplier = 1;
@ -586,8 +587,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
revalidateZone(true);
}
protected byte _zoneValidateCounter = 4;
/**
* Revalidate zone.
* @param force the force
@ -600,23 +599,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (getDistanceSq(_lastZoneValidateLocation.getX(), _lastZoneValidateLocation.getY(), _lastZoneValidateLocation.getZ()) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE * Config.MAX_DRIFT_RANGE : 10000)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(getX(), getY(), getZ());
region.revalidateZones(this);
}

View File

@ -118,6 +118,7 @@ import org.l2jmobius.gameserver.model.Timestamp;
import org.l2jmobius.gameserver.model.TradeList;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.WorldRegion;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Playable;
@ -313,7 +314,6 @@ public class PlayerInstance extends Playable
private byte _siegeState = 0;
private int _curWeightPenalty = 0;
private int _lastCompassZone; // the last compass zone update send to the client
private byte _zoneValidateCounter = 4;
private boolean _isIn7sDungeon = false;
private int _heroConsecutiveKillCount = 0;
private boolean _isPvpHero = false;
@ -1734,36 +1734,26 @@ public class PlayerInstance extends Playable
public void revalidateZone(boolean force)
{
// Cannot validate if not in a world region (happens during teleport)
if (getWorldRegion() == null)
final WorldRegion region = getWorldRegion();
if (region == null)
{
return;
}
// This function is called too often from movement code.
if (!force && (getDistanceSq(_lastZoneValidateLocation.getX(), _lastZoneValidateLocation.getY(), _lastZoneValidateLocation.getZ()) < 10000))
{
return;
}
_lastZoneValidateLocation.setXYZ(getX(), getY(), getZ());
region.revalidateZones(this);
if (Config.ALLOW_WATER)
{
checkWaterState();
}
// This function is called very often from movement code
if (force)
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
}
getWorldRegion().revalidateZones(this);
if (isInsideZone(ZoneId.SIEGE))
{
if (_lastCompassZone == ExSetCompassZoneCode.SIEGEWARZONE2)

View File

@ -227,7 +227,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -4073,23 +4073,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1701,23 +1701,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -228,7 +228,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -4075,23 +4075,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1722,23 +1722,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1749,23 +1749,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1749,23 +1749,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1747,23 +1747,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -224,7 +224,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3152,23 +3152,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1757,23 +1757,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -224,7 +224,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3152,23 +3152,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1757,23 +1757,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -224,7 +224,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3151,23 +3151,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1770,23 +1770,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -223,7 +223,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3139,23 +3139,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1751,23 +1751,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -224,7 +224,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3154,23 +3154,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1806,23 +1806,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);

View File

@ -224,7 +224,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _allSkillsDisabled;
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
protected byte _zoneValidateCounter = 4;
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
private final StampedLock _attackLock = new StampedLock();
@ -3161,23 +3161,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
public void revalidateZone(boolean force)
{
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
if (region != null)

View File

@ -1806,23 +1806,12 @@ public class PlayerInstance extends Playable
return;
}
// This function is called too often from movement code
if (force)
// This function is called too often from movement code.
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
{
_zoneValidateCounter = 4;
}
else
{
_zoneValidateCounter--;
if (_zoneValidateCounter < 0)
{
_zoneValidateCounter = 4;
}
else
{
return;
}
return;
}
_lastZoneValidateLocation.setXYZ(this);
ZoneManager.getInstance().getRegion(this).revalidateZones(this);