Module:Skills/Artisan: Difference between revisions

Added getCookingFireTable
(Added override for specifically Bird Nest Potion to fix a typo in the code)
(Added getCookingFireTable)
Line 4: Line 4:


local SkillData = mw.loadData('Module:Skills/data')
local SkillData = mw.loadData('Module:Skills/data')
local Constants = mw.loadData('Module:Constants/data')
local ShopData = mw.loadData('Module:Shop/data')


local Shared = require('Module:Shared')
local Shared = require('Module:Shared')
Line 97: Line 97:
   local category = frame.args ~= nil and frame.args[1] or frame
   local category = frame.args ~= nil and frame.args[1] or frame
   return p._getHerblorePotionTable(category)
   return p._getHerblorePotionTable(category)
end
function p.getCookingFireTable(frame)
  local toolArray = {}
  for i, upgrade in Shared.skpairs(ShopData.Shop.SkillUpgrades) do
    if Shared.contains(upgrade.name, 'Cooking Fire') then
      table.insert(toolArray, upgrade)
    end
  end
  local result = '{| class="wikitable"'
  result = result..'\r\n!colspan="4"| !!colspan="2"|Bonus '..Icons.Icon({'Cooking', type='skill', notext=true})..' XP'
  result = result..'\r\n|- class="headerRow-0"'
  result = result..'\r\n!colspan="2"|Name!!'..Icons.Icon({'Cooking', type='skill', notext=true})..' Level'
  result = result..'!!Cost!!This Fire!!Total'
  local total = 0
  local total2 = 0
  for i, tool in Shared.skpairs(toolArray) do
    result = result..'\r\n|-'
    result = result..'\r\n|data-sort-value="'..tool.name..'"|'..Icons.Icon({tool.name, type='upgrade', size='50', notext=true})
    result = result..'||'..tool.name
    local level = 1
    if tool.unlockRequirements ~= nil and tool.unlockRequirements.skillLevel ~= nil then
      --Gonna be lazy and assume there's only the one skill level and it's the one we care about
      level = tool.unlockRequirements.skillLevel[1][2]
    end
    result = result..'||style="text-align:right"|'..level
    result = result..'||style="text-align:right" data-sort-value="'..tool.cost.gp..'"|'..Icons.GP(tool.cost.gp)
    local bonusXP = tool.contains.modifiers.increasedSkillXP[1][2]
    total = total + bonusXP
    result = result..'||style="text-align:right"|+'..bonusXP..'%'
    result = result..'||style="text-align:right"|+'..total..'%'
  end
  result = result..'\r\n|}'
  return result
end
end


return p
return p