Модуль:CurrencyDiamondsConverter: различия между версиями
Hloth (обсуждение | вклад) Новая страница: «local p = {} local oneDiamondCost = 16 local spurNominal = 1 local bevelNominal = 8 local sprocketNominal = 16 local cogNominal = 64 local crownNominal = 512 local sunNominal = 4096 function p.currencyToDiamonds(frame) local spur = tonumber(frame.args['spur']) or 0 local bevel = tonumber(frame.args['bevel']) or 0 local sprocket = tonumber(frame.args['sprocket']) or 0 local cog = tonumber(frame.args['cog']) or 0 local crown = tonumber(frame.args[...» |
Hloth (обсуждение | вклад) Нет описания правки |
||
| (не показана 1 промежуточная версия этого же участника) | |||
| Строка 47: | Строка 47: | ||
local spur = math.floor(sum / spurNominal) | local spur = math.floor(sum / spurNominal) | ||
local coinTemplate = ' | local coinTemplate = '{{Currency/Coin|%i|%s}}' | ||
local result = '' | local result = '' | ||
if sun > 0 then | if sun > 0 then | ||
result = result .. string.format(coinTemplate, | result = result .. string.format(coinTemplate, sun, 'Солнышко') | ||
end | end | ||
if crown > 0 then | if crown > 0 then | ||
result = result .. string.format(coinTemplate, | result = result .. string.format(coinTemplate, crown, 'Коронка') | ||
end | end | ||
if cog > 0 then | if cog > 0 then | ||
result = result .. string.format(coinTemplate, | result = result .. string.format(coinTemplate, cog, 'Шестеренка') | ||
end | end | ||
if sprocket > 0 then | if sprocket > 0 then | ||
result = result .. string.format(coinTemplate, | result = result .. string.format(coinTemplate, sprocket, 'Звездочка') | ||
end | end | ||
if bevel > 0 then | if bevel > 0 then | ||
result = result .. string.format(coinTemplate, | result = result .. string.format(coinTemplate, bevel, 'Фаска') | ||
end | end | ||
if spur > 0 then | if spur > 0 then | ||
result = result .. string.format(coinTemplate, | result = result .. string.format(coinTemplate, spur, 'Шпора') | ||
end | end | ||