Module:AlchemistList: Difference between revisions
m
Alsang moved page Module:PotionList to Module:AlchemistList without leaving a redirect: match the naming convention of the other "List" modules
m (currency_cell now returns a node) |
m (Alsang moved page Module:PotionList to Module:AlchemistList without leaving a redirect: match the naming convention of the other "List" modules) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1:
require('strict')
require('Module:Mw.html extension')
local search = require('Module:RecipeTreeSearch')
local param = require( 'Module:Paramtest' )
local currency = require('Module:Currency')
Line 9 ⟶ 10:
-- non dynamic module, no inputs
function p.main()
-- returns
-- other parameters are determined by subqueries of chained pages
local query = {
'[[Uses facility::Standard Potion Station||Potent Potion Station]]',
'?Profession Level A = lvl',
'? #- = name',
'?
'?Value = sell',
'
'limit = 500'
▲ '?Activity KP = brewKP',
▲ '?Activity duration = brewDuration',
}
local results = mw.smw.ask(query)
Line 30 ⟶ 28:
return p.displayTable(results)
--for debugging
--return '<pre>'..mw.text.jsonEncode(results, mw.text.JSON_PRETTY)..'</pre>'
end
Line 50 ⟶ 51:
function p.formatResults(results)
-- iterate through
for _, item in ipairs(results) do
-- New module for recipe searching
local fullRecipe = search.main(item.name)
item.outputQuantity = fullRecipe.output[1].quantity
item.XP = fullRecipe.xp
item.duration = fullRecipe.duration
▲ item.buy = 20
-- direct values
item.
item.profit = item.sell and item.buy and item.sell - item.buy
▲ item.XP = item.brewXP and item.prepXP and item.brewXP + item.prepXP
item.profitPerXP = item.profit and item.XP and math.floor(item.profit / item.XP * 100) / 100
Line 84 ⟶ 70:
local batchSize = 12
local downtime = 40
item.duration = item.
item.
-- properties per hour
item.XPPerHour = item.XP and item.
item.
end
Line 105 ⟶ 90:
:done()
:tag('th')
:
:wikitext('Product')
:done()
:tag('th')
:wikitext('
:done()
:tag('th')
Line 155 ⟶ 141:
:tag('td')
:css{ ['border-right'] = '0', ['padding-right'] = '0', ['text-align'] = 'right' }
:wikitext('[[File:' .. item.name .. '.png|30px|link=' .. item.name .. ']] [[' .. item.name .. ']]')▼
:attr{ ['data-sort-value'] = item.name }
:wikitext(item.outputQuantity .. ' ×')
:done()
:tag('td')
:addClass('plinkt-image no-border')
:css{ ['border-left'] = '0', ['padding-left'] = '0' }
▲ :wikitext('[[File:' .. item.name .. '.png
:done()
:tag('td')
:addClass('plinkt-link no-border')
:wikitext('[[' .. item.name .. ']]')
:done()
local
for
end
row
:node(currency_cell(item.buy))
|