Editing Module:WoodcutterPassiveList

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

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 12: Line 12:
-- returns only directly needed parameter needed for the row,
-- returns only directly needed parameter needed for the row,
-- other parameters are determined by subqueries of chained pages
-- other parameters are determined by subqueries of chained pages
-- Woodcutter cannot sort by any parameter, as Branches use Profession B but Split Wood uses profession A
local query = {
local query = {
'[[Variant of::~*Tree||~Split Wood for*]]',
'[[Variant of::~*Tree]]',
'?Profession Level B = lvl',
'? #- = name',
'? #- = name',
'?Image #- = Image',
'?Image #- = Image',
'?Activity XP = XP',
'?Activity duration = duration',
'?Skill node name = product',
'?Activity JSON = activityJSON',
'?Activity JSON = activityJSON',
'sort = Profession Level B',
'?Activity coins = coins',
'limit = 500'
'limit = 500'
}
}
Line 54: Line 57:
-- 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') or string.find(json,'Split') then
if string.find(json,'Branches') 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 76: Line 72:
end
end
-- sort the results by recipe level
table.sort(resultsScreened, function(item1, item2)
local lvl1 = item1.lvl
local lvl2 = item2.lvl
if (lvl1 == nil) ~= (lvl2 == nil) then --one of two are empty
return lvl2 == nil -- true if lvl2 is nil but not lvl1, false if lvl1 is nil but not lvl2
end
if lvl1 == nil then
return false -- Both empty, equivalent
end
return lvl1 < lvl2 -- normal comparison
end)

return resultsScreened
return resultsScreened


Line 98: Line 81:
-- 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 140: Line 121:
:tag('th')
:tag('th')
:attr{ colspan = '2' }
:attr{ colspan = '2' }
:wikitext('Woodcutter node')
:wikitext('Tree')
:done()
:done()
:tag('th')
:tag('th')
Line 192: Line 173:
-- products (coins or items)
-- products (coins or items)
:IF(item.givesCoins)
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'right' }
:IF(item.coins)
:attr{ ['data-sort-value'] = item.product }
:tag('td')
:wikitext('0.005 &times; ')
:css{ ['border-right'] = '0', ['text-align'] = 'right' }
:done()
:addClass('plinkt-link no-border')
:tag('td')
:attr{ ['data-sort-value'] = item.product }
:css{ ['border-right'] = '0', ['text-align'] = 'center' }
:wikitext(item.coins)
:addClass('plinkt-link no-border')
:done()
:wikitext('[[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
:ELSE()
:done()
:node(unknown_value_cell)
:END()
:tag('td')
:tag('td')
:addClass('plinkt-link no-border')
:wikitext('[[' .. item.product .. ']]')
:css{ ['border-right'] = '0', ['text-align'] = 'center' }
:done()
:addClass('plinkt-link no-border')
: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 &times; ')
:done()
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'center' }
: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)
-- products per hour (items)
:IF(item.givesCoins)
:tag('td')
:css{ ['text-align'] = 'right' }
:tag('td')
:wikitext('0.9 &times; [[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
:addClass('table-na')
:wikitext('N/A')
:done()
:done()
:ELSE()
:tag('td')
:css{ ['text-align'] = 'right' }
:wikitext('0.9 &times; [[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
:done()
:END()
-- profit per hour (coins)
-- profit per hour (coins)
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see Brighter Shores:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template

This page is a member of a hidden category: