Home
Random
Log in
Settings
About HourGlass: The Game Wiki
Disclaimers
HourGlass: The Game Wiki
Search
Editing
Module:Calcsellprice
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
--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 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 (string.find(item, "wine") ~= nil) then artisanprice = (baseprice * 3) elseif (string.find(item, "juice") ~= nil) then artisanprice = math.floor(baseprice * 2.25) elseif ((string.find(item, "jelly")) or (string.find(item, "pickles")) ~= nil) then artisanprice = (50 + (baseprice * 2)) elseif (string.find(item, "dried") ~= nil) then artisanprice = math.floor((baseprice * 7.5) + 25) 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 (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 == "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) local ulang = string.upper(mw.language.getContentLanguage():getCode()) if ulang == "DE" then return formattedSum .. " G" elseif (ulang == "EN" or ulang == "JA" or ulang == "HU" or ulang == "TR") then return formattedSum .. "g" elseif ulang == "ES" then if (sum < 1000) then return formattedSum .. "o" elseif (sum < 10000) then local length = #(tostring(sum)) local temp = string.sub(tostring(sum), -3) return string.sub(tostring(sum), 1, (length-3)) .. "." .. temp .. "o" else local temp = {mw.ustring.gsub(tostring(formattedSum), "%s" , ".")} return temp[1] .. "o" end 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
Summary:
Please note that all contributions to HourGlass: The Game Wiki are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) (see
HourGlass The Game Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Calcsellprice/doc
(
edit
)