Module:Sandbox/User:Alsang/NodeDescriptionChecker: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(tidy up column headings) |
(save as WIP for passive stonemason) |
||
Line 21: | Line 21: | ||
--'[[Uses facility::Knickknacks workbench]] OR [[Variant of::Divination||Sabertooth Cat Skeleton||Wooly Mammoth Skeleton||Triceratops Skeleton||T-Rex Skeleton||Wendigo Skeleton||Bonemeal Cement]]', -- bonewright passive |
--'[[Uses facility::Knickknacks workbench]] OR [[Variant of::Divination||Sabertooth Cat Skeleton||Wooly Mammoth Skeleton||Triceratops Skeleton||T-Rex Skeleton||Wendigo Skeleton||Bonemeal Cement]]', -- bonewright passive |
||
--'[[Uses facility::One Handed Range (stonemason)||One Handed Melee Workbench (stonemason)||Two Handed Range Workbench (stonemason)||Two Handed Melee Workbench (stonemason)||Shield Vice (stonemason)]]', -- stonemason active |
--'[[Uses facility::One Handed Range (stonemason)||One Handed Melee Workbench (stonemason)||Two Handed Range Workbench (stonemason)||Two Handed Melee Workbench (stonemason)||Shield Vice (stonemason)]]', -- stonemason active |
||
'[[Uses facility::Stoneware Bench]] OR [[Variant of::Statue Sculpture||Ornamental Scuplture||Column Sculpture||Bust Sculpture]]', -- stonemason passive |
|||
--'[[Uses facility::Goblin Forge||Gnome Forge (skill node)]]', -- blacksmith active |
--'[[Uses facility::Goblin Forge||Gnome Forge (skill node)]]', -- blacksmith active |
||
--'[[Uses facility::Jewelry Bench]]', -- blacksmith passive, no non-recipe |
--'[[Uses facility::Jewelry Bench]]', -- blacksmith passive, no non-recipe |
||
'[[-Sold item.Sold by::Leather stall]][[Recipe JSON::~*]]', -- leatherworker active, the stall sells scraps and we need to ignore those |
|||
--'[[-Sold item.Sold by::Leather Goods]] OR [[Variant of::Upholstery]]', -- leatherworker passive, but the Upholstery activities dont have pages yet |
|||
'?Uses facility #- = facility', |
'?Uses facility #- = facility', |
||
'?Profession Level A = lvl', |
'?Profession Level A = lvl', |
||
Line 41: | Line 39: | ||
-- criterion for if an entry is a recipe, or a passive activity |
-- criterion for if an entry is a recipe, or a passive activity |
||
for _, item in ipairs(results) do |
for _, item in ipairs(results) do |
||
item.passiveActivity = false -- can delete this entire FOR statement unless there are non-recipe passive activities on the table |
--item.passiveActivity = false -- can delete this entire FOR statement unless there are non-recipe passive activities on the table |
||
item.passiveActivity = not(item.facility=='Stoneware Bench') -- leatherworker has not got upholstery implemented yet, do not use |
|||
end |
end |
||
Line 71: | Line 69: | ||
function p.formatResults(results) |
function p.formatResults(results) |
||
local discountList = discount.main() |
|||
-- iterate through products |
-- iterate through products |
||
for _, item in ipairs(results) do |
for _, item in ipairs(results) do |
||
Line 103: | Line 99: | ||
-- iterate through materials, adding buy price to running total (individuals not needed) |
-- iterate through materials, adding buy price to running total (individuals not needed) |
||
item.buy = 0 |
item.buy = 0 |
||
item.buyDiscount = 0 |
|||
for _, material in ipairs(item.materials) do |
for _, material in ipairs(item.materials) do |
||
Line 119: | Line 114: | ||
item.buy = item.buy and item.buy + shopPrice * material.quantity |
item.buy = item.buy and item.buy + shopPrice * material.quantity |
||
--with the merchant discount, buy price is sell price |
|||
local shopPriceQuery = '[[:+]][[Sold item::' .. material.name .. ']]|?Shop sell price|mainlabel=' .. material.name |
|||
local shopPriceResult = mw.smw.ask(shopPriceQuery) or {} |
|||
local shopPrice = 0 |
|||
if shopPriceResult[1] and shopPriceResult[1]["Shop sell price"] then |
|||
shopPrice = tonumber(shopPriceResult[1]["Shop sell price"]) or 0 |
|||
else |
|||
item.buyDiscount = nil |
|||
end |
|||
item.buyDiscount = item.buyDiscount and item.buyDiscount + shopPrice * material.quantity |
|||
end |
end |
||
Line 178: | Line 160: | ||
item.sell = item.sell and item.outputQuantity and item.sell * item.outputQuantity |
item.sell = item.sell and item.outputQuantity and item.sell * item.outputQuantity |
||
item.profit = item.sell and item.buy and item.sell - item.buy |
item.profit = item.sell and item.buy and item.sell - item.buy |
||
item.profitDiscount = item.sell and item.buyDiscount and item.sell - item.buyDiscount |
|||
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 |
||
item.profitPerXPDiscount = item.profitDiscount and item.XP and math.floor(item.profitDiscount / item.XP * 100) / 100 |
|||
local hideName = string.gsub(item.name,'Leather','Hide') |
|||
item.discountLevel = discountList[hideName] |
|||
-- a lot of downtime in leatherworker |
-- a lot of downtime in leatherworker |
||
Line 194: | Line 172: | ||
item.XPPerHour = item.XP and item.productPerHour and math.floor(item.XP * item.productPerHour) |
item.XPPerHour = item.XP and item.productPerHour and math.floor(item.XP * item.productPerHour) |
||
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.profitDiscount and item.productPerHour and math.floor(item.profitDiscount * item.productPerHour) |
|||
end |
end |
||
Line 206: | Line 183: | ||
:tag('tr') |
:tag('tr') |
||
:tag('th') |
:tag('th') |
||
:wikitext('[[File: |
:wikitext('[[File:Stonemason small icon.png|15px]] Level') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
Line 215: | Line 192: | ||
:wikitext('Materials') |
:wikitext('Materials') |
||
:done() |
:done() |
||
-- :tag('th') |
|||
⚫ | |||
⚫ | |||
-- :done() |
|||
-- :tag('th') |
|||
-- :attr{ colspan = '10' } |
|||
-- :wikitext('Sell Value') |
|||
-- :done() |
|||
:tag('th') |
:tag('th') |
||
:attr{ colspan = '10' } |
:attr{ colspan = '10' } |
||
:wikitext(' |
:wikitext('Buy Value') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:attr{ colspan = '10' } |
:attr{ colspan = '10' } |
||
:wikitext(' |
:wikitext('Sell Value') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
⚫ | |||
:wikitext('[[File:Merchant_small_icon.png|18px]] level<br>for discount') |
|||
⚫ | |||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:attr{ colspan = '10' } |
:attr{ colspan = '10' } |
||
:wikitext('Profit/hr |
:wikitext('Profit/hr') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
Line 244: | Line 214: | ||
:wikitext('XP/hr') |
:wikitext('XP/hr') |
||
:done() |
:done() |
||
:tag('th') |
|||
:attr{ colspan = '10' } |
|||
:wikitext('Coins/XP') |
|||
:done() |
|||
-- :tag('th') |
|||
-- :attr{ colspan = '10' } |
|||
-- :wikitext('Coins/XP with [[File:Merchant_small_icon.png|18px]] discount') |
|||
-- :done() |
|||
:done() |
:done() |
||
Line 294: | Line 260: | ||
row |
row |
||
:node(currency_cell(item.buy)) |
|||
:node(currency_cell(item.sell)) |
|||
:ELSE() |
:ELSE() |
||
Line 309: | Line 275: | ||
:node(currency_cell(item.profitPerHour)) |
:node(currency_cell(item.profitPerHour)) |
||
:tag('td') |
|||
:css{ ['text-align'] = 'center' } |
|||
:wikitext(item.discountLevel) |
|||
:done() |
|||
:node(currency_cell(item.profitPerHourDiscount)) |
|||
:IF(item.XP) |
:IF(item.XP) |
||
:tag('td') |
:tag('td') |
||
Line 331: | Line 291: | ||
:END() |
:END() |
||
:node(currency_cell(item.profitPerXP)) |
|||
-- :node(currency_cell(item.profitPerXPDiscount)) |
|||
:done() |
:done() |