Module:Skills: Difference between revisions

getThievingSourcesForItem: Expose further information in return value
(getThievingSourcesForItem: Include type property in return value to distinguish between various sources)
(getThievingSourcesForItem: Expose further information in return value)
Line 142: Line 142:
if drop.id == itemID then
if drop.id == itemID then
for k, npcID in ipairs(area.npcIDs) do
for k, npcID in ipairs(area.npcIDs) do
areaNPCs[npcID] = drop.quantity
areaNPCs[npcID] = { qty = drop.quantity, area = area }
end
end
break
break
Line 170: Line 170:
end
end


if areaNPCs[npc.id] ~= nil then
local areaNPC = areaNPCs[npc.id]
table.insert(resultArray, {npc = npc.name, minQty = areaNPCs[npc.id], maxQty = areaNPCs[npc.id], wt = SkillData.Thieving.baseAreaUniqueChance, totalWt = 100, level = npc.level, npcID = npc.id, type = 'areaUnique'})
if areaNPC ~= nil then
table.insert(resultArray, {npc = npc.name, minQty = areaNPC.qty, maxQty = areaNPC.qty, wt = SkillData.Thieving.baseAreaUniqueChance, totalWt = 100, level = npc.level, npcID = npc.id, area = areaNPC.area, type = 'areaUnique'})
end
end
end
end