Anonymous

Module:Items/SourceTables: Difference between revisions

From Melvor Idle
Okay I might (MIGHT!) have added archaeology dig site sources
(_getCreationTable: Include mark discovery requirement for Summoning sources)
(Okay I might (MIGHT!) have added archaeology dig site sources)
Line 719: Line 719:
if monster ~= nil then
if monster ~= nil then
table.insert(dropRows, {source = Icons.Icon({monster.name, type='monster'}), type = '[[Monster]]', minqty = drop.minQty, qty = drop.maxQty, weight = drop.dropWt, totalWeight = drop.totalWt, expIcon = Icons.getExpansionIcon(drop.id)})
table.insert(dropRows, {source = Icons.Icon({monster.name, type='monster'}), type = '[[Monster]]', minqty = drop.minQty, qty = drop.maxQty, weight = drop.dropWt, totalWeight = drop.totalWt, expIcon = Icons.getExpansionIcon(drop.id)})
end
end
--Patching in here because it uses the same format
--Can we find this in an Archaeology digsite?
for i, drop in ipairs(p._getItemArchSources(item)) do
if drop.name ~= nil then
table.insert(dropRows, {source = Icons.Icon({drop.name, type='poi'}), type = '[[Archaeology|Dig Site]] ('..drop.size..')', minqty = drop.minQty, qty = drop.maxQty, weight = drop.dropWt, totalWeight = drop.totalWt, expIcon = Icons.getExpansionIcon(drop.id)})
end
end
end
end
Line 1,098: Line 1,106:
local item = Items.getItem(itemName)
local item = Items.getItem(itemName)
return p._getItemMonsterSources(item)
return p._getItemMonsterSources(item)
end
function p._getItemArchSources(item)
local check = false
local itemID = item.id
local resultArray = {}
for i, digSite in pairs(SkillData.Archaeology.digSites) do
for sizeName, size in pairs(digSite.artefacts) do
local found = nil
local sizeWeight = 0
for k, artefact in pairs(size) do
sizeWeight = sizeWeight + artefact.weight
if artefact.itemID == itemID then
found = artefact
end
end
if found ~= nil then
local min = found.minQuantity
local max = found.maxQuantity
table.insert(resultArray, {id = digSite.id, name = digSite.name, size = sizeName, minQty = min, maxQty = max, dropWt = found.weight, totalWt = sizeWeight})
end
end
end
return resultArray
end
function p.getItemArchSources(itemName)
local item = Items.getItem(itemName)
return p._getItemArchSources(item)
end
end