Module:Items: Difference between revisions

Formatting fixes for creationTable, added Herblore stuff
(Added getCreationTable)
(Formatting fixes for creationTable, added Herblore stuff)
Line 2: Line 2:


local ItemData = mw.loadData('Module:Items/data')
local ItemData = mw.loadData('Module:Items/data')
local SkillData = mw.loadData('Module:Skills/data')


local Shared = require('Module:Shared')
local Shared = require('Module:Shared')
Line 153: Line 154:
     req = item.fletchReq
     req = item.fletchReq
     qty = item.fletchQty
     qty = item.fletchQty
    time = 2
  elseif item.herbloreReq ~= nil then
    skill = 'Herblore'
    req = item.herbloreReq
    --Currently using 'herbloreMasteryID' as shorthand to find details, could be a better method
    local potionID = item.herbloreMasteryID
    local potionData = SkillData.Herblore.ItemData[potionID + 1]
    lvl = potionData.herbloreLevel
    xp = potionData.herbloreXP
     time = 2
     time = 2
   else
   else
Line 161: Line 171:
   local result = '{|class="wikitable"'
   local result = '{|class="wikitable"'
   result = result..'\r\n!colspan="2"|Item Creation\r\n|-'
   result = result..'\r\n!colspan="2"|Item Creation\r\n|-'
   result = result..'\r\n!style="text-align: right;"|Requirements'
   result = result..'\r\n|-\r\n!style="text-align: right;"|Requirements'
   result = result..'||'..Icons.Icon({skill, type="skill", notext="true"}).."'''"..lvl.."'''"
   result = result..'||'..Icons.Icon({skill, type="skill", notext="true"}).."'''"..lvl.."'''"
   result = result..'\r\n!style="text-align: right;"|Materials||'
   result = result..'\r\n|-\r\n!style="text-align: right;"|Materials\r\n|'
   for i, mat in pairs(req) do
   for i, mat in pairs(req) do
     if i > 1 then result = result..'<br/>' end
     if i > 1 then result = result..'<br/>' end
Line 173: Line 183:
     end
     end
   end
   end
   result = result..'\r\n!style="text-align:right;"|Base Quantity'
   result = result..'\r\n|-\r\n!style="text-align:right;"|Base Quantity'
   result = result..'||'..qty
   result = result..'\r\n|'..qty
   result = result..'\r\n!style="text-align:right;"|Base Experience'
   result = result..'\r\n|-\r\n!style="text-align:right;"|Base Experience'
   result = result..'||'..xp
   result = result..'\r\n|'..xp
   result = result..'\r\n!style="text-align:right;"|Base Creation Time'
   result = result..'\r\n|-\r\n!style="text-align:right;"|Base Creation Time'
   result = result..'||'..time..' seconds'
   result = result..'\r\n|'..time..' seconds'
   result = result..'\r\n|}'
   result = result..'\r\n|}'