Advertisement
Guest User

Untitled

a guest
Mar 13th, 2019
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.21 KB | None | 0 0
  1. Index: dist/game/config/Custom/MonsterSpawnMultiplier.ini
  2. ===================================================================
  3. --- dist/game/config/Custom/MonsterSpawnMultiplier.ini  (nonexistent)
  4. +++ dist/game/config/Custom/MonsterSpawnMultiplier.ini  (working copy)
  5. @@ -0,0 +1,16 @@
  6. +# ---------------------------------------------------------------------------
  7. +# Monster Spawn Multiplier
  8. +# ---------------------------------------------------------------------------
  9. +
  10. +# Enable/Disable monster spawn multiplier.
  11. +# Default: False
  12. +MonsterSpawnMultiplierEnable = False
  13. +
  14. +# Monster spawn count will be multiplied with this number.
  15. +# Default: 1
  16. +MonsterSpawnMultiplierRate = 1
  17. +
  18. +# Specify ids of monsters to be affected, or leave empty to affect all monsters.
  19. +# Example:
  20. +# MonsterMultiplierList = 1045, 2019
  21. +MonsterSpawnMultiplierList =
  22. Index: java/com/l2jmobius/Config.java
  23. ===================================================================
  24. --- java/com/l2jmobius/Config.java  (revision 5007)
  25. +++ java/com/l2jmobius/Config.java  (working copy)
  26. @@ -118,6 +118,7 @@
  27.     private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini";
  28.     private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini";
  29.     private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini";
  30. +   private static final String CUSTOM_MONSTER_MULTIPLIER_CONFIG_FILE = "./config/Custom/MonsterSpawnMultiplier.ini";
  31.     private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini";
  32.     private static final String CUSTOM_NPC_STAT_MULTIPIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini";
  33.     private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
  34. @@ -1076,6 +1077,9 @@
  35.     public static boolean FAKE_PLAYER_CAN_DROP_ITEMS;
  36.     public static boolean FAKE_PLAYER_CAN_PICKUP;
  37.     public static boolean ENABLE_FIND_PVP;
  38. +   public static boolean MONSTER_SPAWN_MULTIPLIER_ENABLED;
  39. +   public static float MONSTER_SPAWN_MULTIPLIER_RATE;
  40. +   public static List<Integer> MONSTER_SPAWN_MULTIPLIER_LIST;
  41.     public static boolean PREMIUM_SYSTEM_ENABLED;
  42.     public static float PREMIUM_RATE_XP;
  43.     public static float PREMIUM_RATE_SP;
  44. @@ -2430,6 +2434,22 @@
  45.             final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE);
  46.             ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false);
  47.            
  48. +           // Load MonsterSpawnMultiplier config file (if exists)
  49. +           final PropertiesParser MonsterSpawnMultiplier = new PropertiesParser(CUSTOM_MONSTER_MULTIPLIER_CONFIG_FILE);
  50. +          
  51. +           MONSTER_SPAWN_MULTIPLIER_ENABLED = MonsterSpawnMultiplier.getBoolean("MonsterSpawnMultiplierEnable", false);
  52. +           MONSTER_SPAWN_MULTIPLIER_RATE = MonsterSpawnMultiplier.getFloat("MonsterSpawnMultiplierRate", 1);
  53. +           final String[] monsterSpawnMultiplierList = MonsterSpawnMultiplier.getString("MonsterSpawnMultiplierList", "").split(",");
  54. +           MONSTER_SPAWN_MULTIPLIER_LIST = new ArrayList<>(monsterSpawnMultiplierList.length);
  55. +           for (String monsterId : monsterSpawnMultiplierList)
  56. +           {
  57. +               monsterId = monsterId.trim();
  58. +               if (!monsterId.equals("0") && Util.isDigit(monsterId))
  59. +               {
  60. +                   MONSTER_SPAWN_MULTIPLIER_LIST.add(Integer.parseInt(monsterId));
  61. +               }
  62. +           }
  63. +          
  64.             // Load MultilingualSupport config file (if exists)
  65.             final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE);
  66.            
  67. Index: java/com/l2jmobius/gameserver/model/spawns/NpcSpawnTemplate.java
  68. ===================================================================
  69. --- java/com/l2jmobius/gameserver/model/spawns/NpcSpawnTemplate.java    (revision 5007)
  70. +++ java/com/l2jmobius/gameserver/model/spawns/NpcSpawnTemplate.java    (working copy)
  71. @@ -25,6 +25,7 @@
  72.  import java.util.logging.Level;
  73.  import java.util.logging.Logger;
  74.  
  75. +import com.l2jmobius.Config;
  76.  import com.l2jmobius.commons.util.Rnd;
  77.  import com.l2jmobius.gameserver.data.xml.impl.NpcData;
  78.  import com.l2jmobius.gameserver.datatables.SpawnTable;
  79. @@ -87,7 +88,7 @@
  80.         _spawnTemplate = spawnTemplate;
  81.         _group = group;
  82.         _id = set.getInt("id");
  83. -       _count = set.getInt("count", 1);
  84. +       _count = getSpawnMultiplier(_id, set);
  85.         _respawnTime = set.getDuration("respawnTime", null);
  86.         _respawnTimeRandom = set.getDuration("respawnRandom", null);
  87.         _spawnAnimation = set.getBoolean("spawnAnimation", false);
  88. @@ -128,6 +129,21 @@
  89.         mergeParameters(spawnTemplate, group);
  90.     }
  91.    
  92. +   private int getSpawnMultiplier(int id, StatsSet set)
  93. +   {
  94. +       final int originalCount = set.getInt("count", 1);
  95. +       if (Config.MONSTER_SPAWN_MULTIPLIER_ENABLED && NpcData.getInstance().getTemplate(id).isType("L2Monster"))
  96. +       {
  97. +           final int newSpawnCount = (int) (originalCount * Config.MONSTER_SPAWN_MULTIPLIER_RATE);
  98. +           if (!Config.MONSTER_SPAWN_MULTIPLIER_LIST.isEmpty())
  99. +           {
  100. +               return Config.MONSTER_SPAWN_MULTIPLIER_LIST.contains(id) ? newSpawnCount : originalCount;
  101. +           }
  102. +           return newSpawnCount;
  103. +       }
  104. +       return originalCount;
  105. +   }
  106. +  
  107.     private StatsSet mergeParameters(SpawnTemplate spawnTemplate, SpawnGroup group)
  108.     {
  109.         if ((_parameters == null) && (spawnTemplate.getParameters() == null) && (group.getParameters() == null))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement