Modifications

Aller à : navigation, rechercher

Module:Collection/Affichage

2 350 octets ajoutés, 6 septembre 2019 à 06:30
Page créée avec « local p = {} local Boite = mw.loadData('Module:Collection/Boite') local Vaisseau = mw.loadData('Module:Collection/Vaisseau') local Faction = {} Faction[1] = { no... »
local p = {}

local Boite = mw.loadData('Module:Collection/Boite')
local Vaisseau = mw.loadData('Module:Collection/Vaisseau')

local Faction = {}
Faction[1] = {
nom = "République galactique",
icone = mw.getCurrentFrame():expandTemplate({ title = 'Republique galactique logo', args = {} }),
}
Faction[2] = {
nom = "Alliance séparatiste",
icone = mw.getCurrentFrame():expandTemplate({ title = 'Alliance separatiste logo', args = {} }),
}
Faction[3] = {
nom = "Alliance rebelle",
icone = mw.getCurrentFrame():expandTemplate({ title = 'Alliance rebelle logo', args = {} }),
}
Faction[4] = {
nom = "Empire galactique",
icone = mw.getCurrentFrame():expandTemplate({ title = 'Empire galactique logo', args = {} }),
}
Faction[5] = {
nom = "Racails et scélérats",
icone = mw.getCurrentFrame():expandTemplate({ title = 'Racailles scelerats logo', args = {} }),
}
Faction[6] = {
nom = "Résistance",
icone = mw.getCurrentFrame():expandTemplate({ title = 'La resistance logo', args = {} }),
}
Faction[7] = {
nom = "Premier Ordre",
icone = mw.getCurrentFrame():expandTemplate({ title = 'Premier ordre logo', args = {} }),
}

function p.affichageVaisseauListe(vaissCollecTab, affIfZero)
retour = ""
for k, v in pairs (vaissCollecTab) do
if (v ~= 0) or (affIfZero == "true") then
if Vaisseau[k] ~= nil then
retour = retour .. "* " .. Vaisseau[k].lien .. " x " .. v .. "\n"
end
end
end

return retour
end

function p.affichageVaisseauByFaction(vaissCollecTab, affIfZero)
retour = ""
for kFac, vFac in pairs (Faction) do
affLogoFac = false
for kVai, vVai in pairs (vaissCollecTab) do
if Vaisseau[kVai] ~= nil then
if ((vVai ~= 0) or (affIfZero == "true")) and (Vaisseau[kVai].factiondefaut == vFac.nom) then
if affLogoFac == false then
affLogoFac = true
retour = retour .. vFac.icone .." "
end
retour = retour .. "[[" .. Vaisseau[kVai].nom .. "|" .. Vaisseau[kVai].icone .. "]] x " .. vVai .. " "
end
end
end
retour = retour .. "\n\n"
end

return retour
end

return p

Menu de navigation