Module:WoodcutterPassiveList: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(based on MinerPassiveList) |
(all done apart from sorting it properly) |
||
Line 13: | Line 13: | ||
-- other parameters are determined by subqueries of chained pages |
-- other parameters are determined by subqueries of chained pages |
||
local query = { |
local query = { |
||
'[[Variant of::~*Tree]]', |
'[[Variant of::~*Tree||~Split Wood for*]]', |
||
'?Profession Level B = lvl', |
'?Profession Level B = lvl', |
||
'? #- = name', |
'? #- = name', |
||
'?Image #- = Image', |
'?Image #- = Image', |
||
⚫ | |||
'?Activity duration = duration', |
|||
'?Skill node name = product', |
|||
'?Activity JSON = activityJSON', |
'?Activity JSON = activityJSON', |
||
⚫ | |||
'sort = Profession Level B', |
-- 'sort = Profession Level B', |
||
'limit = 500' |
'limit = 500' |
||
} |
} |
||
Line 57: | Line 55: | ||
-- iterate through products |
-- iterate through products |
||
for _, item in ipairs(results) do |
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 |
for j,json in ipairs(item.activityJSON) do |
||
if string.find(json,'Branches') then |
if string.find(json,'Branches') or string.find(json,'Split') then |
||
local activityJSON = mw.text.jsonDecode(json) |
local activityJSON = mw.text.jsonDecode(json) |
||
item.XP = activityJSON.xp |
item.XP = activityJSON.xp |
||
item.lvl = activityJSON.level |
|||
item.duration = activityJSON.duration and tonumber(activityJSON.duration) |
item.duration = activityJSON.duration and tonumber(activityJSON.duration) |
||
item.product = activityJSON.output[1].name |
item.product = activityJSON.output[1].name |
||
Line 81: | Line 86: | ||
-- iterate through products |
-- iterate through products |
||
for _, item in ipairs(results) do |
for _, item in ipairs(results) do |
||
item.givesCoins = string.find(item.product,'Split') |
|||
-- profit from selling the items |
-- profit from selling the items |
||
Line 121: | Line 128: | ||
:tag('th') |
:tag('th') |
||
:attr{ colspan = '2' } |
:attr{ colspan = '2' } |
||
:wikitext(' |
:wikitext('Woodcutter node') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
Line 173: | Line 180: | ||
-- products (coins or items) |
-- products (coins or items) |
||
: |
:IF(item.givesCoins) |
||
:IF(item.coins) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
:css{ ['border-right'] = '0', ['text-align'] = 'right' } |
|||
⚫ | |||
⚫ | |||
⚫ | |||
:attr{ ['data-sort-value'] = item.product } |
|||
⚫ | |||
:wikitext(item.coins) |
|||
⚫ | |||
:done() |
|||
⚫ | |||
:ELSE() |
|||
⚫ | |||
:node(unknown_value_cell) |
|||
⚫ | |||
: |
:END() |
||
: |
:tag('td') |
||
⚫ | |||
⚫ | |||
:addClass('plinkt-link no-border') |
|||
⚫ | |||
:wikitext('[[File:Copper coin.png|20x20px]]') |
|||
⚫ | |||
:tag('td') |
|||
:addClass('plinkt-link no-border') |
|||
:wikitext('Coins') |
|||
⚫ | |||
:ELSE() |
|||
:tag('td') |
|||
⚫ | |||
:addClass('plinkt-link no-border') |
|||
⚫ | |||
⚫ | |||
⚫ | |||
:tag('td') |
|||
⚫ | |||
:addClass('plinkt-link no-border') |
|||
⚫ | |||
:done() |
|||
:tag('td') |
|||
:addClass('plinkt-link no-border') |
|||
⚫ | |||
:done() |
|||
:END() |
|||
-- products per hour (items) |
-- products per hour (items) |
||
: |
:IF(item.givesCoins) |
||
:tag('td') |
|||
⚫ | |||
:addClass('table-na') |
|||
⚫ | |||
: |
:wikitext('N/A') |
||
:done() |
|||
:ELSE() |
|||
:tag('td') |
|||
:css{ ['text-align'] = 'right' } |
|||
⚫ | |||
:done() |
|||
:END() |
|||
-- profit per hour (coins) |
-- profit per hour (coins) |