Shaleych (обсуждение | вклад) мНет описания правки |
Shaleych (обсуждение | вклад) мНет описания правки |
||
(не показаны 3 промежуточные версии этого же участника) | |||
Строка 16: | Строка 16: | ||
local tbl = mw.html.create('table') |
local tbl = mw.html.create('table') |
||
tbl:addClass('wikitable sortable filter-table-mount jquery-tablesorter') |
tbl:addClass('wikitable sortable filter-table-mount jquery-tablesorter') |
||
− | + | --:attr('style', 'width: 15%') |
|
− | tbl:tag("th" |
+ | tbl:tag("th"):wikitext("Монстр"):done() |
+ | tbl:tag("th"):wikitext("Область"):done() |
||
if r["Drops.quantity"] ~= "" then |
if r["Drops.quantity"] ~= "" then |
||
tbl:tag("th"):wikitext("Количество"):done() |
tbl:tag("th"):wikitext("Количество"):done() |
||
Строка 25: | Строка 26: | ||
for _,row in ipairs(result) do |
for _,row in ipairs(result) do |
||
tr = tbl:tag("tr") |
tr = tbl:tag("tr") |
||
− | tr:tag("td"):wikitext(row["Drops._pageName"]):done() |
+ | tr:tag("td"):wikitext('[[' .. row["Drops._pageName"] .. ']]'):done() |
− | tr:tag("td"):wikitext(row["NPCs.zone"]):done() |
+ | tr:tag("td"):wikitext('[[' .. row["NPCs.zone"] .. ']]'):done() |
− | if row["Drops.quantity"] |
+ | if row["Drops.quantity"] then |
tr:tag("td"):wikitext(Mount.Main({args={row["Drops.quantity"],""}})):done() |
tr:tag("td"):wikitext(Mount.Main({args={row["Drops.quantity"],""}})):done() |
||
end |
end |
Текущая версия от 15:28, 7 мая 2023
Для документации этого модуля может быть создана страница Модуль:Dropped by/doc
local itemIcon = require('Модуль:Item_icon')
local p = {}
function p.main( frame )
local cargo = mw.ext.cargo
tables = 'Drops, NPCs'
fields = 'Drops._pageName,Drops.name,Drops.drops_item,Drops.quantity,NPCs.zone'
local args = {
join = 'Drops._pageName = NPCs._pageName',
where = 'Drops.drops_item = "'..frame.args[1]..'"',
orderBy = 'Drops._pageName',
}
local result = cargo.query( tables, fields, args )
local r = result[1]
local tbl = mw.html.create('table')
tbl:addClass('wikitable sortable filter-table-mount jquery-tablesorter')
--:attr('style', 'width: 15%')
tbl:tag("th"):wikitext("Монстр"):done()
tbl:tag("th"):wikitext("Область"):done()
if r["Drops.quantity"] ~= "" then
tbl:tag("th"):wikitext("Количество"):done()
end
tbl:done()
--Construct the rows in the table
for _,row in ipairs(result) do
tr = tbl:tag("tr")
tr:tag("td"):wikitext('[[' .. row["Drops._pageName"] .. ']]'):done()
tr:tag("td"):wikitext('[[' .. row["NPCs.zone"] .. ']]'):done()
if row["Drops.quantity"] then
tr:tag("td"):wikitext(Mount.Main({args={row["Drops.quantity"],""}})):done()
end
end
tr = tbl:tag("tr")
return tbl
end
return p