Editing Module:Sandbox/User:Alsang

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 1: Line 1:
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')

local p = {}
local p = {}


function p.main()
function p.main(frame)
local args = frame:getParent().args
local albumxp = album_xp_data[tonumber(args.level)]


if albumxp then
return
albumxp = lang:formatNum(albumxp)..' xp'
end
--Checks if the recipe has been flagged as passive, defaults to no.
local passive = yn(args.passive or 'no', false)
local quant = 1
if passive then
quant = 0.005
end
local function exparg(xp)
if hc(xp) then
return qty(xp)
else
return qty(0)..edit..'[[Category:Needs experience info]]'
end
end
local function levelarg(profession, level)
if hc(profession) and hc(level) then
return pcp(profession, level)
else
return edit..'[[Category:Needs level info]]'
end
end
local function durationarg(duration)
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')
:addClass('wikitable')
:tag('tr')
:tag('th')
:attr{ colspan = '2' }
:wikitext(args.name)
:done()
:done()
:tag('tr')
:tag('th')
:wikitext('Level required')
:done()
:tag('td')
:wikitext(levelarg(args.profession, args.level))
:done()
:done()
: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()
:tag('td')
:wikitext(exparg(args.xp))
:done()
:done()
:tag('tr')
:tag('th')
:wikitext('[[Album|Album XP]]')
:done()
:tag('td')
:wikitext(albumxp or 'Unknown')
:done()
:done()
:tag('tr')
:tag('th')
:wikitext('Duration')
:done()
:tag('td')
:wikitext(durationarg(args.duration))
:done()
:done()
if hc(args.respawn) then
out
:tag('tr')
:tag('th')
:wikitext('Respawn time')
:done()
:tag('td')
:wikitext(durationarg(args.respawn))
:done()
:done()
end
if hc(args.tool) then
out
:tag('tr')
:tag('th')
:wikitext('Required tool')
:done()
:tag('td')
:wikitext(args.tool)
:done()
:done()
end
if hc(args.input) then
out
:tag('tr')
:tag('th')
:wikitext('Required input')
:done()
:tag('td')
:wikitext(args.input)
:done()
:done()
end
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()
end
return out
end
end


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: