mNo edit summary |
(Replacing Tooltips.getIcon() with Tooltips.getFullTooltip()) |
||
(28 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
-- <nowiki> |
-- <nowiki> |
||
+ | local Math = require([[Module:Math]]) |
||
+ | local Polarity = require([[Module:Polarity]]) |
||
+ | local Tooltip = require([[Module:Tooltips]]) |
||
+ | |||
local function override(arg) |
local function override(arg) |
||
return arg and arg..'[[Category:InfoboxOverride]]' |
return arg and arg..'[[Category:InfoboxOverride]]' |
||
Line 6: | Line 10: | ||
return { |
return { |
||
buildInfobox = function(frame) |
buildInfobox = function(frame) |
||
− | local args = |
+ | local args = frame.args; |
− | local name = args[' |
+ | local name = args['Name']; |
− | local |
+ | local warframe = {} |
− | if args[' |
+ | if args['Conclave'] == 'false' then |
− | + | warframe = mw.loadData([[Module:Warframes/data]]).Warframes[name]; |
|
else |
else |
||
− | + | warframe = mw.loadData([[Module:Warframes/Conclave/data]]).Warframes[name]; |
|
end |
end |
||
Line 19: | Line 23: | ||
:tag('title') |
:tag('title') |
||
:tag('default') |
:tag('default') |
||
+ | :tag('b'):wikitext(name..'[[Category:'..name..']][[Category:Warframes]]'):done() |
||
− | :tag('b') |
||
− | :wikitext(name) |
||
⚫ | |||
:done() |
:done() |
||
:done() |
:done() |
||
− | :tag('image') |
+ | :tag('image'):attr('source', 'Image') |
+ | :tag('default'):wikitext(warframe.Image or 'Panel.png'):done() |
||
⚫ | |||
− | :tag('default') |
||
− | :wikitext(override(args.image) or data.Image or 'Panel.png') |
||
⚫ | |||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'Sex') |
− | : |
+ | :tag('label'):wikitext('Sex'):done() |
+ | :tag('default'):wikitext(warframe.Sex and (name ~= 'Xaku' and warframe.Sex..'[[Category:'..warframe.Sex..'s]]' or warframe.Sex..'[[Category:'..warframe.Sex..']]')):done() |
||
− | :tag('label') |
||
⚫ | |||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.mastery) or data.Mastery or '0') |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'Mastery') |
⚫ | |||
⚫ | |||
+ | :tag('default'):wikitext(warframe.Mastery or '0'):done() |
||
− | :tag('label') |
||
⚫ | |||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.health) or data.Health) |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'Health') |
⚫ | |||
⚫ | |||
+ | :tag('default'):wikitext(warframe.Health and warframe.Health..' ('..(warframe.HealthRank30 or warframe.Health*3)..' at R30)'):done() |
||
− | :tag('label') |
||
⚫ | |||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.shieldcapacity) or data.Shield) |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'Shield') |
− | : |
+ | :tag('label'):wikitext('[[Shield]]'):done() |
+ | :tag('default'):wikitext(warframe.Shield and warframe.Shield..' ('..(warframe.ShieldRank30 or warframe.Shield*3)..' at R30)'):done() |
||
− | :tag('label') |
||
− | :wikitext('[[Armor]]') |
||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.armor) or data.Armor) |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'Armor') |
⚫ | |||
⚫ | |||
+ | :tag('default'):wikitext(warframe.ArmorRank30 and warframe.Armor..' ('..warframe.ArmorRank30..' at R30)' or warframe.Armor):done() |
||
− | :tag('label') |
||
⚫ | |||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.powercapacity) or data.Energy) |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'Energy') |
⚫ | |||
− | :attr('source', 'sprintspeed') |
||
+ | :tag('default'):wikitext(warframe.Energy and warframe.Energy..' ('..(warframe.EnergyRank30 or Math.round(warframe.Energy*1.5, 0.1))..' at R30)'):done() |
||
− | :tag('label') |
||
⚫ | |||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.sprintspeed) or data.Sprint) |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'Sprint') |
⚫ | |||
− | :attr('source', 'mobility') |
||
− | :tag(' |
+ | :tag('default'):wikitext(warframe.Sprint):done() |
⚫ | |||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.mobility) or data.Mobility) |
||
− | :done() |
||
:done() |
:done() |
||
⚫ | |||
− | |||
⚫ | |||
− | local str = '' |
||
+ | :tag('default'):wikitext(warframe.Mobility):done() |
||
− | for i, v in ipairs(data.Polarities) do |
||
− | str = str..'{{Icon|Pol|'..v..'}}' |
||
− | end |
||
− | |||
− | local pols = mw.html.create('data') |
||
− | :attr('source', 'polarities') |
||
− | :tag('label') |
||
⚫ | |||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.polarities) or str or 'None') |
||
− | :done() |
||
− | |||
− | infobox:node(pols) |
||
− | :tag('data') |
||
− | :attr('source', 'exiluspolarity') |
||
− | :tag('label') |
||
⚫ | |||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.exiluspolarity) or (data.ExilusPolarity and '{{Icon|Pol|'..data.ExilusPolarity..'}}') or 'None') |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'AuraPolarity') |
⚫ | |||
− | :attr('source', 'aurapolarity') |
||
+ | :tag('default'):wikitext(warframe.AuraPolarity and Polarity._polarity(warframe.AuraPolarity) or 'None'):done() |
||
− | :tag('label') |
||
⚫ | |||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.aurapolarity) or (data.AuraPolarity and '{{Icon|Pol|'..data.AuraPolarity..'}}') or 'None') |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'ExilusPolarity') |
⚫ | |||
− | :attr('source', 'introduced') |
||
+ | :tag('default'):wikitext(warframe.ExilusPolarity and Polarity._polarity(warframe.ExilusPolarity) or 'None'):done() |
||
− | :tag('label') |
||
− | :wikitext('Introduced') |
||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.introduced) or '{{ver|'..data.Introduced..'}}') |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'Polarities') |
⚫ | |||
− | :attr('source', 'themes') |
||
+ | :tag('default'):wikitext(Polarity._pols(warframe.Polarities)):done() |
||
− | :tag('label') |
||
− | :wikitext('Themes') |
||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.themes) or data.Themes) |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'Introduced') |
− | : |
+ | :tag('label'):wikitext('Introduced'):done() |
+ | :tag('default'):wikitext(warframe.Introduced and '{{ver|'..warframe.Introduced..'}}'):done() |
||
− | :tag('label') |
||
⚫ | |||
− | :done() |
||
− | :tag('default') |
||
− | :wikitext(override(args.progenitor) or data.Progenitor) |
||
− | :done() |
||
:done() |
:done() |
||
− | :tag('data') |
+ | :tag('data'):attr('source', 'Themes') |
− | : |
+ | :tag('label'):wikitext('Themes'):done() |
− | :tag(' |
+ | :tag('default'):wikitext(warframe.Themes):done() |
⚫ | |||
⚫ | |||
⚫ | |||
− | :done() |
||
⚫ | |||
− | :tag('default') |
||
+ | :tag('default'):wikitext(warframe.Progenitor and Tooltip.getFullTooltip(warframe.Progenitor, 'DamageTypes')):done() |
||
− | :wikitext(override(args.subsumed) or data.Subsumed and '{{A|'..data.Subsumed..'}}') |
||
− | + | :done() |
|
⚫ | |||
⚫ | |||
+ | :tag('default'):wikitext(warframe.Subsumed and Tooltip.getFullTooltip(warframe.Subsumed, 'Ability')):done() |
||
⚫ | |||
⚫ | |||
+ | :tag('label'):wikitext('Internal Name'):done() |
||
+ | :tag('default'):wikitext(warframe.InternalName and '<code>'..warframe.InternalName..'</code>' or nil):done() |
||
:done() |
:done() |
||
Revision as of 19:35, 15 September 2021
Documentation for this module may be created at Module:Warframes/infobox/doc
-- <nowiki>
local Math = require([[Module:Math]])
local Polarity = require([[Module:Polarity]])
local Tooltip = require([[Module:Tooltips]])
local function override(arg)
return arg and arg..'[[Category:InfoboxOverride]]'
end
return {
buildInfobox = function(frame)
local args = frame.args;
local name = args['Name'];
local warframe = {}
if args['Conclave'] == 'false' then
warframe = mw.loadData([[Module:Warframes/data]]).Warframes[name];
else
warframe = mw.loadData([[Module:Warframes/Conclave/data]]).Warframes[name];
end
local infobox = mw.html.create('infobox')
:tag('title')
:tag('default')
:tag('b'):wikitext(name..'[[Category:'..name..']][[Category:Warframes]]'):done()
:done()
:done()
:tag('image'):attr('source', 'Image')
:tag('default'):wikitext(warframe.Image or 'Panel.png'):done()
:done()
:tag('data'):attr('source', 'Sex')
:tag('label'):wikitext('Sex'):done()
:tag('default'):wikitext(warframe.Sex and (name ~= 'Xaku' and warframe.Sex..'[[Category:'..warframe.Sex..'s]]' or warframe.Sex..'[[Category:'..warframe.Sex..']]')):done()
:done()
:tag('data'):attr('source', 'Mastery')
:tag('label'):wikitext('[[Mastery Rank]]'):done()
:tag('default'):wikitext(warframe.Mastery or '0'):done()
:done()
:tag('data'):attr('source', 'Health')
:tag('label'):wikitext('[[Health]]'):done()
:tag('default'):wikitext(warframe.Health and warframe.Health..' ('..(warframe.HealthRank30 or warframe.Health*3)..' at R30)'):done()
:done()
:tag('data'):attr('source', 'Shield')
:tag('label'):wikitext('[[Shield]]'):done()
:tag('default'):wikitext(warframe.Shield and warframe.Shield..' ('..(warframe.ShieldRank30 or warframe.Shield*3)..' at R30)'):done()
:done()
:tag('data'):attr('source', 'Armor')
:tag('label'):wikitext('[[Armor]]'):done()
:tag('default'):wikitext(warframe.ArmorRank30 and warframe.Armor..' ('..warframe.ArmorRank30..' at R30)' or warframe.Armor):done()
:done()
:tag('data'):attr('source', 'Energy')
:tag('label'):wikitext('[[Energy Capacity|Energy]]'):done()
:tag('default'):wikitext(warframe.Energy and warframe.Energy..' ('..(warframe.EnergyRank30 or Math.round(warframe.Energy*1.5, 0.1))..' at R30)'):done()
:done()
:tag('data'):attr('source', 'Sprint')
:tag('label'):wikitext('[[Sprint Speed]]'):done()
:tag('default'):wikitext(warframe.Sprint):done()
:done()
:tag('data'):attr('source', 'Mobility')
:tag('label'):wikitext('Mobility'):done()
:tag('default'):wikitext(warframe.Mobility):done()
:done()
:tag('data'):attr('source', 'AuraPolarity')
:tag('label'):wikitext('[[Aura|Aura Polarity]]'):done()
:tag('default'):wikitext(warframe.AuraPolarity and Polarity._polarity(warframe.AuraPolarity) or 'None'):done()
:done()
:tag('data'):attr('source', 'ExilusPolarity')
:tag('label'):wikitext('[[Exilus Adapter|Exilus Polarity]]'):done()
:tag('default'):wikitext(warframe.ExilusPolarity and Polarity._polarity(warframe.ExilusPolarity) or 'None'):done()
:done()
:tag('data'):attr('source', 'Polarities')
:tag('label'):wikitext('[[Mods#Polarity|Polarities]]'):done()
:tag('default'):wikitext(Polarity._pols(warframe.Polarities)):done()
:done()
:tag('data'):attr('source', 'Introduced')
:tag('label'):wikitext('Introduced'):done()
:tag('default'):wikitext(warframe.Introduced and '{{ver|'..warframe.Introduced..'}}'):done()
:done()
:tag('data'):attr('source', 'Themes')
:tag('label'):wikitext('Themes'):done()
:tag('default'):wikitext(warframe.Themes):done()
:done()
:tag('data'):attr('source', 'Progenitor')
:tag('label'):wikitext('[[Lich System#Progenitor Warframe|Progenitor]] Element'):done()
:tag('default'):wikitext(warframe.Progenitor and Tooltip.getFullTooltip(warframe.Progenitor, 'DamageTypes')):done()
:done()
:tag('data'):attr('source', 'Subsumed')
:tag('label'):wikitext('[[Helminth#Ability Replacement|Subsumed Ability]]'):done()
:tag('default'):wikitext(warframe.Subsumed and Tooltip.getFullTooltip(warframe.Subsumed, 'Ability')):done()
:done()
:tag('data'):attr('source', 'Internal Name')
:tag('label'):wikitext('Internal Name'):done()
:tag('default'):wikitext(warframe.InternalName and '<code>'..warframe.InternalName..'</code>' or nil):done()
:done()
return frame:preprocess(tostring(infobox))
end
}