Template:CritterMonths

From Nookipedia, the Animal Crossing wiki
Revision as of 21:44, January 9, 2021 by SuperHamster (talk | contribs) (Font weight fix)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template documentation (view)


This template may be used in critter tables (e.g. Fish/New Horizons) to display which months a critter is available. The purpose of this template is to avoid editors having to write HTML formatting themselves to achieve the desired effect; it also allows us to easily change the way we display month data, if ever desired.

Usage

The first parameter is to define the critter type.

  • type: Can be fish or bug. This sets the color for highlighted months.

There are two ways to input month data. You cannot mix both methods in the same template call.

The first way to define months is through start/end month parameters.

  • start: The first month that a critter is available (January, February, etc.)
  • end: The last month that a critter is available (January, February, etc.)
  • If there are two periods that a critter is available, start2/end2 and start3/end3 may be defined as well.

This method reads left to right and cannot circle back from December. This means that if a fish is available November through March, you need to define it as follows: {{CritterMonths|type=fish|start=January|end=March|start2=November|end2=December}}

For New Leaf, some critters are available for half of August or September. For these, the parameters August-First-Half, August-Second-Half, September-First-Half, and September-Second-Half are also supported.

The second way is through defining individual months with parameters named m1, m2, etc. This method requires you to define every month parameter, but only input text (e.g. y) for the months you want to highlight. Example: {{CritterMonths|type=bug|m1=y|m2=y|m3=y|m4=|m5=|m6=|m7=|m8=|m9=|m10=|m11=y|m12=y}}

For New Leaf, instead of defining m8 and m9, we use m81, m82, m91, and m92, to account for critters available for only half of August or September: {{CritterMonths|type=bug|m1=y|m2=y|m3=y|m4=|m5=|m6=|m7=|m81=y|m82=|m91=|m92=y|m10=|m11=y|m12=y}}

Examples

Fish from November through March: {{CritterMonths|type=fish|start=January|end=March|start2=November|end2=December}}

JFMAMJJASOND


Bug from November through March: {{CritterMonths|type=bug|m1=y|m2=y|m3=y|m4=|m5=|m6=|m7=|m8=|m9=|m10=|m11=y|m12=y}}

JFMAMJJASOND


Fish from April through July: {{CritterMonths|type=fish|start=April|end=July}}

JFMAMJJASOND


Fish only in December: {{CritterMonths|type=fish|start=December|end=December}}

JFMAMJJASOND


Sea Creature from July through the first half of September: {{CritterMonths|type=fish|start=July|end=September-First-Half}}

JFMAMJJASOND


Bug all year round: {{CritterMonths|type=bug|start=January|end=December}}

JFMAMJJASOND

Technical

Th template source is not the prettiest. It also resides on one line, due to new lines causing formatting issues within tables.

While the code looks long, the base logic is actually fairly simple:

  • If start or start2 is set to January, add the following, which sets a color and bolds any following text:
<span style="font-weight: 600; color: {{#switch: {{{type|}}} | fish = #50b3d4 | insect = #77AC3F }}">
  • Insert the letter for the corresponding month (for January, that is J)
  • If end or end2 is set to Month, close the span with </span>
  • Repeat for each of the following months.