|
@@ -555,7 +555,9 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
|
|
*/
|
|
|
private L2Npc initializeNpcInstance(L2Npc mob)
|
|
|
{
|
|
|
- int newlocx, newlocy, newlocz;
|
|
|
+ int newlocx = 0;
|
|
|
+ int newlocy = 0;
|
|
|
+ int newlocz = 0;
|
|
|
|
|
|
// If Locx and Locy are not defined, the L2NpcInstance must be spawned in an area defined by location or spawn territory
|
|
|
// New method
|
|
@@ -575,12 +577,15 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
|
|
}
|
|
|
|
|
|
// Calculate the random position in the location area
|
|
|
- int p[] = TerritoryTable.getInstance().getRandomPoint(getLocationId());
|
|
|
+ final Location location = TerritoryTable.getInstance().getRandomPoint(getLocationId());
|
|
|
|
|
|
// Set the calculated position of the L2NpcInstance
|
|
|
- newlocx = p[0];
|
|
|
- newlocy = p[1];
|
|
|
- newlocz = p[3];
|
|
|
+ if (location != null)
|
|
|
+ {
|
|
|
+ newlocx = location.getX();
|
|
|
+ newlocy = location.getY();
|
|
|
+ newlocz = location.getZ();
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -593,7 +598,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
|
|
// don't correct z of flying npc's
|
|
|
if (!mob.isFlying())
|
|
|
{
|
|
|
- newlocz = GeoData.getInstance().getSpawnHeight(newlocx, newlocy, newlocz, newlocz);
|
|
|
+ newlocz = GeoData.getInstance().getSpawnHeight(newlocx, newlocy, newlocz);
|
|
|
}
|
|
|
|
|
|
mob.stopAllEffects();
|