Module:AlchemistPassiveList: Difference between revisions
m
Alsang moved page Module:PassivePotionList to Module:AlchemistPassiveList without leaving a redirect: match the naming convention of the other "List" modules
(simplify getting the value from passive activities that are not recipes, it was broken) |
m (Alsang moved page Module:PassivePotionList to Module:AlchemistPassiveList without leaving a redirect: match the naming convention of the other "List" modules) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1:
require('strict')
require('Module:Mw.html extension')
local param = require( 'Module:Paramtest' )
local currency = require('Module:Currency')
Line 58 ⟶ 57:
function p.formatResults(results)
-- iterate through
for _, item in ipairs(results) do
Line 67 ⟶ 66:
-- some fields are easy to work out
item.outputQuantity = 1
item.
item.intermediates = {}
item.buy = 0
Line 76 ⟶ 75:
local unpackJSON = mw.text.jsonDecode(item.recipeJSON)
item.outputQuantity = unpackJSON.output[1].quantity
-- SECTION REMOVED
-- do not need to extensively search for subrecipes, as passive recipe
-- passive recipes only ever have one step
item.materials = unpackJSON.materials
▲ -- iterate through reagents, adding buy price to running total (individuals not needed)
item.buy = 0
for _,
--shamelessley lifted from Module:Products
local shopPriceQuery = '[[:+]][[Sold item::' ..
local shopPriceResult = mw.smw.ask(shopPriceQuery) or {}
local shopPrice = 0
Line 101 ⟶ 96:
end
item.buy = item.buy and item.buy + shopPrice *
end
Line 151 ⟶ 107:
item.profitPerXP = item.profit and item.XP and math.floor(item.profit / item.XP * 100) / 100
--
local batchSize = 200
local downtime = 0
item.duration = item.duration and item.duration + downtime/batchSize
item.
-- properties per hour
item.XPPerHour = item.XP and item.
item.profitPerHour = item.profit and item.
end
Line 175 ⟶ 131:
:tag('th')
:attr{ colspan = '3' }
:wikitext('
:done()
:tag('th')
:wikitext('
:done()
:tag('th')
Line 241 ⟶ 197:
:IF(not(item.passiveActivity))
local
for i, _ in ipairs(item.
end
|