帮助:模板/DLC
说明:
主要用法:
- {{DLC|名字}} 显示带超链接的DLC名,如《夜生活》DLC
- {{DLC|图标|名字}} 显示图标,如

其他用法
- {{DLC|图标|名字|28px}} 参数3可以调整大小:

- {{DLC|图标文件|名字}} 图标文件名,如:DLC icon after dark.png
- {{DLC|显示名|名字}} 页面显示名,如: 《夜生活》DLC
- {{DLC|页面名|名字}} 页面名,如:DLC:夜生活
以DLC:After Dark为例:
{{DLC|After Dark}}
{{DLC|图标|After Dark}}
{{DLC|图标文件|After Dark}}
DLC icon after dark.png
{{DLC|显示名|After Dark}}
《夜生活》DLC
可用参数列表
名字:DLC名称 或 缩写
| DLC名称 | 可用缩写 | |
|---|---|---|
| 80年代电影旋律 | 80's Movie Tunes | emt |
| 80年代都市节拍电台 | 80s Downtown Beat | edb |
| 90年代流行电台 | 90s Pop Radio | npr |
| JADIA电台 | JADIA Radio | jad |
| K-pop电台 | K-Pop Station | kps |
| “非洲脉动”电台 | African Vibes | afv |
| 世界之车 | vehicles of the world | vow |
| 世纪中叶现代建筑 | Mid-Century Modern | mcm |
| 东方明珠 | pearls from the east | pfe |
| 乡村之路电台 | country road radio | crr |
| 乡村风光 | Countryside | cos |
| 公共交通 | mass transit | mat |
| 公园生活 | parklife | prk |
| 冰天雪地 | snowfall | snf |
| 圣诞歌,蜡烛与糖果 | carols, candles and candy | ccc |
| 地图包 | content creator pack map pack | map |
| 地图包 2 | Content Creator Pack Map Pack 2 | ma2 |
| 地图包 3 | Content Creator Pack Map Pack 3 | ma3 |
| 城市:天际线 | cities skylines | cts |
| 夜生活 | after dark | afd |
| 大学城 | university city | unc |
| 大灾难 | natural disasters | nad |
| 天堂电台 | Paradise Radio | pdr |
| 山村 | Mountain Village | mov |
| 山间小调 | Alpine Tunes Radio | atr |
| 工业 | industries | ind |
| 工业进化 | Industrial Evolution | ine |
| 布鲁克林与皇后区 | Brooklyn and Queens | baq |
| 广场与步行街 | Plazas and Promenades | pap |
| 广播电台 | on air radio | oar |
| 摩天大厦 | Skyscrapers | sky |
| 放松小站 | relaxation station | res |
| 新生都市 | Emerging Downtown | edt |
| 日式铁路 | Railroads of Japan | roj |
| 日落港口 | sunset harbor | sun |
| 朗日清风 | sunny breeze radio | sbr |
| 机场 | airports | air |
| 机械黎明电台 | synthetic dawn radio | sdr |
| 校园 | campus | cam |
| 校园电台 | campus radio | car |
| 桥梁和码头 | bridges and piers | brp |
| 欧洲郊区 | european suburbia | eus |
| 比赛日 | match day | mad |
| 水陆交界线电台 | Shoreline Radio | slr |
| 流行朋克电台 | Pop Punk Radio | ppr |
| 海岸之滨 | coast to coast radio | coc |
| 海滨度假胜地 | Seaside Resorts | ssr |
| 深度聚焦 | deep focus radio | dfr |
| 火车站 | train stations | trs |
| 爵士盛典 | all that jazz | atj |
| 现代日本 | modern japan | moj |
| 现代都市中心 | modern city center | mcc |
| 穗月和声 | Harvest Harmony | hhr |
| 绿色都市 | green cities | grc |
| 艺术合集 | art deco | ard |
| 豪华版升级包 | deluxe edition | dlx |
| 购物商场 | Shopping Malls | shm |
| 足球场:欧洲俱乐部 | european club pack | ecp |
| 运动场馆 | Sports Venues | spv |
| 都市摇滚电台 | rock city radio | rcr |
| 酒店与度假区 | Hotels and Retreats | har |
| 金融区 | Financial Districts | fid |
| 钢琴曲电台 | Piano Tunes Radio | ptr |
| 铁道雄鹰 | rail hawk radio | rhr |
| 闹市区电台 | downtown radio | dor |
| 静心电台 | calm the mind radio | ctm |
| 非洲剪影 | Africa In Miniature | aim |
| 韩国之心 | Heart of Korea | hok |
| 音乐会 | concerts | con |
| 预购版 | pre order pack | pre |
| 高科技建筑 | high tech buildings | htb |
设计说明
DLC模板本身是一个控制器,根据参数一分配任务。
Switch 参数一:
- 图标文件:使用参数二,查询图标文件
- 图标:使用参数二,查询图标文件,拼接成图标显示格式
- 显示名:使用参数二,查询显示名(如:《夜生活》DLC)
- 页面名:使用参数二,查询页面名(如:DLC:夜生活)
- 链接:使用参数二,查询并拼接成链接(如:[页面名 显示名])
- 其他:使用参数一当作页面名查询
DLC模板调用了两个模板 DLC/查询 和 DLC/查询链接。这俩模板大同小异,说明一个即可。
接下来描述 DLC/查询 模板的思路:
查询核心
最简情况,查询dlc_sort_name属性为参数一的页面的dlc_display_name
{{#ask:
[[Category:DLC]]
[[dlc_sort_name::{{{1}}}]]
|?dlc_display_name
}}
其中
- [[Category:DLC]]用于限制页面分类
- [[dlc_sort_name::{{{1}}}]]用于筛选页面,通过限定属性dlc_sort_name == 参数一
- ?dlc_display_name 用于返回指定的属性 dlc_display_name 可以多写几行查询多个属性
要更灵活的指定查询属性,根据 dlc_sort_name==参数一 筛选页面,并返回 属性参数二:
{{#ask:
[[Category:DLC]]
[[dlc_sort_name::{{{1}}}]]
|?{{{2}}}
}}
不过这样只会输出表格,要指定输出格式,就要增加
{{#ask:
[[Category:DLC]]
[[dlc_sort_name::{{{1}}}]]
|?{{{2|dlc_display_name}}}
|format=plainlist
|template=DLC/参数2
}}
这样,会将查询结果逐行送给模板 DLC/参数2 处理。
不过,需要处理没有结果的情况,对于没结果的情况,添加说明“233333没结果”
{{#ask:
[[Category:DLC]]
[[dlc_sort_name::{{{1}}}]]
|?{{{2|dlc_display_name}}}
|format=plainlist
|template=DLC/参数2
|default= 233333没结果
}}
到这里,基本结构已经完成了。
支持短名和全名
但是,我们不仅要支持 dlc_sort_name,还要支持 dlc_name。
所以需要两个 ask:
{{#ask:
[[Category:DLC]]
[[dlc_sort_name::{{{1}}}]]
|?{{{2|dlc_display_name}}}
|format=plainlist
|template=DLC/参数2
|default= 233333没结果
}}{{#ask:
[[Category:DLC]]
[[dlc_name::{{{1}}}]]
|?{{{2|dlc_display_name}}}
|format=plainlist
|template=DLC/参数2
|default= 233333没结果
}}
由于sort name和name不会一致,两个ask只会出现一个结果,但会有三种情况:
- ask1有结果+233333没结果
- 233333没结果+ask2有结果
- 233333没结果+233333没结果
对于1,2情况,直接替换掉“233333没结果”就可以了 对于3情况,需要将“233333没结果233333没结果”替换为错误提示
于是,代码变成了:
{{#replace:{{#replace:{{#ask:
[[Category:DLC]]
[[dlc_sort_name::{{{1}}}]]
|?{{{2|dlc_display_name}}}
|format=plainlist
|template=DLC/参数2
|default= 233333没结果
}}{{#ask:
[[Category:DLC]]
[[dlc_name::{{{1}}}]]
|?{{{2|dlc_display_name}}}
|format=plainlist
|template=DLC/参数2
|default= 233333没结果
}}|233333没结果233333没结果|没找到匹配的DLC:{{{1}}},请检查参数或对应页面设置}}|233333没结果|}}
注意,最终的结果带有和,这会影响构造链接,也需要替换。
{{#replace:{{#replace:{{#replace:{{#replace:{{#ask:
[[Category:DLC]]
[[dlc_sort_name::{{{1}}}]]
|?{{{2|dlc_display_name}}}
|format=plainlist
|template=DLC/参数2
|default= 233333没结果
}}{{#ask:
[[Category:DLC]]
[[dlc_name::{{{1}}}]]
|?{{{2|dlc_display_name}}}
|format=plainlist
|template=DLC/参数2
|default= 233333没结果
}}|233333没结果233333没结果|没找到匹配的DLC:{{{1}}},请检查参数或对应页面设置}}|233333没结果|}}|[[SMW::on]]|}}|[[SMW::off]]|}}

沪公网安备 31011002002714 号