Модуль:Prototypes/Механика/Стоимость: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| (не показана 1 промежуточная версия этого же участника) | |||
| Строка 1: | Строка 1: | ||
-- Загрузка данных | -- Загрузка данных | ||
local priceData = mw.loadData(" | local JP = require("Module:JsonPaths") | ||
local priceData = mw.loadData( JP.get("prototypes/StaticPrice.json") ) | |||
local p = {} | local p = {} | ||
| Строка 24: | Строка 25: | ||
local output = {} | local output = {} | ||
local seen = {} | local seen = {} | ||
table.insert(output, '{| class="sortable-grid sortable"') | |||
table.insert(output, '! Сортировка (по стоимости)') | |||
table.insert(output, '|-') | |||
for _, item in ipairs(priceData) do | for _, item in ipairs(priceData) do | ||
| Строка 40: | Строка 44: | ||
table.insert( | table.insert( | ||
output, | output, | ||
" | "|data-sort-value=" .. item.StaticPrice.price .. | ||
" | "|{{Cut-Layout|1=[[File:" .. item.id .. ".png|32px|link=]] " .. | ||
name .. "|2=" .. priceFormatted .. "}}" | name .. "|2=" .. priceFormatted .. "}}" | ||
) | ) | ||
table.insert(output, " | table.insert(output, "|-") | ||
end | end | ||
end | end | ||
end | end | ||
table.insert(output, "|}") | |||
return frame:preprocess(table.concat(output, "\n")) | return frame:preprocess(table.concat(output, "\n")) | ||
end | end | ||
return p | return p | ||