Module:Dialogue

local p = {}

function p.invoke_main(frame) local args = frame:getParent.args return p.main(args) end

function p.main(args) local dtype = string.lower( args[1] or '' ) local pagetitle = mw.title.getCurrentTitle local pagename = pagetitle.text local basepagename = pagetitle.baseText local ns3004 = pagetitle.namespace == 3004 -- Transcript namespace local linkarg = args.link local link =  .. ( linkarg or pagename ) ..  local linkb = args.linkb local linkband = linkb and (  .. linkb .. ' and ' ) or  local title = args.title or pagename local sentences = { ['crime'] = 'dialogue related to ' .. linkband .. 'the crime ' .. link, ['quest'] = 'dialogue related to ' .. linkband .. 'the quest ' .. link, }	local defaultText = 'dialogue related to ' .. linkband .. link local source = 'The content below is copied verbatim from \'\'Rule the Seas\'\' and thus copyrighted by Rule The Seas Inc..' local startTable = '{| class="messagebox standard-talk plainlinks" style="border-left:none; text-align:center;"\n|-\n| ' local line = 'This page contains ' .. ( sentences[dtype] or defaultText ) .. '.'	local endTable = ' ' .. source .. ' \n|-\n|}' local header = startTable .. line .. endTable local cats = { ['crime'] = {'Crime transcript'}, ['quest'] = {'Quest transcript'}, }	local setcat = '' local displayTitle = '' if ns3004 then local cat = cats[dtype] or {'Miscellaneous transcript'} setcat = '' local titleTypeIds = { ['crime'] = 2, ['quest'] = 2, }		local titleTypes = { 'Dialogue for ' .. title, 'Transcript of ' .. title, }		local newTitle = titleTypes[ titleTypeIds[dtype] or 2 ] displayTitle = mw.getCurrentFrame:callParserFunction{ name = 'DISPLAYTITLE', args = { newTitle } } -- set Transcript authors SMW --if string.match(args.author or '', '%S') then --	local authors = {} --	for auth in string.gmatch(args.author, "[^;]+") do		--		if string.lower(auth) == 'player' then --			table.insert(authors, 'Player character') --		else --			table.insert(authors, auth) --		end --	end --	mw.smw.set( { ['Transcript authors'] = authors } ) --end end return header .. setcat .. displayTitle end

return p