Minor L2Character moveToNextRoutePoint improvements.
This commit is contained in:
@@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get current position of the L2Character
|
||||||
|
final int curX = getX();
|
||||||
|
final int curY = getY();
|
||||||
|
|
||||||
// Create and Init a MoveData object
|
// Create and Init a MoveData object
|
||||||
final MoveData m = new MoveData();
|
final MoveData m = new MoveData();
|
||||||
|
|
||||||
@@ -3471,11 +3475,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
final double distance = Math.hypot(m._xDestination - curX, m._yDestination - curY);
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), m._xDestination, m._yDestination));
|
setHeading(Util.calculateHeadingFrom(curX, curY, m._xDestination, m._yDestination));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
|
@@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get current position of the L2Character
|
||||||
|
final int curX = getX();
|
||||||
|
final int curY = getY();
|
||||||
|
|
||||||
// Create and Init a MoveData object
|
// Create and Init a MoveData object
|
||||||
final MoveData m = new MoveData();
|
final MoveData m = new MoveData();
|
||||||
|
|
||||||
@@ -3471,11 +3475,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
final double distance = Math.hypot(m._xDestination - curX, m._yDestination - curY);
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), m._xDestination, m._yDestination));
|
setHeading(Util.calculateHeadingFrom(curX, curY, m._xDestination, m._yDestination));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
|
@@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get current position of the L2Character
|
||||||
|
final int curX = getX();
|
||||||
|
final int curY = getY();
|
||||||
|
|
||||||
// Create and Init a MoveData object
|
// Create and Init a MoveData object
|
||||||
final MoveData m = new MoveData();
|
final MoveData m = new MoveData();
|
||||||
|
|
||||||
@@ -3471,11 +3475,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
final double distance = Math.hypot(m._xDestination - curX, m._yDestination - curY);
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), m._xDestination, m._yDestination));
|
setHeading(Util.calculateHeadingFrom(curX, curY, m._xDestination, m._yDestination));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
|
@@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get current position of the L2Character
|
||||||
|
final int curX = getX();
|
||||||
|
final int curY = getY();
|
||||||
|
|
||||||
// Create and Init a MoveData object
|
// Create and Init a MoveData object
|
||||||
final MoveData m = new MoveData();
|
final MoveData m = new MoveData();
|
||||||
|
|
||||||
@@ -3471,11 +3475,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
final double distance = Math.hypot(m._xDestination - curX, m._yDestination - curY);
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), m._xDestination, m._yDestination));
|
setHeading(Util.calculateHeadingFrom(curX, curY, m._xDestination, m._yDestination));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
|
@@ -4463,6 +4463,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get current position of the L2Character
|
||||||
|
final int curX = getX();
|
||||||
|
final int curY = getY();
|
||||||
|
|
||||||
// Create and Init a MoveData object
|
// Create and Init a MoveData object
|
||||||
final MoveData m = new MoveData();
|
final MoveData m = new MoveData();
|
||||||
|
|
||||||
@@ -4487,11 +4491,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
final double distance = Math.hypot(m._xDestination - curX, m._yDestination - curY);
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), m._xDestination, m._yDestination));
|
setHeading(Util.calculateHeadingFrom(curX, curY, m._xDestination, m._yDestination));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
|
@@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get current position of the L2Character
|
||||||
|
final int curX = getX();
|
||||||
|
final int curY = getY();
|
||||||
|
|
||||||
// Create and Init a MoveData object
|
// Create and Init a MoveData object
|
||||||
final MoveData m = new MoveData();
|
final MoveData m = new MoveData();
|
||||||
|
|
||||||
@@ -3471,11 +3475,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
final double distance = Math.hypot(m._xDestination - curX, m._yDestination - curY);
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), m._xDestination, m._yDestination));
|
setHeading(Util.calculateHeadingFrom(curX, curY, m._xDestination, m._yDestination));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
|
@@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get current position of the L2Character
|
||||||
|
final int curX = getX();
|
||||||
|
final int curY = getY();
|
||||||
|
|
||||||
// Create and Init a MoveData object
|
// Create and Init a MoveData object
|
||||||
final MoveData m = new MoveData();
|
final MoveData m = new MoveData();
|
||||||
|
|
||||||
@@ -3471,11 +3475,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
final double distance = Math.hypot(m._xDestination - curX, m._yDestination - curY);
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), m._xDestination, m._yDestination));
|
setHeading(Util.calculateHeadingFrom(curX, curY, m._xDestination, m._yDestination));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
|
@@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get current position of the L2Character
|
||||||
|
final int curX = getX();
|
||||||
|
final int curY = getY();
|
||||||
|
|
||||||
// Create and Init a MoveData object
|
// Create and Init a MoveData object
|
||||||
final MoveData m = new MoveData();
|
final MoveData m = new MoveData();
|
||||||
|
|
||||||
@@ -3471,11 +3475,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
m._zDestination = md.geoPath.get(m.onGeodataPathIndex).getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
double distance = Math.hypot(m._xDestination - super.getX(), m._yDestination - super.getY());
|
final double distance = Math.hypot(m._xDestination - curX, m._yDestination - curY);
|
||||||
// Calculate and set the heading of the L2Character
|
// Calculate and set the heading of the L2Character
|
||||||
if (distance != 0)
|
if (distance != 0)
|
||||||
{
|
{
|
||||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), m._xDestination, m._yDestination));
|
setHeading(Util.calculateHeadingFrom(curX, curY, m._xDestination, m._yDestination));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caclulate the Nb of ticks between the current position and the destination
|
// Caclulate the Nb of ticks between the current position and the destination
|
||||||
|
Reference in New Issue
Block a user