本WIKI除首页和部分特殊页面外编辑权限开放。
为了方便未来的使用,务必收藏哦~
感谢 一直在作死的千岛酱对主页的设计支持,期待更多家主大人加入妖怪屋WIKI~
编辑帮助萌新问答区

全站通知:

模块:商店商品

来自阴阳师妖怪屋WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

此模块的文档可以在模块:商店商品/doc创建

local p = {}

function p.getList(frame)
	local args = (frame == mw.getCurrentFrame() and frame.args) or frame
	
	local items = mw.text.trim(args['item'] or '')
	local currency = mw.text.trim(args['currency'] or '')
	local currency_size = mw.text.trim(args['currencySize'] or '50px')
	
	local currencyPic = ""
	if(#currency ~= 0)
	then
		currency_pic = string.format("[[文件:%s|%s|link=]]", currency, currency_size)
	end
	
	local item_arr = mw.text.split(items, ";;;", true)
	local res = {}
	for i = 1,#item_arr do
		if(#item_arr[i] ~= 0)
		then
			local item_data = mw.text.split(item_arr[i], ",,", true )
			local i_name = item_data[1] or ''
			local i_price = item_data[2] or "0"
			local ex_data = item_data[5] or ''
			if(i_price == "")
			then
				i_price = "0"
			end
			local i_amount = item_data[3] or "0"
			if(i_amount == "")
			then
				i_amount = "0"
			end
			local i_amount_desc = item_data[4] or ""
			if(i_amount_desc == "")
			then
				if(i_amount == "0")
				then
					i_amount_desc = "-"
				else
					i_amount_desc = i_amount
				end
			end
			table.insert(res, frame:expandTemplate{title = "兑换商店/商品行", args = {i_name, i_price, i_amount, i_amount_desc, currency_pic, ex_data}})
		end
	end
	return table.concat(res, "\n|-\n")
end

return p