{{- /* SFCraft 合成配方组件
- 调用: 页面内写 shortcode, 名为 crafting
- a1..c3 为 3x3 合成格, out 为输出格
- 值为 assets/items/ 下贴图的文件名(不含 .png), 留空表示空格子
- 名称后可加 ":数量" 显示堆叠数, 例如 a1="stick:2"
- 引用的贴图不存在时, 格子内显示 ? 占位提示
- caption 参数可选, 显示在组件下方
*/ -}}
{{- $table := resources.Get "table.png" -}}
{{- $slots := slice
(dict "key" "a1" "cls" "grid" "x" "13.75%" "y" "20%")
(dict "key" "a2" "cls" "grid" "x" "25%" "y" "20%")
(dict "key" "a3" "cls" "grid" "x" "36.25%" "y" "20%")
(dict "key" "b1" "cls" "grid" "x" "13.75%" "y" "42.5%")
(dict "key" "b2" "cls" "grid" "x" "25%" "y" "42.5%")
(dict "key" "b3" "cls" "grid" "x" "36.25%" "y" "42.5%")
(dict "key" "c1" "cls" "grid" "x" "13.75%" "y" "65%")
(dict "key" "c2" "cls" "grid" "x" "25%" "y" "65%")
(dict "key" "c3" "cls" "grid" "x" "36.25%" "y" "65%")
(dict "key" "out" "cls" "out" "x" "70%" "y" "37.5%")
-}}
{{- $cssOnce := .Page.Store.Get "sfc_crafting_css" -}}
{{- if not $cssOnce -}}
{{- .Page.Store.Set "sfc_crafting_css" true -}}
{{- end -}}
{{- range $slots -}}
{{- partial "crafting-slot.html"
(dict
"ctx" $
"key" .key
"cls" .cls
"x" .x
"y" .y
) -}}
{{- end -}}
{{- with .Get "caption" -}}
{{ . }}
{{- end -}}