diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java index 3184571100..e7ab8a396f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java @@ -446,8 +446,7 @@ public class NpcData implements IGameXmlReader final NamedNodeMap drop_attrs = drop_node.getAttributes(); if ("item".equals(drop_node.getNodeName().toLowerCase())) { - final double chance = parseDouble(drop_attrs, "chance"); - final DropHolder dropItem = new DropHolder(dropType, parseInteger(drop_attrs, "id"), parseLong(drop_attrs, "min"), parseLong(drop_attrs, "max"), dropType == DropType.LUCKY_DROP ? chance / 100 : chance); + final DropHolder dropItem = new DropHolder(dropType, parseInteger(drop_attrs, "id"), parseLong(drop_attrs, "min"), parseLong(drop_attrs, "max"), parseDouble(drop_attrs, "chance")); if (ItemTable.getInstance().getTemplate(parseInteger(drop_attrs, "id")) == null) { LOGGER.warning("DropListItem: Could not find item with id " + parseInteger(drop_attrs, "id") + "."); @@ -630,7 +629,7 @@ public class NpcData implements IGameXmlReader switch (dropHolder.getDropType()) { case DROP: - case LUCKY_DROP: // TODO: Luck is added to death drops. + case LUCKY_DROP: // Lucky drops are added to normal drops and calculated later { template.addDrop(dropHolder); break; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java index c0a9bd49c7..60c5381e13 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java @@ -671,7 +671,6 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable switch (dropItem.getDropType()) { case DROP: - case LUCKY_DROP: { final L2Item item = ItemTable.getInstance().getTemplate(dropItem.getItemId()); @@ -769,6 +768,15 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable } break; } + case LUCKY_DROP: + { + // try chance before luck + if (((Rnd.nextDouble() * 100) < dropItem.getChance()) && killer.getActingPlayer().tryLuck()) + { + return new ItemHolder(dropItem.getItemId(), Rnd.get(dropItem.getMin(), dropItem.getMax())); + } + break; + } case SPOIL: { // chance diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java index 3184571100..e7ab8a396f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java @@ -446,8 +446,7 @@ public class NpcData implements IGameXmlReader final NamedNodeMap drop_attrs = drop_node.getAttributes(); if ("item".equals(drop_node.getNodeName().toLowerCase())) { - final double chance = parseDouble(drop_attrs, "chance"); - final DropHolder dropItem = new DropHolder(dropType, parseInteger(drop_attrs, "id"), parseLong(drop_attrs, "min"), parseLong(drop_attrs, "max"), dropType == DropType.LUCKY_DROP ? chance / 100 : chance); + final DropHolder dropItem = new DropHolder(dropType, parseInteger(drop_attrs, "id"), parseLong(drop_attrs, "min"), parseLong(drop_attrs, "max"), parseDouble(drop_attrs, "chance")); if (ItemTable.getInstance().getTemplate(parseInteger(drop_attrs, "id")) == null) { LOGGER.warning("DropListItem: Could not find item with id " + parseInteger(drop_attrs, "id") + "."); @@ -630,7 +629,7 @@ public class NpcData implements IGameXmlReader switch (dropHolder.getDropType()) { case DROP: - case LUCKY_DROP: // TODO: Luck is added to death drops. + case LUCKY_DROP: // Lucky drops are added to normal drops and calculated later { template.addDrop(dropHolder); break; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java index c0a9bd49c7..60c5381e13 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java @@ -671,7 +671,6 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable switch (dropItem.getDropType()) { case DROP: - case LUCKY_DROP: { final L2Item item = ItemTable.getInstance().getTemplate(dropItem.getItemId()); @@ -769,6 +768,15 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable } break; } + case LUCKY_DROP: + { + // try chance before luck + if (((Rnd.nextDouble() * 100) < dropItem.getChance()) && killer.getActingPlayer().tryLuck()) + { + return new ItemHolder(dropItem.getItemId(), Rnd.get(dropItem.getMin(), dropItem.getMax())); + } + break; + } case SPOIL: { // chance diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java index 3184571100..e7ab8a396f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java @@ -446,8 +446,7 @@ public class NpcData implements IGameXmlReader final NamedNodeMap drop_attrs = drop_node.getAttributes(); if ("item".equals(drop_node.getNodeName().toLowerCase())) { - final double chance = parseDouble(drop_attrs, "chance"); - final DropHolder dropItem = new DropHolder(dropType, parseInteger(drop_attrs, "id"), parseLong(drop_attrs, "min"), parseLong(drop_attrs, "max"), dropType == DropType.LUCKY_DROP ? chance / 100 : chance); + final DropHolder dropItem = new DropHolder(dropType, parseInteger(drop_attrs, "id"), parseLong(drop_attrs, "min"), parseLong(drop_attrs, "max"), parseDouble(drop_attrs, "chance")); if (ItemTable.getInstance().getTemplate(parseInteger(drop_attrs, "id")) == null) { LOGGER.warning("DropListItem: Could not find item with id " + parseInteger(drop_attrs, "id") + "."); @@ -630,7 +629,7 @@ public class NpcData implements IGameXmlReader switch (dropHolder.getDropType()) { case DROP: - case LUCKY_DROP: // TODO: Luck is added to death drops. + case LUCKY_DROP: // Lucky drops are added to normal drops and calculated later { template.addDrop(dropHolder); break; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java index c0a9bd49c7..60c5381e13 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java @@ -671,7 +671,6 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable switch (dropItem.getDropType()) { case DROP: - case LUCKY_DROP: { final L2Item item = ItemTable.getInstance().getTemplate(dropItem.getItemId()); @@ -769,6 +768,15 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable } break; } + case LUCKY_DROP: + { + // try chance before luck + if (((Rnd.nextDouble() * 100) < dropItem.getChance()) && killer.getActingPlayer().tryLuck()) + { + return new ItemHolder(dropItem.getItemId(), Rnd.get(dropItem.getMin(), dropItem.getMax())); + } + break; + } case SPOIL: { // chance