Module:WoodcutterPassiveList: Difference between revisions

all done apart from sorting it properly
(based on MinerPassiveList)
 
(all done apart from sorting it properly)
Line 13:
-- other parameters are determined by subqueries of chained pages
local query = {
'[[Variant of::~*Tree||~Split Wood for*]]',
'?Profession Level B = lvl',
'? #- = name',
'?Image #- = Image',
'?Activity XP = XP',
'?Activity duration = duration',
'?Skill node name = product',
'?Activity JSON = activityJSON',
'?Activity XPcoins = XPcoins',
-- 'sort = Profession Level B',
'limit = 500'
}
Line 57 ⟶ 55:
-- iterate through products
for _, item in ipairs(results) do
-- if theres only one activity, wrap in table
if type(item.activityJSON)=='string' then
item.activityJSON = { item.activityJSON }
end
for j,json in ipairs(item.activityJSON) do
if string.find(json,'Branches') or string.find(json,'Split') then
local activityJSON = mw.text.jsonDecode(json)
item.XP = activityJSON.xp
item.lvl = activityJSON.level
item.duration = activityJSON.duration and tonumber(activityJSON.duration)
item.product = activityJSON.output[1].name
Line 81 ⟶ 86:
-- iterate through products
for _, item in ipairs(results) do
item.givesCoins = string.find(item.product,'Split')
 
-- profit from selling the items
Line 121 ⟶ 128:
:tag('th')
:attr{ colspan = '2' }
:wikitext('TreeWoodcutter node')
:done()
:tag('th')
Line 173 ⟶ 180:
-- products (coins or items)
:tagIF('td'item.givesCoins)
:IF(item.coins)
:css{ ['border-right'] = '0', ['text-align'] = 'right' }
:tag('td')
:attr{ ['data-sort-value'] = item.product }
:css{ ['border-right'] = '0', ['text-align'] = 'right' }
:wikitext('0.005 × ')
:addClass('plinkt-link no-border')
:done()
:attr{ ['data-sort-value'] = item.product }
:tag('td')
:wikitext(item.coins)
:css{ ['border-right'] = '0', ['text-align'] = 'center' }
:done()
:addClass('plinkt-link no-border')
:ELSE()
:wikitext('[[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
:node(unknown_value_cell)
:done()
:tagEND('td')
:addClasstag('plinkt-link no-bordertd')
:css{ ['border-right'] = '0', ['text-align'] = 'center' }
:wikitext('[[' .. item.product .. ']]')
:addClass('plinkt-link no-border')
:done()
:wikitext('[[File:Copper coin.png|20x20px]]')
:done()
:tag('td')
:addClass('plinkt-link no-border')
:wikitext('Coins')
:done()
:ELSE()
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'right' }
:addClass('plinkt-link no-border')
:attr{ ['data-sort-value'] = item.product }
:wikitext('0.005 × ')
:done()
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'rightcenter' }
:addClass('plinkt-link no-border')
:wikitext('[[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
:done()
:tag('td')
:addClass('plinkt-link no-border')
:wikitext('[[' .. item.product .. ']]')
:done()
:END()
-- products per hour (items)
:tagIF('td'item.givesCoins)
:tag('td')
:css{ ['text-align'] = 'right' }
:addClass('table-na')
:wikitext('0.9 × [[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
:donewikitext('N/A')
:done()
:ELSE()
:tag('td')
:css{ ['text-align'] = 'right' }
:wikitext('0.9 × [[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
:done()
:END()
-- profit per hour (coins)
10,165

edits