Änderungen

651 Bytes hinzugefügt ,  17:23, 3. Mai 2023
ES update
Zeile 10: Zeile 10:  
local quality = tonumber(frame.args.q)
 
local quality = tonumber(frame.args.q)
 
local profmult = tonumber(frame.args.pm)
 
local profmult = tonumber(frame.args.pm)
local ulang = string.upper(frame.args.ll)
+
local toFormatOrNotToFormat = string.lower(frame.args.fm)
    
if ((baseprice == nil) or (baseprice == 0)) then return 0 end
 
if ((baseprice == nil) or (baseprice == 0)) then return 0 end
Zeile 25: Zeile 25:     
--Calculate some artisan goods prices from base ingredient price
 
--Calculate some artisan goods prices from base ingredient price
 +
--These are needed for data-sort-values on pages like Flowers, Fruit, Vegetables
 
if (item == "wine") then
 
if (item == "wine") then
 
artisanprice = (baseprice * 3)
 
artisanprice = (baseprice * 3)
Zeile 31: Zeile 32:  
elseif ((item == "jelly") or (item == "pickles")) then
 
elseif ((item == "jelly") or (item == "pickles")) then
 
artisanprice = (50 + (baseprice * 2))
 
artisanprice = (50 + (baseprice * 2))
elseif (item == "roe") then
  −
artisanprice = (30 + math.floor(baseprice / 2))
  −
elseif (item == "aged roe") then
  −
artisanprice = (2 * (30 + math.floor(baseprice / 2)))
   
elseif (item == "honey") then
 
elseif (item == "honey") then
 
--This is a hack that works only because
 
--This is a hack that works only because
Zeile 43: Zeile 40:  
artisanprice = 100
 
artisanprice = 100
 
end
 
end
elseif (item == "pale ale") then artisanprice = 300
+
elseif (string.find(item, "aged roe") ~= nil) then
 +
artisanprice = (2 * (30 + math.floor(baseprice / 2)))
 +
elseif (string.find(item, "roe") ~= nil) then
 +
artisanprice = (30 + math.floor(baseprice / 2))
 +
--[[elseif (item == "pale ale") then artisanprice = 300
 
elseif ((item == "beer") or (item == "mead")) then artisanprice = 200
 
elseif ((item == "beer") or (item == "mead")) then artisanprice = 200
 
elseif (item == "green tea") then artisanprice = 100
 
elseif (item == "green tea") then artisanprice = 100
--[[elseif (item == "caviar") then artisanprice = 500
+
elseif (item == "caviar") then artisanprice = 500
 
elseif (item == "cheese") then artisanprice = 230
 
elseif (item == "cheese") then artisanprice = 230
 
elseif (item == "goat cheese") then artisanprice = 400
 
elseif (item == "goat cheese") then artisanprice = 400
Zeile 60: Zeile 61:     
local sum = math.floor(math.floor(profmult * 10 * math.floor(qualitymult * artisanprice)) / 10)
 
local sum = math.floor(math.floor(profmult * 10 * math.floor(qualitymult * artisanprice)) / 10)
 +
 +
if toFormatOrNotToFormat == "false" then return sum end
    
local formattedSum = mw.language.getContentLanguage():formatNum(sum)
 
local formattedSum = mw.language.getContentLanguage():formatNum(sum)
 +
local ulang = string.upper(mw.language.getContentLanguage():getCode())
    
if ulang == "DE" then return formattedSum .. " G"
 
if ulang == "DE" then return formattedSum .. " G"
elseif (ulang == "EN" or ulang == "HU" or ulang == "TR") then
+
elseif (ulang == "EN" or ulang == "JA" or ulang == "HU" or ulang == "TR") then
 
return formattedSum .. "g"
 
return formattedSum .. "g"
elseif ulang == "ES" then return formattedSum .. "[[File:Gold.png|18px|link=]]"
+
elseif ulang == "ES" then
 +
if (sum < 1000) then return formattedSum .. "[[File:Gold.png|18px|link=]]"
 +
elseif (sum < 10000) then
 +
local length = #(tostring(sum))
 +
local temp = string.sub(tostring(sum), -3)
 +
return string.sub(tostring(sum), 1, (length-3)) .. "." .. temp .. "[[File:Gold.png|18px|link=]]"
 +
else
 +
local temp = {mw.ustring.gsub(tostring(formattedSum), "%s" , ".")}
 +
return temp[1] .. "[[File:Gold.png|18px|link=]]"
 +
end
 
elseif ulang == "FR" then return formattedSum .. "po"
 
elseif ulang == "FR" then return formattedSum .. "po"
 
elseif ulang == "IT" then return formattedSum .. "o"
 
elseif ulang == "IT" then return formattedSum .. "o"
105.900

Bearbeitungen