维多利亚3
ParaWikis
502 Bad Gateway
502 Bad Gateway
openresty
最近更改
随机页面
加入QQ群
工具
链入页面
相关更改
特殊页面
页面信息
页面值
×
欢迎访问维多利亚3百科!
注册一个账号
,一起参与编写吧!这里是
当前的工程
。
全站已采用新UI,任何使用上的问题请点击
这里
。欢迎所有对百科感兴趣的同学加入QQ群:
497888338
。
阅读
查看源代码
查看历史
讨论
查看“Module:State”的源代码
←
Module:State
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
------------------------------------------------------------------------------ -- -- Module:State -- -- This module implements Template:State. ------------------------------------------------------------------------------ local getArgs = require('Module:Arguments').getArgs local iconify = require('Module:Iconify').iconify local stateTrait = require('Module:State trait').state_trait local yesno = require('Module:Yesno') local inArray = require('Module:TableTools').inArray local p = {}; function p.main(frame) local args = getArgs(frame) return p.state(args) end function p.state(args) local newline = "\n|" local stateData = mw.loadData('Module:State/List')[args.state] if not stateData then return '<span style="color:red; font-size:11px;">(unrecognized state "' .. args.state .. '" for [[Module:State]])</span>[[Category:Pages with unrecognized states]]' end -- initialize return string with state name; args.state is parameter 1 in {{state}} local s = args.state -- set info formatting, default to 'state status' type local width = "36px" local image = false if yesno(args.cores) then width = "border|24px" -- 'hack' iconify to add border like {{flag}} image = true -- used in info iconify to set icon from info directly end --[[ -- state info, comma separated pseudo-table in template call, with a separate parameter for formatting as state status icons or "core" flags -- args.info is parameter 2 in {{state}} -- args.core is parameter "cores" in {{state}} --]] local info = args.info or "" s = s .. newline if info ~= "" then info = mw.text.split(info,",") for _, v in ipairs(info) do v = mw.text.split(v, "_") -- Allow using claims icon in 'core' type, must be last if yesno(args.cores) and string.lower(v[1]) == "claims" then image = false width = "24px" end if image then image = v[1]..".png" end s = string.format("%s\n* %s", s, iconify({icon=v[1], group="State status", image=image, width=width, text="0"})) if v[2] and v[2] ~= "" then s = string.format("%s %s", s, iconify({icon="Capital", group="State status", width="20px", text="0"})) end end end --[[ -- state homelands, defined table in state data --]] s = s .. newline for _, v in ipairs(stateData["homelands"]) do s = string.format("%s\n* %s",s,v) end -- strategic region, optional; args.region is parameter "region" in {{state}} if yesno(args.region) then s = string.format("%s%s %s",s,newline,stateData["region"]) end -- arable land amount s = string.format("%s\n| %s",s,stateData["arable_land"]) -- arable resources, optionally multiColumn'd; args.multiColumn is parameter "mc" in {{state}} -- keep equivalent with {{multiColumn}} with two columns s = s .. newline if yesno(args.multiColumn) then s = s .. '<div style="columns:100px 2; column-gap: 10px;-webkit-columns:100px 2; -webkit-column-gap: 10px;-moz-columns:100px 2; -moz-column-gap: 10px;">' end local agOrder = { 'Maize Farms', 'Millet Farms', 'Rice Farms', 'Rye Farms', 'Wheat Farms', 'Livestock Ranches', 'Banana Plantations', 'Coffee Plantations', 'Cotton Plantations', 'Dye Plantations', 'Opium Plantations', 'Silk Plantations', 'Sugar Plantations', 'Tea Plantations', 'Tobacco Plantations', 'Vineyard' }; for _, ag in ipairs(agOrder) do -- cycle standardized order if inArray(stateData["arable_resources"], ag) then -- check the type is actually present ag = mw.ustring.gsub(ag, "e?s$","") -- singularize ag buildings s = mw.ustring.format("%s\n* %s",s,iconify({icon=ag,group="building",width="30px"})) end end if yesno(args.multiColumn) then s = s .. '</div>' end -- non-ag resources, cycles invoked list; can miss resources in state; args.resources is parameter 3 in {{state}} s = s .. newline local resTable = stateData["resources"] for res in mw.text.gsplit(args.resources,",") do s = string.format("%s %s ||", s, resTable[res] or "—") end s = s:sub(1, -4) -- trim last ' ||' -- state traits local traits = stateData["traits"] s = s .. newline if traits[1] ~= nil then for _, v in ipairs(traits) do s = mw.ustring.format("%s%s\n",s,stateTrait(v)) end s = s:sub(1, -2) -- trim last newline end return s end return p
本页使用的模板:
Template:Clear
(
查看源代码
)
Template:Lua
(
查看源代码
)
Template:Template
(
查看源代码
)
Template:Tlx
(
查看源代码
)
Module:Arguments
(
查看源代码
)
Module:Lua
(
查看源代码
)
Module:State/doc
(
查看源代码
)
Module:TableTools
(
查看源代码
)
Module:Yesno
(
查看源代码
)
返回
Module:State
。
×
登录
密码
记住登录
加入维多利亚3百科
忘记密码?
其他方式登录