diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java index 63845ed861..33592e5036 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java @@ -26,6 +26,7 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.SystemMessageId; /** * @author UnAfraid @@ -63,19 +64,15 @@ public class CreateItemRandom extends AbstractEffect return; } - final double random = Rnd.nextDouble() * 100; - double comulativeChance = 0; - for (int attempt = 0; attempt <= 1000; attempt++) // 1000 attempts! TODO: Remove this whole handler. + for (ItemChanceHolder holder : item.getItem().getCreateItems()) { - for (ItemChanceHolder holder : item.getItem().getCreateItems()) + if (holder.getChance() < Rnd.get(100)) { - comulativeChance += holder.getChance(); - if (comulativeChance >= random) - { - player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); - return; - } + player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); + return; } } + + player.sendPacket(SystemMessageId.THERE_WAS_NOTHING_FOUND_INSIDE); } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java index 63845ed861..33592e5036 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java @@ -26,6 +26,7 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.SystemMessageId; /** * @author UnAfraid @@ -63,19 +64,15 @@ public class CreateItemRandom extends AbstractEffect return; } - final double random = Rnd.nextDouble() * 100; - double comulativeChance = 0; - for (int attempt = 0; attempt <= 1000; attempt++) // 1000 attempts! TODO: Remove this whole handler. + for (ItemChanceHolder holder : item.getItem().getCreateItems()) { - for (ItemChanceHolder holder : item.getItem().getCreateItems()) + if (holder.getChance() < Rnd.get(100)) { - comulativeChance += holder.getChance(); - if (comulativeChance >= random) - { - player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); - return; - } + player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); + return; } } + + player.sendPacket(SystemMessageId.THERE_WAS_NOTHING_FOUND_INSIDE); } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java index 63845ed861..33592e5036 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java @@ -26,6 +26,7 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.SystemMessageId; /** * @author UnAfraid @@ -63,19 +64,15 @@ public class CreateItemRandom extends AbstractEffect return; } - final double random = Rnd.nextDouble() * 100; - double comulativeChance = 0; - for (int attempt = 0; attempt <= 1000; attempt++) // 1000 attempts! TODO: Remove this whole handler. + for (ItemChanceHolder holder : item.getItem().getCreateItems()) { - for (ItemChanceHolder holder : item.getItem().getCreateItems()) + if (holder.getChance() < Rnd.get(100)) { - comulativeChance += holder.getChance(); - if (comulativeChance >= random) - { - player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); - return; - } + player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); + return; } } + + player.sendPacket(SystemMessageId.THERE_WAS_NOTHING_FOUND_INSIDE); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java index 63845ed861..33592e5036 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java @@ -26,6 +26,7 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.SystemMessageId; /** * @author UnAfraid @@ -63,19 +64,15 @@ public class CreateItemRandom extends AbstractEffect return; } - final double random = Rnd.nextDouble() * 100; - double comulativeChance = 0; - for (int attempt = 0; attempt <= 1000; attempt++) // 1000 attempts! TODO: Remove this whole handler. + for (ItemChanceHolder holder : item.getItem().getCreateItems()) { - for (ItemChanceHolder holder : item.getItem().getCreateItems()) + if (holder.getChance() < Rnd.get(100)) { - comulativeChance += holder.getChance(); - if (comulativeChance >= random) - { - player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); - return; - } + player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); + return; } } + + player.sendPacket(SystemMessageId.THERE_WAS_NOTHING_FOUND_INSIDE); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java index 63845ed861..33592e5036 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java @@ -26,6 +26,7 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.SystemMessageId; /** * @author UnAfraid @@ -63,19 +64,15 @@ public class CreateItemRandom extends AbstractEffect return; } - final double random = Rnd.nextDouble() * 100; - double comulativeChance = 0; - for (int attempt = 0; attempt <= 1000; attempt++) // 1000 attempts! TODO: Remove this whole handler. + for (ItemChanceHolder holder : item.getItem().getCreateItems()) { - for (ItemChanceHolder holder : item.getItem().getCreateItems()) + if (holder.getChance() < Rnd.get(100)) { - comulativeChance += holder.getChance(); - if (comulativeChance >= random) - { - player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); - return; - } + player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); + return; } } + + player.sendPacket(SystemMessageId.THERE_WAS_NOTHING_FOUND_INSIDE); } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java index 63845ed861..33592e5036 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java @@ -26,6 +26,7 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.SystemMessageId; /** * @author UnAfraid @@ -63,19 +64,15 @@ public class CreateItemRandom extends AbstractEffect return; } - final double random = Rnd.nextDouble() * 100; - double comulativeChance = 0; - for (int attempt = 0; attempt <= 1000; attempt++) // 1000 attempts! TODO: Remove this whole handler. + for (ItemChanceHolder holder : item.getItem().getCreateItems()) { - for (ItemChanceHolder holder : item.getItem().getCreateItems()) + if (holder.getChance() < Rnd.get(100)) { - comulativeChance += holder.getChance(); - if (comulativeChance >= random) - { - player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); - return; - } + player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); + return; } } + + player.sendPacket(SystemMessageId.THERE_WAS_NOTHING_FOUND_INSIDE); } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java index 63845ed861..33592e5036 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/CreateItemRandom.java @@ -26,6 +26,7 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.SystemMessageId; /** * @author UnAfraid @@ -63,19 +64,15 @@ public class CreateItemRandom extends AbstractEffect return; } - final double random = Rnd.nextDouble() * 100; - double comulativeChance = 0; - for (int attempt = 0; attempt <= 1000; attempt++) // 1000 attempts! TODO: Remove this whole handler. + for (ItemChanceHolder holder : item.getItem().getCreateItems()) { - for (ItemChanceHolder holder : item.getItem().getCreateItems()) + if (holder.getChance() < Rnd.get(100)) { - comulativeChance += holder.getChance(); - if (comulativeChance >= random) - { - player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); - return; - } + player.addItem("CreateItems", holder.getId(), holder.getCount(), player, true); + return; } } + + player.sendPacket(SystemMessageId.THERE_WAS_NOTHING_FOUND_INSIDE); } }