Hello
Mb it would be instresting for ppl who wants to randomly increase spawn amount of monsters.
L2J_Mobius_Classic_2.3_SevenSigns\java\com\l2jmobius\gameserver\model\spawns\NpcSpawnTemplate.java
public NpcSpawnTemplate(SpawnTemplate spawnTemplate, SpawnGroup group, StatsSet set)
// Replace
- _count = set.getInt("count", 1);
+ _count = getSpawnMultiplier(_id, set);
// Add
private int getSpawnMultiplier(int id, StatsSet set)
{
final L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(id);
if (!npcTemplate.isType("L2Monster"))
{
return set.getInt("count", 1);
}
if (Config.MONSTER_SPAWN_MULTIPLIER_ENABLE)
{
int rnd = new Random().nextInt((Config.MONSTER_SPAWN_MULTIPLIER_RANGE - 1) + 1) + 1;
if (Config.MONSTER_SPAWN_MULTIPLIER_LIST.size() > 0)
{
if (Config.MONSTER_SPAWN_MULTIPLIER_LIST.contains(id))
{
return rnd;
}
}
return rnd;
}
return set.getInt("count", 1);
}
L2J_Mobius_Classic_2.3_SevenSigns\java\com\l2jmobius\Config.java
+import java.util.Collections;
+ private static final String CUSTOM_MONSTER_MULTIPLIER_CONFIG_FILE = "./config/Custom/MonsterMultiplier.ini";
+ public static boolean MONSTER_SPAWN_MULTIPLIER_ENABLE;
+ public static int MONSTER_SPAWN_MULTIPLIER_RANGE;
+ public static List<Integer> MONSTER_SPAWN_MULTIPLIER_LIST;
+ // Load MonsterMultiplier config file (if exists)
+ final PropertiesParser MonsterMultiplier = new PropertiesParser(CUSTOM_MONSTER_MULTIPLIER_CONFIG_FILE);
+
+ MONSTER_SPAWN_MULTIPLIER_ENABLE = MonsterMultiplier.getBoolean("MonsterSpawnMultiplier", false);
+ MONSTER_SPAWN_MULTIPLIER_RANGE = MonsterMultiplier.getInt("MonsterSpawnMultiplierRange", 2);
+
+ if (MONSTER_SPAWN_MULTIPLIER_ENABLE)
+ {
+ final List<String> monsterMultiplierList = getIds(ChampionMonster.getString("MonsterSpawnMultiplierList", ""), ",");
+ MONSTER_SPAWN_MULTIPLIER_LIST = new ArrayList<>(monsterMultiplierList.size());
+ for (String s : monsterMultiplierList)
+ {
+ MONSTER_SPAWN_MULTIPLIER_LIST.add(Integer.parseInt(s));
+ }
+ }
+ public static List<String> getIds(String str, String separator)
+ {
+ List<String> list = new ArrayList<>(Arrays.asList(str.split(separator)));
+ list.removeAll(Collections.singletonList(""));
+
+ return list;
+ }
Create L2J_Mobius_Classic_2.3_SevenSigns\dist\game\config\Custom\MonsterSpawnMultiplier.ini
# ---------------------------------------------------------------------------
# MonsterSpawnMultiplier randomly set the spawn amount of L2Monster
# ---------------------------------------------------------------------------
# Enable/Disable
MonsterSpawnMultiplier = True
# Randomly increase amount of spawned NPC of type L2Monster
# Default: 1
MonsterSpawnMultiplierRange = 1
# Specify ids of L2Monster to be affected
# Empty to affect of L2Monster
# Set ids to affect specific L2Monster
# Example
# MonsterMultiplierList = 1045,2019
# Default:
MonsterSpawnMultiplierList =