Module:Skills/Gathering: Difference between revisions

Updated getPickaxeTable
(updated getRodTable)
(Updated getPickaxeTable)
Line 48: Line 48:


function p.getPickaxeTable(frame)
function p.getPickaxeTable(frame)
   local result = '{| class="wikitable sortable"'
  local toolArray = {}
  for i, upgrade in Shared.skpairs(SkillData.Shop.SkillUpgrades) do
    if Shared.contains(upgrade.name, 'Pickaxe') then
      table.insert(toolArray, upgrade)
    end
  end
 
   local result = '{| class="wikitable"'
  result = result..'\r\n!colspan="4"| !!colspan="2"|Mine Time Decrease!!colspan="2"|2x Ore Chance'
   result = result..'\r\n|- class="headerRow-0"'
   result = result..'\r\n|- class="headerRow-0"'
   result = result..'\r\n!colspan="2"|Name!!'..Icons.Icon({'Mining', type='skill', notext=true})..' Level'
   result = result..'\r\n!colspan="2"|Name!!'..Icons.Icon({'Mining', type='skill', notext=true})..' Level'
   result = result..'!!2x Ore Chance!!Bonus Speed!!Cost'
   result = result..'!!Cost!!This Pick!!Total!!This Pick!!Total'
 
  local total = 0
  local total2 = 0


   for i, axe in Shared.skpairs(SkillData.Mining.Picks) do
   for i, tool in Shared.skpairs(toolArray) do
     if axe.cost ~= nil and axe.cost > 0 then
     result = result..'\r\n|-'
      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..'\r\n|data-sort-value="'..axe.name..'"|'..Icons.Icon({axe.name, type='upgrade', size='50', notext=true})
    result = result..'||[['..tool.name..']]'
      result = result..'||[['..axe.name..']]'
    local level = 1
      result = result..'||style="text-align:right"|'..axe.level
    if tool.unlockRequirements ~= nil and tool.unlockRequirements.skillLevel ~= nil then
      result = result..'||style="text-align:right" data-sort-value="'..axe.bonus..'"|'..axe.bonus..'%'
       --Gonna be lazy and assume there's only the one skill level and it's the one we care about
       result = result..'||style="text-align:right" data-sort-value="'..axe.speed..'"|'..axe.speed..'%'
       level = tool.unlockRequirements.skillLevel[1][2]
       result = result..'||style="text-align:right" data-sort-value="'..axe.cost..'"|'..Icons.GP(axe.cost)
     end
     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 cutTime = tool.contains.modifiers.decreasedSkillIntervalPercent[1][2]
    total = total + cutTime
    result = result..'||style="text-align:right"|-'..cutTime..'%'
    result = result..'||style="text-align:right"|-'..total..'%'
    local OreDouble = tool.contains.modifiers.increasedChanceToDoubleOres
    total2 = total2 + OreDouble
    result = result..'||style="text-align:right"|+'..OreDouble..'%'
    result = result..'||style="text-align:right"|+'..total2..'%'
   end
   end