Module:AlchemistPassiveList: Difference between revisions

separate out the code to differentiate between passive recipes and passive activities
(change code base to match PotionList which uses extensive search for all subreceipes and reagents, but keep it showing non-recipe passive activities)
(separate out the code to differentiate between passive recipes and passive activities)
Line 14:
local query = {
'[[Uses facility::Passive Potion Station]] OR [[Variant of::Ebsworth Work]]',
'?Variant of #- = variant',
'?Profession Level A = lvl',
'? #- = name',
Line 19 ⟶ 20:
'?Activity XP = XP',
'?Activity duration = duration',
'?Activity coins = coins',
'?Variant of #- = variant',
'?Value = sell',
'sort = Profession Level A',
Line 26 ⟶ 25:
}
local results = mw.smw.ask(query)
 
-- criterion for if an entry is a recipe, or a passive activity
for _, item in ipairs(results) do
item.passiveActivity = item.variant=='Ebsworth Work'
end
results = p.formatResults(results)
 
Line 57 ⟶ 61:
-- recipe in a workable format
if item.variant=='Ebsworth Work'passiveActivity then
-- if it is ebswortha work,passive subactivity inthat differentis fieldsnot fora the buy and sell valuesrecipe
-- some fields are easy to work out
item.outputQuantity = 1
item.reagents = {}
item.intermediates = {}
item.buy = 0
 
item.sell = item.coins
-- "sell price" is replaced with the coins that the activity gives
local shopPriceQuery = '[[Name::' .. item.name .. ']]|?Activity coins#-'
local shopPriceResult = mw.smw.ask(shopPriceQuery) or {}
local shopPrice = 0
if shopPriceResult[1] and shopPriceResult[1]["Activity coins"] then
item.sell = tonumber(shopPriceResult[1]["Activity coins"]) or 0
end
else
Line 93 ⟶ 106:
else
item.buy = nil
end
item.buy = item.buy and item.buy + shopPrice * reagent.quantity
Line 233 ⟶ 246:
:done()
:IF(not(item.variant=='Ebsworth Work'passiveActivity))
 
local reagentCell = row:tag('td')
10,210

edits