全站通知:

帮助:模板/DLC

来自城市:天际线WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

操作编辑文档  刷新  历史  ·   编辑模板  查看模板


说明:

主要用法:

  • {{DLC|名字}} 显示带超链接的DLC名,如《夜生活》DLC
  • {{DLC|图标|名字}} 显示图标,如DLC icon after dark.png

其他用法

  • {{DLC|图标|名字|28px}} 参数3可以调整大小:DLC icon after dark.png
  • {{DLC|图标文件|名字}} 图标文件名,如:DLC icon after dark.png
  • {{DLC|显示名|名字}} 页面显示名,如: 《夜生活》DLC
  • {{DLC|页面名|名字}} 页面名,如:DLC:夜生活

以DLC:After Dark为例:

{{DLC|After Dark}}

《夜生活》DLC


{{DLC|图标|After Dark}}

DLC icon after dark.png


{{DLC|图标文件|After Dark}}

DLC icon after dark.png


{{DLC|显示名|After Dark}}

《夜生活》DLC


可用参数列表

名字:DLC名称 或 缩写

 DLC名称可用缩写
80年代电影旋律80's Movie Tunesemt
80年代都市节拍电台80s Downtown Beatedb
90年代流行电台90s Pop Radionpr
JADIA电台JADIA Radiojad
K-pop电台K-Pop Stationkps
“非洲脉动”电台African Vibesafv
世界之车vehicles of the worldvow
世纪中叶现代建筑Mid-Century Modernmcm
东方明珠pearls from the eastpfe
乡村之路电台country road radiocrr
公共交通mass transitmat
公园生活parklifeprk
冰天雪地snowfallsnf
圣诞歌,蜡烛与糖果carols, candles and candyccc
地图包content creator pack map packmap
地图包 2Content Creator Pack Map Pack 2ma2
城市:天际线cities skylinescts
夜生活after darkafd
大学城university cityunc
大灾难natural disastersnad
天堂电台Paradise Radiopdr
工业industriesind
工业进化Industrial Evolutionine
布鲁克林与皇后区Brooklyn and Queensbaq
广场与步行街Plazas and Promenadespap
广播电台on air radiooar
摩天大厦Skyscraperssky
放松小站relaxation stationres
日式铁路Railroads of Japanroj
日落港口sunset harborsun
朗日清风sunny breeze radiosbr
机场airportsair
机械黎明电台synthetic dawn radiosdr
校园campuscam
校园电台campus radiocar
桥梁和码头bridges and piersbrp
欧洲郊区european suburbiaeus
比赛日match daymad
水陆交界线电台Shoreline Radioslr
流行朋克电台Pop Punk Radioppr
海岸之滨coast to coast radiococ
海滨度假胜地Seaside Resortsssr
深度聚焦deep focus radiodfr
火车站train stationstrs
爵士盛典all that jazzatj
现代日本modern japanmoj
现代都市中心modern city centermcc
绿色都市green citiesgrc
艺术合集art decoard
豪华版升级包deluxe editiondlx
购物商场Shopping Mallsshm
足球场:欧洲俱乐部european club packecp
运动场馆Sports Venuesspv
都市摇滚电台rock city radiorcr
酒店与度假区Hotels and Retreatshar
金融区Financial Districtsfid
钢琴曲电台Piano Tunes Radioptr
铁道雄鹰rail hawk radiorhr
闹市区电台downtown radiodor
静心电台calm the mind radioctm
非洲剪影Africa In Miniatureaim
韩国之心Heart of Koreahok
音乐会concertscon
预购版pre order packpre
高科技建筑high tech buildingshtb


设计说明

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]]|}}