Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: dist/game/config/Custom/MonsterSpawnMultiplier.ini
- ===================================================================
- --- dist/game/config/Custom/MonsterSpawnMultiplier.ini (nonexistent)
- +++ dist/game/config/Custom/MonsterSpawnMultiplier.ini (working copy)
- @@ -0,0 +1,16 @@
- +# ---------------------------------------------------------------------------
- +# Monster Spawn Multiplier
- +# ---------------------------------------------------------------------------
- +
- +# Enable/Disable monster spawn multiplier.
- +# Default: False
- +MonsterSpawnMultiplierEnable = False
- +
- +# Monster spawn count will be multiplied with this number.
- +# Default: 1
- +MonsterSpawnMultiplierRate = 1
- +# Monster spawn mode
- +# 0 : static (fixed rate MonsterSpawnMultiplierRate)
- +# 1 : dynamic (random from 1..MonsterSpawnMultiplierRate)
- +# Default: 0
- +MonsterSpawnMultiplierMode = 0
- +# Specify ids of monsters to be affected, or leave empty to affect all monsters.
- +# Example:
- +# MonsterMultiplierList = 1045, 2019
- +MonsterSpawnMultiplierList =
- Index: java/com/l2jmobius/Config.java
- ===================================================================
- --- java/com/l2jmobius/Config.java (revision 5007)
- +++ java/com/l2jmobius/Config.java (working copy)
- @@ -118,6 +118,7 @@
- private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini";
- private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini";
- private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini";
- + private static final String CUSTOM_MONSTER_MULTIPLIER_CONFIG_FILE = "./config/Custom/MonsterSpawnMultiplier.ini";
- private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini";
- private static final String CUSTOM_NPC_STAT_MULTIPIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini";
- private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
- @@ -1076,6 +1077,9 @@
- public static boolean FAKE_PLAYER_CAN_DROP_ITEMS;
- public static boolean FAKE_PLAYER_CAN_PICKUP;
- public static boolean ENABLE_FIND_PVP;
- + public static boolean MONSTER_SPAWN_MULTIPLIER_ENABLED;
- + public static float MONSTER_SPAWN_MULTIPLIER_RATE;
- + public static float MONSTER_SPAWN_MULTIPLIER_MODE;
- + public static List<Integer> MONSTER_SPAWN_MULTIPLIER_LIST;
- public static boolean PREMIUM_SYSTEM_ENABLED;
- public static float PREMIUM_RATE_XP;
- public static float PREMIUM_RATE_SP;
- @@ -2430,6 +2434,22 @@
- final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE);
- ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false);
- + // Load MonsterSpawnMultiplier config file (if exists)
- + final PropertiesParser MonsterSpawnMultiplier = new PropertiesParser(CUSTOM_MONSTER_MULTIPLIER_CONFIG_FILE);
- +
- + MONSTER_SPAWN_MULTIPLIER_ENABLED = MonsterSpawnMultiplier.getBoolean("MonsterSpawnMultiplierEnable", false);
- + MONSTER_SPAWN_MULTIPLIER_RATE = MonsterSpawnMultiplier.getFloat("MonsterSpawnMultiplierRate", 1);
- + MONSTER_SPAWN_MULTIPLIER_MODE = MonsterSpawnMultiplier.getInt("MonsterSpawnMultiplierMode", 0);
- + final String[] monsterSpawnMultiplierList = MonsterSpawnMultiplier.getString("MonsterSpawnMultiplierList", "").split(",");
- + MONSTER_SPAWN_MULTIPLIER_LIST = new ArrayList<>(monsterSpawnMultiplierList.length);
- + for (String monsterId : monsterSpawnMultiplierList)
- + {
- + monsterId = monsterId.trim();
- + if (!monsterId.equals("0") && Util.isDigit(monsterId))
- + {
- + MONSTER_SPAWN_MULTIPLIER_LIST.add(Integer.parseInt(monsterId));
- + }
- + }
- +
- // Load MultilingualSupport config file (if exists)
- final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE);
- Index: java/com/l2jmobius/gameserver/model/spawns/NpcSpawnTemplate.java
- ===================================================================
- --- java/com/l2jmobius/gameserver/model/spawns/NpcSpawnTemplate.java (revision 5007)
- +++ java/com/l2jmobius/gameserver/model/spawns/NpcSpawnTemplate.java (working copy)
- @@ -25,6 +25,7 @@
- import java.util.logging.Level;
- import java.util.logging.Logger;
- +import java.util.Random;
- +import com.l2jmobius.Config;
- import com.l2jmobius.commons.util.Rnd;
- import com.l2jmobius.gameserver.data.xml.impl.NpcData;
- import com.l2jmobius.gameserver.datatables.SpawnTable;
- @@ -87,7 +88,7 @@
- _spawnTemplate = spawnTemplate;
- _group = group;
- _id = set.getInt("id");
- - _count = set.getInt("count", 1);
- + _count = getSpawnMultiplier(_id, set);
- _respawnTime = set.getDuration("respawnTime", null);
- _respawnTimeRandom = set.getDuration("respawnRandom", null);
- _spawnAnimation = set.getBoolean("spawnAnimation", false);
- @@ -128,6 +129,21 @@
- mergeParameters(spawnTemplate, group);
- }
- + private int getSpawnMultiplier(int id, StatsSet set)
- + {
- + final int originalCount = set.getInt("count", 1);
- + if (Config.MONSTER_SPAWN_MULTIPLIER_ENABLED && NpcData.getInstance().getTemplate(id).isType("L2Monster"))
- + {
- + int newSpawnCount = originalCount;
- + if (Config.MONSTER_SPAWN_MULTIPLIER_MODE == 1)
- + {
- + newSpawnCount = newSpawnCount * (new Random().nextInt((int) ((Config.MONSTER_SPAWN_MULTIPLIER_RATE - 1) + 1)) + 1);
- + }
- + else
- + {
- + newSpawnCount = (int) (newSpawnCount * Config.MONSTER_SPAWN_MULTIPLIER_RATE);
- + }
- +
- + if (!Config.MONSTER_SPAWN_MULTIPLIER_LIST.isEmpty())
- + {
- + return Config.MONSTER_SPAWN_MULTIPLIER_LIST.contains(id) ? newSpawnCount : originalCount;
- + }
- + return newSpawnCount;
- + }
- + return originalCount;
- + }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement