Sea of Thieves Wiki
Advertisement

La documentación para este módulo puede ser creada en Módulo:Tester/doc

return {
	main = function( frame )
		local args = frame
		if frame == mw.getCurrentFrame() then
			args = frame:getParent().args
		end
		local html = mw.html.create( "table" )
				:attr( "class", "wikitable list" )
				:attr( "summary", "List of related commendations with the emblem name requirements and rewards." )
					:tag( "tr" )
						:tag( "th" )
						:attr( "colspan", "4" )
						:wikitext( "[[Commendations]]" )
							:tag( "tr" )
							:tag( "th" )
							:wikitext("Image")
							:tag("th")
							:wikitext("Commendation")
							:tag("th")
							:wikitext("Requirements")
							:attr("style", "min-width:160px;")
							:tag("th")
							:wikitext("Rewards")
						:done()
					:done()
		for _, v in pairs(args) do
			local b = mw.text.trim(v)
			
			-- Header
			local a = mw.ext.cargo.query( "Commendations", "comm_name,comm_text,reward,reward1,reward2,reward3,reward4,reward5,d,title,grade1,grade2,grade3,grade4,grade5,image,timelimited", { where = 'comm_name="' .. b .. '"', ["no html"] = true } )
			
			a = a[1] or { }
			
			if a.comm_name then
				-- Image
				html = html
				:tag( "tr" )
					:tag( "th" )
					:attr( "class", "thumb" )
						:tag("div")
						:attr( "class", "thumb-frame pseudo-before" )
						:wikitext( "[[File:" .. (a.image or "empty") .. "|74px]]" )
						:done()
					:done() -- End Image
					
				-- Commendation name
					:tag( "th" )
					:attr( "id", a.comm_name )
					:wikitext( a.comm_name )
					:done() -- End Commendation name
					
				-- Requirements
					:tag( "td" )
					:wikitext( a.comm_text )
					
						if type(tonumber(a.timelimited)) == "number" then
							html = html
							:tag( "br" ):done()
							:tag( "span" )
							:attr( "style", "border: 1px solid rgba(149, 243, 171, 0.4); background: rgba(19,51,57,1); display: inline-block; padding: 0 4px; border-radius: 4px; margin: 3px 6px 3px auto; color: white; font-size: .75rem;" )
							:attr( "class", "tag-timelimited")
							:wikitext( " [[File:Timelimited icon 14px.png|14px]] Time-limited " )
							:done()
						end
						if a.grade1 ~= "" then
							html = html
							:tag( "div" )
							:attr( "class", "toccolours mw-collapsible mw-collapsed" )
							:attr( "data-expandtext", " View Grades " )
							:attr( "data-collapsetext", " Hide Grades " )
							:wikitext( " " )
							:tag( "div" )
							:attr( "class", "mw-collapsible-content" )
								:tag("ul")
									:tag("li")
									:wikitext( "'''Grade I:''' " .. ( a.grade1 or "data required" ) ) 
									:tag("li")
									:wikitext( "'''Grade II:''' " .. a.grade2 )
								if a.grade3 ~= "" then
									html = html
									:tag ("li")
									:wikitext("'''Grade III:'''" .. a.grade3 )
									:done()
								end
								if a.grade4 ~= "" then
									html = html
									:tag ("li")
									:wikitext("'''Grade IV:''' " .. a.grade4 )
									:done()
								end
								if a.grade5 ~= "" then
									html = html
									:tag ("li")
									:wikitext("'''Grade V:''' " .. a.grade5 )
									:done()
								end

						else
							html = html:done()
						end -- Ends Requirements
						
				--Rewards
				html = html
					:tag( "td" )
						if a.d ~= "" then
							html = html
							:wikitext( "{{d|+" .. a.d .. "}}" )
							:tag( "br" )
							:done()
						end 
						if a.title == "yes" then
							html = html
							:wikitext( "Rewards the [[Titles#" .. a.comm_name .. "|" .. a.comm_name .. "]] Title" )
							:tag( "br" )
							:done()
						elseif a.title ~= "" then 
							html = html
							:wikitext( "Rewards the [[Titles#" .. a.title .. "|" .. a.title .. "]] Title" )
							:tag( "br" )
							:done()
						end
						if a.reward ~= "" then
							html = html
							:wikitext( a.reward )
							:done()
						end
						if a.reward1 ~= "" then
							html = html
							:wikitext( a.reward .. " at Grade I" )
							:done()
						end
						if a.reward2 ~= "" then
							html = html
							:wikitext( a.reward .. " at Grade II" )
							:done()
						end
						if a.reward3 ~= "" then
							html = html
							:wikitext( a.reward .. " at Grade III" )
							:done()
						end
						if a.reward4 ~= "" then
							html = html
							:wikitext( a.reward .. " at Grade IV" )
							:done()
						end		
						if a.reward5 ~= "" then
							html = html
							:wikitext( a.reward .. " at Grade V" )
							:done()
						end	
						-- End Rewards
					
			end
		end
		html = html:allDone()
		return tostring(html)
	end, 
	}
Advertisement