Module:Armory: Difference between revisions

No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:


local cellDef = {
local cellDef = {
     name = { header = 'Item', class = 'armoury-name', type = 'eq_string' },
     name = { header = 'Item', class = 'armory-name', type = 'eq_string' },
     ['Equipment tier'] = { header = 'Tier', class = 'armoury-tier', type = 'eq_number' },
     ['Mod tier'] = { header = 'Tier', class = 'armory-tier', type = 'eq_number' },
     ['Combat class'] = { header = 'Class', class = 'armoury-class', type = 'eq_image' },
     ['Combat class'] = { header = 'Class', class = 'armory-class', type = 'eq_image' },
     ['Equipment type'] = { header = 'Type', class = 'armoury-type', type = 'eq_string' },
     ['Mod type'] = { header = 'Type', class = 'armory-type', type = 'eq_string' },
     ['Attack style'] = { header = 'Style', class = 'armoury-style', type = 'eq_number' },
     ['Attack style'] = { header = 'Style', class = 'armory-style', type = 'eq_number' },
     ['Equipment armour'] = { header = 'Armour', class = 'armoury-armour', type = 'eq_number' },
     ['Mod armor'] = { header = 'Armor', class = 'armory-armor', type = 'eq_number' },
     ['Equipment life points'] = { header = 'Life<br />points', class = 'armoury-lifepoints', type = 'eq_number' },
     ['Mod life points'] = { header = 'Life<br />points', class = 'armory-lifepoints', type = 'eq_number' },
     ['Strength bonus'] = { header = 'Strength<br />bonus', class = 'armoury-strength', type = 'eq_number' },
     ['Strength bonus'] = { header = 'Strength<br />bonus', class = 'armory-strength', type = 'eq_number' },
     ['Magic bonus'] = { header = 'Magic<br />bonus', class = 'armoury-magic', type = 'eq_number' },
     ['Magic bonus'] = { header = 'Magic<br />bonus', class = 'armory-magic', type = 'eq_number' },
     ['Ranged bonus'] = { header = 'Ranged<br />bonus', class = 'armoury-ranged', type = 'eq_number' },
     ['Ranged bonus'] = { header = 'Ranged<br />bonus', class = 'armory-ranged', type = 'eq_number' },
     ['Prayer bonus'] = { header = 'Prayer<br />bonus', class = 'armoury-prayer', type = 'eq_number' },
     ['Prayer bonus'] = { header = 'Prayer<br />bonus', class = 'armory-prayer', type = 'eq_number' },
     ['Weapon damage'] = { header = 'Damage', class = 'armoury-damage', type = 'eq_number' },
     ['Weapon damage'] = { header = 'Damage', class = 'armory-damage', type = 'eq_number' },
     ['Weapon accuracy'] = { header = 'Accuracy', class = 'armoury-accuracy', type = 'eq_number' },
     ['Weapon accuracy'] = { header = 'Accuracy', class = 'armory-accuracy', type = 'eq_number' },
     ['Weapon attack speed'] = { header = 'Speed', class = 'armoury-speed', type = 'eq_string' },
     ['Weapon attack speed'] = { header = 'Speed', class = 'armory-speed', type = 'eq_string' },
     ['Attack range'] = { header = 'Attack<br />range', class = 'armoury-attack-range', type = 'eq_number' }
     ['Attack range'] = { header = 'Attack<br />range', class = 'armory-attack-range', type = 'eq_number' }
}
}


Line 27: Line 27:
ranged = '[[File:Ranged.png|x24px|link=Ranged]]',
ranged = '[[File:Ranged.png|x24px|link=Ranged]]',
magic = '[[File:Magic.png|x24px|link=Magic]]',
magic = '[[File:Magic.png|x24px|link=Magic]]',
hybrid = '[[File:CombatSwords.png|x24px|link=Armour#Hybrid]]',
hybrid = '[[File:CombatSwords.png|x24px|link=Armor#Hybrid]]',
all = '[[File:CombatSwords.png|x24px|link=Armour#All]]',
all = '[[File:CombatSwords.png|x24px|link=Armor#All]]',
none = ''
none = ''
}
}
Line 35: Line 35:
['_types'] = {
['_types'] = {
armor = 1,
armor = 1,
torso = 1,
shields = 1,
legs = 1,
weapons = 1,
hands = 1,
sensors = 1,
feet = 1,
engines = 1,
back = 1,
utility = 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', 'Mod tier', 'Mod type', 'Mod armor', 'Mod life points', 'Strength bonus', 'Magic bonus', 'Ranged bonus', 'Prayer bonus'}, --armor
     {'Combat class', 'Equipment tier', 'Equipment type', 'Attack style', 'Weapon accuracy', 'Weapon damage', 'Prayer bonus', 'Weapon attack speed', 'Attack range'}, --mh/2h weapons
     {'Combat class', 'Mod tier', 'Mod type', 'Attack style', 'Weapon accuracy', 'Weapon damage', 'Prayer bonus', 'Weapon attack speed', 'Attack range'}, --mh/2h weapons
     {'Combat class', 'Equipment tier', 'Equipment type', 'Attack style', 'Weapon accuracy', 'Weapon damage', 'Equipment armour', 'Equipment life points', 'Prayer bonus', 'Weapon attack speed', 'Attack range'}, --offhands inc shields
     {'Combat class', 'Mod tier', 'Mod type', 'Attack style', 'Weapon accuracy', 'Weapon damage', 'Mod armor', 'Mod life points', 'Prayer bonus', 'Weapon attack speed', 'Attack range'}, --offhands inc shields
     {'Combat class', 'Equipment tier', 'Equipment armour', 'Strength bonus', 'Magic bonus', 'Ranged bonus', 'Prayer bonus'}, -- ring neck pocket
     {'Combat class', 'Mod tier', 'Mod armor', 'Strength bonus', 'Magic bonus', 'Ranged bonus', 'Prayer bonus'}, -- ring neck pocket
     {'Combat class', 'Equipment tier', 'Weapon damage', 'Prayer bonus', 'Strength bonus', 'Magic bonus', 'Ranged bonus', 'Equipment armour' }, -- ammo
     {'Combat class', 'Mod tier', 'Weapon damage', 'Prayer bonus', 'Strength bonus', 'Magic bonus', 'Ranged bonus', 'Mod armor' }, -- ammo
     {'Combat class', 'Equipment tier', 'Strength bonus', 'Magic bonus', 'Ranged bonus', 'Equipment armour' }, -- sigil pocket default
     {'Combat class', 'Mod tier', 'Strength bonus', 'Magic bonus', 'Ranged bonus', 'Mod armor' }, -- sigil pocket default
}
}


local sorts = {
local sorts = {
['Name'] = nil,
['Name'] = nil,
['Tier'] = 'Equipment tier',
['Tier'] = 'Mod tier',
['ID'] = 'Item ID',
['ID'] = 'Item ID',
}
}
Line 88: Line 78:
if rowtype then
if rowtype then
table.insert(query, '[[Equipment slot::'..args.slot..']]')
table.insert(query, '[[Mod slot::'..args.slot..']]')
else
else
error('Please provide a valid equipment slot')
error('Please provide a valid Mod slot')
end
end
Line 121: Line 111:
local t_min = tonumber(args.tier_min)
local t_min = tonumber(args.tier_min)
local t_max = tonumber(args.tier_max)
local t_max = tonumber(args.tier_max)
if args.enable_tier_min == 'true' and t_min and t_min > 0 and not no_tier_search[args.slot] then
if args.enable_tier_min == 'true' and t_min and t_min > 100 and not no_tier_search[args.slot] then
table.insert(query, '[[Equipment tier::≥'..t_min..']]')
table.insert(query, '[[Mod tier::≥'..t_min..']]')
end
end
if args.enable_tier_max =='true' and t_max and t_max < 120 and not no_tier_search[args.slot] then
if args.enable_tier_max =='true' and t_max and t_max < 500 and not no_tier_search[args.slot] then
table.insert(query, '[[Equipment tier::≤'..t_max..']]')
table.insert(query, '[[Mod tier::≤'..t_max..']]')
end
end
querySize = 0
querySize = 0
Line 156: Line 146:
if not data then
if not data then
local ret = mw.html.create('div')
local ret = mw.html.create('div')
ret :addClass('armoury no-results-found table-bg-red')
ret :addClass('armory no-results-found table-bg-red')
:attr({
:attr({
id = 'armoury-no-results-found',
id = 'armory-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 167: Line 157:
local ret = mw.html.create('table')
local ret = mw.html.create('table')
ret :addClass('wikitable armoury sticky-header sortable alternating-rows')
ret :addClass('wikitable armory sticky-header sortable alternating-rows')
:attr({
:attr({
['data-page'] = page,
['data-page'] = page,
Line 186: Line 176:
if querySize > QUERY_SIZE then
if querySize > QUERY_SIZE then
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)
return '<div id="armory-query-size-limit-reached" class="armory 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 204: Line 194:
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="armoury-version">%s</span>]]', data.page, data['Is variant of'], data['Version anchor'])
name = mw.ustring.format('[[%s|%s <span class="armory-version">%s</span>]]', data.page, data['Is variant of'], data['Version anchor'])
else
else
name = '[['..data.page..']]'
name = '[['..data.page..']]'
Line 212: Line 202:
local tr = mw.html.create('tr')
local tr = mw.html.create('tr')
tr :addClass('armouryrow')
tr :addClass('armoryrow')
:tag('td')
:tag('td')
:wikitext(name)
:wikitext(name)
:addClass('armoury-name eq_string')
:addClass('armory-name eq_string')
for i,v in ipairs(rowLayout) do
for i,v in ipairs(rowLayout) do