Template:Synthesis Recipe.RecipeList: Difference between revisions

From Horizon Wiki Mirror
Content deleted Content added
imported>Aramachus
m some code improvements and a lot of commentary
imported>Aramachus
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 3: Line 3:
-->{{#ifeq:{{lc:{{{1}}}}}|none|style="display: none;"}}<!--
-->{{#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 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|}}}||style="display: none;"}}<!--
-->{{#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
if the item is the ingredient of the recipe, then it is a desynthesis recipe. Unfortunately, in a phantom template it seems not possible to use %PAGE% or %TITLE% to check if the pagename is equal to the ingredient, so we can only check against the "keyword" "this".
-->{{#ifeq:{{{ingredient}}}|this|style="display: none;"|}}<!--
if neither cap, crystal nor result (could add more) is given, then do not display the recipe because it isnt filled out
-->{{#if:{{{cap|}}}{{{crystal|}}}{{{result|}}}||style="display:none;"}}<!--
-->{{#if:{{{cap|}}}{{{crystal|}}}{{{result|}}}||style="display:none;"}}<!--
there is a another complicated case: if an item is obtainable as a HQ from a synth, that page will list the recipe. But that needs to be removed from the table because the recipe will be listed under what is the NQ. The check for that is tricky because it needs to check that:
- HQ == this (cant detect pagename, need to use "this")
- result != HQ (because it might just be the same, e.g. items where the HQ is just more quantity)
and the same for HQ2 and HQ3


the occurences which are still in the table are then pages where "this" has not been used by the full name of the item. Because the .dpl template cannot check equality between a parameter and the page's name, there is no way to know whether we are looking at the recipe from the NQ page (stay in table) or the HQ page (should not be in table).


-->{{#ifeq:{{{hq result}}}|{{{result}}}||{{#ifeq:{{{hq result}}}|this|style="display:none;"}}}}<!--
-->{{#ifeq:{{{hq result}}}|{{{result}}}||{{#ifeq:{{{hq result}}}|this|style="display:none;"}}}}<!--
-->{{#ifeq:{{{hq 2 result}}}|{{{result}}}||{{#ifeq:{{{hq 2 result}}}|this|style="display:none;"}}}}<!--
-->{{#ifeq:{{{hq 2 result}}}|{{{result}}}||{{#ifeq:{{{hq 2 result}}}|this|style="display:none;"}}}}<!--
-->{{#ifeq:{{{hq 3 result}}}|{{{result}}}||{{#ifeq:{{{hq 3 result}}}|this|style="display:none;"}}}}
-->{{#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
Start output code
Line 29: 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 -->
|<!-- 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|}}}|&nbsp;x&nbsp;{{{ingredient quantity}}}}}</li><!--
<ul><li>[[{{{ingredient}}}]]{{#if:{{{ingredient quantity|}}}|&nbsp;x&nbsp;{{{ingredient quantity}}}}}</li><!--
Line 42: Line 38:
-->}}}}|''none''}}
-->}}}}|''none''}}
</onlyinclude></includeonly>
</onlyinclude></includeonly>
[[Category:DPL Phantom Templates]]
{{#dpl:
==Usage==
|category=Alchemy/Apprentice
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<!-- need to use +1 here because the additional linebreak at the beginning of the phantom template that is used to apply classes and styles to the rows somehow counts as a column here -->
===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

{{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>