Editing Module:ChefList
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 94: | Line 94: | ||
-- iterate through materials, adding buy price to running total (individuals not needed) |
-- iterate through materials, adding buy price to running total (individuals not needed) |
||
-- also need to keep track of how many materials are needed from each shop |
|||
item.buy = 0 |
item.buy = 0 |
||
item.fishShopTrips = 0 |
|||
item.vegShopTrips = 0 |
|||
for _, material in ipairs(item.materials) do |
for _, material in ipairs(item.materials) do |
||
Line 113: | Line 110: | ||
item.buy = item.buy and item.buy + shopPrice * material.quantity |
item.buy = item.buy and item.buy + shopPrice * material.quantity |
||
-- query which shop sold it, add to running total |
|||
local shopNameQuery = '[[:+]][[Sold item::' .. material.name .. ']]|?Sold by|mainlabel=' .. material.name |
|||
local shopNameResult = mw.smw.ask(shopNameQuery) or {} |
|||
⚫ | |||
if shopNameResult[1] and shopNameResult[1]["Sold by"] then |
|||
shopName = shopNameResult[1]["Sold by"] or '' |
|||
end |
|||
if shopName=="The Frequently Fresh Fish Stall" then |
|||
item.fishShopTrips = item.fishShopTrips + 1 |
|||
elseif shopName=="Kevin's Ingredients" then |
|||
item.vegShopTrips = item.vegShopTrips + 1 |
|||
end |
|||
end |
end |
||
Line 174: | Line 156: | ||
item.profitPerXP = item.profit and item.XP and math.floor(item.profit / item.XP * 100) / 100 |
item.profitPerXP = item.profit and item.XP and math.floor(item.profit / item.XP * 100) / 100 |
||
-- |
-- 40 seconds to buy new supplies and travel and deposit and everything, per 12 products |
||
-- this part will be tricky for Chef since different recipes do different size batches, and travel to different shops |
|||
-- assume make one trip to buy 24 of each material from each shop per batch of 24 food |
|||
local batchSize = |
local batchSize = 12 |
||
⚫ | |||
-- 20 seconds moving between stations per 24 made |
|||
-- 30 seconds per trip to Kevin's Ingredients |
|||
-- 60 seconds per trip to the fish shop |
|||
-- are these results optimal? no. are they approximate? yes |
|||
local downtime = 20 + item.vegShopTrips * 30 + item.fishShopTrips * 60 |
|||
item.duration = item.duration and item.duration + downtime/batchSize |
item.duration = item.duration and item.duration + downtime/batchSize |
||
item.productPerHour = item.duration and 1 / item.duration * 3600 |
item.productPerHour = item.duration and 1 / item.duration * 3600 |