Template:Maps/docs

From MHWiki
< Template:Maps
Revision as of 01:34, 23 June 2021 by B.Tay (talk | contribs) (Added details regarding parameters in Transclusion Sample + comments reminding editors to update {{MAPS}} and MOS - Maps when an edit is done on this page)

Usage

Transclusion Sample

  • To maintain consistency between Treasure Map pages, please copy-paste the following transclusion sample below into the edit sections of Treasure Map pages and adjust the parameter values accordingly (enter in the value one space to the right after the equal sign as shown below).
  • Do remember to use the Show preview button in the edit screen to check whether the Template Sample is as desired!
  • The following details should be noted regarding the parameters:
    • "subgroup1": This is (currently) always "Adventuring Items", please fill that in.
    • "subgroup2/3/4": These are usually empty and are there just in case we have some extra categorisation in the future.
    • "hunters": The most common number here is 5 but there's also 2/4/6/10 as possibilities.
    • "mice": This should follow the format of [[#Treasure Map|Number]], the internal link jumps to the mice list within the treasure map page.
    • "rankacquire/join": Pretty self explanatory, use phrases "<br/>and above" or "<br/>and below" or "<br/>through<br/>" to avoid excessive linking to the various ranks.
    • "reward": This should follow the format of [[#Treasure Chest|ABC Treasure Chest]]<br/>[[#Treasure Chest|Rare ABC Rift Treasure Chest]], the internal link jumps to the rewards list within the treasure map page.
    • "case/source/cost": Pretty self explanatory, make sure to check that your links and/or redirects are in order.
    • "mhinfo/imglink/desc": Use the info from the Larry's Loot Lexicon link of the Scroll Case (Treasure Maps themselves are not inventory items).
    • "mhinfo": List only the portion of the Larry's Loot Lexicon link after the "item_type=" in the link. For example, Treasure Map Scroll Case would list "mhinfo = treasure_map_scroll_case_convertible".
    • "altmhinfo": Only used when "mhinfo" is insufficient for the info required in the infobox.
    • "imglink": Please use the {{MHdomain}} template here and remove any of the "?cv=number" at the end of the links (the links should end with the file format, usually gif or png).
    • "altimglink": Only used when "imglink" is insufficient for the info required in the infobox.
{{Maps
 | subgroup1   = Adventuring Items
 | subgroup2   = 
 | subgroup3   = 
 | subgroup4   = 
 | hunters     = Number
 | mice        = [[#Treasure Map|Number]]
 | rankacquire = [[Rank]]<br/>and above
 | rankjoin    = [[Rank]]<br/>and above
 | reward      = [[#Treasure Chest|ABC Treasure Chest]]<br/>[[#Treasure Chest|Rare ABC Rift Treasure Chest]]
 | case        = [[ABC Scroll Case]]
 | source      = [[ABC Cartographer]]
 | cost        = Number [[Ancient Relic]]
 | mhinfo      = abc_scroll_case_convertible
 | altmhinfo   = 
 | imglink     = {{MHdomain}}/images/items/convertibles/randomnumbersandletters.gif
 | altimglink  = 
 | desc        = Words words words
 }}

Transclusion Sample: Notes

Please note the following should you need to adjust the transclusion sample in the future:

  • There are no spaces between the left border and the opening braces " {{ " as well as ending braces " }} ".
  • There is one space between the left border and the pipe character " | ".
  • There is one space between the pipe character and the start of the named parameters.
  • The named parameters should follow the order as per the Template Sample. Do note that they are also case-sensitive.
  • The equal signs " = " are all aligned in such a way that they are all one space to the right of the longest named parameter (currently rankacquire but subject to change in the future).
  • Parameter values are entered one space to the right after the equal sign as shown above.

This is to maintain a clean look for editors to view when editing content pages: start and end of transclusion from template clearly highlighted, named parameters aligned and ordered neatly, parameter values are aligned and easy to edit at a glance.

Further Illustration

It is assumed in this section that you understand how Template:Use and Template:If works. You are also assumed to have generally understood how Tables and Templates work.

Template: Raw Code

Please remember to change this accordingly if you have changed the template itself!

{| align="left" cellpadding="5" width="400" style="border:2px solid #32CD32; border-top:25px solid #32CD32; border-spacing:0; margin-left:20px; margin-bottom:20px; padding:5px;"
|-
 ! colspan="2" style="font-size:150%;"                                                                                    | {{PAGENAME}}
|-
 ! colspan="2" style="border-style: solid; border-width: 2px 2px 2px 2px; font-size:125%;" bgcolor=LawnGreen              | {{if|{{{subgroup2|}}}|Categories:|Category:}} {{{subgroup1|??}}}{{if|{{{subgroup2|}}}|, {{{subgroup2}}}|}}{{if|{{{subgroup3|}}}|, {{{subgroup3}}}|}}{{if|{{{subgroup4|}}}|, {{{subgroup4}}}|}}
|-
 ! colspan="2" width="400"                                                                                                |
|-
 ! colspan="2" width="400" style="border-style: solid; font-size:110%; border-width: 2px 2px 2px 2px;" bgcolor=LawnGreen  | Map Info
|-
 | nowrap align="left"  style="border-style: solid; border-width:  0px 0px 0px 2px"                                       | '''Max Number of Hunters:'''
 | nowrap align="right" style="border-style: solid; border-width:  0px 2px 0px 0px"                                       | {{{hunters|??}}}
|- 
 | nowrap align="left"  style="border-style: solid; border-width:  0px 0px 0px 2px"                                       | '''Number of Mice:'''
 | nowrap align="right" style="border-style: solid; border-width:  0px 2px 0px 0px"                                       | {{{mice|??}}}
|- 
 | nowrap align="left"  style="border-style: solid; border-width:  0px 0px 0px 2px"                                       | '''Rank to Acquire:'''
 | nowrap align="right" style="border-style: solid; border-width:  0px 2px 0px 0px"                                       | {{{rankacquire|??}}} 
|- 
 | nowrap align="left"  style="border-style: solid; border-width:  0px 0px 0px 2px"                                       | '''Rank to Join:'''
 | nowrap align="right" style="border-style: solid; border-width:  0px 2px 0px 0px"                                       | {{{rankjoin|??}}} 
|- 
 | nowrap align="left"  style="border-style: solid; border-width:  0px 0px 2px 2px"                                       | '''Reward Chest:'''
 | nowrap align="right" style="border-style: solid; border-width:  0px 2px 2px 0px"                                       | {{{reward|??}}}
|- 
 ! colspan="2" width="400"                                                                                                |
|-
 ! colspan="2" width="400" style="border-style: solid; font-size:110%; border-width: 2px 2px 2px 2px;" bgcolor=LawnGreen  | Scroll Case Info
|-
 | nowrap align="left"  style="border-style: solid; border-width:  0px 0px 0px 2px"                                       | '''Scroll Case:'''
 | nowrap align="right" style="border-style: solid; border-width:  0px 2px 0px 0px"                                       | {{{case|??}}}
|-
 | nowrap align="left"  style="border-style: solid; border-width:  0px 0px 0px 2px"                                       | '''Scroll Case Source:'''
 | nowrap align="right" style="border-style: solid; border-width:  0px 2px 0px 0px"                                       | {{{source|??}}} 
|-
 | nowrap align="left"  style="border-style: solid; border-width:  0px 0px 0px 2px"                                       | '''Cost:''' 
 | nowrap align="right" style="border-style: solid; border-width:  0px 2px 0px 0px"                                       | {{{cost|??}}}
|- 
 | nowrap align="left"  style="border-style: solid; border-width:  2px 0px 2px 2px"                                       | '''Larry's Loot Lexicon:'''  
 | nowrap align="right" style="border-style: solid; border-width:  2px 2px 2px 0px"                                       | {{if|1={{{mhinfo|}}}|2=[{{MHdomain}}/item.php?item_type={{{mhinfo}}} MouseHunt Info Page]|3={{{altmhinfo|??}}}}}
|- 
 | nowrap align="left"  style="border-style: solid; border-width:  0px 0px 2px 2px"                                       | '''Image:''' 
 | nowrap align="right" style="border-style: solid; border-width:  0px 2px 2px 0px"                                       | {{if|{{{imglink|}}}|[{{{imglink}}} External Link]|{{{altimglink|??}}}}}
|- 
 | colspan="2" align="center" style="font-size:110%; padding:10px;"                                                       | {{{desc|??}}}
|}
{{-}}
{{if|{{NAMESPACE}}||[[Category:Treasure Maps]]}}

Template: Notes

  • If it ain't broke, don't fix it: it is known that some of the attributes aren't exactly the cleanest when it comes to coding, for instance, the table attribute "align=left" is unneeded as the table alignment is already determined by the "margin-left" attribute. However, unless you are sufficiently skilled in coding and know what you're doing, please do NOT tamper around with the attributes.
  • Consider other editors too: the spacing as shown in the raw code above is done on purpose to help editors understand at a glance where each row and cell value starts at. If at any point of time you change something, please also check the spacing to make sure that editors in the future will appreciate your work!
  • Most of the cell values should be pretty understandable at a glance (please refer to the links given above if you don't), though a few that are slightly more complicated are explained below:
    • {{if|{{{subgroup2|}}}|Categories:|Category:}} {{{subgroup1|??}}}{{if|{{{subgroup2|}}}|, {{{subgroup2}}}|}}{{if|{{{subgroup3|}}}|, {{{subgroup3}}}|}}{{if|{{{subgroup4|}}}|, {{{subgroup4}}}|}}
      • If the "subgroup2" parameter contains text, then "Categories:" will be used, otherwise, "Category:" will be used (presumably only max one subgroup if there's no subgroup2).
      • "subgroup1" parameter's text will be listed first: if there's none, "??" will be shown (this shouldn't be the case though since all Treasure Maps have the subgroup of "Adventuring Items").
      • If the "subgroup2/3/4" parameter contains text (let's called this ABC for instance), then ", ABC" will be shown, otherwise nothing happens.
    • {{if|1={{{mhinfo|}}}|2=[{{MHdomain}}/item.php?item_type={{{mhinfo}}} MouseHunt Info Page]|3={{{altmhinfo|??}}}}}
      • If the "mhinfo" parameter contains text, that text will be treated and labelled as an external link, otherwise the "altmhinfo" parameter's text will be shown. If "altmhinfo" parameter is also empty, then "??" will be shown.
      • "mhinfo" is sufficient for most Larry's Loot Lexicon links, though "altmhinfo" can be used in the case that the devs have some weird item where the link doesn't follow the one stated in the code above. Remember to link manually if so!
      • The reason why the parameters are numbered specifically in this code is because of the extra "=" sign in the second parameter, which breaks the way the parser interprets the template if anonymous parameters were used. See this.
    • {{if|{{{imglink|}}}|[{{{imglink}}} External Link]|{{{altimglink|??}}}}}
      • If the "imglink" parameter contains text, that text will be treated and labelled as an external link, otherwise, the "altimglink" parameter's text will be shown. If "altimglink" parameter is also empty, then "??" will be shown.
      • "imglink" is sufficient for most images, however, it has one major limitation where it only accepts one image link. "altimglink" is provided as a backup plan, though you should remember to do the linking manually when it is used.
    • {{if|{{NAMESPACE}}||[[Category:Treasure Maps]]}}
      • If the page is in the main namespace (i.e. it is a content page), the page is tagged with the "Treasure Maps" category, otherwise, nothing happens.
      • This code is to simply automate expected page categorisation.