Check if item template exists on loading droplists.

This commit is contained in:
MobiusDev 2017-02-26 20:06:07 +00:00
parent 882e9fb7a0
commit 9ad05be44a
4 changed files with 14 additions and 4 deletions

View File

@ -495,7 +495,7 @@
<item id="1539" min="1" max="1" chance="93.258796448537" /> <!-- Major Healing Potion --> <item id="1539" min="1" max="1" chance="93.258796448537" /> <!-- Major Healing Potion -->
<item id="36537" min="1" max="1" chance="4.932587964485" /> <!-- Leather Braid --> <item id="36537" min="1" max="1" chance="4.932587964485" /> <!-- Leather Braid -->
<item id="36557" min="1" max="1" chance="1.644195988162" /> <!-- Accessory Gem --> <item id="36557" min="1" max="1" chance="1.644195988162" /> <!-- Accessory Gem -->
<item id="49929" min="1" max="4" chance="0.164419598816" /> <!-- Spirit Stone --> <item id="45929" min="1" max="4" chance="0.164419598816" /> <!-- Spirit Stone -->
</group> </group>
<group chance="20"> <group chance="20">
<item id="8600" min="1" max="1" chance="50" /> <!-- Herb of Life --> <item id="8600" min="1" max="1" chance="50" /> <!-- Herb of Life -->

View File

@ -37,6 +37,7 @@ import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.commons.util.IGameXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.AISkillScope; import com.l2jmobius.gameserver.enums.AISkillScope;
import com.l2jmobius.gameserver.enums.MpRewardAffectType; import com.l2jmobius.gameserver.enums.MpRewardAffectType;
import com.l2jmobius.gameserver.enums.MpRewardType; import com.l2jmobius.gameserver.enums.MpRewardType;
@ -659,7 +660,11 @@ public class NpcData implements IGameXmlReader
case "item": case "item":
{ {
final IDropItem dropItem = dropListScope.newDropItem(parseInteger(attrs, "id"), parseLong(attrs, "min"), parseLong(attrs, "max"), parseDouble(attrs, "chance")); final IDropItem dropItem = dropListScope.newDropItem(parseInteger(attrs, "id"), parseLong(attrs, "min"), parseLong(attrs, "max"), parseDouble(attrs, "chance"));
if (dropItem != null) if (ItemTable.getInstance().getTemplate(parseInteger(attrs, "id")) == null)
{
LOGGER.warning("DropListItem: Could not find item with id " + parseInteger(attrs, "id") + ".");
}
else if (dropItem != null)
{ {
drops.add(dropItem); drops.add(dropItem);
} }

View File

@ -542,7 +542,7 @@
<item id="1539" min="1" max="1" chance="93.258796448537" /> <!-- Major Healing Potion --> <item id="1539" min="1" max="1" chance="93.258796448537" /> <!-- Major Healing Potion -->
<item id="36537" min="1" max="1" chance="4.932587964485" /> <!-- Leather Braid --> <item id="36537" min="1" max="1" chance="4.932587964485" /> <!-- Leather Braid -->
<item id="36557" min="1" max="1" chance="1.644195988162" /> <!-- Accessory Gem --> <item id="36557" min="1" max="1" chance="1.644195988162" /> <!-- Accessory Gem -->
<item id="49929" min="1" max="4" chance="0.164419598816" /> <!-- Spirit Stone --> <item id="45929" min="1" max="4" chance="0.164419598816" /> <!-- Spirit Stone -->
</group> </group>
<group chance="20"> <group chance="20">
<item id="8600" min="1" max="1" chance="50" /> <!-- Herb of Life --> <item id="8600" min="1" max="1" chance="50" /> <!-- Herb of Life -->

View File

@ -37,6 +37,7 @@ import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.commons.util.IGameXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.AISkillScope; import com.l2jmobius.gameserver.enums.AISkillScope;
import com.l2jmobius.gameserver.enums.MpRewardAffectType; import com.l2jmobius.gameserver.enums.MpRewardAffectType;
import com.l2jmobius.gameserver.enums.MpRewardType; import com.l2jmobius.gameserver.enums.MpRewardType;
@ -659,7 +660,11 @@ public class NpcData implements IGameXmlReader
case "item": case "item":
{ {
final IDropItem dropItem = dropListScope.newDropItem(parseInteger(attrs, "id"), parseLong(attrs, "min"), parseLong(attrs, "max"), parseDouble(attrs, "chance")); final IDropItem dropItem = dropListScope.newDropItem(parseInteger(attrs, "id"), parseLong(attrs, "min"), parseLong(attrs, "max"), parseDouble(attrs, "chance"));
if (dropItem != null) if (ItemTable.getInstance().getTemplate(parseInteger(attrs, "id")) == null)
{
LOGGER.warning("DropListItem: Could not find item with id " + parseInteger(attrs, "id") + ".");
}
else if (dropItem != null)
{ {
drops.add(dropItem); drops.add(dropItem);
} }