Module:Enemy List: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
m (edit buttons)
(Use plinkt styling with no-border; Use Module:Mw.html extension methods; Always link to the page in case it's different from Name)
 
Line 1: Line 1:
require('strict')
require('strict')
require('Module:Mw.html extension')
local yesno = require('Module:Yesno')
local yesno = require('Module:Yesno')
local album_xp_data = mw.loadData('Module:Experience/data').album
local album_xp_data = mw.loadData('Module:Experience/data').album
Line 42: Line 43:
:wikitext('This list is updated dynamically. '..purge())
:wikitext('This list is updated dynamically. '..purge())
:done()
:done()
:tag('tr')
:tr()
:th{ 'Enemy', attr = { colspan = '2' } }:done()
:tag('th')
:th('Unlock<br>Level'):done()
:attr{ colspan = '2' }
:wikitext('Enemy')
:th('Combat<br>Level'):done()
:done()
:th('HP'):done()
:tag('th'):wikitext('Unlock<br>Level'):done()
:th('Attack Style'):done()
:tag('th'):wikitext('Combat<br>Level'):done()
:th('Immune To'):done()
:tag('th'):wikitext('HP'):done()
:th('Vulnerable'):done()
:tag('th'):wikitext('Attack Style'):done()
:th('Found At'):done()
:tag('th'):wikitext('Immune To'):done()
:th('XP'):done()
:tag('th'):wikitext('Vulnerable'):done()
:th('Album XP'):done()
:tag('th'):wikitext('Found At'):done()
:tag('th'):wikitext('XP'):done()
:tag('th'):wikitext('Album XP'):done()
:done()
:done()


for _, monster in ipairs(data) do
for _, monster in ipairs(data) do
local edit = editbutton("'''?''' (edit)", monster['Name'])
local edit = editbutton("'''?''' (edit)", monster[1])
local row = out:tag('tr')
local row = out:tr()
:tag('td'):wikitext(monster.Image):done()
:td{ monster.Image, addClass = 'plinkt-image no-border' }:done()
:tag('td'):wikitext(('[[%s]]'):format(monster['Name'])):done()
:td{ ('[[%s|%s]]'):format(monster[1], monster['Name']), addClass = 'plinkt-link no-border'}:done()
:tag('td'):wikitext(monster['Unlock level'] or edit):done()
:td(monster['Unlock level'] or edit):done()
:tag('td'):wikitext(monster['Profession Level A'] or edit):done()
:td(monster['Profession Level A'] or edit):done()
:tag('td'):wikitext((monster.Health and formatNum(monster.Health)) or edit):done()
:td((monster.Health and formatNum(monster.Health)) or edit):done()
:tag('td'):wikitext(format_attack_style(monster['Attack style'])):done()
:td(format_attack_style(monster['Attack style'])):done()
:tag('td'):wikitext(format_attack_style(monster['Immune to'])):done()
:td(format_attack_style(monster['Immune to'])):done()
:tag('td'):wikitext(format_attack_style(monster['Vulnerable to'])):done()
:td(format_attack_style(monster['Vulnerable to'])):done()


local location_text = {}
local location_text = {}
Line 75: Line 73:
end
end
row
row
:tag('td'):wikitext(table.concat(location_text, ', ')):done()
:td(table.concat(location_text, ', ')):done()
:tag('td'):wikitext((monster.Experience and formatNum(monster.Experience)) or edit):done()
:td((monster.Experience and formatNum(monster.Experience)) or edit):done()
:tag('td'):wikitext((monster['Album XP'] and formatNum(monster['Album XP']) or editbutton("'''?''' (edit)", 'Module:Experience/data'))):done()
:td((monster['Album XP'] and formatNum(monster['Album XP']) or editbutton("'''?''' (edit)", 'Module:Experience/data'))):done()
end
end


Line 89: Line 87:
:wikitext('This list is updated dynamically. '..purge())
:wikitext('This list is updated dynamically. '..purge())
:done()
:done()
:tag('tr')
:tr()
:th{ 'Enemy', attr = { colspan = '2' } }:done()
:tag('th')
:th('Level'):done()
:attr{ colspan = '2' }
:th('Weapon<br>Strength'):done()
:wikitext('Enemy')
:th('[[File:Knowledge icon.png|16px|link=Knowledge]] KP'):done()
:done()
:tag('th'):wikitext('Level'):done()
:th('Location'):done()
:tag('th'):wikitext('Weapon<br>Strength'):done()
:th('XP'):done()
:tag('th'):wikitext('[[File:Knowledge icon.png|16px|link=Knowledge]] KP'):done()
:th('Album XP'):done()
:tag('th'):wikitext('Location'):done()
:tag('th'):wikitext('XP'):done()
:tag('th'):wikitext('Album XP'):done()
:done()
:done()


Line 105: Line 100:
local edit = editbutton("'''?''' (edit)", monster['Name'])
local edit = editbutton("'''?''' (edit)", monster['Name'])
local row = out:tag('tr')
local row = out:tag('tr')
:tag('td'):wikitext(monster.Image):done()
:td{ monster.Image, addClass = 'plinkt-image no-border' }:done()
:tag('td'):wikitext(('[[%s]]'):format(monster['Name'])):done()
:td{ ('[[%s|%s]]'):format(monster[1], monster['Name']), addClass = 'plinkt-link no-border'}:done()
:tag('td'):wikitext(monster['Unlock level'] or edit):done()
:td(monster['Unlock level'] or edit):done()
:tag('td'):wikitext((monster['Unlock level'] and monster['Unlock level'] + 20) or edit):done()
:td((monster['Unlock level'] and monster['Unlock level'] + 20) or edit):done()
:tag('td'):wikitext(monster.Knowledge or edit):done()
:td(monster.Knowledge or edit):done()


local location_text = {}
local location_text = {}
Line 117: Line 112:
end
end
row
row
:tag('td'):wikitext(table.concat(location_text, ', ')):done()
:td(table.concat(location_text, ', ')):done()
:tag('td'):wikitext((monster.Experience and formatNum(monster.Experience)) or edit):done()
:td((monster.Experience and formatNum(monster.Experience)) or edit):done()
:tag('td'):wikitext((monster['Album XP'] and formatNum(monster['Album XP']) or editbutton("'''?''' (edit)", 'Module:Experience/data'))):done()
:td((monster['Album XP'] and formatNum(monster['Album XP']) or editbutton("'''?''' (edit)", 'Module:Experience/data'))):done()
end
end


Line 144: Line 139:
'?Version anchor',
'?Version anchor',
'?Version default',
'?Version default',
'?#-',
'sort=Profession Level A',
'sort=Profession Level A',
'order=asc',
'order=asc',