Open main menu

Yugipedia β

Changes

Module:DM Fusion display

211 bytes removed, 1 month ago
Fixed wrong table being iterated on. Removing unnecessary checks. Fixed some exceptions being carried over to the next combination
local mats_row = cur_table:tag("tr"):tag("td"):tag("div"):attr("style", "column-width: 13em; column-count: " .. columns):tag("ul")
-- The second cell also includes Print other materials, but don't include those present in the "except with" additionexceptions table
for _, card in pairs(mats) do
if not other_mat_exceptions[card] then
card = unlink(card)
mats_row:tag("li"):wikitext(format_card_to_display(card) .. (other_mat_exceptions[card] and string.format(" (except with \"[[%s|%s]]\")", other_mat_exceptions[card], CARD_INFO[other_mat_exceptions[card]]["name"]) or ''))
end
end
end
local query = mw.smw.ask( string.format("[[For Fusion::%s]] |?Fusion Material exception 1 |?Fusion Material exception 2|?For Fusion", table.concat(fusion_ids, "||")) ) or {}
return query
local fusion_frame = HTML()
local page_name = _args[1] or "Harpie Lady Sisters Amazon of the Seas (DOR)"
local query = process_fusion_combination_query( string.format("[[Fusion result::%s]]", page_name ))
if query then
local combination_exceptions_query = process_combination_exception_query(query)
local combination_exceptions = {}
if next(combination_exceptions_query) ~= nil then
for _, combi_ex in pairs(query) do
combination_exceptions[unlink(combi_ex["Fusion Material exception 1"])] = unlink(combi_ex["Fusion Material exception 2"])
end
end
local prev_description, cur_table
for i, combination in pairs(query) do
local combi_id, mats1, mats2, description, columns = combination[1], combination["Fusion Material 1"], combination["Fusion Material 2"], combination["Description"], combination["Columns"] or 1 local combination_exceptions = {}
-- MW attributes don't return a table if there is only 1 value. Converting both to tables to facilitate future processing
mats1 = type(mats1) ~= 'table' and { mats1 } or mats1
mats2 = type(mats2) ~= 'table' and { mats2 } or mats2
for _, combi_ex in pairs(combination_exceptions_query) do
if combi_ex["For Fusion"] == combi_id then
combination_exceptions[unlink(combi_ex["Fusion Material exception 1"])] = unlink(combi_ex["Fusion Material exception 2"])
end
end
-- Creates a new table on the first itteration, and when a description changes
if material_index == 1 then
mats = mats1
if next(combination_exceptions_query) ~= nil then for _, combi_ex in pairs(combination_exceptions_query) do if unlink(combi_ex["Fusion Material exception 1"]) == page_name then cur_combi_exceptions[combi_ex["Fusion Material exception 2"]] = true end
end
end
else
mats = mats2
if next(combination_exceptions_query) ~= nil then for _, combi_ex in pairs(combination_exceptions_query) do if unlink(combi_ex["Fusion Material exception 2"]) == page_name then cur_combi_exceptions[combi_ex["Fusion Material exception 1"]] = true end
end
end