diff --git a/data/npc/lib/npcsystem/modules.lua b/data/npc/lib/npcsystem/modules.lua index 9a51f19a2c..500f4e13eb 100644 --- a/data/npc/lib/npcsystem/modules.lua +++ b/data/npc/lib/npcsystem/modules.lua @@ -812,15 +812,17 @@ if Modules == nil then if itemSubType == nil then itemSubType = 1 end - - local shopItem = self:getShopItem(itemid, itemSubType) - if shopItem == nil then - self.npcHandler.shopItems[#self.npcHandler.shopItems + 1] = {id = itemid, buy = cost, sell = -1, subType = itemSubType, name = realName or ItemType(itemid):getName()} - else - if cost < shopItem.sell then - print("[Warning : " .. Npc():getName() .. "] NpcSystem: Buy price lower than sell price: (".. shopItem.name ..")") + local it = ItemType(itemid) + if it:getId() ~= 0 then + local shopItem = self:getShopItem(itemid, itemSubType) + if shopItem == nil then + self.npcHandler.shopItems[#self.npcHandler.shopItems + 1] = {id = itemid, buy = cost, sell = -1, subType = itemSubType, name = realName or ItemType(itemid):getName()} + else + if cost < shopItem.sell then + print("[Warning : " .. Npc():getName() .. "] NpcSystem: Buy price lower than sell price: (".. shopItem.name ..")") + end + shopItem.buy = cost end - shopItem.buy = cost end end @@ -910,15 +912,17 @@ if Modules == nil then if itemSubType == nil then itemSubType = 0 end - - local shopItem = self:getShopItem(itemid, itemSubType) - if shopItem == nil then - self.npcHandler.shopItems[#self.npcHandler.shopItems + 1] = {id = itemid, buy = -1, sell = cost, subType = itemSubType, name = realName or ItemType(itemid):getName()} - else - if shopItem.buy > -1 and cost > shopItem.buy then - print("[Warning : " .. Npc():getName() .. "] NpcSystem: Sell price higher than buy price: (".. shopItem.name ..")") + local it = ItemType(itemid) + if it:getId() ~= 0 then + local shopItem = self:getShopItem(itemid, itemSubType) + if shopItem == nil then + self.npcHandler.shopItems[#self.npcHandler.shopItems + 1] = {id = itemid, buy = -1, sell = cost, subType = itemSubType, name = realName or ItemType(itemid):getName()} + else + if shopItem.buy > -1 and cost > shopItem.buy then + print("[Warning : " .. Npc():getName() .. "] NpcSystem: Sell price higher than buy price: (".. shopItem.name ..")") + end + shopItem.sell = cost end - shopItem.sell = cost end end