Модуль:Prototypes/Хранилище/Предмет: различия между версиями

мНет описания правки
мНет описания правки
Строка 94: Строка 94:
                 result = result .. processAllSelectors(selectedChild.children)
                 result = result .. processAllSelectors(selectedChild.children)
             elseif selectedChild["!type"] == "NestedSelector" and selectedChild.tableId then
             elseif selectedChild["!type"] == "NestedSelector" and selectedChild.tableId then
                 local nestedRolls = selectedChild.rolls and (selectedChild.rolls.value or (selectedChild.rolls.range and math.random(selectedChild.rolls.range[1], selectedChild.rolls.range[2])) or 1) or 1
                 local nestedRolls
                if selectedChild.rolls then
                    if selectedChild.rolls.value then
                        nestedRolls = selectedChild.rolls.value
                    elseif selectedChild.rolls.range then
                        local rangeParts = {string.match(selectedChild.rolls.range, "(%d+),%s*(%d+)")}
                        nestedRolls = math.random(tonumber(rangeParts[1]), tonumber(rangeParts[2]))
                    else
                        nestedRolls = 1
                    end
                else
                    nestedRolls = 1
                end
                 result = result .. getTableOutput(selectedChild.tableId, nestedRolls)
                 result = result .. getTableOutput(selectedChild.tableId, nestedRolls)
             end
             end
Строка 113: Строка 125:
             result = result .. processAllSelectors(child.children)
             result = result .. processAllSelectors(child.children)
         elseif child["!type"] == "NestedSelector" and child.tableId then
         elseif child["!type"] == "NestedSelector" and child.tableId then
             local nestedRolls = child.rolls and (child.rolls.value or (child.rolls.range and math.random(child.rolls.range[1], child.rolls.range[2])) or 1) or 1
             local nestedRolls
            if child.rolls then
                if child.rolls.value then
                    nestedRolls = child.rolls.value
                elseif child.rolls.range then
                    local rangeParts = {string.match(child.rolls.range, "(%d+),%s*(%d+)")}
                    nestedRolls = math.random(tonumber(rangeParts[1]), tonumber(rangeParts[2]))
                else
                    nestedRolls = 1
                end
            else
                nestedRolls = 1
            end
             result = result .. getTableOutput(child.tableId, nestedRolls)
             result = result .. getTableOutput(child.tableId, nestedRolls)
         end
         end