Template:Synthesis Recipe.RecipeList: Difference between revisions
imported>Aramachus trying a template to generate recipe lists, although not working properly yet |
imported>Aramachus mNo edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<includeonly><onlyinclude>- |
<includeonly><onlyinclude>-<!-- |
||
clever ways to not show desynth recipes and recipes where the item is the |
|||
| ⚫ | |||
-->{{#ifeq:{{{ |
-->{{#ifeq:{{lc:{{{1}}}}}|none|style="display: none;"}}<!-- |
||
if the recipe has only one ingredient with quantity one, then it is by definition a desynthesis of that ingredient (there might be exceptions...) |
|||
| ⚫ | |||
-->{{#if:{{{ingredient 2|}}}{{{ingredient quantity|}}}{{#ifeq:{{lc:{{{crystal}}}}}|lightning||not using lightning crystal so it is not a desynth recipe}}||style="display: none;"}}<!-- |
|||
if neither cap, crystal nor result (could add more) is given, then do not display the recipe because it isn't filled out |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
-->{{#ifeq:{{{hq 3 result}}}|{{{result}}}||{{#ifeq:{{{hq 3 result}}}|this|style="display:none;"}}}}<!-- |
|||
compare the level of the recipe against the rank and hide recipes which are outside of the level range. This is necessary because for some items multiple recipes exist which vary in level. dpl pulls the entire page if it categorizes as a certain range and all recipes end up here. So a manual sorting of the rows by level is necessary |
|||
-->{{#ifexpr:{{{cap}}}<{{GetRankLevel|{{{phantom_arg}}}|min}}|style="display:none;"}}{{#ifexpr:{{{cap}}}>{{GetRankLevel|{{{phantom_arg}}}|max}}|style="display:none;"}}<!-- |
|||
Start output code |
|||
--> |
|||
| |
| |
||
[[ |
[[%PAGE%|%TITLE%]]{{#if:{{{yield|}}}| x {{{yield}}}}}{{#if:{{{crafting tool|}}}|<br/> {{KeyItem}}[[{{{crafting tool}}}]]}} |
||
{{#if:{{{subcraft|}}}|<nowiki/> |
{{#if:{{{subcraft|}}}|<nowiki/> |
||
:{{Craft|{{{subcraft}}}|{{{subcraft cap}}}}}}} |
:{{Craft|{{{subcraft}}}|{{{subcraft cap}}}}}}} |
||
| Line 10: | Line 25: | ||
{{{cap}}} |
{{{cap}}} |
||
| |
| |
||
[[{{{crystal}}}]] |
[[{{{crystal}}} Crystal|{{Color|{{{crystal}}}|{{{crystal}}}}}]] |
||
|<!-- first ingredient always exists, there is no recipe with zero ingredients. quantities are optional with 1 being implied if none is given by the synthesis recipe template. Subsequent ingredients are checked if they exist, in a nested fashion --> |
|||
| |
|||
<ul><li>[[{{{ingredient}}}]]{{#if:{{{ingredient quantity|}}}| x {{{ingredient quantity}}}}}<!-- |
<ul><li>[[{{{ingredient}}}]]{{#if:{{{ingredient quantity|}}}| x {{{ingredient quantity}}}}}</li><!-- |
||
-- |
-->{{#if:{{{ingredient 2|}}}|<li>[[{{{ingredient 2}}}]]{{#if:{{{ingredient 2 quantity|}}}| x {{{ingredient 2 quantity}}}}}</li><!-- |
||
-->{{#if:{{{ingredient 3|}}}|<li>[[{{{ingredient 3}}}]] |
-->{{#if:{{{ingredient 3|}}}|<li>[[{{{ingredient 3}}}]]{{#if:{{{ingredient 3 quantity|}}}| x {{{ingredient 3 quantity}}}}}</li><!-- |
||
-->{{#if:{{{ingredient 4|}}}|<li>[[{{{ingredient 4}}}]] |
-->{{#if:{{{ingredient 4|}}}|<li>[[{{{ingredient 4}}}]]{{#if:{{{ingredient 4 quantity|}}}| x {{{ingredient 4 quantity}}}}}</li><!-- |
||
-->{{#if:{{{ingredient 5|}}}|<li>[[{{{ingredient 5}}}]] |
-->{{#if:{{{ingredient 5|}}}|<li>[[{{{ingredient 5}}}]]{{#if:{{{ingredient 5 quantity|}}}| x {{{ingredient 5 quantity}}}}}</li>}}}}}}}}</ul> |
||
|<!-- next line is complicated because: if no hq result is specified but a hq yield is specified, the synthesis recipe template will default to using the normal result with the hq yield as the hq. Also, the synthesis recipe allows to use "this" as a keyword to use the page title. all these cases must be caught here --> |
|||
| |
|||
{{#if:{{{hq result|}}}|HQ: [[{{{hq result}}}]]{{#if:{{{hq yield|}}}| x {{{hq yield}}}}}<!-- |
{{#if:{{{hq result|}}}{{{hq yield|}}}|HQ: [[{{#ifeq:{{{hq result}}}|this|%PAGE%{{!}}%TITLE%|{{{hq result|{{#ifeq:{{{result}}}|this|%PAGE%{{!}}%TITLE%|{{{result}}}}}}}}}}]]{{#if:{{{hq yield|}}}| x {{{hq yield}}}}}<!-- |
||
-->{{#if:{{{hq 2 result|}}}|<br/>HQ2: [[{{{hq 2 result}}}]]{{#if:{{{hq 2 yield|}}}| x {{{hq 2 yield}}}}}<!-- |
-->{{#if:{{{hq 2 result|}}}{{{hq 2 yield|}}}|<br/>HQ2: [[{{{hq 2 result|{{#ifeq:{{{result}}}|this|%PAGE%{{!}}%TITLE%|{{{result}}}}}}}}]]{{#if:{{{hq 2 yield|}}}| x {{{hq 2 yield}}}}}<!-- |
||
-->{{#if:{{{hq 3 result|}}}|<br/>HQ3: [[{{{hq 3 result}}}]]{{#if:{{{hq 3 yield|}}}| x {{{hq 3 yield}}}}}<!-- |
-->{{#if:{{{hq 3 result|}}}{{{hq 3 yield|}}}|<br/>HQ3: [[{{{hq 3 result|{{#ifeq:{{{result}}}|this|%PAGE%{{!}}%TITLE%|{{{result}}}}}}}}]]{{#if:{{{hq 3 yield|}}}| x {{{hq 3 yield}}}}}<!-- |
||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
</onlyinclude></includeonly> |
</onlyinclude></includeonly> |
||
[[Category:DPL Phantom Templates]] |
|||
{{#dpl: |
|||
==Usage== |
|||
|category=Alchemy/Amateur |
|||
dpl phantom template to format the rows of [[Template:RecipeList]] |
|||
|notcategory=Alchemy/Subcraft |
|||
|include={Synthesis Recipe¦RecipeList.dpl} |
|||
For usage, see [[Template:RecipeList]] |
|||
|table=class="horizon-table alchemy-table center-col-2 center-col-3",-,Item,Cap,Crystal,Ingredients,HQ |
|||
|tablesortcol=3 |
|||
===Examples of [[Template:RecipeList]]=== |
|||
}} |
|||
<pre>{{RecipeList|craft=Alchemy|rank=Apprentice}}</pre> |
|||
{{RecipeList|craft=Alchemy|rank=Apprentice}} |
|||
Latest revision as of 14:38, 13 November 2024
Usage
dpl phantom template to format the rows of Template:RecipeList
For usage, see Template:RecipeList
Examples of Template:RecipeList
{{RecipeList|craft=Alchemy|rank=Apprentice}}
Extension:DynamicPageList4 (DPL4), version 4.0.0: Error: MediaWiki\Extension\DynamicPageList4\Query::buildAndSelect - Template:Synthesis_Recipe.RecipeList: The DynamicPageList4 extension (version 4.0.0) produced a SQL statement which led to a Database error.<br/>The reason may be an internal error of DynamicPageList4 or an error that you made; especially when using parameters like 'categoryregexp' or 'titleregexp'. Usage of non-greedy <code>*?</code> matching patterns are not supported.<br/>The error message was:<br/><code>Error 1054: Unknown column 'ecl1.cl_to' in 'WHERE' Function: MediaWiki\Extension\DynamicPageList4\Query::buildAndSelect - Template:Synthesis_Recipe.RecipeList Query: SET STATEMENT max_statement_time=10 FOR SELECT DISTINCT p.page_namespace AS `page_namespace`,p.page_id AS `page_id`,p.page_title AS `page_title` FROM `page` `p` JOIN `categorylinks` `cl1` ON (((p.page_id = cl1.cl_from) AND (cl1.cl_to = 'Alchemy/Apprentice'))) LEFT JOIN `categorylinks` `ecl1` ON (((p.page_id = ecl1.cl_from) AND (ecl1.cl_to = 'Alchemy/Subcraft'))) LEFT JOIN `categorylinks` `ecl2` ON (((p.page_id = ecl2.cl_from) AND (ecl2.cl_to = 'High_Quality'))) WHERE p.page_is_redirect = 0 AND ecl1.cl_to IS NULL AND ecl2.cl_to IS NULL LIMIT 500 </code>