Adapted random spawn system to newer branches.
This commit is contained in:
@@ -128,6 +128,7 @@ public final class Config
|
||||
public static final String CUSTOM_PVP_ANNOUNCE_CONFIG_FILE = "./config/Custom/PvpAnnounce.ini";
|
||||
public static final String CUSTOM_PVP_REWARD_ITEM_CONFIG_FILE = "./config/Custom/PvpRewardItem.ini";
|
||||
public static final String CUSTOM_PVP_TITLE_CONFIG_FILE = "./config/Custom/PvpTitleColor.ini";
|
||||
public static final String CUSTOM_RANDOM_SPAWNS_CONFIG_FILE = "./config/Custom/RandomSpawns.ini";
|
||||
public static final String CUSTOM_SAYUNE_FOR_ALL_CONFIG_FILE = "./config/Custom/SayuneForAll.ini";
|
||||
public static final String CUSTOM_SCREEN_WELCOME_MESSAGE_CONFIG_FILE = "./config/Custom/ScreenWelcomeMessage.ini";
|
||||
public static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini";
|
||||
@@ -1134,6 +1135,10 @@ public final class Config
|
||||
public static int CUSTOM_STARTING_LOC_Z;
|
||||
public static int SHOP_MIN_RANGE_FROM_NPC;
|
||||
public static int SHOP_MIN_RANGE_FROM_PLAYER;
|
||||
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;
|
||||
public static boolean FREE_JUMPS_FOR_ALL;
|
||||
public static boolean CUSTOM_CB_ENABLED;
|
||||
public static int COMMUNITYBOARD_CURRENCY;
|
||||
@@ -2842,6 +2847,22 @@ public final class Config
|
||||
TITLE_FOR_PVP_AMOUNT4 = PvpTitleColor.getString("PvPTitleForAmount4", "Title");
|
||||
TITLE_FOR_PVP_AMOUNT5 = PvpTitleColor.getString("PvPTitleForAmount5", "Title");
|
||||
|
||||
// Load RandomSpawns config file (if exists)
|
||||
final PropertiesParser RandomSpawns = new PropertiesParser(CUSTOM_RANDOM_SPAWNS_CONFIG_FILE);
|
||||
|
||||
ENABLE_RANDOM_MONSTER_SPAWNS = RandomSpawns.getBoolean("EnableRandomMonsterSpawns", false);
|
||||
MOB_MAX_SPAWN_RANGE = RandomSpawns.getInt("MaxSpawnMobRange", 150);
|
||||
MOB_MIN_SPAWN_RANGE = MOB_MAX_SPAWN_RANGE * -1;
|
||||
if (ENABLE_RANDOM_MONSTER_SPAWNS)
|
||||
{
|
||||
final String[] mobsIds = RandomSpawns.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 SayuneForAll config file (if exists)
|
||||
final PropertiesParser SayuneForAll = new PropertiesParser(CUSTOM_SAYUNE_FOR_ALL_CONFIG_FILE);
|
||||
|
||||
|
@@ -23,9 +23,11 @@ import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
@@ -35,6 +37,7 @@ import com.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||
import com.l2jmobius.gameserver.model.interfaces.INamable;
|
||||
import com.l2jmobius.gameserver.model.interfaces.IPositionable;
|
||||
import com.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
|
||||
/**
|
||||
* This class manages the spawn and respawn of a group of L2NpcInstance that are in the same are and have the same type.<br>
|
||||
@@ -540,6 +543,20 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
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);
|
||||
|
||||
final boolean isQuestMonster = (npc.getTitle() != null) && npc.getTitle().contains("Quest");
|
||||
if (npc.isMonster() && !isQuestMonster && !npc.isWalker() && !npc.isInsideZone(ZoneId.NO_BOOKMARK) && (getInstanceId() == 0) && GeoEngine.getInstance().canMoveToTarget(newlocx, newlocy, newlocz, randX, randY, newlocz, npc.getInstanceWorld()) && !getTemplate().isUndying() && !npc.isRaid() && !npc.isRaidMinion() && !Config.MOBS_LIST_NOT_RANDOM.contains(npc.getId()))
|
||||
{
|
||||
newlocx = randX;
|
||||
newlocy = randY;
|
||||
}
|
||||
}
|
||||
|
||||
// DO NOT CORRECT SPAWN Z IN GENERAL - Prevent NPC spawns on top of buildings
|
||||
// don't correct z of flying npc's
|
||||
// if (!npc.isFlying())
|
||||
|
Reference in New Issue
Block a user