Index: C:/Documents and Settings/Y/My Documents/Eclipse/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/model/L2MinionData.java
===================================================================
--- C:/Documents and Settings/Y/My Documents/Eclipse/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/model/L2MinionData.java (revision 2055)
+++ C:/Documents and Settings/Y/My Documents/Eclipse/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/model/L2MinionData.java (working copy)
@@ -17,7 +17,7 @@
* http://www.gnu.org/copyleft/gpl.html
*/
package net.sf.l2j.gameserver.model;
-
+import java.util.Random;
/**
* This class defines the spawn data of a Minion type
* In a group mob, there are one master called RaidBoss and several slaves called Minions.
@@ -34,9 +34,11 @@
private int _minionId;
/** The number of this Minion Type to spawn */
- private int _minionAmount;
-
+ private int _minionAmount;
+ private int _minionAmountMin;
+ private int _minionAmountMax;
+
/**
* Set the Identifier of the Minion to spawn.
*
@@ -57,6 +59,28 @@
}
/**
+ * Set the minimum of minions to amount.
+ *
+ * @param amountMin The minimum quantity of this Minion type to spawn
+ *
+ */
+ public void setAmountMin(int amountMin)
+ {
+ _minionAmountMin = amountMin;
+ }
+
+ /**
+ * Set the maximum of minions to amount.
+ *
+ * @param amountMax The maximum quantity of this Minion type to spawn
+ *
+ */
+ public void setAmountMax(int amountMax)
+ {
+ _minionAmountMax = amountMax;
+ }
+
+ /**
* Set the amount of this Minion type to spawn.
*
* @param amount The quantity of this Minion type to spawn
@@ -72,7 +96,16 @@
*/
public int getAmount()
{
- return _minionAmount;
+ if (_minionAmountMax > _minionAmountMin)
+ {
+ Random random = new Random();
+ _minionAmount = _minionAmountMin + random.nextInt(_minionAmountMax-_minionAmountMin);
+ return _minionAmount;
+ }
+ else
+ {
+ return _minionAmountMin;
+ }
}
}
Index: C:/Documents and Settings/Y/My Documents/Eclipse/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/NpcTable.java
===================================================================
--- C:/Documents and Settings/Y/My Documents/Eclipse/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/NpcTable.java (revision 2055)
+++ C:/Documents and Settings/Y/My Documents/Eclipse/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/NpcTable.java (working copy)
@@ -178,7 +178,7 @@
_log.log(Level.SEVERE, "error reading npc trainers ", e);
}
try {
- PreparedStatement statement4 = con.prepareStatement("SELECT boss_id, minion_id, amount FROM minions");
+ PreparedStatement statement4 = con.prepareStatement("SELECT boss_id, minion_id, amount_min, amount_max FROM minions");
ResultSet minionData = statement4.executeQuery();
L2MinionData minionDat = null;
L2NpcTemplate npcDat = null;
@@ -190,7 +190,8 @@
npcDat = _npcs.get(raidId);
minionDat = new L2MinionData();
minionDat.setMinionId(minionData.getInt("minion_id"));
- minionDat.setAmount(minionData.getInt("amount"));
+ minionDat.setAmountMin(minionData.getInt("amount_min"));
+ minionDat.setAmountMax(minionData.getInt("amount_max"));
npcDat.addRaidData(minionDat);
cnt++;
}