Anonymous

Module:Items/SourceTables/Sandbox: Difference between revisions

From Melvor Idle
Revert: "Use Recipe icon for source icons when available"; Purchase outputs no longer show icon text when in a table; Add more fallbacks to display N/A when data is nil
(Added 1/x values to Chances; Use Recipe icon for source icons when available; Merge Shop and Upgrade sources into Creation Table; Changed 'Inputs' to 'Costs'; Add output quantity for upgraded items; Fix Ash requirements, apparently)
(Revert: "Use Recipe icon for source icons when available"; Purchase outputs no longer show icon text when in a table; Add more fallbacks to display N/A when data is nil)
Line 100: Line 100:
qty = recipe.baseQuantity or 1
qty = recipe.baseQuantity or 1
reqs = Icons._SkillReq(skill, lvl, false, (isAbyssal and 'melvorItA:Abyssal' or nil))
reqs = Icons._SkillReq(skill, lvl, false, (isAbyssal and 'melvorItA:Abyssal' or nil))
-- Source Icon
source = Icons.Icon({ skill, type='skill', class=(isAbyssal and 'abyss-icon' or nil) })
if recipe.name ~= nil then
source = Icons.Icon({ skill, img=recipe.name, type=dataProp.recipeType })
else
source = Icons.Icon({ skill, type='skill', class=(isAbyssal and 'abyss-icon' or nil) })
end
-- Action time
-- Action time
if recipe.baseMinInterval ~= nil then
if recipe.baseMinInterval ~= nil then
Line 442: Line 437:
if showSource then tableHeader:tag('th'):wikitext('Source') end
if showSource then tableHeader:tag('th'):wikitext('Source') end
if showRequirements then tableHeader:tag('th'):wikitext('Requires') end
if showRequirements then tableHeader:tag('th'):wikitext('Requires') end
if showInputs then tableHeader:tag('th'):wikitext('Inputs') end
if showInputs then tableHeader:tag('th'):wikitext('Costs') end
if showOutputs then tableHeader:tag('th'):wikitext('Outputs') end
if showOutputs then tableHeader:tag('th'):wikitext('Outputs') end
if showXP then tableHeader:tag('th'):wikitext('Exp') end
if showXP then tableHeader:tag('th'):wikitext('Exp') end
Line 453: Line 448:


if showSource then recipeRow:tag('td'):wikitext(data.source) end
if showSource then recipeRow:tag('td'):wikitext(data.source) end
if showRequirements then recipeRow:tag('td'):wikitext((data.reqs or 'None')) end
if showRequirements then
if data.reqs ~= nil then
recipeRow:tag('td'):wikitext(data.reqs)
else
recipeRow:tag('td'):wikitext('N/A'):addClass('table-na')
end
end


if showInputs and data.costs ~= nil then
if showInputs then
addCostsRow(recipeRow, data, 1)
if data.costs ~= nil then
elseif showInputs then
addCostsRow(recipeRow, data, 1)
recipeRow:tag('td'):wikitext('N/A'):addClass('table-na')
else
recipeRow:tag('td'):wikitext('N/A'):addClass('table-na')
end
end
end


Line 465: Line 468:
local outputData = recipeRow:tag('td'):wikitext(data.qty)
local outputData = recipeRow:tag('td'):wikitext(data.qty)
if data.center then outputData:addClass('center') end
if data.center then outputData:addClass('center') end
elseif data.qty ~= nil then
recipeRow:tag('td'):wikitext(Icons.Icon({ item.name, type='item', notext=true, qty=(data.qty or 1) })):addClass('center')
else
else
recipeRow:tag('td'):wikitext(Icons.Icon({ item.name, type='item', notext=true, qty=(data.qty or 1) })):addClass('center')
recipeRow:tag('td'):wikitext('N/A'):addClass('table-na')
end
end
if showXP then
if data.skill ~= nil and data.xp ~= nil then
local iconClass = (data.isAbyssal and 'abyss-icon' or nil)
local xpText = (data.isAbyssal and ' AXP' or ' XP')
recipeRow:tag('td')
:wikitext(Icons.Icon({ data.skill, notext=true, type='skill', class=iconClass }))
:wikitext(' ' .. Num.formatnum(data.xp) .. xpText)
else
recipeRow:tag('td'):wikitext('N/A'):addClass('table-na')
end
end
end
end
if showXP and data.skill ~= nil and data.xp ~= nil then
if showTime then
local iconClass = (data.isAbyssal and 'abyss-icon' or nil)
if data.time ~= nil then
local xpText = (data.isAbyssal and ' AXP' or ' XP')
recipeRow:tag('td'):wikitext(Shared.timeString(data.time, true)):addClass('center')
recipeRow:tag('td')
else
:wikitext(Icons.Icon({ data.skill, notext=true, type='skill', class=iconClass }))
recipeRow:tag('td'):wikitext('N/A'):addClass('table-na')
:wikitext(' ' .. Num.formatnum(data.xp) .. xpText)
end
end
end
if showTime and data.time ~= nil then recipeRow:tag('td'):wikitext(Shared.timeString(data.time, true)):addClass('center') end
if showChance then
if showChance then
if data.weight ~= nil then
if data.weight ~= nil then
Line 1,535: Line 1,550:
source = Shop._getPurchaseExpansionIcon(purchase) .. Common.getPurchaseIcon({purchase})
source = Shop._getPurchaseExpansionIcon(purchase) .. Common.getPurchaseIcon({purchase})
-- Always show icon text when there's multiple items
-- Always show icon text when there's multiple items
notext = false
-- notext = false
else
else
source = Icons.Icon({'Shop'}) .. ' Purchase'
source = Icons.Icon({'Shop'}) .. ' Purchase'
Line 1,541: Line 1,556:


table.insert(tableData, {
table.insert(tableData, {
['reqs'] = Common.getRequirementString(purchase.purchaseRequirements, 'None'),
['reqs'] = Common.getRequirementString(purchase.purchaseRequirements),
['isAbyssal'] = namespace == 'melvorItA',
['isAbyssal'] = namespace == 'melvorItA',
['costs'] = Shop.getCostString(purchase.cost, false),
['costs'] = Shop.getCostString(purchase.cost, false),
Line 1,726: Line 1,741:
"Arrow Shafts",
"Arrow Shafts",
-- "Yew Longbow",
-- "Yew Longbow",
-- "Water Rune",
"Blood Rune",
"Steam Rune",
"Steam Rune",
-- "Wolf",
-- "Wolf",
Line 1,754: Line 1,769:
"Ancient Ring of Mastery",
"Ancient Ring of Mastery",
"Mastery Token (Cooking)",
"Mastery Token (Cooking)",
"Gem Gloves",
"Magic Bones",
"Bowstring",
"Superior Max Skillcape",
"Thief's Moneysack",
"Thief's Moneysack",
"Golden Star",
"Golden Star",
Line 1,770: Line 1,781:
"Gloom Vein Seed",
"Gloom Vein Seed",
"Elite Chest",
"Elite Chest",
"Gem Gloves",
"Magic Bones",
"Bowstring",
"Superior Max Skillcape",
"Abyssal Coin Contract II",
"Abyssal Coin Contract II",
"Dark Summon Consumable II",
"Dark Summon Consumable II",
"Abyssal Slayer Gear Upgrade Kit",
"Topaz Bolts (Enchanted)",
"Summoning Shard (Black)",
"Dragon Javelin",
"Skillers Body",
}
}
local checkFuncs = {
local checkFuncs = {