Welcome to the Umamusume Wiki! If you want to contribute, please read the guidelines.
Module:Game/Contribution
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Game/Contribution/doc
--[[
!! THIS PAGE IS MANAGED BY GITLAB !!
ANY EDITS TO PAGE CONTENT WILL BE OVERWRITTEN
TO MAKE CHANGES, PLEASE SUBMIT A MERGE REQUEST AT https://gitlab.com/umamusume-wiki/lua-modules
]]
local Contribution = {}
local Game = require("Module:Game")
local Cargo = require("Module:Cargo")
function Contribution.listMissing(frame)
local function findMissing(masterTable, cargoTable, cargoIdKey)
local cargoDatas = Cargo.query {
from = cargoTable,
fields = { cargoIdKey },
limit = 5000,
}
local cargoIdMap = {}
for _, cargoData in ipairs(cargoDatas) do
cargoIdMap[cargoData[cargoIdKey]] = true
end
local masterDatas = Game.queryMaster {
from = masterTable,
where = "id < 9000000", -- ignore dummy cards
data = { "id" }
}
local missing = {}
for _, data in ipairs(masterDatas) do
local id = data[1]
if cargoIdMap[id] ~= true then
table.insert(missing, id)
end
end
return missing
end
local missingCards = findMissing("card_data", "Game_Cards", "card_id")
local missingSupports = findMissing("support_card_data", "Game_Supports", "support_id")
local text = '=== Cards ===\n'
if #missingCards > 0 then
for _, cardId in ipairs(missingCards) do
local line = string.format("%s (%s)\n\n",
frame:expandTemplate { title = "Game Card", args = { cardId } },
cardId)
text = text .. line
end
else
text = text .. 'Up to date!\n\n'
end
text = text .. '=== Supports ===\n'
if #missingSupports > 0 then
for _, supportId in ipairs(missingSupports) do
local line = string.format("%s (%s)\n\n",
frame:expandTemplate { title = "Game Support", args = { supportId } },
supportId)
text = text .. line
end
else
text = text .. 'Up to date!\n\n'
end
return mw.text.trim(text)
end
return Contribution