Difference between revisions of "Module:Augmenting Uses"

From Idlescape Wiki
Jump to navigation Jump to search
(Created)
 
m (better scraps function)
 
(8 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
local craftingAugmentingData = mw.loadData("Module:CraftingAugmenting/data")
 
local craftingAugmentingData = mw.loadData("Module:CraftingAugmenting/data")
 
local itemsData = mw.loadData("Module:Items/data")
 
local itemsData = mw.loadData("Module:Items/data")
 +
local pageName = mw.title.getCurrentTitle().fullText
 +
local scrappingBaseXp = 20
 +
local scrappingXpPower = 2
 +
  
 
local augmentationBonusNames ={
 
local augmentationBonusNames ={
     ["toolBoost.mining"] = "[[mining]]",
+
     ["toolBoost.mining"] = "[[Mining]]",
     ["toolBoost.foraging"] = "[[foraging]]",
+
     ["toolBoost.foraging"] = "[[Foraging]]",
 
     ["offensiveAccuracyAffinityRating.Ice"] = "[[Combat#Offensive Stats|Ice Accuracy]]",
 
     ["offensiveAccuracyAffinityRating.Ice"] = "[[Combat#Offensive Stats|Ice Accuracy]]",
 
     ["offensiveAccuracyAffinityRating.Nature"] = "[[Combat#Offensive Stats|Nature Accuracy]]",
 
     ["offensiveAccuracyAffinityRating.Nature"] = "[[Combat#Offensive Stats|Nature Accuracy]]",
Line 16: Line 20:
 
     ["toolBoost.smithing"] = "[[Smithing]]",
 
     ["toolBoost.smithing"] = "[[Smithing]]",
 
     ["toolBoost.runecrafting"] = "[[Runecrafting]]",
 
     ["toolBoost.runecrafting"] = "[[Runecrafting]]",
     ["toolBoost.cooking"] = "[[cooking]]",
+
     ["toolBoost.cooking"] = "[[Cooking]]",
     ["toolBoost.enchanting"] = "[[enchanting]]",
+
     ["toolBoost.enchanting"] = "[[Enchanting]]",
     ["toolBoost.fishing"] = "[[fishing]]",
+
     ["toolBoost.fishing"] = "[[Mishing]]",
 
     ["toolBoost.fishingBaitPower"] = "Bait",
 
     ["toolBoost.fishingBaitPower"] = "Bait",
 
     ["toolBoost.fishingRarityPower"] = "Bonus Rarity",
 
     ["toolBoost.fishingRarityPower"] = "Bonus Rarity",
 
     ["toolBoost.fishingReelPower"] = "Reel",
 
     ["toolBoost.fishingReelPower"] = "Reel",
 
     ["offensiveAccuracyAffinityRating.Chaos"] = [[Combat#Offensive Stats|Choas Accuracy]],
 
     ["offensiveAccuracyAffinityRating.Chaos"] = [[Combat#Offensive Stats|Choas Accuracy]],
     ["weaponBonus.strength"] = "[[Combat#Offensive Stats|strength]]",
+
     ["weaponBonus.strength"] = "[[Combat#Offensive Stats|Strength]]",
     ["weaponBonus.intellect"] = "[[Combat#Offensive Stats|intellect]]",
+
     ["weaponBonus.intellect"] = "[[Combat#Offensive Stats|Intellect]]",
     ["weaponBonus.dexterity"] = "[[Combat#Offensive Stats|dexterity]]",
+
     ["weaponBonus.dexterity"] = "[[Combat#Offensive Stats|Dexterity]]",
 
     ["offensiveAccuracyAffinityRating.Melee"] = "[[Combat#Offensive Stats|Melee Accuracy]]",
 
     ["offensiveAccuracyAffinityRating.Melee"] = "[[Combat#Offensive Stats|Melee Accuracy]]",
 
     ["offensiveCritical.chance"] = "[[Combat#Offensive Stats|Crit Chance]]",
 
     ["offensiveCritical.chance"] = "[[Combat#Offensive Stats|Crit Chance]]",
 
     ["offensiveCritical.damageMultiplier"] = "[[Combat#Offensive Stats|Crit Mult]]",
 
     ["offensiveCritical.damageMultiplier"] = "[[Combat#Offensive Stats|Crit Mult]]",
 
     ["armorBonus.agility"] = "[[Combat#Defensive Stats|Agility]]",
 
     ["armorBonus.agility"] = "[[Combat#Defensive Stats|Agility]]",
     ["armorBonus.protection"] = "[[Combat#Defensive Stats|Protectino]]",
+
     ["armorBonus.protection"] = "[[Combat#Defensive Stats|Protection]]",
 
     ["armorBonus.stamina"] = "[[Combat#Defensive Stats|Stamina]]",
 
     ["armorBonus.stamina"] = "[[Combat#Defensive Stats|Stamina]]",
 
     ["armorBonus.resistance"] = "[[Combat#Defensive Stats|Resistance]]",
 
     ["armorBonus.resistance"] = "[[Combat#Defensive Stats|Resistance]]",
Line 37: Line 41:
 
}
 
}
  
local pageName = mw.title.getCurrentTitle().fullText
+
local tierToDust = {
 +
    [1] = "basic",
 +
    [2] = "basic",
 +
    [3] = "unusual",
 +
    [4] = "singular",
 +
    [5] = "prime",
 +
    [6] = "mythical",
 +
    [7] = "mythical",
 +
    [7.5] = "mythical"
 +
}
  
 
local function pairsByKeys(t, f)
 
local function pairsByKeys(t, f)
Line 79: Line 92:
 
     for _ in pairs(T) do count = count + 1 end
 
     for _ in pairs(T) do count = count + 1 end
 
     return count
 
     return count
 +
end
 +
 +
local function getItemTier(itemData)
 +
    local highestRequiredLevel
 +
    if itemData.requiredLevel then
 +
        -- Highest level of the required skills
 +
        highestRequiredLevel = 0
 +
        for _, level in pairs(itemData.requiredLevel) do
 +
            if level > highestRequiredLevel then
 +
                highestRequiredLevel = level
 +
            end
 +
        end
 +
        highestRequiredLevel = tonumber(string.format("%.1f", highestRequiredLevel / 10))
 +
    end
 +
    local itemTier = itemData.overrideItemTier or highestRequiredLevel or itemData.enchantmentTier or 1
 +
    return itemTier
 +
end
 +
 +
local function getScrapExperience(itemData)
 +
    local item_tier = getItemTier(itemData)
 +
    local xp = scrappingBaseXp * (item_tier ^ scrappingXpPower)
 +
    return math.floor(xp)
 
end
 
end
  
Line 91: Line 126:
 
         return "Module:Items/data out of date"
 
         return "Module:Items/data out of date"
 
     end
 
     end
 +
end
 +
---gets the augments that have the itemId in thier augmenting cost and returns an array of them
 +
---@param itemId number
 +
---@return table
 +
local function getMatchedAugs(itemId)
 +
    local matchedAugs = {}
 +
    for id, data in pairs(craftingAugmentingData) do
 +
        if data.scrapping then
 +
            for costId, _ in pairsByKeys(data.scrapping) do
 +
                if tonumber(costId) == itemId then
 +
                    matchedAugs[id] = data.scrapping
 +
                end
 +
            end
 +
        end
 +
    end
 +
    return matchedAugs
 +
end
 +
---decides the collase state based on the given string
 +
---@param collapse string
 +
---@return string
 +
local function decideCollapseState(collapse)
 +
    if collapse == "collapsible" then
 +
        collapse = " mw-made-collapsible mw-collapsible"
 +
    elseif collapse == "collapsed" then
 +
        collapse = " mw-made-collapsible mw-collapsible mw-collapsed"
 +
    else
 +
        collapse = ""
 +
    end
 +
    return collapse
 +
end
 +
 +
local function getItemDust(tier)
 +
    tier = math.floor(tier)
 +
    if tier <= 2 then
 +
        return "Basic Runic Dust"
 +
    elseif tier <= 3 then
 +
        return "Unusual Runic Dust"
 +
    elseif tier <= 4 then
 +
        return "Singular Runic Dust"
 +
    elseif tier <= 5 then
 +
        return "Prime Runic Dust"
 +
    elseif tier > 5 then
 +
        return "Mythical Runic Dust"
 +
    end
 +
end
 +
 +
local function createImgCell(item)
 +
    local imgCell = mw.html.create('td')
 +
    :wikitext(img._img({item.name, '50'}))
 +
    :done()
 +
    return imgCell
 +
end
 +
 +
local function createNameCell(item)
 +
    local nameCell = mw.html.create('td')
 +
    :wikitext("[[" .. item.name .. "]]")
 +
    :done()
 +
    return nameCell
 
end
 
end
  
local function genTable(name, collapse)
+
local function createXpCell(item)
     local itemI = getItem(findId._findId({name, "item"}))
+
     local xpCell = mw.html.create('td')
     local collapseS = ""
+
    :css('text-align', 'center')
     if collapse == 1 then
+
    :wikitext(tostring(getScrapExperience(item)))
        collapseS = " mw-made-collapsible mw-collapsible"
+
    :done()
     elseif collapse == 2 then
+
    return xpCell
         collapseS = " mw-made-collapsible mw-collapsible mw-collapsed"
+
end
 +
 
 +
local function createAugBonusCell(item)
 +
    local augBonusCell = mw.html.create('td')
 +
     local augBonusS = ""
 +
     if item.equipmentStats.augmentationBonus then
 +
        local augBonusC = tablelength(item.equipmentStats.augmentationBonus)
 +
        for _, augBonus in ipairs(item.equipmentStats.augmentationBonus) do
 +
            augBonusS = augBonusS .. augmentationBonusNames[augBonus.stat] .. " +" .. augBonus.value
 +
            augBonusC = augBonusC - 1
 +
            if augBonusC > 0 then
 +
                augBonusS = augBonusS .. "<br>"
 +
            end
 +
        end
 +
     elseif not item.equipmentStats.augmentationBonus then
 +
         augBonusS = "-"
 
     end
 
     end
     local matchedAugs = {}
+
 
     for itemId, itemData in pairs(craftingAugmentingData) do
+
     augBonusCell
        if itemData.scrapping then
+
     :css('text-align', 'center')
            for costId, _ in pairsByKeys(itemData.scrapping) do
+
    :wikitext(augBonusS)
                if tonumber(costId) == itemI.id then
+
    :done()
                     matchedAugs[itemId] = itemData.scrapping
+
 
                 end
+
    return augBonusCell
 +
end
 +
 
 +
local function createCostCell(mItemData, item)
 +
    local costCell = mw.html.create('td')
 +
    local augCostC = tablelength(mItemData)
 +
    for costId, costQuantity in pairsByKeys(mItemData) do
 +
        local costItem = getItem(costId)
 +
        if tonumber(costId) == item.id then
 +
            costCell:tag('span'):css('display', 'inline-block')
 +
                :wikitext(tostring(costQuantity) .. " " .. img._img({costItem.name, '25'}))
 +
                :tag('span'):css('font-weight', 'bold')
 +
                     :wikitext(costItem.name)
 +
                :done()
 +
            :done()
 +
            augCostC = augCostC - 1
 +
            if augCostC > 0  then
 +
                costCell:tag('br')
 +
            end
 +
        else
 +
            costCell:tag('span'):css('display', 'inline-block')
 +
                :wikitext(tostring(costQuantity) .. " " .. img._img({costItem.name, '25', word = 1}))
 +
            :done()
 +
            augCostC = augCostC - 1
 +
            if augCostC > 0  then
 +
                 costCell:tag('br')
 
             end
 
             end
 
         end
 
         end
 
     end
 
     end
 +
    return costCell
 +
end
 +
 +
local function createDustCell(item)
 +
    local itemTier = getItemTier(item)
 +
    local dustCell = mw.html.create('td')
 +
    :wikitext(img._img({getItemDust(itemTier), '25', word = 1}))
 +
    :done()
 +
    return dustCell
 +
end
 +
 +
local function createScrapCell(item)
 +
    local scrapCell = mw.html.create('td')
 +
    :wikitext(img._img({item.rarity .. " Gear Scraps", '25', word = 1}))
 +
    :done()
 +
    return scrapCell
 +
end
 +
 +
local function genTable(name, collapse)
 +
    local item = getItem(findId._findId({name, "item"}))
 +
    local matchedAugs = getMatchedAugs(item.id)
 
     local t = mw.html.create("table")
 
     local t = mw.html.create("table")
         t:addClass("wikitable sortable jquery-tablesorter" .. collapseS)
+
         :addClass("wikitable sortable jquery-tablesorter" .. collapse)
 
         :tag('tr')
 
         :tag('tr')
 
             :tag('th')
 
             :tag('th')
 
                 :attr("colspan", "2")
 
                 :attr("colspan", "2")
 
                 :wikitext("Item")
 
                 :wikitext("Item")
 +
            :done()
 +
            :tag('th')
 +
                :wikitext("XP")
 +
            :done()
 +
            :tag('th')
 +
                :wikitext("Dust")
 +
            :done()
 +
            :tag('th')
 +
                :wikitext("Scrap")
 
             :done()
 
             :done()
 
             :tag("th")
 
             :tag("th")
                 :wikitext("Aug. Bonus.")
+
                 :wikitext("Aug. Bonus")
 
             :done()
 
             :done()
 
             :tag("th")
 
             :tag("th")
                 :wikitext("Materials")
+
                 :wikitext("Cost")
 
             :done()
 
             :done()
 
         :done()
 
         :done()
     for itemId, itemData in pairs(matchedAugs) do
+
     for mItemId, mItemData in pairs(matchedAugs) do
         local item = getItem(itemId)
+
         local mItem = getItem(mItemId)
         local dTr = t:tag('tr')
+
         t:tag('tr')
             :tag('td')
+
             :node(createImgCell(mItem))
                :wikitext(img._img({item.name, '40'}))
+
            :node(createNameCell(mItem))
             :done()
+
             :node(createXpCell(mItem))
             :tag('td')
+
             :node(createDustCell(mItem))
                :wikitext("[[" .. item.name .. "]]")
+
             :node(createScrapCell(mItem))
             :done()
+
             :node(createAugBonusCell(mItem))
        local augBonusS = ""
+
             :node(createCostCell(mItemData, item))
        if item.equipmentStats.augmentationBonus then
 
            local augBonusC = tablelength(item.equipmentStats.augmentationBonus)
 
            for _, augBonus in ipairs(item.equipmentStats.augmentationBonus) do
 
                augBonusS = augBonusS .. augmentationBonusNames[augBonus.stat] .. " +" .. augBonus.value
 
                augBonusC = augBonusC - 1
 
                if augBonusC > 0 then
 
                    augBonusS = augBonusS .. "<br>"
 
                end
 
             end
 
        elseif not item.equipmentStats.augmentationBonus then
 
            augBonusS = "-"
 
        end
 
        dTr:tag('td')
 
             :css('text-align', 'center')
 
            :wikitext(augBonusS)
 
 
         :done()
 
         :done()
        local costCell = dTr:tag('td')
 
        local augCostC = tablelength(itemData)
 
        for costId, costQuantity in pairs(itemData) do
 
            local costItem = getItem(costId)
 
            if tonumber(costId) == itemI.id then
 
                costCell:tag('span'):css('display', 'inline-block')
 
                    :wikitext(tostring(costQuantity) .. " " .. img._img({costItem.name, '20'}))
 
                    :tag('span'):css('font-weight', 'bold')
 
                        :wikitext(costItem.name)
 
                    :done()
 
                :done()
 
                augCostC = augCostC - 1
 
                if augCostC > 0  then
 
                    costCell:tag('br')
 
                end
 
            else
 
                costCell:tag('span'):css('display', 'inline-block')
 
                    :wikitext(tostring(costQuantity) .. " " .. img._img({costItem.name, '20', word = 1}))
 
                :done()
 
            augCostC = augCostC - 1
 
            if augCostC > 0  then
 
                costCell:tag('br')
 
            end
 
            end
 
        end
 
        dTr:done()
 
 
     end
 
     end
 
     return t
 
     return t
Line 185: Line 307:
 
end
 
end
  
function p._craftingUses(_args)
+
function p._augmentingUses(_args)
 
     local name = ""
 
     local name = ""
 
     if tablelength(_args) == 0 then
 
     if tablelength(_args) == 0 then
 
         name = pageName
 
         name = pageName
 +
    elseif _args["collapse"] and not _args[1] then
 +
        name = pageName
 +
    elseif _args["collapse"] and _args[1] then
 +
        name = _args[1]
 
     else
 
     else
 
         name = _args[1]
 
         name = _args[1]
 
     end
 
     end
     local collapse = 0
+
     local t = genTable(name, decideCollapseState(_args["collapse"]))
    if _args["collapse"] == "collapseable" then
 
        collapse = 1
 
    elseif _args["collapse"] == "collapsed" then
 
        collapse =2
 
    end
 
    local t = genTable(name, collapse)
 
 
 
 
     return t
 
     return t
 
end
 
end
 
return p
 
return p

Latest revision as of 15:55, 3 July 2024


local p = {}
local findId = require("Module:FindId")
local img = require("Module:Img")
local craftingAugmentingData = mw.loadData("Module:CraftingAugmenting/data")
local itemsData = mw.loadData("Module:Items/data")
local pageName = mw.title.getCurrentTitle().fullText
local scrappingBaseXp = 20
local scrappingXpPower = 2


local augmentationBonusNames ={
    ["toolBoost.mining"] = "[[Mining]]",
    ["toolBoost.foraging"] = "[[Foraging]]",
    ["offensiveAccuracyAffinityRating.Ice"] = "[[Combat#Offensive Stats|Ice Accuracy]]",
    ["offensiveAccuracyAffinityRating.Nature"] = "[[Combat#Offensive Stats|Nature Accuracy]]",
    ["offensiveAccuracyAffinityRating.Fire"] = "[[Combat#Offensive Stats|Fire Accuracy]]",
    ["offensiveAccuracyAffinityRating.Lightning"] = "[[Combat#Offensive Stats|Lightning Accuracy]]",
    ["offensiveAccuracyAffinityRating.Magic"] = "[[Combat#Offensive Stats|Magic Accuracy]]",
    ["toolBoost.farming"] = "[[Farming]]",
    ["toolBoost.smithing"] = "[[Smithing]]",
    ["toolBoost.runecrafting"] = "[[Runecrafting]]",
    ["toolBoost.cooking"] = "[[Cooking]]",
    ["toolBoost.enchanting"] = "[[Enchanting]]",
    ["toolBoost.fishing"] = "[[Mishing]]",
    ["toolBoost.fishingBaitPower"] = "Bait",
    ["toolBoost.fishingRarityPower"] = "Bonus Rarity",
    ["toolBoost.fishingReelPower"] = "Reel",
    ["offensiveAccuracyAffinityRating.Chaos"] = [[Combat#Offensive Stats|Choas Accuracy]],
    ["weaponBonus.strength"] = "[[Combat#Offensive Stats|Strength]]",
    ["weaponBonus.intellect"] = "[[Combat#Offensive Stats|Intellect]]",
    ["weaponBonus.dexterity"] = "[[Combat#Offensive Stats|Dexterity]]",
    ["offensiveAccuracyAffinityRating.Melee"] = "[[Combat#Offensive Stats|Melee Accuracy]]",
    ["offensiveCritical.chance"] = "[[Combat#Offensive Stats|Crit Chance]]",
    ["offensiveCritical.damageMultiplier"] = "[[Combat#Offensive Stats|Crit Mult]]",
    ["armorBonus.agility"] = "[[Combat#Defensive Stats|Agility]]",
    ["armorBonus.protection"] = "[[Combat#Defensive Stats|Protection]]",
    ["armorBonus.stamina"] = "[[Combat#Defensive Stats|Stamina]]",
    ["armorBonus.resistance"] = "[[Combat#Defensive Stats|Resistance]]",
    ["offensiveAccuracyAffinityRating.Range"] = "[[Combat#Offensive Stats|Range Accuracy]]",
    ["offensiveAccuracyAffinityRating.Blunt"] = "[[Combat#Offensive Stats|Blunt Accuracy]]",
}

local tierToDust = {
    [1] = "basic",
    [2] = "basic",
    [3] = "unusual",
    [4] = "singular",
    [5] = "prime",
    [6] = "mythical",
    [7] = "mythical",
    [7.5] = "mythical"
}

local function pairsByKeys(t, f)
    local a = {}
    local orgi_key_type
    local orgi_key_numbered
    for n in pairs(t) do
        if tonumber(n) == nil then
            table.insert(a, n)
            orgi_key_type = "word"
        elseif type(n) == "number" then
            table.insert(a, n)
            orgi_key_type = "int"
        elseif type(n) == "string" and type(tonumber(n) == "number") then
            orgi_key_type = "number"
            table.insert(a, tonumber(n))
        end
    end
    table.sort(a, f)
    local key
    local value
    local i = 0             -- iterator variable
    local iter = function() -- iterator function
        i = i + 1
        if a[i] == nil then
            return nil
        elseif orgi_key_type == "word" or orgi_key_type == "int" then
            key = a[i]
            value = t[a[i]]
        elseif orgi_key_type == "number" then
            key = tostring(a[i])
            value = t[tostring(a[i])]
        end
        return key, value
    end
    return iter
end

local function tablelength(T)
    local count = 0
    for _ in pairs(T) do count = count + 1 end
    return count
end

local function getItemTier(itemData)
    local highestRequiredLevel
    if itemData.requiredLevel then
        -- Highest level of the required skills
        highestRequiredLevel = 0
        for _, level in pairs(itemData.requiredLevel) do
            if level > highestRequiredLevel then
                highestRequiredLevel = level
            end
        end
        highestRequiredLevel = tonumber(string.format("%.1f", highestRequiredLevel / 10))
    end
    local itemTier = itemData.overrideItemTier or highestRequiredLevel or itemData.enchantmentTier or 1
    return itemTier
end

local function getScrapExperience(itemData)
    local item_tier = getItemTier(itemData)
    local xp = scrappingBaseXp * (item_tier ^ scrappingXpPower)
    return math.floor(xp)
end

---fetches an item object
---@param itemId integer|string or string
---@return table|string
local function getItem(itemId)
    local item = itemsData[tostring(itemId)]
    if item then
        return item
    else
        return "Module:Items/data out of date"
    end
end
---gets the augments that have the itemId in thier augmenting cost and returns an array of them
---@param itemId number
---@return table
local function getMatchedAugs(itemId)
    local matchedAugs = {}
    for id, data in pairs(craftingAugmentingData) do
        if data.scrapping then
            for costId, _ in pairsByKeys(data.scrapping) do
                if tonumber(costId) == itemId then
                    matchedAugs[id] = data.scrapping
                end
            end
        end
    end
    return matchedAugs
end
---decides the collase state based on the given string
---@param collapse string
---@return string
local function decideCollapseState(collapse)
    if collapse == "collapsible" then
        collapse = " mw-made-collapsible mw-collapsible"
    elseif collapse == "collapsed" then
        collapse = " mw-made-collapsible mw-collapsible mw-collapsed"
    else
        collapse = ""
    end
    return collapse
end

local function getItemDust(tier)
    tier = math.floor(tier)
    if tier <= 2 then
        return "Basic Runic Dust"
    elseif tier <= 3 then
        return "Unusual Runic Dust"
    elseif tier <= 4 then
        return "Singular Runic Dust"
    elseif tier <= 5 then
        return "Prime Runic Dust"
    elseif tier > 5 then
        return "Mythical Runic Dust"
    end
end

local function createImgCell(item)
    local imgCell = mw.html.create('td')
    :wikitext(img._img({item.name, '50'}))
    :done()
    return imgCell
end

local function createNameCell(item)
    local nameCell = mw.html.create('td')
    :wikitext("[[" .. item.name .. "]]")
    :done()
    return nameCell
end

local function createXpCell(item)
    local xpCell = mw.html.create('td')
    :css('text-align', 'center')
    :wikitext(tostring(getScrapExperience(item)))
    :done()
    return xpCell
end

local function createAugBonusCell(item)
    local augBonusCell = mw.html.create('td')
    local augBonusS = ""
    if item.equipmentStats.augmentationBonus then
        local augBonusC = tablelength(item.equipmentStats.augmentationBonus)
        for _, augBonus in ipairs(item.equipmentStats.augmentationBonus) do
            augBonusS = augBonusS .. augmentationBonusNames[augBonus.stat] .. " +" .. augBonus.value
            augBonusC = augBonusC - 1
            if augBonusC > 0 then
                augBonusS = augBonusS .. "<br>"
            end
        end
    elseif not item.equipmentStats.augmentationBonus then
        augBonusS = "-"
    end

    augBonusCell
    :css('text-align', 'center')
    :wikitext(augBonusS)
    :done()

    return augBonusCell
end

local function createCostCell(mItemData, item)
    local costCell = mw.html.create('td')
    local augCostC = tablelength(mItemData)
    for costId, costQuantity in pairsByKeys(mItemData) do
        local costItem = getItem(costId)
        if tonumber(costId) == item.id then
            costCell:tag('span'):css('display', 'inline-block')
                :wikitext(tostring(costQuantity) .. " " .. img._img({costItem.name, '25'}))
                :tag('span'):css('font-weight', 'bold')
                    :wikitext(costItem.name)
                :done()
            :done()
            augCostC = augCostC - 1
            if augCostC > 0  then
                costCell:tag('br')
            end
        else
            costCell:tag('span'):css('display', 'inline-block')
                :wikitext(tostring(costQuantity) .. " " .. img._img({costItem.name, '25', word = 1}))
            :done()
            augCostC = augCostC - 1
            if augCostC > 0  then
                costCell:tag('br')
            end
        end
    end
    return costCell
end

local function createDustCell(item)
    local itemTier = getItemTier(item)
    local dustCell = mw.html.create('td')
    :wikitext(img._img({getItemDust(itemTier), '25', word = 1}))
    :done()
    return dustCell
end

local function createScrapCell(item)
    local scrapCell = mw.html.create('td')
    :wikitext(img._img({item.rarity .. " Gear Scraps", '25', word = 1}))
    :done()
    return scrapCell
end

local function genTable(name, collapse)
    local item = getItem(findId._findId({name, "item"}))
    local matchedAugs = getMatchedAugs(item.id)
    local t = mw.html.create("table")
        :addClass("wikitable sortable jquery-tablesorter" .. collapse)
        :tag('tr')
            :tag('th')
                :attr("colspan", "2")
                :wikitext("Item")
            :done()
            :tag('th')
                :wikitext("XP")
            :done()
            :tag('th')
                :wikitext("Dust")
            :done()
            :tag('th')
                :wikitext("Scrap")
            :done()
            :tag("th")
                :wikitext("Aug. Bonus")
            :done()
            :tag("th")
                :wikitext("Cost")
            :done()
        :done()
    for mItemId, mItemData in pairs(matchedAugs) do
        local mItem = getItem(mItemId)
        t:tag('tr')
            :node(createImgCell(mItem))
            :node(createNameCell(mItem))
            :node(createXpCell(mItem))
            :node(createDustCell(mItem))
            :node(createScrapCell(mItem))
            :node(createAugBonusCell(mItem))
            :node(createCostCell(mItemData, item))
        :done()
    end
    return t
end

function p.augmentingUses(frame)
    return p._augmentingUses(frame:getParent().args)
end

function p._augmentingUses(_args)
    local name = ""
    if tablelength(_args) == 0 then
        name = pageName
    elseif _args["collapse"] and not _args[1] then
        name = pageName
    elseif _args["collapse"] and _args[1] then
        name = _args[1]
    else
        name = _args[1]
    end
    local t = genTable(name, decideCollapseState(_args["collapse"]))
    return t
end
return p