Difference between revisions of "User:Darkid/Sandbox2/pt-br"

From Team Fortress Wiki
Jump to: navigation, search
(Created page with "<includeonly>{{Complex template|user=Darkid}}</includeonly> This template is used to display item stats similar to how they appear in-game. == Parameters == {| class="wikitab...")
 
Line 1: Line 1:
<includeonly>{{Complex template|user=Darkid}}</includeonly>
+
-- TODO: Missing features:
This template is used to display item stats similar to how they appear in-game.
+
-- Stat clocks: https://wiki.teamfortress.com/wiki/Civilian_Grade_Stat_Clock
 +
-- Halloween spells: https://www.youtube.com/watch?v=kA7K4jNnMmQ
 +
-- War paint prefix
 +
-- TODO: Update the golden frying pan (strange professional killstreak)
  
== Parameters ==
+
local p = {}
{| class="wikitable grid"
 
! width="15%" class="header" | Parameter
 
! width="35%" class="header" | Example
 
! class="header" | Description
 
|- <!-- This section is for parameters which effect the item name. -->
 
| {{code|item-name}}
 
| {{code|Batter's Helmet}}
 
| Proper item name in English (e.g. {{xt|Batter's Helmet}} instead of {{!xt|Casque de Batteur}}). The item name will be automatically translated on language subpages.
 
|-
 
| {{code|custom-name}}
 
| {{code|Spam Hammer}}
 
| Adds a custom name with quotation marks. Still needs {{code|item-name}} to produce the correct image.
 
|-
 
| {{code|no-custom-name-quotes}}
 
| {{code|yes}}
 
| Removes quotation marks from custom names if the {{code|custom-name}} field is used.
 
|-
 
| {{code|custom-icon}}
 
| {{code|File:User Username my item icon.png}}
 
| Adds a custom icon for users' own purposes. This parameter is independent from {{code|item-name}} parameter.
 
|-
 
| {{code|quality}}
 
| {{code|normal}}
 
| Defaults to "{{code|unique}}" (the standard item yellow). See [[Item quality]] for a list of accepted values.
 
|-
 
| {{code|prefix}}
 
| {{code|none}}<br />{{code|The Best}}
 
| Set to "none" to hide the "Vintage" or "Community", etc, prefix but keeping the colour. Can also use a custom value, e.g. "{{code|1=prefix = The Best}}" will generate "The Best Flare Gun".
 
|-
 
| {{code|suffix}}
 
| {{code|none}}<br />{{code|The Best}}
 
| Same as 'prefix' for non-en pages. Can also use a custom value, e.g. "{{code|1=suffix = The Best}}" will generate "Flare Gun The Best".
 
|-
 
| {{code|filter}}
 
| {{code|Coldfront}}
 
| Adds the appropriate [[Strange Filter]] prefix / suffix to the weapon.
 
|-
 
| {{code|paint-color}}
 
| {{code|Mann Co. Orange}}
 
| Adds the colored paint 'splat' specified to the top right of the item icon.
 
|-
 
| {{code|unusual-effect}}
 
| {{code|Bubbling}}
 
| Adds the Particle Effect icon to the top right of the item's icon. Also adds the "Unusual Effect:" line.
 
|-
 
| {{code|strange-icon}}
 
| {{code|yes}}
 
| Adds the Strange/StatTrack icon to the top right of the item's icon.
 
|-
 
| {{code|decal-icon}}
 
| {{code|yes}}
 
| Adds this [[:File:Paint_Splat_Decal.png|icon]] to the top right of the item's icon. Only used on the [[Items]] page.
 
|-
 
! style="text-align:left;" class="header" colspan="3" | ''Attributes''
 
|- <!-- This section is for parameters which modify the item description. -->
 
| {{code|item-level}}
 
| {{code|50}}
 
| Item level. Defaults to "<span class="att_level">1-100</span>".
 
|-
 
| {{code|item-kind}}
 
| {{code|Hat}}
 
| Item kind. This string is not automatically translated.
 
|-
 
| {{code|no-level}}
 
| {{code|yes}}
 
| Optional attribute. If "yes", item level will not be displayed.
 
|-
 
| {{code|limited}}
 
| {{code|yes}}
 
| Optional attribute. If "yes", the item name will be colored yellow, the word "Limited" will be added with a link to [[Limited Quantity]].
 
|-
 
| {{code|grade}}
 
| {{code|elite}}
 
| Optional attribute. If specified, the item name will be colored correctly for the grade, and the name of the grade will be added before the name, e.g.: Elite Grade Rocket Launcher. Valid options are <code>Civilian, Freelance, Mercenary, Commando, Assassin, Elite</code>
 
|-
 
| {{code|wear}}
 
| {{code|factory new}}
 
| Optional attribute, for decorated weapons. Listed in parenthesis after the item name, e.g.: Rocket Launcher (Factory New). Valid options are <code>Battle Scarred, Well-Worn, Field-Tested, Minimal Wear, Factory New.</code>
 
|-
 
| {{code|rankson}}
 
| {{code|Kills}}
 
| Primary stat method for a strange weapon.
 
|-
 
| {{code|killcount}}
 
| {{code|7616}}
 
| Number of kills for the primary rank method.
 
|-
 
| {{code|rankson2}}
 
| {{code|Kill assists}} or {{code|Damage dealt}}
 
| Secondary rank method '''or''' strange part. {{code|rankson3}} and {{code|rankson4}} work similarly.
 
|-
 
| {{code|killcount2}}
 
| {{code|12}}
 
| Number of kills for the secondary rank method '''or''' first strange part. {{code|killcount3}} and {{code|killcount4}} work similarly.
 
|-
 
|
 
<code>att-n-neutral</code><br />
 
<code>att-n-positive</code><br />
 
<code>att-n-negative</code>
 
|
 
<code>att-1-neutral = Cloak Type: Feign Death</code><br />
 
<code>att-2-positive = +80% cloak regen rate</code><br />
 
<code>att-3-negative = +60% cloak drain rate</code><br />
 
(See section on [[#Examples|examples]] below)
 
| Displays up to 8 positive, negative and neutral values.
 
|-
 
| {{code|item-description}}
 
| {{code|It doesn't matter how much people respect you when they're on fire.}}
 
| For items that have an in-game description. This displays the description in a smaller font in order to distinguish from neutral attributes. Will not display if a {{code|custom-description}} is set.
 
|-
 
| {{code|custom-description}}
 
| {{code|This hat is the greatest.}}
 
| For items that have a custom in-game description (from a [[Description Tag]]). Displays like a normal description but has quotation marks surrounding it.
 
|-
 
| {{code|gift-from}}
 
| {{code|Robin}}
 
| Display the source of a gifted item. Displays the text "<span class="att_positive">Gift from: Robin</span>"
 
|-
 
| {{code|date-received}}
 
| {{code|Mar 23, 2011 (06:30:00)}}
 
| Display the date a gifted item was received. Will not appear if no {{code|gift-from}} is defined. Displays the text "<span class="att_neutral">Date Received: Mar 23, 2011 (06:30:00)</span>"
 
|-
 
| {{code|item-expiration}}
 
| {{code|Dec 31, 2010 (23:00:00)}}
 
| For items that expire. Displays the text "<span class="att_negative">This item will expire on Dec 31, 2010 (23:00:00).</span>".
 
|-
 
| {{code|item-uses}}
 
| {{code|5}}
 
| For items that have "uses". Displays the text "<span class="att_uses">This is a limited item. Uses: 5</span>".
 
|-
 
| {{code|item-flags}}
 
| {{code|Not Tradable or Usable in Crafting}}
 
| For item flags. Displays them inside brackets: "<span class="att_flags">( Not Tradable or Usable in Crafting )</span>".
 
|-
 
| {{code|festivized}}
 
| {{code|yes}}
 
| For items which have been Festivized. Displays the text "<span style="color:#8650AC">Festivized</span>".
 
|-
 
! style="text-align:left;" class="header" colspan="3" | ''Styling''
 
|-
 
| {{code|width}}
 
| {{code|25%}}
 
| Width parameter. Defaults to {{code|100%}} in infoboxes, but for other usages, can be any value (%, px, pt, em).
 
|-
 
| {{code|style}}
 
|
 
| Style parameter. Can add any valid CSS style to the main div.
 
|-
 
|}
 
  
== Examples ==
+
require('Module:Backpack item/format')
{| class="wikitable grid"
 
! class="header" width="40%" | Code
 
! class="header" width="30%" | Old Output
 
! class="header" width="30%" | New Output
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Cloak and Dagger
 
| item-level = 5
 
| item-kind = Invis Watch
 
| att-1-neutral = Cloak Type: Feign Death
 
| att-2-positive = +80% cloak regen rate
 
| att-3-negative = +60% cloak drain rate
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Cloak and Dagger
 
| item-level = 5
 
| item-kind = Invis Watch
 
| att-1-neutral = Cloak Type: Feign Death
 
| att-2-positive = +80% cloak regen rate
 
| att-3-negative = +60% cloak drain rate
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Cloak and Dagger
 
| item-level = 5
 
| item-kind = Invis Watch
 
| att-1-neutral = Cloak Type: Feign Death
 
| att-2-positive = +80% cloak regen rate
 
| att-3-negative = +60% cloak drain rate
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Rocket Launcher
 
| custom-name = Rawket Lawnchair
 
| quality = vintage
 
| item-level = 50
 
| item-kind = Furniture
 
| att-1-positive = +20% additional comfort
 
| att-2-positive = +35% increase in lumbar support
 
| att-3-negative = +50% increase in financial hardship
 
| custom-description = For those who favour comfort over fiscal stability.
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Rocket Launcher
 
| custom-name = Rawket Lawnchair
 
| quality = vintage
 
| item-level = 50
 
| item-kind = Furniture
 
| att-1-positive = +20% additional comfort
 
| att-2-positive = +35% increase in lumbar support
 
| att-3-negative = +50% increase in financial hardship
 
| custom-description = For those who favour comfort over fiscal stability.
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Rocket Launcher
 
| custom-name = Rawket Lawnchair
 
| quality = vintage
 
| item-level = 50
 
| item-kind = Furniture
 
| att-1-positive = +20% additional comfort
 
| att-2-positive = +35% increase in lumbar support
 
| att-3-negative = +50% increase in financial hardship
 
| custom-description = For those who favour comfort over fiscal stability.
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Wiki Cap
 
| quality = community
 
| item-kind = Hat
 
| item-level = 20
 
| item-flags = Not Tradable or Usable in Crafting
 
| unusual-effect = Community Sparkle
 
| item-description = Given to valuable Community Contributors<br>Given to valuable contributors to the official TF2 Wiki<br><nowiki>http://wiki.teamfortress.com/</nowiki>
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Wiki Cap
 
| quality = community
 
| item-kind = Hat
 
| item-level = 20
 
| item-flags = Not Tradable or Usable in Crafting
 
| unusual-effect = Community Sparkle
 
| item-description = Given to valuable Community Contributors<br>Given to valuable contributors to the official TF2 Wiki<br><nowiki>http://wiki.teamfortress.com/</nowiki>
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Wiki Cap
 
| quality = community
 
| item-kind = Hat
 
| item-level = 20
 
| item-flags = Not Tradable or Usable in Crafting
 
| unusual-effect = Community Sparkle
 
| item-description = Given to valuable Community Contributors<br>Given to valuable contributors to the official TF2 Wiki<br><nowiki>http://wiki.teamfortress.com/</nowiki>
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Tux
 
| limited = yes
 
| item-kind = Mascot
 
| item-level = 1-100
 
| item-description = Linux represent!
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Tux
 
| limited = yes
 
| item-kind = Mascot
 
| item-level = 1-100
 
| item-description = Linux represent!
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Tux
 
| limited = yes
 
| item-kind = Mascot
 
| item-level = 1-100
 
| item-description = Linux represent!
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Citizen Pain
 
| item-kind = Minigun
 
| grade = Assassin
 
| wear = Battle Scarred
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Citizen Pain
 
| item-kind = Minigun
 
| grade = Assassin
 
| wear = Battle Scarred
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Citizen Pain
 
| item-kind = Minigun
 
| grade = Assassin
 
| wear = Battle Scarred
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = A Hat to Kill For
 
| item-kind = Hat
 
| grade = Civilian
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = A Hat to Kill For
 
| item-kind = Hat
 
| grade = Civilian
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = A Hat to Kill For
 
| item-kind = Hat
 
| grade = Civilian
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Medigun
 
| item-kind = Medi Gun
 
| quality = Strange
 
| strange-icon = yes
 
| rankson = Ubers
 
| killcount = 20
 
| rankson2 = Kill assists
 
| killcount2 = 300
 
| rankson3 = Allied Healing Done
 
| killcount3 = 10000
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Medigun
 
| item-kind = Medi Gun
 
| quality = Strange
 
| strange-icon = yes
 
| rankson = Ubers
 
| killcount = 20
 
| rankson2 = Kill assists
 
| killcount2 = 300
 
| rankson3 = Allied Healing Done
 
| killcount3 = 10000
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Medigun
 
| item-kind = Medi Gun
 
| quality = Strange
 
| strange-icon = yes
 
| rankson = Ubers
 
| killcount = 20
 
| rankson2 = Kill assists
 
| killcount2 = 300
 
| rankson3 = Allied Healing Done
 
| killcount3 = 10000
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Burstchester
 
| item-kind = Special Taunt
 
| rankson = Times Performed
 
| quality = Strange Unusual
 
| unusual-effect = Mega Strike
 
| grade = Assassin
 
| prefix = Taunt:
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Burstchester
 
| item-kind = Special Taunt
 
| quality = Strange Unusual
 
| rankson = Times Performed
 
| unusual-effect = Mega Strike
 
| grade = Assassin
 
| prefix = Taunt:
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Burstchester
 
| item-kind = Special Taunt
 
| quality = Strange Unusual
 
| rankson = Times Performed
 
| unusual-effect = Mega Strike
 
| grade = Assassin
 
| prefix = Taunt:
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Forest Fire
 
| item-kind = Flame Thrower
 
| quality = Strange
 
| grade = Mercenary
 
| wear = Well-Worn
 
| rankson = Kills
 
| killcount = 10
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Forest Fire
 
| item-kind = Flame Thrower
 
| quality = Strange
 
| grade = Mercenary
 
| wear = Well-Worn
 
| rankson = Kills
 
| killcount = 10
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Forest Fire
 
| item-kind = Flame Thrower
 
| quality = Strange
 
| grade = Mercenary
 
| wear = Well-Worn
 
| rankson = Kills
 
| killcount = 10
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Co-Pilot
 
| item-kind = Hat
 
| limited = yes
 
| quality = Strange
 
| rankson = points scored
 
| killcount = 75
 
| description = Winter 2014 Limited Community Cosmetic
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Co-Pilot
 
| item-kind = Hat
 
| limited = yes
 
| quality = Strange
 
| rankson = points scored
 
| killcount = 75
 
| description = Winter 2014 Limited Community Cosmetic
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Co-Pilot
 
| item-kind = Hat
 
| limited = yes
 
| quality = Strange
 
| rankson = points scored
 
| killcount = 75
 
| description = Winter 2014 Limited Community Cosmetic
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Sniper Rifle
 
| item-kind = Sniper Rifle
 
| quality = Strange
 
| strange-icon = yes
 
| filter = yukon
 
| rankson = kills
 
| killcount = 999
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Sniper Rifle
 
| item-kind = Sniper Rifle
 
| quality = Strange
 
| strange-icon = yes
 
| filter = yukon
 
| rankson = kills
 
| killcount = 999
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Sniper Rifle
 
| item-kind = Sniper Rifle
 
| quality = Strange
 
| strange-icon = yes
 
| filter = yukon
 
| rankson = kills
 
| killcount = 999
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Max's Severed Head
 
| item-kind = Hat
 
| limited = yes
 
| paint-color = Team Spirit
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Max's Severed Head
 
| item-kind = Hat
 
| limited = yes
 
| paint-color = Team Spirit
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Max's Severed Head
 
| item-kind = Hat
 
| limited = yes
 
| paint-color = Team Spirit
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Flare Gun
 
| item-kind = Flare Gun
 
| item-level = 10
 
| item-description = This weapon will reload when not active
 
| att-1-positive  = 100% critical hit vs burning players
 
| killstreak = professional // Killstreaks Active + changes prefix to "Professional Killstreak"
 
| killstreaker = Singularity // adds "Killstreaker: " line
 
| sheen = Hot Rod
 
}}
 
</pre>
 
|{{Backpack item
 
| item-name = Flare Gun
 
| item-kind = Flare Gun
 
| item-level = 10
 
| prefix = Professional Killstreak
 
| item-description = This weapon will reload when not active
 
| att-1-positive  = 100% critical hit vs burning players
 
| att-2-positive  = Killstreaker: Singularity
 
| att-3-positive  = Sheen: Hot Rod
 
| att-4-positive  = Killstreaks Active
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Flare Gun
 
| item-kind = Flare Gun
 
| item-level = 10
 
| prefix = Professional Killstreak
 
| item-description = This weapon will reload when not active
 
| att-1-positive  = 100% critical hit vs burning players
 
| att-2-positive  = Killstreaker: Singularity
 
| att-3-positive  = Sheen: Hot Rod
 
| att-4-positive  = Killstreaks Active
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| quality = normal
 
| item-name = Tomislav
 
| item-kind = Tomislav
 
| item-level = 1
 
| festivized = yes
 
}}
 
</pre>
 
|{{Backpack item
 
| quality = normal
 
| item-name = Tomislav
 
| item-kind = Tomislav
 
| item-level = 1
 
| festivized = yes
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| quality = normal
 
| item-name = Tomislav
 
| item-kind = Tomislav
 
| item-level = 1
 
| festivized = yes
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Jarate
 
| item-level = 5
 
| item-kind = Jar Based Karate
 
| gift-from = Darkid
 
| date-received = Wednesday, January 4, 2017
 
}}</pre>
 
|{{Backpack item
 
| item-name = Jarate
 
| item-level = 5
 
| item-kind = Jar Based Karate
 
| gift-from = Darkid
 
| date-received = Wednesday, January 4, 2017
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Jarate
 
| item-level = 5
 
| item-kind = Jar Based Karate
 
| gift-from = Darkid
 
| date-received = Wednesday, January 4, 2017
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Name Tag
 
| item-level = 1
 
| item-kind = Tool
 
| att-1-neutral = Changes the name of an item in your backpack
 
| item-uses = 1
 
| item-flags = Not Tradable or Marketable
 
}}</pre>
 
|{{Backpack item
 
| item-name = Name Tag
 
| item-level = 1
 
| item-kind = Tool
 
| att-1-neutral = Changes the name of an item in your backpack
 
| item-uses = 1
 
| item-flags = Not Tradable or Marketable
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Name Tag
 
| item-level = 1
 
| item-kind = Tool
 
| att-1-neutral = Changes the name of an item in your backpack
 
| item-uses = 1
 
| item-flags = Not Tradable or Marketable
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Heavy Costume Transmogrifier
 
| custom-icon = Backpack Costume Transmogrifier Heavy.png
 
| item-description = Using this transmogrifier on any Halloween 2013 costume piece will replace it with a costume piece wearable by Heavies.
 
| item-level = 1
 
| item-kind = Tool
 
| item-expiration = Monday, November 11, 2013 (6:00:00)
 
| item-uses = 1
 
}}</pre>
 
|{{Backpack item
 
| item-name = Heavy Costume Transmogrifier
 
| custom-icon = Backpack Costume Transmogrifier Heavy.png
 
| item-description = Using this transmogrifier on any Halloween 2013 costume piece will replace it with a costume piece wearable by Heavies.
 
| item-level = 1
 
| item-kind = Tool
 
| item-expiration = Monday, November 11, 2013 (6:00:00)
 
| item-uses = 1
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Heavy Costume Transmogrifier
 
| custom-icon = Backpack Costume Transmogrifier Heavy.png
 
| item-description = Using this transmogrifier on any Halloween 2013 costume piece will replace it with a costume piece wearable by Heavies.
 
| item-level = 1
 
| item-kind = Tool
 
| item-expiration = Monday, November 11, 2013 (6:00:00)
 
| item-uses = 1
 
}}
 
|-
 
|<pre>
 
{{#invoke:Backpack item|backpack_item
 
| item-name = Shotgun
 
| quality = Strange
 
| festivized = yes
 
| killstreak = professional
 
| filter = yukon
 
}}</pre>
 
|{{Backpack item
 
| item-name = Shotgun
 
| quality = Strange
 
| festivized = yes
 
| killstreak = professional
 
| filter = yukon
 
}}
 
|{{#invoke:Backpack item|backpack_item
 
| item-name = Shotgun
 
| quality = Strange
 
| festivized = yes
 
| killstreak = professional
 
| filter = yukon
 
}}
 
|}
 
  
== See also ==
+
-- Defined here so that it can be referenced inside the next function
{{Image insertion templates list}}
+
local frame = nil
  
<noinclude>[[Category:Template documentation|Backpack item]]</noinclude>
+
--[[ A more natural way to invoke templates in lua. Examples:
 +
  {{If lang}} -> template('If lang')
 +
  {{See also|Foo}} -> template('See also', 'Foo')
 +
  {{Hatnote|Foo|Bar}} -> template('Hatnote', {'Foo', 'Bar'})
 +
  {{Lang
 +
    | de = German
 +
    | en = English
 +
    | ru = Russian
 +
  }}
 +
  ->
 +
  template('Lang', {
 +
    ['de'] = 'German',
 +
    ['en'] = 'English',
 +
    ['ru'] = 'Russian',
 +
  }
 +
]]
 +
function template(title, args)
 +
  if type(args) == 'string' then
 +
    args = {args}
 +
  end
 +
  return frame:expandTemplate{title=title, args=args}
 +
end
 +
 
 +
-- Returns '(text)', with correct parenthesis characters in Chinese.
 +
function paren(text)
 +
  return template('Lang', {
 +
    -- English and default
 +
    ['en']      = '(' .. text .. ')',
 +
    ['zh-hans'] = '(' .. text .. ')',
 +
    ['zh-hant'] = '(' .. text .. ')',
 +
  })
 +
end
 +
 
 +
-- Colors are from styles in https://wiki.teamfortress.com/wiki/MediaWiki:Common.css
 +
local grade_colors = {
 +
  civilian  = 'B0C3D9',
 +
  freelance = '5E98D9',
 +
  mercenary = '4B69FF',
 +
  commando  = '8847FF',
 +
  assassin  = 'D32CE6',
 +
  elite    = 'EB4B4B',
 +
}
 +
 
 +
local quality_colors = {
 +
  normal        = 'B2B2B2',
 +
  unusual        = '8650AC',
 +
  vintage        = '476291',
 +
  unique        = 'FFD700',
 +
  community      = '70B04A',
 +
  valve          = 'A50F79',
 +
  ['self-made']  = '70B04A',
 +
  customized    = '476291',
 +
  genuine        = '4D7455',
 +
  strange        = 'CF6A32',
 +
  completed      = '8650AC',
 +
  haunted        = '38F3AB',
 +
  collectors    = 'C00000',
 +
  decorated      = 'FAFAFA',
 +
}
 +
 
 +
-- Potentially add the icon in the corner (paint splotch, unusual, pyroland, etc)
 +
function get_corner_icon(args)
 +
  local image
 +
  local image_link
 +
  if args['paint-color'] then
 +
    image = 'Paint Splat ' .. args['paint-color']
 +
    image_link = 'Paint Can'
 +
  elseif args['unusual-effect'] then
 +
    image = 'Viewmode unusual'
 +
    image_link = 'Unusual'
 +
  elseif args['decal-icon'] then
 +
    image = 'Paint Splat Decal'
 +
    image_link = 'Decal Tool'
 +
  elseif args['strange-icon'] then
 +
    image = 'Viewmode strange'
 +
    image_link = 'Strange'
 +
  elseif args['stat-icon'] then
 +
    image = 'Viewmode statclock'
 +
    image_link = 'Decorated'
 +
  elseif args['pyroland-icon'] then
 +
    image = 'Viewmode pyrovision'
 +
    image_link = 'Pyroland'
 +
  else -- Early exit if there's no icon, there's no reason to make an empty div
 +
    return ''
 +
  end
 +
 
 +
  local icon_begin = '<div style="width: 26px; height: 26px; ' .. template('Lang', {
 +
    ['ar'] = 'float: left; right: 86px;',
 +
    -- English and default
 +
    ['en'] = 'float: right; left: 86px;',
 +
  }) .. ' position: absolute; top: 6px;">'
 +
  local icon_end = '</div>'
 +
 
 +
  return icon_begin .. '[[File:' .. image .. '.png|25px|link=' .. image_link .. template('if lang') .. ']]' .. icon_end
 +
end
 +
 
 +
-- The main item image (and link)
 +
function get_main_image(args)
 +
  local image
 +
  local image_link = args['item-name']
 +
  if args['custom-icon'] then
 +
    image = args['custom-icon']
 +
    image_link = '{{{BASEPAGENAME}}'
 +
  elseif args['grade'] and args['wear'] then
 +
    image = 'Backpack ' .. args['item-name'] .. ' ' .. args['item-kind'] .. ' ' .. args['wear'] .. '.png'
 +
  elseif args['festivized'] then
 +
    image = 'Backpack Festivized ' .. args['item-name'] .. '.png'
 +
  elseif args['item-name'] then
 +
    image = 'Backpack ' .. args['item-name'] .. '.png'
 +
  else
 +
    image = 'Backpack Unknownweapon.png'
 +
  end
 +
 
 +
  local wikitext = '[[File:' .. image .. '|90x90px'
 +
  if args['file-link'] ~= nil then
 +
    wikitext = wikitext .. '|link=' .. image_link
 +
  end
 +
  return wikitext .. ']]'
 +
end
 +
 
 +
-- The color and font for the full name of the item
 +
function get_full_item_name_style(args)
 +
  local color
 +
  if args['custom-color'] then
 +
    color = args['custom-color']
 +
  elseif grade_colors[args['grade']] then
 +
    color = '#' .. grade_colors[args['grade']]
 +
  elseif quality_colors[args['quality']] then
 +
    color = '#' .. quality_colors[args['quality']]
 +
  else -- Default
 +
    color = '#' .. quality_colors['unique']
 +
  end
 +
 
 +
  local style = 'color: ' .. color .. '; font-size:18px; line-height:16px; text-shadow: 2px 1px 1px #24201B; font-family:'
 +
 
 +
  -- Specific fonts for some languages that aren't supported by the standard TF2 Build font.
 +
  style = style .. template('Lang', {
 +
    ['ar']      = 'مبنيات TF2, bold;',
 +
    -- English and default
 +
    ['en']      = 'TF2 Build, Verdana, Geneva, sans-serif;',
 +
    ['hu']      = 'Verdana, Geneva, sans-serif; font-weight: bold;',
 +
    ['ja']      = 'TF2 Build, Shin Go, Heisei Kaku Gothic W5; font-weight: bold;',
 +
    ['ko']      = 'Pathang, sans-serif, Totum, Kodig, serif; font-weight: bold;',
 +
    ['zh-hans'] = 'SimSum-18030, SimHei, serif; font-weight: bold;',
 +
    ['zh-hant'] = 'JhengHei, Verdana, JhengHei, JhengHei, sans-serif; font-weight: bold;',
 +
  })
 +
  return style
 +
end
 +
 
 +
-- The full name of the item, including any prefixes and suffixes
 +
function get_full_item_name(args)
 +
  -- Early exit if 'custom-name' is specified.
 +
  if args['custom-name'] then
 +
    if args['no-custom-name-quotes'] == 'yes' then
 +
      return args['custom-name']
 +
    else
 +
      return '"' .. args['custom-name'] .. '"'
 +
    end
 +
  end
 +
 
 +
  -- Step 2: Compute the strings
 +
  local festivized = ''
 +
  local filter = ''
 +
  local item_name = ''
 +
  local killstreak = ''
 +
  local quality = ''
 +
 
 +
  if args['festivized'] then
 +
    festivized = template('Decorated name', 'festivized')
 +
  end
 +
 
 +
  if args['filter'] then
 +
    filter = template('Item name', 'from ' .. args['filter'])
 +
  end
 +
 
 +
  if args['item-name-local'] then
 +
    item_name = args['item-name-local']
 +
  else
 +
    item_name = template('Item name', args['item-name'])
 +
  end
 +
 
 +
  -- TODO: killstreak string comes from somewhere, maybe it's directly in the template?
 +
  -- I can probably do better than that.
 +
  if args['killstreak'] then
 +
    killstreak = 'KILLSTREAK'
 +
  end
 +
 
 +
  if args['quality'] == 'unique' or args['quality'] == 'normal' then
 +
    -- Unique and Normal weapons do not have a quality name
 +
  elseif args['quality'] == 'strange' then
 +
    quality = template('Strange rank name', {['item-name']=args['item-name'], rankson=args['rankson'], kills=args['killcount']})
 +
  elseif args['quality'] ~= nil then
 +
    -- Not one of the above qualities, default to the quality name.
 +
    quality = template('Item name', args['quality'])
 +
  end
 +
 
 +
  return format_string(template('Lang', item_name_format), {
 +
    festivized=festivized,
 +
    filter=filter,
 +
    item_name=item_name,
 +
    killstreak=killstreak,
 +
    quality=quality,
 +
    prefix=args['prefix'],
 +
    suffix=args['suffix'],
 +
  })
 +
end
 +
 
 +
-- The full level of the item, including any strange suffixes, wears, grades, etc
 +
function get_full_item_level(args)
 +
  if args['no-level'] == 'yes' then
 +
    return ''
 +
  end
 +
 
 +
  -- Step 1: Precompute a bunch of language-aware strings
 +
  local limited = ''
 +
  local item_kind = ''
 +
  local grade = ''
 +
  local wear = ''
 +
  local rankson = ''
 +
  local strange_rank_name = ''
 +
  local item_level = ''
 +
 
 +
  if args['limited'] then
 +
    limited = '[[Limited Quantity' .. template('If lang') .. '|<span style="color:yellow; hover:yellow">' .. template('Common string', 'backpack item limited') .. '</span>]] '
 +
  end
 +
 
 +
  if args['item-kind'] then
 +
    item_kind = args['item-kind'] .. ' '
 +
  end
 +
 
 +
  if args['grade'] then
 +
    grade = template('Decorated name', args['grade'] .. ' grade') .. ' '
 +
  end
 +
 
 +
  if args['wear'] then
 +
    wear = paren(template('Decorated name', args['wear'])) .. ' '
 +
  end
 +
 
 +
  if args['rankson'] then
 +
    strange_rank_name = template('Strange rank name', {['item-name']=args['item-name'], rankson=args['rankson'], kills=args['killcount']}) .. ' '
 +
    rankson = '- ' .. template('Item name', args['rankson']) .. ': ' .. args['killcount'] .. ' '
 +
    for n = 2, 10 do
 +
      if args['rankson' .. n] then
 +
        if args['killcount' .. n] == nil then args['killcount' .. n] = 0 end
 +
        rankson = rankson .. '<br>' .. paren(template('Item name', args['rankson' .. n]) .. ': ' .. args['killcount' .. n])
 +
      end
 +
    end
 +
  end
 +
 
 +
  -- Adapted from WebAPI
 +
  -- Missing languages: de, fi, nl
 +
  -- Self translated: none
 +
  if args['item-level'] then
 +
    item_level = args['item-level']
 +
    if args['item-kind'] then
 +
      item_level = template('Common string', {'backpack item level', args['item-level']}) .. ' '
 +
    end
 +
  end
 +
 
 +
  -- Step 2: Allow individual languages to specify how to order the strings
 +
  -- Note that there are essentially three types of weapon levels: Strange, Grade/Wear, and default.
 +
 
 +
  local full_item_level;
 +
  if grade ~= '' then
 +
    -- Adapted from WebAPI
 +
    -- Missing translation: all
 +
    -- Self translated: none
 +
    -- TODO
 +
--[[
 +
    full_item_level = template('Lang', {
 +
      ['cs']      =
 +
      ['da']      =
 +
      ['de']      =
 +
      ['en']      = grade .. item_kind .. wear,
 +
      ['es']      =
 +
      ['fi']      =
 +
      ['fr']      =
 +
      ['hu']      =
 +
      ['it']      =
 +
      ['ja']      =
 +
      ['ko']      =
 +
      ['nl']      =
 +
      ['no']      =
 +
      ['pl']      =
 +
      ['pt']      =
 +
      ['pt-br']  =
 +
      ['ro']      =
 +
      ['ru']      =
 +
      ['sv']      =
 +
      ['tr']      =
 +
      ['zh-hans'] =
 +
      ['zh-hant'] =
 +
    })
 +
]]
 +
    full_item_level = grade .. item_kind .. wear
 +
  elseif strange_rank_name ~= '' then
 +
    assert(false, template('Lang', item_desc_format_strange) .. item_desc_format_strange);
 +
    full_item_level = format_string(template('Lang', item_desc_format_strange), {
 +
      limited=limited,
 +
      strange_rank_name=strange_rank_name,
 +
      item_kind=item_kind,
 +
      rankson=rankson,
 +
    })
 +
  else
 +
    -- Adapted from WebAPI
 +
    -- Missing translation: all
 +
    -- Self translated: none
 +
    -- TODO
 +
--[[
 +
    full_item_level = template('Lang', {
 +
      ['cs']      =
 +
      ['da']      =
 +
      ['de']      =
 +
      ['en']      = limited .. item_level .. item_kind,
 +
      ['es']      =
 +
      ['fi']      =
 +
      ['fr']      =
 +
      ['hu']      =
 +
      ['it']      =
 +
      ['ja']      =
 +
      ['ko']      =
 +
      ['nl']      =
 +
      ['no']      =
 +
      ['pl']      =
 +
      ['pt']      =
 +
      ['pt-br']  =
 +
      ['ro']      =
 +
      ['ru']      =
 +
      ['sv']      =
 +
      ['tr']      =
 +
      ['zh-hans'] =
 +
      ['zh-hant'] =
 +
    })
 +
]]
 +
    full_item_level = limited .. item_level .. item_kind
 +
  end
 +
 
 +
  -- Step 3: Add coloring for certain types
 +
  local color = '#756B5E'
 +
  if args['limited'] then
 +
    color = 'yellow'
 +
  elseif grade_colors[args['grade']] then
 +
    color = '#' .. grade_colors[args['grade']]
 +
  end
 +
 
 +
  return '<span style="color: ' .. color .. '">' .. full_item_level .. '</span>'
 +
end
 +
 
 +
function p.backpack_item(f)
 +
  frame = f
 +
  -- TODO: Trying this, it may not work.
 +
  local args = f.args
 +
  if #args == 0 then args = f.args end
 +
 
 +
  -- Setting some defaults for parameters
 +
  if args['width'] == nil then args['width'] = '100%' end
 +
  if args['style'] == nil then args['style'] = '' end
 +
  if args['killcount'] == nil then args['killcount'] = 0 end
 +
  if args['item-level'] == nil then args['item-level'] = '1-100' end
 +
 
 +
  -- Normalize some parameters
 +
  if args['quality'] ~= nil then args['quality'] = args['quality']:lower() end
 +
  if args['grade'] ~= nil then args['grade'] = args['grade']:lower() end
 +
  if args['no-custom-name-quotes'] ~= nil then args['no-custom-name-quotes'] = args['no-custom-name-quotes']:lower() end
 +
  if args['prefix'] ~= nil then args['prefix'] = args['prefix']:lower() end
 +
  if args['suffix'] ~= nil then args['suffix'] = args['suffix']:lower() end
 +
 
 +
  -- Define the div for the darker, background box with rounded corners
 +
  body = '<div style="text-align: center; background: #24201B; width: ' .. args['width'] .. '; -moz-border-radius: 10px; border-radius: 10px; padding:7px 0px; ' .. args['style'] .. '">'
 +
 
 +
  -- Add the div for the lighter, foreground box which holds the item image
 +
  -- TODO: <center>? This is probably not needed.
 +
  body = body .. '<center><div style="align:center; width: 120px; height: 90px; -moz-border-radius: 10px; border-radius: 10px; background: #3C362F; margin-bottom: 5px; border: 0px #847668 solid; position:relative;">'
 +
 
 +
  body = body .. get_corner_icon(args)
 +
  body = body .. get_main_image(args)
 +
 
 +
  -- End of foreground box
 +
  body = body .. '</div></center>'
 +
 
 +
  -- Add a transparent div for the text.
 +
  body = body .. '<div style="-moz-border-radius: 10px; border-radius: 10px; background: transparent; padding: 5px; margin: 0px 7px;">'
 +
 
 +
  -- Add the main item name (and style)
 +
  body = body .. '<span style="' .. get_full_item_name_style(args) .. '">' .. get_full_item_name(args) .. '</span>'
 +
 
 +
  -- Add a div for the secondary attributes
 +
  body = body .. '<div style="font-family: ' .. template('Lang', {
 +
  -- Specific fonts for some languages that aren't supported by the standard TF2 Secondary font. -->
 +
    ['en']      = 'TF2 Secondary, Verdana, Geneva, sans-serif;',
 +
    ['hu']      = 'Verdana, Genva, sans-serif; font-weight: bold;',
 +
    ['ja']      = 'TF2 Secondary, Shin Go, Heisei Kaku Gothic W5; font-weight: bold;',
 +
    ['ko']      = 'Pathang, sans-serif, Totum, Kodig, serif; font-weight: bold;',
 +
    ['zh-hans'] = 'SimSum-18030, SimHei, serif;',
 +
    ['zh-hant'] = 'JhengHei, JhengHei, sans-serif;',
 +
  }) .. 'font-size: 15px">'
 +
 
 +
  body = body .. get_full_item_level(args)
 +
 
 +
  -- TODO: Something legacy with strange-secondary and att-strangerank?
 +
 
 +
  if args['unusual-effect'] then
 +
    body = body .. '<br><font color="#8650AC">' .. template('Common string', {'backpack item unusual effect', args['unusual-effect']}) .. '</font>'
 +
  end
 +
 
 +
  for n = 1, 8 do
 +
    if args['att-' .. n .. '-positive'] then
 +
      body = body .. '<br><span class="att_positive">' .. args['att-' .. n .. '-positive'] .. '</span>'
 +
    elseif args['att-' .. n .. '-negative'] then
 +
      body = body .. '<br><span class="att_negative">' .. args['att-' .. n .. '-negative'] .. '</span>'
 +
    elseif args['att-' .. n .. '-neutral'] then
 +
      body = body .. '<br><span class="att_neutral">' .. args['att-' .. n .. '-neutral'] .. '</span>'
 +
    end
 +
  end
 +
 
 +
  if args['festivized'] then
 +
    body = body .. '<br><span style="color: #8650AC">' .. template('Common string', 'backpack item festivized') .. '</span>'
 +
  end
 +
  if args['killstreaker'] then
 +
    body = body .. '<br><span class="att_positive">' .. template('Common string', {'backpack item killstreaker', args['killstreaker']}) .. '</span>'
 +
  end
 +
  if args['sheen'] then
 +
    body = body .. '<br><span class="att_positive">' .. template('Common string', {'backpack item sheen', args['sheen']}) .. '</span>'
 +
  end
 +
  if args['killstreak'] then
 +
    body = body .. '<br><span class="att_positive">' .. template('Common string', 'backpack item killstreaks active') .. '</span>'
 +
  end
 +
 
 +
  local item_description
 +
  if args['custom-description'] then
 +
    item_description = '"' .. args['custom-description'] .. '"'
 +
  elseif args['item-description'] then
 +
    item_description = args['item-description']
 +
  end
 +
  if item_description ~= nil then
 +
    -- TODO: Span containing just an nbsp? Why?
 +
    body = body .. '<br><span style="line-height: 0.3em;">&nbsp;</span>'
 +
    body = body .. '<br><span class="att_neutral" style="line-height: 1.2em; font-size: 95%; width: 80%;">' .. item_description .. '</span>'
 +
  end
 +
 
 +
  if args['gift-from'] then
 +
    body = body .. '<br><br><span class="att_positive">' .. template('Common string', {'backpack item gift from', args['gift-from']}) .. '</span>'
 +
    if args['date-received'] then
 +
      body = body .. '<br><span class="att_neutral">' .. template('Common string', {'backpack item date received', args['date-received']}) .. '</span>'
 +
    end
 +
  end
 +
 
 +
  if args['item-expiration'] then
 +
    body = body .. '<br><br><span class="att_negative" style="line-height:1.2em; font-size:95%; width:80%;">' .. template('Common string', {'backpack item item expiration', args['item-expiration']}) .. '</span>'
 +
  end
 +
  if args['item-uses'] then
 +
    body = body .. '<br><br><span class="att_uses">' .. template('Common string', {'backpack item item uses', args['item-uses']}) .. '</span>'
 +
  end
 +
  if args['item-flags'] then
 +
    body = body .. '<br><br><span class="att_neutral">( ' .. args['item-flags'] .. ' )</span>'
 +
  end
 +
 
 +
  -- End of secondary attributes div
 +
  -- End of transparent div
 +
  -- End of darker, background box
 +
  body = body .. '</div></div></div>'
 +
 
 +
  return body
 +
end
 +
 
 +
return p

Revision as of 03:03, 13 June 2019

-- TODO: Missing features: -- Stat clocks: https://wiki.teamfortress.com/wiki/Civilian_Grade_Stat_Clock -- Halloween spells: https://www.youtube.com/watch?v=kA7K4jNnMmQ -- War paint prefix -- TODO: Update the golden frying pan (strange professional killstreak)

local p = {}

require('Module:Backpack item/format')

-- Defined here so that it can be referenced inside the next function local frame = nil

--[[ A more natural way to invoke templates in lua. Examples:

 /pt-br -> template('If lang')
Veja também: Foo

-> template('See also', 'Foo')

Foo

-> template('Hatnote', {'Foo', 'Bar'})

 English
 ->
 template('Lang', {
   ['de'] = 'German',
   ['en'] = 'English',
   ['ru'] = 'Russian',
 }

]] function template(title, args)

 if type(args) == 'string' then
   args = {args}
 end
 return frame:expandTemplate{title=title, args=args}

end

-- Returns '(text)', with correct parenthesis characters in Chinese. function paren(text)

 return template('Lang', {
   -- English and default
   ['en']      = '(' .. text .. ')',
   ['zh-hans'] = '(' .. text .. ')',
   ['zh-hant'] = '(' .. text .. ')',
 })

end

-- Colors are from styles in https://wiki.teamfortress.com/wiki/MediaWiki:Common.css local grade_colors = {

 civilian  = 'B0C3D9',
 freelance = '5E98D9',
 mercenary = '4B69FF',
 commando  = '8847FF',
 assassin  = 'D32CE6',
 elite     = 'EB4B4B',

}

local quality_colors = {

 normal         = 'B2B2B2',
 unusual        = '8650AC',
 vintage        = '476291',
 unique         = 'FFD700',
 community      = '70B04A',
 valve          = 'A50F79',
 ['self-made']  = '70B04A',
 customized     = '476291',
 genuine        = '4D7455',
 strange        = 'CF6A32',
 completed      = '8650AC',
 haunted        = '38F3AB',
 collectors     = 'C00000',
 decorated      = 'FAFAFA',

}

-- Potentially add the icon in the corner (paint splotch, unusual, pyroland, etc) function get_corner_icon(args)

 local image
 local image_link
 if args['paint-color'] then
   image = 'Paint Splat ' .. args['paint-color']
   image_link = 'Paint Can'
 elseif args['unusual-effect'] then
   image = 'Viewmode unusual'
   image_link = 'Unusual'
 elseif args['decal-icon'] then
   image = 'Paint Splat Decal'
   image_link = 'Decal Tool'
 elseif args['strange-icon'] then
   image = 'Viewmode strange'
   image_link = 'Strange'
 elseif args['stat-icon'] then
   image = 'Viewmode statclock'
   image_link = 'Decorated'
 elseif args['pyroland-icon'] then
   image = 'Viewmode pyrovision'
   image_link = 'Pyroland'
 else -- Early exit if there's no icon, there's no reason to make an empty div
   return 
 end

local icon_begin = '

' local icon_end = '

'

 return icon_begin .. '25px' .. icon_end

end

-- The main item image (and link) function get_main_image(args)

 local image
 local image_link = args['item-name']
 if args['custom-icon'] then
   image = args['custom-icon']
   image_link = '{Darkid/Sandbox2'
 elseif args['grade'] and args['wear'] then
   image = 'Backpack ' .. args['item-name'] .. ' ' .. args['item-kind'] .. ' ' .. args['wear'] .. '.png'
 elseif args['festivized'] then
   image = 'Backpack Festivized ' .. args['item-name'] .. '.png'
 elseif args['item-name'] then
   image = 'Backpack ' .. args['item-name'] .. '.png'
 else
   image = 'Backpack Unknownweapon.png'
 end
 local wikitext = 'link=' .. image_link   end   return wikitext .. ''

end

-- The color and font for the full name of the item function get_full_item_name_style(args)

 local color
 if args['custom-color'] then
   color = args['custom-color']
 elseif grade_colors[args['grade']] then
   color = '#' .. grade_colors[args['grade']]
 elseif quality_colors[args['quality']] then
   color = '#' .. quality_colors[args['quality']]
 else -- Default
   color = '#' .. quality_colors['unique']
 end
 local style = 'color: ' .. color .. '; font-size:18px; line-height:16px; text-shadow: 2px 1px 1px #24201B; font-family:'
 -- Specific fonts for some languages that aren't supported by the standard TF2 Build font.
 style = style .. template('Lang', {
   ['ar']      = 'مبنيات TF2, bold;',
   -- English and default
   ['en']      = 'TF2 Build, Verdana, Geneva, sans-serif;',
   ['hu']      = 'Verdana, Geneva, sans-serif; font-weight: bold;',
   ['ja']      = 'TF2 Build, Shin Go, Heisei Kaku Gothic W5; font-weight: bold;',
   ['ko']      = 'Pathang, sans-serif, Totum, Kodig, serif; font-weight: bold;',
   ['zh-hans'] = 'SimSum-18030, SimHei, serif; font-weight: bold;',
   ['zh-hant'] = 'JhengHei, Verdana, JhengHei, JhengHei, sans-serif; font-weight: bold;',
 })
 return style

end

-- The full name of the item, including any prefixes and suffixes function get_full_item_name(args)

 -- Early exit if 'custom-name' is specified.
 if args['custom-name'] then
   if args['no-custom-name-quotes'] == 'yes' then
     return args['custom-name']
   else
     return '"' .. args['custom-name'] .. '"'
   end
 end
 -- Step 2: Compute the strings
 local festivized = 
 local filter = 
 local item_name = 
 local killstreak = 
 local quality = 
 if args['festivized'] then
   festivized = template('Decorated name', 'festivized')
 end
 if args['filter'] then
   filter = template('Item name', 'from ' .. args['filter'])
 end
 if args['item-name-local'] then
   item_name = args['item-name-local']
 else
   item_name = template('Item name', args['item-name'])
 end
 -- TODO: killstreak string comes from somewhere, maybe it's directly in the template?
 -- I can probably do better than that.
 if args['killstreak'] then
   killstreak = 'KILLSTREAK'
 end
 if args['quality'] == 'unique' or args['quality'] == 'normal' then
   -- Unique and Normal weapons do not have a quality name
 elseif args['quality'] == 'strange' then
   quality = template('Strange rank name', {['item-name']=args['item-name'], rankson=args['rankson'], kills=args['killcount']})
 elseif args['quality'] ~= nil then
   -- Not one of the above qualities, default to the quality name.
   quality = template('Item name', args['quality'])
 end
 return format_string(template('Lang', item_name_format), {
   festivized=festivized,
   filter=filter,
   item_name=item_name,
   killstreak=killstreak,
   quality=quality,
   prefix=args['prefix'],
   suffix=args['suffix'],
 })

end

-- The full level of the item, including any strange suffixes, wears, grades, etc function get_full_item_level(args)

 if args['no-level'] == 'yes' then
   return 
 end
 -- Step 1: Precompute a bunch of language-aware strings
 local limited = 
 local item_kind = 
 local grade = 
 local wear = 
 local rankson = 
 local strange_rank_name = 
 local item_level = 
 if args['limited'] then
   limited = '' .. template('Common string', 'backpack item limited') .. ' '
 end
 if args['item-kind'] then
   item_kind = args['item-kind'] .. ' '
 end
 if args['grade'] then
   grade = template('Decorated name', args['grade'] .. ' grade') .. ' '
 end
 if args['wear'] then
   wear = paren(template('Decorated name', args['wear'])) .. ' '
 end
 if args['rankson'] then
   strange_rank_name = template('Strange rank name', {['item-name']=args['item-name'], rankson=args['rankson'], kills=args['killcount']}) .. ' '
   rankson = '- ' .. template('Item name', args['rankson']) .. ': ' .. args['killcount'] .. ' '
   for n = 2, 10 do
     if args['rankson' .. n] then
       if args['killcount' .. n] == nil then args['killcount' .. n] = 0 end
       rankson = rankson .. '
' .. paren(template('Item name', args['rankson' .. n]) .. ': ' .. args['killcount' .. n]) end end end
 -- Adapted from WebAPI
 -- Missing languages: de, fi, nl
 -- Self translated: none
 if args['item-level'] then
   item_level = args['item-level']
   if args['item-kind'] then
     item_level = template('Common string', {'backpack item level', args['item-level']}) .. ' '
   end
 end
 -- Step 2: Allow individual languages to specify how to order the strings
 -- Note that there are essentially three types of weapon levels: Strange, Grade/Wear, and default.
 local full_item_level;
 if grade ~=  then
   -- Adapted from WebAPI
   -- Missing translation: all
   -- Self translated: none
   -- TODO

--[[

   full_item_level = template('Lang', {
     ['cs']      =
     ['da']      =
     ['de']      =
     ['en']      = grade .. item_kind .. wear,
     ['es']      =
     ['fi']      =
     ['fr']      =
     ['hu']      =
     ['it']      =
     ['ja']      =
     ['ko']      =
     ['nl']      =
     ['no']      =
     ['pl']      =
     ['pt']      =
     ['pt-br']   =
     ['ro']      =
     ['ru']      =
     ['sv']      =
     ['tr']      =
     ['zh-hans'] =
     ['zh-hant'] =
   })

]]

   full_item_level = grade .. item_kind .. wear
 elseif strange_rank_name ~=  then
   assert(false, template('Lang', item_desc_format_strange) .. item_desc_format_strange);
   full_item_level = format_string(template('Lang', item_desc_format_strange), {
     limited=limited,
     strange_rank_name=strange_rank_name,
     item_kind=item_kind,
     rankson=rankson,
   })
 else
   -- Adapted from WebAPI
   -- Missing translation: all
   -- Self translated: none
   -- TODO

--[[

   full_item_level = template('Lang', {
     ['cs']      =
     ['da']      =
     ['de']      =
     ['en']      = limited .. item_level .. item_kind,
     ['es']      =
     ['fi']      =
     ['fr']      =
     ['hu']      =
     ['it']      =
     ['ja']      =
     ['ko']      =
     ['nl']      =
     ['no']      =
     ['pl']      =
     ['pt']      =
     ['pt-br']   =
     ['ro']      =
     ['ru']      =
     ['sv']      =
     ['tr']      =
     ['zh-hans'] =
     ['zh-hant'] =
   })

]]

   full_item_level = limited .. item_level .. item_kind
 end
 -- Step 3: Add coloring for certain types
 local color = '#756B5E'
 if args['limited'] then
   color = 'yellow'
 elseif grade_colors[args['grade']] then
   color = '#' .. grade_colors[args['grade']]
 end
 return '' .. full_item_level .. ''

end

function p.backpack_item(f)

 frame = f
 -- TODO: Trying this, it may not work.
 local args = f.args
 if #args == 0 then args = f.args end
 -- Setting some defaults for parameters
 if args['width'] == nil then args['width'] = '100%' end
 if args['style'] == nil then args['style'] =  end
 if args['killcount'] == nil then args['killcount'] = 0 end
 if args['item-level'] == nil then args['item-level'] = '1-100' end
 -- Normalize some parameters
 if args['quality'] ~= nil then args['quality'] = args['quality']:lower() end
 if args['grade'] ~= nil then args['grade'] = args['grade']:lower() end
 if args['no-custom-name-quotes'] ~= nil then args['no-custom-name-quotes'] = args['no-custom-name-quotes']:lower() end
 if args['prefix'] ~= nil then args['prefix'] = args['prefix']:lower() end
 if args['suffix'] ~= nil then args['suffix'] = args['suffix']:lower() end
 -- Define the div for the darker, background box with rounded corners

body = '

'
 -- Add the div for the lighter, foreground box which holds the item image
-- TODO:
? This is probably not needed. body = body .. '
'
 body = body .. get_corner_icon(args)
 body = body .. get_main_image(args)
 -- End of foreground box
body = body .. '
'
 -- Add a transparent div for the text.
body = body .. '
'
 -- Add the main item name (and style)
 body = body .. '' .. get_full_item_name(args) .. ''
 -- Add a div for the secondary attributes
body = body .. '
   ['en']      = 'TF2 Secondary, Verdana, Geneva, sans-serif;',
   ['hu']      = 'Verdana, Genva, sans-serif; font-weight: bold;',
   ['ja']      = 'TF2 Secondary, Shin Go, Heisei Kaku Gothic W5; font-weight: bold;',
   ['ko']      = 'Pathang, sans-serif, Totum, Kodig, serif; font-weight: bold;',
   ['zh-hans'] = 'SimSum-18030, SimHei, serif;',
   ['zh-hant'] = 'JhengHei, JhengHei, sans-serif;',
 }) .. 'font-size: 15px">'
 body = body .. get_full_item_level(args)
 -- TODO: Something legacy with strange-secondary and att-strangerank?
 if args['unusual-effect'] then
   body = body .. '
' .. template('Common string', {'backpack item unusual effect', args['unusual-effect']}) .. '' end
 for n = 1, 8 do
   if args['att-' .. n .. '-positive'] then
     body = body .. '
' .. args['att-' .. n .. '-positive'] .. '' elseif args['att-' .. n .. '-negative'] then body = body .. '
' .. args['att-' .. n .. '-negative'] .. '' elseif args['att-' .. n .. '-neutral'] then body = body .. '
' .. args['att-' .. n .. '-neutral'] .. '' end end
 if args['festivized'] then
   body = body .. '
' .. template('Common string', 'backpack item festivized') .. '' end if args['killstreaker'] then body = body .. '
' .. template('Common string', {'backpack item killstreaker', args['killstreaker']}) .. '' end if args['sheen'] then body = body .. '
' .. template('Common string', {'backpack item sheen', args['sheen']}) .. '' end if args['killstreak'] then body = body .. '
' .. template('Common string', 'backpack item killstreaks active') .. '' end
 local item_description
 if args['custom-description'] then
   item_description = '"' .. args['custom-description'] .. '"'
 elseif args['item-description'] then
   item_description = args['item-description']
 end
 if item_description ~= nil then
   -- TODO: Span containing just an nbsp? Why?
   body = body .. '
 ' body = body .. '
' .. item_description .. '' end
 if args['gift-from'] then
   body = body .. '

' .. template('Common string', {'backpack item gift from', args['gift-from']}) .. '' if args['date-received'] then body = body .. '
' .. template('Common string', {'backpack item date received', args['date-received']}) .. '' end end
 if args['item-expiration'] then
   body = body .. '

' .. template('Common string', {'backpack item item expiration', args['item-expiration']}) .. '' end if args['item-uses'] then body = body .. '

' .. template('Common string', {'backpack item item uses', args['item-uses']}) .. '' end if args['item-flags'] then body = body .. '

( ' .. args['item-flags'] .. ' )' end
 -- End of secondary attributes div
 -- End of transparent div
 -- End of darker, background box
body = body .. '

'

 return body

end

return p