Random spawn system for monsters.

This commit is contained in:
mobius
2015-01-02 11:21:30 +00:00
parent 0c6829d4ad
commit 6e0be1da25
3 changed files with 54 additions and 1 deletions

View File

@ -589,10 +589,29 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
}
else
{
// The L2NpcInstance is spawned at the exact position (Lox, Locy, Locz)
// The L2NpcInstance is spawned at a random position
newlocx = getX();
newlocy = getY();
newlocz = getZ();
// If random spawn system is enabled
if (Config.ENABLE_RANDOM_MONSTER_SPAWNS)
{
final int randX = newlocx + Rnd.get(Config.MOB_MIN_SPAWN_RANGE, Config.MOB_MAX_SPAWN_RANGE);
final int randY = newlocy + Rnd.get(Config.MOB_MIN_SPAWN_RANGE, Config.MOB_MAX_SPAWN_RANGE);
boolean isQuestMonster = false;
if ((mob.getTitle() != null) && mob.getTitle().contains("Quest"))
{
isQuestMonster = true;
}
if (mob.isMonster() && !isQuestMonster && !mob.isWalker() && (Config.GEODATA > 0) && GeoData.getInstance().canSeeTarget(newlocx, newlocy, newlocz, randX, randY, newlocz) && (getInstanceId() == 0) && !getTemplate().isUndying() && !mob.isRaid() && !mob.isRaidMinion() && !Config.MOBS_LIST_NOT_RANDOM.contains(mob.getId()))
{
newlocx = randX;
newlocy = randY;
}
}
}
// don't correct z of flying npc's