Keep track of inactive regions to prevent object creations.
This commit is contained in:
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+32
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+55
-28
@@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -52,6 +53,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private Boolean _active = Config.GRIDS_ALWAYS_ON;
|
private Boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
private ZoneManager _zoneManager;
|
private ZoneManager _zoneManager;
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
@@ -207,8 +209,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if all 9 neighbors (including self) are inactive or active but with no players.
|
public void incrementActiveNeighbors()
|
||||||
// returns true if the above condition is met.
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -243,6 +258,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
@@ -380,30 +410,6 @@ public class WorldRegion
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSurroundingRegions(WorldRegion[] regions)
|
|
||||||
{
|
|
||||||
_surroundingRegions = regions;
|
|
||||||
|
|
||||||
// Make sure that this region is always the first region to improve bulk operations when this region should be updated first.
|
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
|
||||||
{
|
|
||||||
if (_surroundingRegions[i] == this)
|
|
||||||
{
|
|
||||||
final WorldRegion first = _surroundingRegions[0];
|
|
||||||
_surroundingRegions[0] = this;
|
|
||||||
_surroundingRegions[i] = first;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the list _surroundingRegions containing all WorldRegion around the current WorldRegion
|
|
||||||
*/
|
|
||||||
public WorldRegion[] getSurroundingRegions()
|
|
||||||
{
|
|
||||||
return _surroundingRegions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<WorldObject> getVisibleObjects()
|
public List<WorldObject> getVisibleObjects()
|
||||||
{
|
{
|
||||||
return _visibleObjects;
|
return _visibleObjects;
|
||||||
@@ -445,9 +451,25 @@ public class WorldRegion
|
|||||||
return _fences;
|
return _fences;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public void setSurroundingRegions(WorldRegion[] regions)
|
||||||
{
|
{
|
||||||
return "(" + _regionX + ", " + _regionY + ")";
|
_surroundingRegions = regions;
|
||||||
|
|
||||||
|
// Make sure that this region is always the first region to improve bulk operations when this region should be updated first.
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
if (_surroundingRegions[i] == this)
|
||||||
|
{
|
||||||
|
final WorldRegion first = _surroundingRegions[0];
|
||||||
|
_surroundingRegions[0] = this;
|
||||||
|
_surroundingRegions[i] = first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorldRegion[] getSurroundingRegions()
|
||||||
|
{
|
||||||
|
return _surroundingRegions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -532,4 +554,9 @@ public class WorldRegion
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "(" + _regionX + ", " + _regionY + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -389,20 +389,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new CharMoveToLocation(this));
|
broadcastPacket(new CharMoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new CharMoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -52,6 +53,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private Boolean _active = Config.GRIDS_ALWAYS_ON;
|
private Boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
private ZoneManager _zoneManager;
|
private ZoneManager _zoneManager;
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
@@ -207,8 +209,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if all 9 neighbors (including self) are inactive or active but with no players.
|
public void incrementActiveNeighbors()
|
||||||
// returns true if the above condition is met.
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -243,6 +258,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
@@ -380,30 +410,6 @@ public class WorldRegion
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSurroundingRegions(WorldRegion[] regions)
|
|
||||||
{
|
|
||||||
_surroundingRegions = regions;
|
|
||||||
|
|
||||||
// Make sure that this region is always the first region to improve bulk operations when this region should be updated first.
|
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
|
||||||
{
|
|
||||||
if (_surroundingRegions[i] == this)
|
|
||||||
{
|
|
||||||
final WorldRegion first = _surroundingRegions[0];
|
|
||||||
_surroundingRegions[0] = this;
|
|
||||||
_surroundingRegions[i] = first;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the list _surroundingRegions containing all WorldRegion around the current WorldRegion
|
|
||||||
*/
|
|
||||||
public WorldRegion[] getSurroundingRegions()
|
|
||||||
{
|
|
||||||
return _surroundingRegions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<WorldObject> getVisibleObjects()
|
public List<WorldObject> getVisibleObjects()
|
||||||
{
|
{
|
||||||
return _visibleObjects;
|
return _visibleObjects;
|
||||||
@@ -445,9 +451,25 @@ public class WorldRegion
|
|||||||
return _fences;
|
return _fences;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public void setSurroundingRegions(WorldRegion[] regions)
|
||||||
{
|
{
|
||||||
return "(" + _regionX + ", " + _regionY + ")";
|
_surroundingRegions = regions;
|
||||||
|
|
||||||
|
// Make sure that this region is always the first region to improve bulk operations when this region should be updated first.
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
if (_surroundingRegions[i] == this)
|
||||||
|
{
|
||||||
|
final WorldRegion first = _surroundingRegions[0];
|
||||||
|
_surroundingRegions[0] = this;
|
||||||
|
_surroundingRegions[i] = first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorldRegion[] getSurroundingRegions()
|
||||||
|
{
|
||||||
|
return _surroundingRegions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -532,4 +554,9 @@ public class WorldRegion
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "(" + _regionX + ", " + _regionY + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -391,20 +391,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new CharMoveToLocation(this));
|
broadcastPacket(new CharMoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new CharMoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -574,20 +574,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -575,20 +575,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+32
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -653,20 +653,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+32
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -653,20 +653,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -653,20 +653,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -652,20 +652,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+32
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -653,20 +653,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -43,6 +44,7 @@ public class WorldRegion
|
|||||||
private final int _regionY;
|
private final int _regionY;
|
||||||
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
private boolean _active = Config.GRIDS_ALWAYS_ON;
|
||||||
private ScheduledFuture<?> _neighborsTask = null;
|
private ScheduledFuture<?> _neighborsTask = null;
|
||||||
|
private final AtomicInteger _activeNeighbors = new AtomicInteger();
|
||||||
|
|
||||||
public WorldRegion(int regionX, int regionY)
|
public WorldRegion(int regionX, int regionY)
|
||||||
{
|
{
|
||||||
@@ -127,6 +129,21 @@ public class WorldRegion
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementActiveNeighbors()
|
||||||
|
{
|
||||||
|
_activeNeighbors.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areNeighborsActive()
|
||||||
|
{
|
||||||
|
return Config.GRIDS_ALWAYS_ON || (_activeNeighbors.get() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean areNeighborsEmpty()
|
public boolean areNeighborsEmpty()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _surroundingRegions.length; i++)
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
@@ -161,6 +178,21 @@ public class WorldRegion
|
|||||||
|
|
||||||
_active = value;
|
_active = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].incrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _surroundingRegions.length; i++)
|
||||||
|
{
|
||||||
|
_surroundingRegions[i].decrementActiveNeighbors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the AI on or off to match the region's activation.
|
// Turn the AI on or off to match the region's activation.
|
||||||
switchAI(value);
|
switchAI(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -653,20 +653,34 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
|
|
||||||
public void broadcastMoveToLocation()
|
public void broadcastMoveToLocation()
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new MoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSocialAction(int id)
|
public void broadcastSocialAction(int id)
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
if (isPlayable())
|
||||||
if ((region != null) && region.isActive())
|
|
||||||
{
|
{
|
||||||
broadcastPacket(new SocialAction(getObjectId(), id));
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final WorldRegion region = getWorldRegion();
|
||||||
|
if ((region != null) && region.areNeighborsActive())
|
||||||
|
{
|
||||||
|
broadcastPacket(new SocialAction(getObjectId(), id));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user