Cambios

181 bytes eliminados ,  06:02 31 may 2023
sin resumen de edición
Línea 1: Línea 1: −
--Not adding a dot to 2nd ES number at all now.
  −
--Math.Max(r.Next(1, 11) * 100, price * r.Next(3, 6))
  −
--Scribunto: math.max(x, ...) Returns the max of all arguments
  −
   
local p = {}
 
local p = {}
   Línea 11: Línea 7:  
local space = string.lower(frame.args["spacearoundseparator"])
 
local space = string.lower(frame.args["spacearoundseparator"])
 
local ulang = string.upper(mw.language.getContentLanguage():getCode())
 
local ulang = string.upper(mw.language.getContentLanguage():getCode())
+
 
local lowprice, highprice, temp, temp2
   
local formattedprice = "[[File:Gold.png|18px|link=]]"
 
local formattedprice = "[[File:Gold.png|18px|link=]]"
   Línea 28: Línea 23:  
end
 
end
 
else
 
else
lowprice = tonumber(price) * 3
+
local lowprice = tonumber(price) * 3
highprice = tonumber(price) * 5
+
local highprice = tonumber(price) * 5
 +
local fmlowprice = tostring(mw.language.getContentLanguage():formatNum(lowprice))
 +
local fmhighprice = tostring(mw.language.getContentLanguage():formatNum(highprice))
 
 
 
if (lowprice <= 100) then
 
if (lowprice <= 100) then
 
formattedprice = formattedprice .. "100"
 
formattedprice = formattedprice .. "100"
 
elseif (ulang ~= "ES") then
 
elseif (ulang ~= "ES") then
formattedprice = formattedprice .. tostring(mw.language.getContentLanguage():formatNum(lowprice))
+
formattedprice = formattedprice .. fmlowprice
 
else
 
else
 
--Spanish
 
--Spanish
temp = tostring(mw.language.getContentLanguage():formatNum(lowprice))
+
if (lowprice < 1000) then
+
formattedprice = formattedprice .. fmlowprice
if (tonumber(temp) < 10000) then
+
elseif (lowprice < 10000) then
local length = #(temp)
+
local length = #(fmlowprice)
temp2 = string.sub(temp, -3)
+
local temp = string.sub(fmlowprice, -3)
formattedprice = formattedprice .. string.sub(temp, 1, (length-3)) .. "." .. temp2
+
formattedprice = formattedprice .. string.sub(fmlowprice, 1, (length-3)) .. "." .. temp
 
else
 
else
temp2 = {mw.ustring.gsub(tostring(formattedSum), "%s" , ".")}
+
local temp = {mw.ustring.gsub(tostring(fmlowprice), "%s" , ".")}
formattedprice = formattedprice .. temp2[1]
+
formattedprice = formattedprice .. temp[1]
 
end
 
end
 +
end
 
 
if space == "true" then formattedprice = formattedprice .. " " .. separator .. " "
+
if space == "true" then formattedprice = formattedprice .. " " .. separator .. " "
else formattedprice = formattedprice .. separator
+
else formattedprice = formattedprice .. separator
end
   
end
 
end
 +
 
if (highprice <= 1000) then
 
if (highprice <= 1000) then
 
if (ulang ~= "ES") then  
 
if (ulang ~= "ES") then  
Línea 58: Línea 56:  
end
 
end
 
elseif (ulang ~= "ES") then
 
elseif (ulang ~= "ES") then
formattedprice = formattedprice .. tostring(mw.language.getContentLanguage():formatNum(highprice))
+
formattedprice = formattedprice .. fmhighprice
 
else
 
else
--Spanish and highprice > 1000
+
--Spanish and highprice > 1000
temp = tostring(mw.language.getContentLanguage():formatNum(highprice))
+
if (highprice < 10000) then
+
local length = #(fmhighprice)
if (temp < 10000) then
+
local temp = string.sub(fmhighprice, -3)
local length = #(tostring(temp))
+
formattedprice = formattedprice .. string.sub(fmhighprice, 1, (length-3)) .. "." .. temp
temp2 = string.sub(tostring(temp), -3)
  −
formattedprice = formattedprice .. string.sub(tostring(temp), 1, (length-3)) .. "." .. temp2
   
else
 
else
temp2 = {mw.ustring.gsub(tostring(formattedSum), "%s" , ".")}
+
local temp = {mw.ustring.gsub(tostring(fmhighprice), "%s" , ".")}
formattedprice = formattedprice .. temp2[1]
+
formattedprice = formattedprice .. temp[1]
 
end
 
end
 
end
 
end
105 867

ediciones