Модуль:Prototypes/Механика/Стоимость: различия между версиями

мНет описания правки
мНет описания правки
 
(не показана 1 промежуточная версия этого же участника)
Строка 1: Строка 1:
-- Загрузка данных
-- Загрузка данных
local priceData = mw.loadData("Модуль:IanComradeBot/prototypes/StaticPrice.json/data")
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,
                     "<tr data-sort-value=" .. item.StaticPrice.price ..  
                     "|data-sort-value=" .. item.StaticPrice.price ..  
                     "><td>{{Cut-Layout|1=[[File:" .. item.id .. ".png|32px|link=]] " ..  
                     "|{{Cut-Layout|1=[[File:" .. item.id .. ".png|32px|link=]] " ..  
                     name .. "|2=" .. priceFormatted .. "}}"
                     name .. "|2=" .. priceFormatted .. "}}"
                 )
                 )
                 table.insert(output, "</td></tr>")
                 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