바뀜

둘러보기로 가기 검색하러 가기
3,203 바이트 추가됨 ,  2023년 2월 20일 (월) 21:44
새 문서: --Assumes baseprice is always an integer --Adds the language-appropriate letters/characters for 'gold' local p = {} --csp = calculate sell price function p.csp(frame) local item =...
--Assumes baseprice is always an integer
--Adds the language-appropriate letters/characters for 'gold'

local p = {}

--csp = calculate sell price
function p.csp(frame)
local item = string.lower(frame.args.im)
local baseprice = tonumber(frame.args.bp)
local quality = tonumber(frame.args.q)
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

local qualitymult, artisanprice

if (profmult == nil) or (item == "coffee") or (item == "oil") then profmult = 1 end

if (quality == 1) then qualitymult = 1.25
elseif (quality == 2) then qualitymult = 1.5
elseif (quality == 4) then qualitymult = 2
else qualitymult = 1
end

--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
artisanprice = (baseprice * 3)
elseif (item == "juice") then
artisanprice = math.floor(baseprice * 2.25)
elseif ((item == "jelly") or (item == "pickles")) then
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
--This is a hack that works only because
--no flower has a base sell price of 100
if (baseprice ~= 100) then
artisanprice = (100 + (baseprice * 2))
else
artisanprice = 100
end
elseif (item == "pale ale") then artisanprice = 300
elseif ((item == "beer") or (item == "mead")) then artisanprice = 200
elseif (item == "green tea") then artisanprice = 100
--[[elseif (item == "caviar") then artisanprice = 500
elseif (item == "cheese") then artisanprice = 230
elseif (item == "goat cheese") then artisanprice = 400
elseif (item == "cloth") then artisanprice = 470
elseif (item == "mayonnaise") then artisanprice = 190
elseif (item == "duck mayonnaise") then artisanprice = 375
elseif (item == "void mayonnaise") then artisanprice = 275
elseif (item == "dinosaur mayonnaise") then artisanprice = 800
elseif (item == "truffle oil") then artisanprice = 1065
]]
else artisanprice = baseprice
end

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)

if ulang == "DE" then return formattedSum .. " G"
elseif (ulang == "EN" or ulang == "HU" or ulang == "TR") then
return formattedSum .. "g"
elseif ulang == "ES" then return formattedSum .. "[[File:Gold.png|18px|link=]]"
elseif ulang == "FR" then return formattedSum .. "po"
elseif ulang == "IT" then return formattedSum .. "o"
elseif ulang == "KO" then return formattedSum .. "골드"
elseif ulang == "PT" then
if ((sum < 2) and (sum > -2)) then
return formattedSum .. " ouro"
else return formattedSum .. " ouros"
end
elseif ulang == "RU" then return formattedSum .. " з."
elseif ulang == "ZH" then return formattedSum .. "金"
else return formattedSum
end
end

return p

편집

106,467

둘러보기 메뉴