Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:QuestDetails

From Granblue Fantasy Relink Wiki

Template: Template:QuestDetails

Takes the following arguments:

  • id
  • name
  • location
  • locationimage
  • description

Constructs an HTML card based on the provided arguments

id name description island location locationimage difficulty type power timelimit objective petitioner sidegoal1 sidereward1 sidegoal2 sidereward2 sidegoal3 sidereward3 fail exp rupies msp firstclear clearreward ranks3 ranks2 ranks ranka rankb chest1 chest2 chest3 chest4 chest5
403308 Collector's Digest I heard a sandstorm on Dahli Island kicked up some historic artifacts, coins included. Unfortunately, the bane of coin enthusiasts everywhere, silver slimes, love a metallic scent, and they've also been sighted in the area. Get to those pennies before the slimes digest 'em all! Dahli Island Dahli Relicbelt
Dahli Relicbelt.png
Hard Explore 3,600 4 Collect ancient coins within the time limit Adamant Coin Collector Collect 50 Vallion coins  Glitterstone (L) ×1 Defeat King Silverslime ×2  Glitterstone (L) ×1 Collect 150 Vallion coins  Glittercrystal ×1 The critical gauge reaches 0 10,000 2,820 5

More...

Collector's Digest
Dahli Relicbelt
Adamant Coin Collector
I heard a sandstorm on Dahli Island kicked up some historic artifacts, coins included. Unfortunately, the bane of coin enthusiasts everywhere, silver slimes, love a metallic scent, and they've also been sighted in the area. Get to those pennies before the slimes digest 'em all!
Side Goals
Reward
Collect 50 Vallion coins
Defeat King Silverslime ×2
Collect 150 Vallion coins

This quest has no drop chests.

More...

local getArgs = require('Module:Arguments').getArgs
local tabber = require('Module:Tabber').renderTabber

local p = {}

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

local function constructDetails(args)
	-- Return early for bad data
	if args.id == nil then return '' end

	local questDetails = mw.html.create('div')
	questDetails:addClass('quest-details'):attr('id', string.format('details-%s', args.id))

	local questDetailsContent = mw.html.create('div'):addClass('quest-details-content')

	-- Details header (data-driven loop)
	local detailsHeader = mw.html.create('div'):addClass('details-h2')
	local headerFields = {
		{ class = 'details-name',       key = 'name' },
		{ class = 'details-location',   key = 'location' },
		{ class = 'details-petitioner', key = 'petitioner' },
	}
	for _, field in ipairs(headerFields) do
		detailsHeader:tag('div'):addClass(field.class):wikitext(args[field.key] or 'Nil'):done()
	end
	questDetailsContent:node(detailsHeader)
	
	-- Description
	questDetailsContent:tag('div'):addClass('quest-description')
		:wikitext(args.description or '')
	:done()

	-- Rewards section
	local rewardsSection = mw.html.create('div'):addClass('rewards-section')

	-- Side goals (data-driven loop)
	local sideGoals = mw.html.create('div'):addClass('side-goals-container')
	sideGoals:tag('div'):addClass('side-goal-row')
		:tag('div'):addClass('side-goal'):wikitext('Side Goals'):done()
		:tag('div'):addClass('side-reward'):wikitext('Reward'):done()
	:done()

	for i = 1, 3 do
		local goal   = args['sidegoal' .. i]
		local reward = args['sidereward' .. i]
		if goal or reward then
			sideGoals:tag('div'):addClass('side-goal-row')
				:tag('div'):addClass('side-goal'):wikitext(goal or ''):done()
				:tag('div'):addClass('side-reward'):wikitext(reward or ''):done()
			:done()
		end
	end
	rewardsSection:node(sideGoals)

	-- Chest rewards loop
	local hasNonNilChest = false
	local chestListBuilder = mw.html.create('div'):addClass('chest-rewards-list')
	for i = 1, 5 do
		local chest = args['chest' .. i]
		if chest ~= nil then
			hasNonNilChest = true
			chestListBuilder:tag('ul'):tag('li'):wikitext(chest):done()
		end
	end
	local chestListOutput
	if hasNonNilChest then
		chestListOutput = tostring(chestListBuilder)
	else
		chestListOutput = 'This quest has no drop chests.'
	end

	-- Rank rewards (data-driven loop)
	local rankListBuilder = mw.html.create('div'):addClass('rank-rewards-list')
	local rankRewards = {
		{ file = 'Rank_5.png', key = 'ranks3' },
		{ file = 'Rank_4.png', key = 'ranks2' },
		{ file = 'Rank_3.png', key = 'ranks' },
		{ file = 'Rank_2.png', key = 'ranka' },
		{ file = 'Rank_1.png', key = 'rankb' },
	}
	for _, rank in ipairs(rankRewards) do
		rankListBuilder:tag('div')
			:wikitext(string.format('[[File:%s|center|50px|link=]]', rank.file))
			:wikitext(args[rank.key] or '')
		:done()
	end

	-- Tabber
	local tabberData = tabber({
		label1   = 'First-Clear Rewards',
		content1 = args.firstclear,
		label2   = 'Clear Rewards',
		content2 = args.clearreward,
		label3   = 'Rank rewards',
		content3 = tostring(rankListBuilder),
		label4   = 'Drop Items',
		content4 = chestListOutput,
	})
	rewardsSection:node(tabberData)
	questDetailsContent:node(rewardsSection)

	questDetails:node(questDetailsContent)

	-- Image
	questDetails:tag('div')
		:addClass('quest-image')
		:wikitext(string.format('[[File:%s|link=]]', args.locationimage or ''))
	:done()

	return tostring(questDetails)
end

function p._main(args)
	local frame = mw.getCurrentFrame()

	local questDetails = constructDetails(args)

	return tostring(questDetails) .. frame:extensionTag{
		name = 'templatestyles',
		args = { src = 'Template:Quests/styles.css' }
	}
end

return p