Module:LeatherworkerList: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(offload much of the search, screen, and format functions to the new ProfessionList module, so they work the same for all table)
m (cleanup required modules, this one does actually use recipe tree search)
Line 3: Line 3:
local lang = mw.getContentLanguage()
local lang = mw.getContentLanguage()
local plist = require('Module:ProfessionList')
local plist = require('Module:ProfessionList')
local rts = require('Module:RecipeTreeSearch')
local search = require('Module:RecipeTreeSearch')
local discount = require('Module:MerchantHideDiscount')
local discount = require('Module:MerchantHideDiscount')


Line 77: Line 77:
item.profitPerHour = item.profit and item.productPerHour and math.floor(item.profit * item.productPerHour)
item.profitPerHour = item.profit and item.productPerHour and math.floor(item.profit * item.productPerHour)
item.profitPerHourDiscount = item.profit and item.productPerHour and math.floor(item.profit * item.productPerHour)
item.profitPerHourDiscount = item.profit and item.productPerHour and math.floor(item.profit * item.productPerHour)

-- discounted buy price is not provided by the search, have to do it manually
-- discounted buy price is not provided by the search, have to do it manually
item.discountLevel = discount[item.material]
item.discountLevel = discount[item.material]
item.buyPriceDiscount = rts.getShopSellPrice(item.material)
item.buyPriceDiscount = search.getShopSellPrice(item.material)
item.profitDiscount = item.sellPrice and item.buyPriceDiscount and item.sellPrice - item.buyPriceDiscount
item.profitDiscount = item.sellPrice and item.buyPriceDiscount and item.sellPrice - item.buyPriceDiscount
item.profitPerHourDiscount = item.profitDiscount and item.productPerHour and math.floor(item.profitDiscount * item.productPerHour)
item.profitPerHourDiscount = item.profitDiscount and item.productPerHour and math.floor(item.profitDiscount * item.productPerHour)