(Created page with "cdb = require("Module:Crafting_DB") edb = require("Module:Enemy_DB") cbdb = require("Module:CooksBook_DB") pdb = require("Module:Potions_DB") u = require("Module:Util") local p = {} function p.used_in_table(name) recipes = {} for _, e in ipairs(cdb) do for _, f in ipairs(e[6]) do if f[1] == name then table.insert(recipes, {e[1], e[2], e[4], f[2]}) end end end result = [[ {| class="wikitable sorta...") |
mNo edit summary |
||
| (16 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
cbdb = require("Module:CooksBook_DB") | cbdb = require("Module:CooksBook_DB") | ||
pdb = require("Module:Potions_DB") | pdb = require("Module:Potions_DB") | ||
idb = require("Module:Tablette_DB") | |||
u = require("Module:Util") | u = require("Module:Util") | ||
| Line 10: | Line 11: | ||
recipes = {} | recipes = {} | ||
for _, e in ipairs(cdb) do | for _, e in ipairs(cdb) do | ||
for _, f in ipairs(e[ | for _, f in ipairs(e[5]) do | ||
if f[1] == name then | if f[1] == name then | ||
table.insert(recipes, {e[1], e[2], e[ | table.insert(recipes, {e[1], e[2], e[3], f[2]}) | ||
end | end | ||
end | end | ||
| Line 18: | Line 19: | ||
result = [[ | result = [[ | ||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
!Item | ! colspan="2"|Item | ||
!Crafting level | !Crafting level | ||
!Amount needed | !Amount needed | ||
| Line 26: | Line 27: | ||
|- | |- | ||
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[ | |]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[ | ||
|]] .. '[[' .. e[1] .. ']]' .. [[ | |||
|]] .. e[3] .. [[ | |]] .. e[3] .. [[ | ||
| Line 49: | Line 52: | ||
result = [[ | result = [[ | ||
{| class="wikitable" | {| class="wikitable" | ||
!Recipe | ! colspan="2"|Recipe | ||
!Cooking level | !Cooking level | ||
!Amount needed | !Amount needed | ||
| Line 57: | Line 60: | ||
|- | |- | ||
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[ | |]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[ | ||
|]] .. '[[' .. e[1] .. ']]' .. [[ | |||
|]] .. e[3] .. [[ | |]] .. e[3] .. [[ | ||
| Line 69: | Line 74: | ||
end | end | ||
function p.brewed_in_table(name) | |||
recipes = {} | recipes = {} | ||
for _, e in ipairs(pdb) do | for _, e in ipairs(pdb) do | ||
| Line 80: | Line 85: | ||
result = [[ | result = [[ | ||
{| class="wikitable" | {| class="wikitable" | ||
!Potion | ! colspan="2"|Potion | ||
!Brewing Level | !Brewing Level | ||
!Amount Needed | !Amount Needed | ||
| Line 89: | Line 94: | ||
|- | |- | ||
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[ | |]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[ | ||
|]] .. '[[' .. e[1] .. ']]' .. [[ | |||
|]] .. e[3] .. [[ | |]] .. e[3] .. [[ | ||
| Line 95: | Line 102: | ||
|]] .. e[5] .. [[ | |]] .. e[5] .. [[ | ||
]] | |||
end | |||
return result .. [[ | |||
|} | |||
]] | |||
end | |||
function p.bloodify_table(name) | |||
recipes = {} | |||
for _, e in ipairs(idb) do | |||
local added = false | |||
for _, f in ipairs(e[7]) do | |||
if f[1] == name then | |||
table.insert(recipes, {e[1], e[2], f[2]}) | |||
added = true | |||
end | |||
end | |||
if added then | |||
for _, s in ipairs(e[8]) do | |||
if s[1] == name then | |||
recipes[#recipes][4] = s[2] | |||
else | |||
recipes[#recipes][4] = '' | |||
end | |||
end | |||
else | |||
for _, s in ipairs(e[8]) do | |||
if s[1] == name then | |||
table.insert(recipes, {e[1], e[2], '', s[2]}) | |||
end | |||
end | |||
end | |||
end | |||
result = [[ | |||
{| class="wikitable" | |||
! colspan="2"|Tablette | |||
! colspan="2"|How many needed to Bloodify | |||
]] | |||
for _, e in ipairs(recipes) do | |||
result = result .. [[ | |||
|- | |||
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[ | |||
|]] .. '[[' .. e[1] .. ']]' .. [[ | |||
|style="width: 30%;"|]] .. u.c(e[3]) .. [[ | |||
|style="width: 30%;"|]] .. u.c(e[4]) .. [[ | |||
]] | ]] | ||
| Line 106: | Line 163: | ||
recipes = {} | recipes = {} | ||
for _, e in ipairs(edb) do | for _, e in ipairs(edb) do | ||
if e[2] ~= "Fields2" then | |||
for _, f in ipairs(e[8]) do | |||
if f[1] == name then | |||
table.insert(recipes, {e[1], e[1] .. ' Monster', f[2], f[3], f[4], f[6], f[5] and e[2]}) | |||
end | |||
end | |||
end | |||
end | end | ||
result = [[ | result = [[ | ||
{| class="wikitable" | {| class="wikitable" | ||
! | ! colspan="2"|Monster | ||
!Amount dropped | !Amount dropped | ||
!Drop chance | !Drop chance | ||
| Line 122: | Line 181: | ||
|- class="]] .. u.r(e[5]) .. [[" | |- class="]] .. u.r(e[5]) .. [[" | ||
|]] .. '[[File: ' .. e[2]:gsub(' ', '') .. '.png|35px|link=' .. e[1] .. ']]' .. [[ | |]] .. '[[File: ' .. e[2]:gsub(' ', '') .. '.png|35px|link=' .. e[1] .. ']]' .. [[ | ||
|]] .. '[[' .. e[1] .. ']]' .. [[ | |||
|]] .. (e[3] == e[4] and u.c(e[3]) or u.c(e[3]) .. ' - ' .. u.c(e[4])) .. [[ | |]] .. (e[3] == e[4] and u.c(e[3]) or u.c(e[3]) .. ' - ' .. u.c(e[4])) .. [[ | ||
| Line 144: | Line 205: | ||
function p.tbit(frame) | function p.tbit(frame) | ||
return p.brewed_in_table(frame.args[1] or frame:getParent():getTitle()) | return p.brewed_in_table(frame.args[1] or frame:getParent():getTitle()) | ||
end | |||
function p.tbt(frame) | |||
return p.bloodify_table(frame.args[1] or frame:getParent():getTitle()) | |||
end | end | ||
Latest revision as of 16:51, 14 January 2025
Documentation for this module may be created at Module:Items/doc
cdb = require("Module:Crafting_DB")
edb = require("Module:Enemy_DB")
cbdb = require("Module:CooksBook_DB")
pdb = require("Module:Potions_DB")
idb = require("Module:Tablette_DB")
u = require("Module:Util")
local p = {}
function p.used_in_table(name)
recipes = {}
for _, e in ipairs(cdb) do
for _, f in ipairs(e[5]) do
if f[1] == name then
table.insert(recipes, {e[1], e[2], e[3], f[2]})
end
end
end
result = [[
{| class="wikitable sortable"
! colspan="2"|Item
!Crafting level
!Amount needed
]]
for _, e in ipairs(recipes) do
result = result .. [[
|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[' .. e[1] .. ']]' .. [[
|]] .. e[3] .. [[
|]] .. u.c(e[4]) .. [[
]]
end
return result .. [[
|}
]]
end
function p.cooked_in_table(name)
recipes = {}
for _, e in ipairs(cbdb) do
for _, f in ipairs(e[6]) do
if f[1] == name then
table.insert(recipes, {e[1], e[2], e[3], f[2]})
end
end
end
result = [[
{| class="wikitable"
! colspan="2"|Recipe
!Cooking level
!Amount needed
]]
for _, e in ipairs(recipes) do
result = result .. [[
|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[' .. e[1] .. ']]' .. [[
|]] .. e[3] .. [[
|]] .. u.c(e[4]) .. [[
]]
end
return result .. [[
|}
]]
end
function p.brewed_in_table(name)
recipes = {}
for _, e in ipairs(pdb) do
for _, f in ipairs(e[5]) do
if f[1] == name then
table.insert(recipes, {e[1], e[2], e[3], f[2], e[6]})
end
end
end
result = [[
{| class="wikitable"
! colspan="2"|Potion
!Brewing Level
!Amount Needed
!Potion Effect
]]
for _, e in ipairs(recipes) do
result = result .. [[
|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[' .. e[1] .. ']]' .. [[
|]] .. e[3] .. [[
|]] .. u.c(e[4]) .. [[
|]] .. e[5] .. [[
]]
end
return result .. [[
|}
]]
end
function p.bloodify_table(name)
recipes = {}
for _, e in ipairs(idb) do
local added = false
for _, f in ipairs(e[7]) do
if f[1] == name then
table.insert(recipes, {e[1], e[2], f[2]})
added = true
end
end
if added then
for _, s in ipairs(e[8]) do
if s[1] == name then
recipes[#recipes][4] = s[2]
else
recipes[#recipes][4] = ''
end
end
else
for _, s in ipairs(e[8]) do
if s[1] == name then
table.insert(recipes, {e[1], e[2], '', s[2]})
end
end
end
end
result = [[
{| class="wikitable"
! colspan="2"|Tablette
! colspan="2"|How many needed to Bloodify
]]
for _, e in ipairs(recipes) do
result = result .. [[
|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[' .. e[1] .. ']]' .. [[
|style="width: 30%;"|]] .. u.c(e[3]) .. [[
|style="width: 30%;"|]] .. u.c(e[4]) .. [[
]]
end
return result .. [[
|}
]]
end
function p.dropped_from_table(name)
recipes = {}
for _, e in ipairs(edb) do
if e[2] ~= "Fields2" then
for _, f in ipairs(e[8]) do
if f[1] == name then
table.insert(recipes, {e[1], e[1] .. ' Monster', f[2], f[3], f[4], f[6], f[5] and e[2]})
end
end
end
end
result = [[
{| class="wikitable"
! colspan="2"|Monster
!Amount dropped
!Drop chance
]]
for _, e in ipairs(recipes) do
result = result .. [[
|- class="]] .. u.r(e[5]) .. [["
|]] .. '[[File: ' .. e[2]:gsub(' ', '') .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[' .. e[1] .. ']]' .. [[
|]] .. (e[3] == e[4] and u.c(e[3]) or u.c(e[3]) .. ' - ' .. u.c(e[4])) .. [[
|1/]] .. e[5] .. (e[6] and e[6] ~= '' and '*' or '') .. [[
]]
end
return result .. [[
|}
]]
end
function p.tuit(frame)
return p.used_in_table(frame.args[1] or frame:getParent():getTitle())
end
function p.tcit(frame)
return p.cooked_in_table(frame.args[1] or frame:getParent():getTitle())
end
function p.tbit(frame)
return p.brewed_in_table(frame.args[1] or frame:getParent():getTitle())
end
function p.tbt(frame)
return p.bloodify_table(frame.args[1] or frame:getParent():getTitle())
end
function p.tdft(frame)
return p.dropped_from_table(frame.args[1] or frame:getParent():getTitle())
end
return p