From 04160e38783fa489e8a7f26f72f82856c793098f Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Thu, 7 Jun 2018 15:17:42 +0000 Subject: [PATCH] Minor L2Character moveToNextRoutePoint improvements. --- .../com/l2jmobius/gameserver/model/actor/L2Character.java | 8 ++++++-- .../com/l2jmobius/gameserver/model/actor/L2Character.java | 8 ++++++-- .../com/l2jmobius/gameserver/model/actor/L2Character.java | 8 ++++++-- .../com/l2jmobius/gameserver/model/actor/L2Character.java | 8 ++++++-- .../com/l2jmobius/gameserver/model/actor/L2Character.java | 8 ++++++-- .../com/l2jmobius/gameserver/model/actor/L2Character.java | 8 ++++++-- .../com/l2jmobius/gameserver/model/actor/L2Character.java | 8 ++++++-- .../com/l2jmobius/gameserver/model/actor/L2Character.java | 8 ++++++-- 8 files changed, 48 insertions(+), 16 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e9c56e6d33..27e2df675c 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe return false; } + // Get current position of the L2Character + final int curX = getX(); + final int curY = getY(); + // Create and Init a MoveData object 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(); } - 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 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 diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e9c56e6d33..27e2df675c 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe return false; } + // Get current position of the L2Character + final int curX = getX(); + final int curY = getY(); + // Create and Init a MoveData object 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(); } - 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 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 diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e9c56e6d33..27e2df675c 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe return false; } + // Get current position of the L2Character + final int curX = getX(); + final int curY = getY(); + // Create and Init a MoveData object 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(); } - 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 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 diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e9c56e6d33..27e2df675c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe return false; } + // Get current position of the L2Character + final int curX = getX(); + final int curY = getY(); + // Create and Init a MoveData object 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(); } - 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 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 diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 42b2a4342a..0811340074 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -4463,6 +4463,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe return false; } + // Get current position of the L2Character + final int curX = getX(); + final int curY = getY(); + // Create and Init a MoveData object 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(); } - 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 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 diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e9c56e6d33..27e2df675c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe return false; } + // Get current position of the L2Character + final int curX = getX(); + final int curY = getY(); + // Create and Init a MoveData object 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(); } - 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 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 diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e9c56e6d33..27e2df675c 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe return false; } + // Get current position of the L2Character + final int curX = getX(); + final int curY = getY(); + // Create and Init a MoveData object 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(); } - 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 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 diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e9c56e6d33..27e2df675c 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3447,6 +3447,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe return false; } + // Get current position of the L2Character + final int curX = getX(); + final int curY = getY(); + // Create and Init a MoveData object 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(); } - 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 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