本模块已过时,但仍可少量使用。
如果您需要编写集成战略中的一般事件,请参阅模板:ISEvent
本模块已过时,但仍可少量使用。
如果您需要编写集成战略中的一般事件,请参阅模板:ISEvent

本模块用于在复杂条件下撰写集成战略事件,拥有以下参数:

  • theme, collectionLink(条件必需)
指定该事件中,收藏品对应的主题和收藏品一览页面的链接
如:|theme=水月与深蓝之树|collectionLink=生物制品陈设
没有收藏品选项可不使用这两个参数
  • eventId(必需)
指定本事件的id,将会影响呈现范围,请确保同页面只有一个id,可使用原数据表中的id
  • sceneX(X=1,2,3...,最大支持50个,便于5个以内的多分支)
指定第X场景的内容(不含选项),格式为:|sceneX = <背景>;;<描述>
如:|sceneX = avg_pic_rogue_2_46;;这是一段安全屋的描述
第1场景为初始场景
  • itemX(X=1,2,3...)
指定第X场景的选项,格式为:|itemX = <类型>;;<行动>;;<类型参数>;;<选项>;;<目标场景>...
该参数指定了这个场景的所有选项,多个选项时,每一行为一个选项。
<类型>仅接受下列值,并会同时影响<类型参数>
  • simple:代表这个选项给予的是基本属性值(如生命值、希望等),或一些辅助描述性文字。
    • <类型参数>为显示的图标,对于描述性文字可空。
  • item:代表这个选项给予的是道具(如高级进阶券)。
    • <类型参数>为显示的道具图标。
  • collection:代表这个选项给予的是收藏品。
    • <类型参数>为要显示的收藏品ID。
  • back模块系统定义,代表回到上一个场景。
<行动>为该选项外显的文字
  • home模块系统定义,代表回到第一个场景。
<选项>为点击该选项后显示的补充文字。
<目标场景>为点击该选项后跳转的场景的编号(即上文sceneX的X)。
  • 为空时不跳转(即无动作)

local p = {}

function p.item(frame, itemRawData, extraData)
	if itemRawData then
		local res_table = {}
		local itemData = mw.text.split(itemRawData, ";;", true)
		--开头与按钮参数
		local btnParam = ""
		if itemData[5]~="" then btnParam = string.format("mw-customtoggle-%s%d mw-customtoggle-%s%d", extraData[3], extraData[4], extraData[3], itemData[5]) end
		if itemData[1]=="home" then btnParam = string.format("mw-customtoggle-%s%d mw-customtoggle-%s%d", extraData[3], extraData[4], extraData[3], 1) end
		table.insert(res_table, string.format('{|class="wikitable %s" style="width:100%%;margin:0;display:table;font-size:14px;white-space:normal"\n', btnParam))
		table.insert(res_table, '!style="background:#343434;color:#fff;"|')
		--图标分歧
		if itemData[1]=="simple" then
			table.insert(res_table, itemData[2])
			if btnParam~="" then table.insert(res_table, ' <i class="fa-chevron-right fas"></i>') end
			if itemData[3]~="" then table.insert(res_table, string.format('<br>[[File:集成战略 选项 %s.png|x50px|link=]]', itemData[3])) end
			if itemData[4]~="" then table.insert(res_table, string.format('<br><span style="font-weight:normal">%s</span>', itemData[4])) end
		elseif itemData[1]=="item" then
			table.insert(res_table, itemData[2])
			if btnParam~="" then table.insert(res_table, ' <i class="fa-chevron-right fas"></i>') end
			local itemText = frame:expandTemplate{title = "集成战略事件物品图标", args = {item = itemData[3]} }
			table.insert(res_table, itemText)
			if itemData[4]~="" then table.insert(res_table, string.format('<br><span style="font-weight:normal">%s</span>', itemData[4])) end
		elseif itemData[1]=="collection" then
			table.insert(res_table, itemData[2])
			if btnParam~="" then table.insert(res_table, ' <i class="fa-chevron-right fas"></i>') end
			local itemText = frame:expandTemplate{title = "集成战略事件物品图标", args = {collection = itemData[3], theme = extraData[1], link = extraData[2]} }
			table.insert(res_table, itemText)
			if itemData[4]~="" then table.insert(res_table, string.format('<br><span style="font-weight:normal">%s</span>', itemData[4])) end
		elseif itemData[1]=="back" then
			table.insert(res_table, "<i class=\"fa-chevron-left fas\"></i> ''返回上一场景''")
		elseif itemData[1]=="home" then
			table.insert(res_table, "<i class=\"fa-home fas\"></i> ''从头开始事件''")
		else
			--
		end
		--结尾
		table.insert(res_table, '\n|}\n')
		
		return table.concat(res_table)
	else
		return ""
	end
end

function p.list(frame)
	local args = (frame == mw.getCurrentFrame() and frame.args) or frame
	
	local theme = mw.text.trim(args["theme"] or "")
	local collectionLink = mw.text.trim(args["collectionLink"] or "")
	local eventId = mw.text.trim(args["eventId"] or "")
	local sceneList, itemRawList = {}, {}
	for i=1,50 do
		if args["scene"..i] then sceneList[i] = mw.text.trim(args["scene"..i]) end
		if args["item"..i] then itemRawList[i] = mw.text.trim(args["item"..i]) end
	end
	
	local res_table = {}
	
	for sceneNum=1,#sceneList do
		if sceneList[sceneNum] then
			local sceneData = mw.text.split(sceneList[sceneNum], ";;", true)
			local hideScene = ""
			if sceneNum>=2 then hideScene="mw-collapsed" end
			--建立场景
			table.insert(res_table, string.format('<div id="mw-customcollapsible-%s%i" class="mw-collapsible %s">\n', eventId, sceneNum, hideScene))
			table.insert(res_table, '{| class="wikitable logo" style="text-align:center;width:560px;display:table;white-space:normal"\n')
			local scenePicture = ""
			if sceneData[1]~="" and sceneData[1] then scenePicture="[[文件:"..sceneData[1]..".png|560px]]<br>" end
			table.insert(res_table, string.format('!style="background-color:#212121;color:white;"| %s%s\n', scenePicture, sceneData[2]))
			table.insert(res_table, '|-\n|style="padding:0;background-color:#212121;"|\n')
			--选项内容
			local sceneItemList = itemRawList[sceneNum]
			sceneItemList = mw.text.split(sceneItemList, "\n", true)
			for itemNum=1, #sceneItemList do
				table.insert(res_table, p.item(frame, sceneItemList[itemNum], {theme, collectionLink, eventId, sceneNum}))
			end
			--结尾
			table.insert(res_table, '|}</div>\n')
		end
	end
	
	return table.concat(res_table)
end

return p