Модуль:Prototypes/Хранилище/Предмет: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 197: | Строка 197: | ||
if not tableId then return result end | if not tableId then return result end | ||
-- | -- Создание строки с вероятностью | ||
local | local probString = '' | ||
if nestedSelector.prob then | |||
local percentage = nestedSelector.prob * 100 | |||
probString = string.format('<div class="probability">Шанс выпадения: %.2f%%</div>', percentage) | |||
end | |||
-- Создание строки с диапазоном выпадения | |||
local rollsString = '' | |||
if nestedSelector.rolls and nestedSelector.rolls.range then | if nestedSelector.rolls and nestedSelector.rolls.range then | ||
local min, max = nestedSelector.rolls.range:match("(%d+),%s*(%d+)") | |||
min, max = tonumber(min), tonumber(max) | |||
if min and max then | |||
rollsString = string.format('<div class="rolls">Количество предметов: от %d до %d</div>', min, max) | |||
end | |||
end | end | ||
-- Обёртка div с | -- Обёртка в <div> с дополнительными данными | ||
result = result .. '<div class="nested-selector">' | |||
result = result .. | result = result .. probString .. rollsString | ||
result = result .. getTableOutput(tableId) | result = result .. getTableOutput(tableId) | ||
result = result .. '</div>' | result = result .. '</div>' | ||