Editing Module:ProfessionList
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 37: | Line 37: | ||
-- use within :node() |
-- use within :node() |
||
function p.unknown_value_edit_cell(page,N) |
function p.unknown_value_edit_cell(page,N) |
||
⚫ | |||
if type(page) == 'string' then |
|||
page = {page} |
|||
end |
|||
local textstring = '' |
|||
for _,p in ipairs(page) do |
|||
⚫ | |||
local link = '['..url.." '''?''' (edit)]<br>" |
|||
textstring = textstring .. link |
|||
end |
|||
return mw.html.create('td') |
return mw.html.create('td') |
||
:addClass('table-bg-gray') |
:addClass('table-bg-gray') |
||
:css{ ['text-align'] = 'center' } |
:css{ ['text-align'] = 'center' } |
||
:attr{ colspan = tostring(N) } |
:attr{ colspan = tostring(N) } |
||
:wikitext( |
:wikitext('['..url.." '''?''' (edit)]") |
||
:done() |
:done() |
||
end |
end |
||
Line 156: | Line 148: | ||
local fullRecipe = search.main(item.product) |
local fullRecipe = search.main(item.product) |
||
-- overwrite any parameters from the original recipe with their counterparts from the full recipe |
-- overwrite any parameters from the original recipe with their counterparts from the full recipe |
||
-- |
-- when product is nil, no data is overwritten |
||
-- first need to nil the xp, kp, and duration, since if they are nil in the fullRecipe they must stay nil |
|||
item.xp = nil |
|||
item.kp = nil |
|||
item.duration = nil |
|||
for key,value in pairs(fullRecipe) do |
for key,value in pairs(fullRecipe) do |
||
item[key] = value |
item[key] = value |
||
Line 166: | Line 154: | ||
-- include the price of selling the product |
-- include the price of selling the product |
||
item.sellPrice = search.getShopSellPrice(item.product) |
|||
local qty = item.output[1].quantity |
|||
item.sellPrice = sell and qty and sell * qty |
|||
item.profit = item.buyPrice and item.sellPrice and item.sellPrice - item.buyPrice |
item.profit = item.buyPrice and item.sellPrice and item.sellPrice - item.buyPrice |
||
item.profitPerXP = item.profit and item.xp and item.profit / item.xp |
|||
end |
end |
||
return output |
return output |
||
end |
|||
function p.one_column_image_text(materials) |
|||
local materialCell = mw.html.create('td') |
|||
for _, mat in ipairs(materials) do |
|||
materialCell:wikitext(mat.quantity .. ' × [[File:' .. mat.name .. '.png|18px|link=' .. mat.name .. ']] [[' .. mat.name .. ']]<br>') |
|||
end |
|||
return materialCell |
|||
end |
end |
||
Line 215: | Line 187: | ||
:addClass('plinkt-image no-border') |
:addClass('plinkt-image no-border') |
||
:css{ ['border-left'] = '0', ['padding-left'] = '0' } |
:css{ ['border-left'] = '0', ['padding-left'] = '0' } |
||
:wikitext('[[' .. image .. '|link=' .. link .. '|30px]]') |
:wikitext('[[File:' .. image .. '.png|link=' .. link .. '|30px]]') |
||
:done() |
:done() |
||
:tag('td') |
:tag('td') |