Módulo:Pylon battery
A documentação para este módulo pode ser criada em Módulo:Pylon battery/doc
local p = {}
-- from [[Module:Lamp]]
local xps = {
250, 276, 308, 340, 373, 416, 492, 508, 577, 614, -- 1 to 10
680, 752, 822, 916, 1008, 1046, 1096, 1140, 1192, 1240, --11 to 20
1298, 1348, 1408, 1470, 1536, 1596, 1621, 1656, 1812, 1892, --21 to 30
1973, 2056, 2144, 2237, 2332, 2434, 2540, 2648, 2766, 2882, --31 to 40
3008, 3138, 3272, 3414, 3558, 3716, 3882, 4050, 4220, 4404, --41 to 50
4593, 4800, 4998, 5218, 5448, 5688, 5940, 6184, 6466, 6737, --51 to 60
7030, 7342, 7645, 8018, 8432, 8686, 9076, 9516, 9880, 10371, --61 to 70
10772, 11237, 11786, 12328, 12855, 13358, 13980, 14587, 15169, 15920, --71 to 80
16664, 17390, 18087, 19048, 19674, 20132, 21502, 22370, 23690, 24486, --81 to 90
25806, 26458, 27714, 28944, 30130, 32258, 33390, 34408 --91 to 98
}
local lang = mw.getContentLanguage()
function dispNum(x)
return lang:formatNum( math.floor( (tonumber(x) or 0)*10 )/10 )
end
function p.main(frame)
return p._main(frame:getParent().args)
end
function p.rex(frame)
local args = frame:getParent().args
args.rex = true
return p._main(args)
end
function p._main(args)
local lvl = tonumber(args.level) or 1
local number = tonumber(args.number) or 1
local rex = args.rex or false
local xp_per = 0.1 * math.floor(0.5 * xps[math.min(lvl, 98)])
local mult = 1
if number >= 100 then
mult = 1.2
elseif number >= 10 then
mult = 1.1
end
local xp_gained_base = xp_per * number * 0.25
local xp_gained = xp_gained_base * mult
xp_gained = math.floor(xp_gained*10)/10
local str = { 'Contribuir ', number }
--local str = { 'Contributing ', number, (number==1 and ' battery' or ' batteries'), ' to the pylon at level ', lvl, ' Archaeology grants a base of ', dispNum(xp_gained_base), ' experience.' }
if rex then
table.insert(str, string.format('%s ao esqueleto no nível %s de Arqueologia concede uma base de %s experiência.', (number==1 and ' fragmento de esqueleto de rex' or ' fragmentos de esqueleto de rex'), lvl, dispNum(xp_gained_base)))
if mult > 1 then
table.insert(str, string.format(' Por ter contribuído com tantos, você ganha %s%% experiência adicional, garantindo %s experiência total.', (mult-1)*100, dispNum(xp_gained)))
else
table.insert(str, " Você não contribuiu o suficiente para ganhar qualquer experiência adicional.")
end
table.insert(str, string.format(' Você também contribui com %s%% de poder para o esqueleto.', math.min(1,0.001*number)))
else
table.insert(str, string.format('%s a torre no nível %s de Arqueologia concede uma base de %s experiência.', (number==1 and ' bateria' or ' baterias'), lvl, dispNum(xp_gained_base)))
if mult > 1 then
table.insert(str, string.format(' Por ter contribuído com tantas, você ganha %s%% experiência adicional, garantindo %s experiência total.', (mult-1)*100, dispNum(xp_gained)))
else
table.insert(str, " Você não contribuiu o suficiente para ganhar qualquer experiência adicional.")
end
table.insert(str, string.format(' Você também contribui com %s%% de energia para a torre.', math.min(1,0.001*number)))
end
return table.concat(str, '')
end
return p