Random spawn system for monsters.
This commit is contained in:
parent
0c6829d4ad
commit
6e0be1da25
17
trunk/dist/game/config/Custom.properties
vendored
17
trunk/dist/game/config/Custom.properties
vendored
@ -537,3 +537,20 @@ CustomStartingLocation = False
|
||||
CustomStartingLocX = 50821
|
||||
CustomStartingLocY = 186527
|
||||
CustomStartingLocZ = -3625
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Random Spawn System for Monsters
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable random monster spawns.
|
||||
# Default: True
|
||||
EnableRandomMonsterSpawns = True
|
||||
|
||||
# Max range for X and Y coords.
|
||||
# Default: 150
|
||||
MaxSpawnMobRange = 150
|
||||
|
||||
# Example: No random spawns for Kasha's Eye.
|
||||
# MobsSpawnNotRandom = 18812,18813,18814
|
||||
MobsSpawnNotRandom = 18812,18813,18814
|
||||
|
@ -801,6 +801,10 @@ public final class Config
|
||||
public static int CUSTOM_STARTING_LOC_X;
|
||||
public static int CUSTOM_STARTING_LOC_Y;
|
||||
public static int CUSTOM_STARTING_LOC_Z;
|
||||
public static boolean ENABLE_RANDOM_MONSTER_SPAWNS;
|
||||
public static int MOB_MIN_SPAWN_RANGE;
|
||||
public static int MOB_MAX_SPAWN_RANGE;
|
||||
public static List<Integer> MOBS_LIST_NOT_RANDOM;
|
||||
|
||||
// --------------------------------------------------
|
||||
// NPC Settings
|
||||
@ -2563,6 +2567,19 @@ public final class Config
|
||||
CUSTOM_STARTING_LOC_Y = CustomSettings.getInt("CustomStartingLocY", 186527);
|
||||
CUSTOM_STARTING_LOC_Z = CustomSettings.getInt("CustomStartingLocZ", -3625);
|
||||
|
||||
ENABLE_RANDOM_MONSTER_SPAWNS = CustomSettings.getBoolean("EnableRandomMonsterSpawns", false);
|
||||
MOB_MAX_SPAWN_RANGE = CustomSettings.getInt("MaxSpawnMobRange", 150);
|
||||
MOB_MIN_SPAWN_RANGE = MOB_MAX_SPAWN_RANGE * -1;
|
||||
if (ENABLE_RANDOM_MONSTER_SPAWNS)
|
||||
{
|
||||
String[] mobsIds = CustomSettings.getString("MobsSpawnNotRandom", "18812,18813,18814,22138").split(",");
|
||||
MOBS_LIST_NOT_RANDOM = new ArrayList<>(mobsIds.length);
|
||||
for (String id : mobsIds)
|
||||
{
|
||||
MOBS_LIST_NOT_RANDOM.add(Integer.valueOf(id));
|
||||
}
|
||||
}
|
||||
|
||||
// Load PvP L2Properties file (if exists)
|
||||
final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_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
|
||||
|
Loading…
Reference in New Issue
Block a user