|
@@ -19,10 +19,8 @@
|
|
package handlers.itemhandlers;
|
|
package handlers.itemhandlers;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.logging.Logger;
|
|
|
|
|
|
|
|
import com.l2jserver.Config;
|
|
import com.l2jserver.Config;
|
|
-import com.l2jserver.gameserver.datatables.ItemTable;
|
|
|
|
import com.l2jserver.gameserver.handler.IItemHandler;
|
|
import com.l2jserver.gameserver.handler.IItemHandler;
|
|
import com.l2jserver.gameserver.model.L2ExtractableProduct;
|
|
import com.l2jserver.gameserver.model.L2ExtractableProduct;
|
|
import com.l2jserver.gameserver.model.actor.L2Playable;
|
|
import com.l2jserver.gameserver.model.actor.L2Playable;
|
|
@@ -33,12 +31,11 @@ import com.l2jserver.gameserver.network.SystemMessageId;
|
|
import com.l2jserver.util.Rnd;
|
|
import com.l2jserver.util.Rnd;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * @author FBIagent 11/12/2006
|
|
|
|
|
|
+ * Extractable Items handler.
|
|
|
|
+ * @author FBIagent
|
|
*/
|
|
*/
|
|
public class ExtractableItems implements IItemHandler
|
|
public class ExtractableItems implements IItemHandler
|
|
{
|
|
{
|
|
- private static Logger _log = Logger.getLogger(ItemTable.class.getName());
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
|
|
public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
|
|
{
|
|
{
|
|
@@ -64,19 +61,31 @@ public class ExtractableItems implements IItemHandler
|
|
}
|
|
}
|
|
|
|
|
|
boolean created = false;
|
|
boolean created = false;
|
|
- // calculate extraction
|
|
|
|
- int min;
|
|
|
|
- int max;
|
|
|
|
- int createitemAmount;
|
|
|
|
for (L2ExtractableProduct expi : exitem)
|
|
for (L2ExtractableProduct expi : exitem)
|
|
{
|
|
{
|
|
if (Rnd.get(100000) <= expi.getChance())
|
|
if (Rnd.get(100000) <= expi.getChance())
|
|
{
|
|
{
|
|
- min = (int) (expi.getMin() * Config.RATE_EXTRACTABLE);
|
|
|
|
- max = (int) (expi.getMax() * Config.RATE_EXTRACTABLE);
|
|
|
|
|
|
+ final int min = (int) (expi.getMin() * Config.RATE_EXTRACTABLE);
|
|
|
|
+ final int max = (int) (expi.getMax() * Config.RATE_EXTRACTABLE);
|
|
|
|
|
|
- createitemAmount = (max == min) ? min : (Rnd.get((max - min) + 1) + min);
|
|
|
|
- activeChar.addItem("Extract", expi.getId(), createitemAmount, activeChar, true);
|
|
|
|
|
|
+ int createItemAmount = (max == min) ? min : (Rnd.get((max - min) + 1) + min);
|
|
|
|
+ if (createItemAmount == 0)
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (item.isStackable() || (createItemAmount == 1))
|
|
|
|
+ {
|
|
|
|
+ activeChar.addItem("Extract", expi.getId(), createItemAmount, activeChar, true);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ while (createItemAmount > 0)
|
|
|
|
+ {
|
|
|
|
+ activeChar.addItem("Extract", expi.getId(), 1, activeChar, true);
|
|
|
|
+ createItemAmount--;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
created = true;
|
|
created = true;
|
|
}
|
|
}
|
|
}
|
|
}
|