Module:Items: Difference between revisions

no edit summary
(Fixed a typo)
No edit summary
Line 13: Line 13:


function p.getItemByID(ID)
function p.getItemByID(ID)
   local result = Shared.clone(ItemData[ID + 1])
   local result = Shared.clone(ItemData.Items[ID + 1])
   if result ~= nil then
   if result ~= nil then
     result.id = ID
     result.id = ID
Line 22: Line 22:
function p.getItem(name)
function p.getItem(name)
   local result = nil
   local result = nil
   for i, item in pairs(ItemData) do
   for i, item in pairs(ItemData.Items) do
     if(item.name == name) then
     if(item.name == name) then
       result = Shared.clone(item)
       result = Shared.clone(item)
Line 166: Line 166:
     --Currently using 'herbloreMasteryID' as shorthand to find details, could be a better method
     --Currently using 'herbloreMasteryID' as shorthand to find details, could be a better method
     local potionID = item.herbloreMasteryID
     local potionID = item.herbloreMasteryID
     local potionData = SkillData.Herblore.ItemData[potionID + 1]
     local potionData = SkillData.Herblore.ItemData.Items[potionID + 1]
     lvl = potionData.herbloreLevel
     lvl = potionData.herbloreLevel
     xp = potionData.herbloreXP
     xp = potionData.herbloreXP
Line 235: Line 235:
   local burnStr = ''
   local burnStr = ''
   local growStr = ''
   local growStr = ''
   for i, item2 in pairs(ItemData) do
   for i, item2 in pairs(ItemData.Items) do
     if item2.dropTable ~= nil then
     if item2.dropTable ~= nil then
       for j, loot in pairs(item2.dropTable) do
       for j, loot in pairs(item2.dropTable) do
Line 334: Line 334:
   --HerbCheck:
   --HerbCheck:
   if item.herbloreMasteryID ~= nil then
   if item.herbloreMasteryID ~= nil then
     local potionData = SkillData.Herblore.ItemData[item.herbloreMasteryID + 1].herbloreLevel
     local potionData = SkillData.Herblore.ItemData.Items[item.herbloreMasteryID + 1].herbloreLevel
     table.insert(lineArray, Icons._SkillReq("Herblore", potionData))
     table.insert(lineArray, Icons._SkillReq("Herblore", potionData))
   end
   end
Line 435: Line 435:


   --Next: Can we find it by rummaging around in another item?
   --Next: Can we find it by rummaging around in another item?
   for i, item2 in pairs(ItemData) do
   for i, item2 in pairs(ItemData.Items) do
     if item2.dropTable ~= nil then
     if item2.dropTable ~= nil then
       local qty = 1
       local qty = 1
Line 598: Line 598:
   --And with all the header out of the way, finally time to actually build the table itself.
   --And with all the header out of the way, finally time to actually build the table itself.
   local itemList = {}
   local itemList = {}
   for i, itemBase in pairs(ItemData) do
   for i, itemBase in pairs(ItemData.Items) do
     local item = Shared.clone(itemBase)
     local item = Shared.clone(itemBase)
     item.id = i - 1
     item.id = i - 1