Module:Sandbox/User:Alsang: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
No edit summary |
No edit summary |
||
(42 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
p = {} |
|||
require('strict') |
|||
require('Module:Mw.html extension') |
|||
local editbutton = require('Module:Edit button') |
|||
local edit = editbutton("'''?''' (edit)") |
|||
local hc = require('Module:Param Parse').has_content |
|||
local yn = require('Module:Yesno') |
|||
local qty = require('Module:Quantity box')._main |
|||
local pcp = require('Module:Profession clickpic')._main |
|||
local currency = require('Module:Currency') |
|||
local album_xp_data = mw.loadData('Module:Experience/data').album |
|||
local lang = mw.language.getContentLanguage() |
|||
local tooltip = require('Module:Tooltip') |
|||
p.query = '[[Category:Guardian Equipment]] AND [[Variant type::~*]] AND [[Category:Armorer]]|?#-=name|limit=500' |
|||
local p = {} |
|||
function p.main( |
function p.main() |
||
local args = frame:getParent().args |
|||
local albumxp = album_xp_data[tonumber(args.level)] |
|||
local results = mw.smw.ask(p.query) |
|||
if albumxp then |
|||
albumxp = lang:formatNum(albumxp)..' xp' |
|||
end |
|||
local out = mw.html.create('table') |
|||
--Checks if the recipe has been flagged as passive, defaults to no. |
|||
:addClass('wikitable sortable') |
|||
local passive = yn(args.passive or 'no', false) |
|||
for _,page in ipairs(results) do |
|||
local quant = 1 |
|||
out:tag('tr') |
|||
if passive then |
|||
:tag('th') |
|||
quant = 0.005 |
|||
:wikitext('[[' .. page.name .. ']]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[[' .. page.name .. ' (basic)]]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[[' .. page.name .. ' (moderate)]]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[[' .. page.name .. ' (fine)]]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[[' .. page.name .. ' (strong)]]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[[' .. page.name .. ' (superior)]]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[[' .. page.name .. ' (perfect)]]') |
|||
:done() |
|||
:done() |
|||
end |
end |
||
return out |
|||
local function exparg(xp) |
|||
if hc(xp) then |
|||
return qty(xp) |
|||
else |
|||
return qty(0)..edit..'[[Category:Needs experience info]]' |
|||
end |
|||
end |
|||
end |
|||
local function levelarg(profession, level) |
|||
if hc(profession) and hc(level) then |
|||
function p.main2() |
|||
return pcp(profession, level) |
|||
else |
|||
return edit..'[[Category:Needs level info]]' |
|||
end |
|||
end |
|||
local |
local results = mw.smw.ask(p.query) |
||
if hc(duration) then |
|||
return duration..' seconds' |
|||
else |
|||
return edit..'[[Category:Needs duration info]]' |
|||
end |
|||
end |
|||
local smw_properties = { |
|||
['Skill node name'] = args.name, |
|||
['Uses profession'] = args.profession, |
|||
['Profession level'] = args.level, |
|||
['Activity XP'] = args.xp, |
|||
['Activity album XP'] = album_xp_data[tonumber(args.level)], |
|||
['Activity KP'] = args.kp, |
|||
['Activity duration'] = args.duration, |
|||
['Activity coins'] = args.coins, |
|||
['Activity input'] = args.input, |
|||
['Activity container'] = args.container, |
|||
-- straight copy from Infobox Recipe, its good to have a standard format |
|||
['Activity JSON'] = mw.text.jsonEncode({test = true}) |
|||
} |
|||
mw.smw.set(smw_properties) |
|||
local out = mw.html.create('table') |
local out = mw.html.create('table') |
||
:addClass('wikitable') |
:addClass('wikitable sortable') |
||
for _,page in ipairs(results) do |
|||
:tag('tr') |
|||
out:tag('tr') |
|||
:tag('th') |
:tag('th') |
||
:attr{ |
:attr{ rowspan = '2' } |
||
:wikitext( |
:wikitext('[[' .. page.name .. ']]') |
||
:done() |
:done() |
||
: |
:tag('td') |
||
:wikitext('[[File:' .. page.name .. ' (basic).png]]') |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Level required') |
|||
:done() |
:done() |
||
:tag('td') |
:tag('td') |
||
:wikitext( |
:wikitext('[[File:' .. page.name .. ' (moderate).png]]') |
||
:done() |
:done() |
||
: |
:tag('td') |
||
:wikitext('[[File:' .. page.name .. ' (fine).png]]') |
|||
:tag('tr') |
|||
:tag('th') |
|||
:IF(passive) |
|||
:wikitext('[[File:Passive small icon.png|20x20px|link=Passive Activity]] [['..args.profession..'|'..args.profession..' XP]] ') |
|||
:node(tooltip._span{ 'passive' }) |
|||
:node(tooltip._div{ name = 'passive', content = 'Passive activities give reduced experience when a players level is high enough to perform a new passive activity for that profession. The number shown here is the full experience.' }) |
|||
:ELSE() |
|||
:wikitext('[['..args.profession..'|'..args.profession..' XP]]') |
|||
:END() |
|||
:done() |
:done() |
||
:tag('td') |
:tag('td') |
||
:wikitext( |
:wikitext('[[File:' .. page.name .. ' (strong).png]]') |
||
:done() |
:done() |
||
: |
:tag('td') |
||
:wikitext('[[File:' .. page.name .. ' (superior).png]]') |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('[[Album|Album XP]]') |
|||
:done() |
:done() |
||
:tag('td') |
:tag('td') |
||
:wikitext( |
:wikitext('[[File:' .. page.name .. ' (perfect).png]]') |
||
:done() |
:done() |
||
:done() |
:done() |
||
:tag('tr') |
:tag('tr') |
||
:tag(' |
:tag('td') |
||
:wikitext(' |
:wikitext('[[File:' .. page.name .. ' (basic) dye.png]]') |
||
:done() |
:done() |
||
:tag('td') |
:tag('td') |
||
:wikitext( |
:wikitext('[[File:' .. page.name .. ' (moderate) dye.png]]') |
||
:done() |
:done() |
||
: |
:tag('td') |
||
:wikitext('[[File:' .. page.name .. ' (fine) dye.png]]') |
|||
if hc(args.respawn) then |
|||
out |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Respawn time') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(durationarg(args.respawn)) |
|||
:done() |
|||
:done() |
:done() |
||
:tag('td') |
|||
end |
|||
:wikitext('[[File:' .. page.name .. ' (strong) dye.png]]') |
|||
if hc(args.tool) then |
|||
out |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Required tool') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(args.tool) |
|||
:done() |
|||
:done() |
:done() |
||
:tag('td') |
|||
end |
|||
:wikitext('[[File:' .. page.name .. ' (superior) dye.png]]') |
|||
if hc(args.input) then |
|||
out |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Required input') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(args.input) |
|||
:done() |
|||
:done() |
:done() |
||
:tag('td') |
|||
end |
|||
:wikitext('[[File:' .. page.name .. ' (perfect) dye.png]]') |
|||
if hc(args.container) then |
|||
out |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Required container') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(args.container) |
|||
:done() |
|||
:done() |
|||
end |
|||
if hc(args.coins) then |
|||
out |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Coins') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(currency.parse(args.coins)) |
|||
:done() |
|||
:done() |
:done() |
||
:done() |
|||
end |
end |
||
return out |
return out |
||
end |
end |
||
return p |
return p |
Revision as of 20:30, 1 January 2025
Module documentation
This documentation is transcluded from Module:Sandbox/User:Alsang/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Sandbox/User:Alsang/doc. [edit]
Module:Sandbox/User:Alsang's function main is invoked by Template:Sandbox/User:Alsang.
p = {}
p.query = '[[Category:Guardian Equipment]] AND [[Variant type::~*]] AND [[Category:Armorer]]|?#-=name|limit=500'
function p.main()
local results = mw.smw.ask(p.query)
local out = mw.html.create('table')
:addClass('wikitable sortable')
for _,page in ipairs(results) do
out:tag('tr')
:tag('th')
:wikitext('[[' .. page.name .. ']]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (basic)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (moderate)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (fine)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (strong)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (superior)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (perfect)]]')
:done()
:done()
end
return out
end
function p.main2()
local results = mw.smw.ask(p.query)
local out = mw.html.create('table')
:addClass('wikitable sortable')
for _,page in ipairs(results) do
out:tag('tr')
:tag('th')
:attr{ rowspan = '2' }
:wikitext('[[' .. page.name .. ']]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (basic).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (moderate).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (fine).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (strong).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (superior).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (perfect).png]]')
:done()
:done()
:tag('tr')
:tag('td')
:wikitext('[[File:' .. page.name .. ' (basic) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (moderate) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (fine) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (strong) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (superior) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (perfect) dye.png]]')
:done()
:done()
end
return out
end
return p