Module:Armory: Difference between revisions
Created page with "local hc = require('Module:Paramtest').has_content local yn = require('Module:Yesno') local QUERY_SIZE = 8 local p = {} local cellDef = { name = { header = 'Item', class..." |
No edit summary |
||
| Line 6: | Line 6: | ||
local cellDef = { | local cellDef = { | ||
name = { header = 'Item', class = ' | name = { header = 'Item', class = 'armoury-name', type = 'eq_string' }, | ||
['Equipment tier'] = { header = 'Tier', class = ' | ['Equipment tier'] = { header = 'Tier', class = 'armoury-tier', type = 'eq_number' }, | ||
['Combat class'] = { header = 'Class', class = ' | ['Combat class'] = { header = 'Class', class = 'armoury-class', type = 'eq_image' }, | ||
['Equipment type'] = { header = 'Type', class = ' | ['Equipment type'] = { header = 'Type', class = 'armoury-type', type = 'eq_string' }, | ||
['Attack style'] = { header = 'Style', class = ' | ['Attack style'] = { header = 'Style', class = 'armoury-style', type = 'eq_number' }, | ||
['Equipment armour'] = { header = 'Armour', class = ' | ['Equipment armour'] = { header = 'Armour', class = 'armoury-armour', type = 'eq_number' }, | ||
['Equipment life points'] = { header = 'Life<br />points', class = ' | ['Equipment life points'] = { header = 'Life<br />points', class = 'armoury-lifepoints', type = 'eq_number' }, | ||
['Strength bonus'] = { header = 'Strength<br />bonus', class = ' | ['Strength bonus'] = { header = 'Strength<br />bonus', class = 'armoury-strength', type = 'eq_number' }, | ||
['Magic bonus'] = { header = 'Magic<br />bonus', class = ' | ['Magic bonus'] = { header = 'Magic<br />bonus', class = 'armoury-magic', type = 'eq_number' }, | ||
['Ranged bonus'] = { header = 'Ranged<br />bonus', class = ' | ['Ranged bonus'] = { header = 'Ranged<br />bonus', class = 'armoury-ranged', type = 'eq_number' }, | ||
['Prayer bonus'] = { header = 'Prayer<br />bonus', class = ' | ['Prayer bonus'] = { header = 'Prayer<br />bonus', class = 'armoury-prayer', type = 'eq_number' }, | ||
['Weapon damage'] = { header = 'Damage', class = ' | ['Weapon damage'] = { header = 'Damage', class = 'armoury-damage', type = 'eq_number' }, | ||
['Weapon accuracy'] = { header = 'Accuracy', class = ' | ['Weapon accuracy'] = { header = 'Accuracy', class = 'armoury-accuracy', type = 'eq_number' }, | ||
['Weapon attack speed'] = { header = 'Speed', class = ' | ['Weapon attack speed'] = { header = 'Speed', class = 'armoury-speed', type = 'eq_string' }, | ||
['Attack range'] = { header = 'Attack<br />range', class = ' | ['Attack range'] = { header = 'Attack<br />range', class = 'armoury-attack-range', type = 'eq_number' } | ||
} | } | ||
| Line 34: | Line 34: | ||
local printouts = { | local printouts = { | ||
['_types'] = { | ['_types'] = { | ||
head = 1, | |||
torso = 1, | |||
legs = 1, | |||
hands = 1, | |||
feet = 1, | |||
back = 1, | |||
['main hand weapon'] = 2, | |||
['2h weapon'] = 2, | |||
['off-hand'] = 3, | |||
['off-hand weapon'] = 3, | |||
neck = 4, | |||
ring = 4, | |||
pocket = 4, | |||
ammo = 5, | |||
aura = 6, | |||
sigil = 6 | |||
}, | }, | ||
{'Combat class', 'Equipment tier', 'Equipment type', 'Equipment armour', 'Equipment life points', 'Strength bonus', 'Magic bonus', 'Ranged bonus', 'Prayer bonus'}, --armour | {'Combat class', 'Equipment tier', 'Equipment type', 'Equipment armour', 'Equipment life points', 'Strength bonus', 'Magic bonus', 'Ranged bonus', 'Prayer bonus'}, --armour | ||
| Line 146: | Line 156: | ||
if not data then | if not data then | ||
local ret = mw.html.create('div') | local ret = mw.html.create('div') | ||
ret :addClass(' | ret :addClass('armoury no-results-found table-bg-red') | ||
:attr({ | :attr({ | ||
id = ' | id = 'armoury-no-results-found', | ||
['data-page'] = page, | ['data-page'] = page, | ||
['data-query'] = mw.text.nowiki(table.concat(query, ' ')) | ['data-query'] = mw.text.nowiki(table.concat(query, ' ')) | ||
| Line 157: | Line 167: | ||
local ret = mw.html.create('table') | local ret = mw.html.create('table') | ||
ret :addClass('wikitable | ret :addClass('wikitable armoury sticky-header sortable alternating-rows') | ||
:attr({ | :attr({ | ||
['data-page'] = page, | ['data-page'] = page, | ||
| Line 176: | Line 186: | ||
if querySize > QUERY_SIZE then | if querySize > QUERY_SIZE then | ||
return '<div id=" | return '<div id="armoury-query-size-limit-reached" class="armoury query-size-limit-reached table-bg-red">Warning: you have too many filters set and have exceeded the query size. The results provided below have ignored one or more of your filters. Set some filters to "Any"/"None"/disabled to reduce the size.</div>\n' .. tostring(ret) | ||
end | end | ||
return tostring(ret) | return tostring(ret) | ||
| Line 194: | Line 204: | ||
local name | local name | ||
if data['Is variant of'] and data['Version anchor'] then | if data['Is variant of'] and data['Version anchor'] then | ||
name = mw.ustring.format('[[%s|%s <span class=" | name = mw.ustring.format('[[%s|%s <span class="armoury-version">%s</span>]]', data.page, data['Is variant of'], data['Version anchor']) | ||
else | else | ||
name = '[['..data.page..']]' | name = '[['..data.page..']]' | ||
| Line 202: | Line 212: | ||
local tr = mw.html.create('tr') | local tr = mw.html.create('tr') | ||
tr :addClass(' | tr :addClass('armouryrow') | ||
:tag('td') | :tag('td') | ||
:wikitext(name) | :wikitext(name) | ||
:addClass(' | :addClass('armoury-name eq_string') | ||
for i,v in ipairs(rowLayout) do | for i,v in ipairs(rowLayout) do | ||