Conan Exiles Wiki
Pcj (talk | contribs)
No edit summary
Pcj (talk | contribs)
No edit summary
Line 9: Line 9:
 
where = 'uniqueName = "' .. frame.args[1] .. '" AND _pageName=uniqueName AND NOT _pageName LIKE "%Template%"',
 
where = 'uniqueName = "' .. frame.args[1] .. '" AND _pageName=uniqueName AND NOT _pageName LIKE "%Template%"',
 
groupBy = '_pageName',
 
groupBy = '_pageName',
default='Item name not found',
 
 
limit = 1
 
limit = 1
 
}
 
}
Line 15: Line 14:
 
local r = result[1]
 
local r = result[1]
 
if r == nil then
 
if r == nil then
 
text = 'Item name not found'
local innertext = frame.args[1]
 
text = '[['..frame.args[1]..']]'
 
 
else
 
else
 
if r['dlcPackage'] ~= nil then
 
if r['dlcPackage'] ~= nil then

Revision as of 20:54, 15 March 2019

local p = {}
local cargo = mw.ext.cargo

function p.Main( frame )
	local text = ""
    tables = 'Item'
    fields = '_pageName,image,dlcPackage'
    local args = {
        where = 'uniqueName = "' .. frame.args[1] .. '" AND _pageName=uniqueName AND NOT _pageName LIKE "%Template%"',
        groupBy = '_pageName',
        limit = 1
    }
    local result = cargo.query( tables, fields, args )
    local r = result[1]
    if r == nil then
		text = 'Item name not found'
	else 
		if r['dlcPackage'] ~= nil then
			text = '<span style="position: relative; display: inline-block;"><span style="display: block;">[[File:' .. r['image'] .. '|32px|link=' .. r['_pageName'] .. '|frameless]]</span><span style="position: absolute; display: block; top: 0; bottom: 0; left: 0; right: 0;">[[File:T DLC icon.png|32px|link={{{1}}}]]</span></span>'
		else
			text = '[[File:' .. r['image'] .. '|32px|link=' .. r['_pageName'] .. '|frameless]]'
		end
		text = text .. ' [['.. r['_pageName'] .. ']]'
	end
    return text
end

return p