Mudanças entre as edições de "Módulo:Gb"
Ir para navegação
Ir para pesquisar
| Linha 6: | Linha 6: | ||
local function g(k, default) | local function g(k, default) | ||
return mw.text.trim(args[k] or "") ~= "" and args[k] or default | |||
end | end | ||
-- | local img = g("img", "Placeholder.png") | ||
local | local nome = g("nome", "Nome do Boss") | ||
local | local frase = g("frase", "Frase ou lema do boss.") | ||
local hp = g("hp", "???") | |||
local exp = g("exp", "???") | |||
local nivel = g("nivel", "???") | |||
local necessario = g("necessario", "-") | |||
local forte = g("forte", "-") | |||
local reflete = g("reflete", "-") | |||
local normal = g("normal", "") | |||
local elite = g("elite", "") | |||
local hard = g("hard", "") | |||
local extra = g("extra", "") | |||
local | local html = mw.html.create("div") | ||
local | :addClass("boss-container") | ||
local | :css{ | ||
background = "#18181b", | |||
["border-radius"] = "12px", | |||
padding = "30px", | |||
color = "#fff", | |||
width = "700px", | |||
margin = "auto", | |||
["font-family"] = "Verdana,sans-serif" | |||
} | |||
-- Título | |||
html:tag("div") | |||
:css("font-size", "1.5em") | |||
:css("font-weight", "bold") | |||
:css("margin-bottom", "10px") | |||
:wikitext("Bosses") | |||
-- Variantes | |||
local var = html:tag("div") | |||
:css("margin-bottom", "24px") | |||
var:tag("span") | |||
:css{ | |||
["background-color"] = "#232329", | |||
["border-radius"] = "7px 0 0 7px", | |||
padding = "7px 20px", | |||
["font-size"] = "1em", | |||
color = "#cbcdd7", | |||
["font-weight"] = "600" | |||
} | |||
:wikitext("Unbound Crimsonveil") | |||
var:tag("span") | |||
:css{ | |||
["background-color"] = "#19171c", | |||
["border-radius"] = "0 7px 7px 0", | |||
padding = "7px 20px", | |||
["font-size"] = "1em", | |||
color = "#fff", | |||
["font-weight"] = "600", | |||
border = "2px solid #c7a047", | |||
["border-left"] = "0" | |||
} | |||
:wikitext("Archon Crimsonveil") | |||
-- Container principal | |||
local main = html:tag("div") | |||
:css{ | |||
display = "flex", | |||
["align-items"] = "center" | |||
} | |||
-- Imagem | |||
main:tag("div") | |||
:css{ width = "110px", flex = "none" } | |||
:wikitext(string.format("[[Arquivo:%s|90x90px]]", img)) | |||
local | -- Nome + frase | ||
local textBox = main:tag("div") | |||
textBox:tag("div") | |||
:css{ ["font-size"] = "1.2em", ["font-weight"] = "bold", color = "#e82b2b" } | |||
:wikitext(nome) | |||
textBox:tag("div") | |||
:css{ ["font-size"] = "95%", color = "#eaa85d", ["font-style"] = "italic" } | |||
:wikitext(string.format('"%s"', frase)) | |||
-- Stats | |||
local stats = main:tag("div") | |||
:css{ | |||
["margin-left"] = "auto", | |||
display = "flex", | |||
["flex-direction"] = "column", | |||
["align-items"] = "flex-end", | |||
gap = "6px" | |||
} | |||
} | |||
. | |||
} | |||
local statBox = stats:tag("div") | |||
:css{ | |||
["background-color"] = "#222126", | |||
["border-radius"] = "8px", | |||
padding = "12px 20px", | |||
["min-width"] = "170px" | |||
} | |||
local sline = statBox:tag("div") | |||
local | :css{ | ||
display = "flex", | |||
["align-items"] = "center", | |||
gap = "18px" | |||
} | |||
sline:tag("span") | |||
:attr("title", "HP") | |||
:wikitext(string.format(" | :css{ color = "#fb3d3d", ["font-weight"] = "bold" } | ||
:wikitext(string.format('<span style="font-size:1.15em;">❤️ %s</span>', hp)) | |||
- | sline:tag("span") | ||
:attr("title", "EXP") | |||
:css{ color = "#ffe568", ["font-weight"] = "bold" } | |||
:wikitext(string.format('<span style="font-size:1.08em;">💰 %s</span>', exp)) | |||
sline:tag("span") | |||
:css{ | :attr("title", "Nível") | ||
:wikitext( | :css{ color = "#6ca8fb", ["font-weight"] = "bold" } | ||
:wikitext(string.format('<span style="font-size:1.04em;">⚔️ %s</span>', nivel)) | |||
-- Frescor / forte / reflete | |||
:css{[" | local infoLine = stats:tag("div") | ||
:css{ | |||
["margin-top"] = "5px", | |||
["font-size"] = "90%", | |||
color = "#cfccff" | |||
} | |||
infoLine:wikitext(string.format("<b>Necessario:</b> %s ", fresco)) | |||
infoLine:wikitext(string.format('<span style="margin-left:12px;"><b>Forte:</b> %s</span>', forte)) | |||
infoLine:wikitext(string.format('<span style="margin-left:12px;"><b>Reflete:</b> %s</span>', reflete)) | |||
-- | -- Loot table | ||
local loot = html:tag("div") | |||
:css{["margin-top"]=" | :css{ | ||
["margin-top"] = "28px", | |||
background = "#232329", | |||
["border-radius"] = "10px", | |||
padding = "18px" | |||
} | |||
local tableEl = loot:tag("table") | |||
local | :css{ | ||
width = "100%", | |||
:css{ | color = "#fff", | ||
["table-layout"] = "auto" | |||
} | |||
local function | local function row(label, color, content) | ||
local tr = tableEl:tag("tr") | |||
tr:tag("th") | |||
:css{ | |||
["text-align"] = "left", | |||
color = color, | |||
padding = "6px", | |||
["font-size"] = "1.07em" | |||
} | |||
:wikitext(label) | |||
tr:tag("td"):wikitext(content) | |||
end | end | ||
row("Normal:", "#f3e8bb", normal) | |||
row("Elite:", "#aeccff", elite) | |||
row("Hard:", "#e6e5ff", hard) | |||
row("Extra:", "#f9538f", extra) | |||
return tostring(html) | return tostring(html) | ||
Edição das 20h46min de 22 de novembro de 2025
A documentação para este módulo pode ser criada em Módulo:Gb/doc
-- Módulo:BossDisplay
local p = {}
function p.bossInfo(frame)
local args = frame:getParent().args
local function g(k, default)
return mw.text.trim(args[k] or "") ~= "" and args[k] or default
end
local img = g("img", "Placeholder.png")
local nome = g("nome", "Nome do Boss")
local frase = g("frase", "Frase ou lema do boss.")
local hp = g("hp", "???")
local exp = g("exp", "???")
local nivel = g("nivel", "???")
local necessario = g("necessario", "-")
local forte = g("forte", "-")
local reflete = g("reflete", "-")
local normal = g("normal", "")
local elite = g("elite", "")
local hard = g("hard", "")
local extra = g("extra", "")
local html = mw.html.create("div")
:addClass("boss-container")
:css{
background = "#18181b",
["border-radius"] = "12px",
padding = "30px",
color = "#fff",
width = "700px",
margin = "auto",
["font-family"] = "Verdana,sans-serif"
}
-- Título
html:tag("div")
:css("font-size", "1.5em")
:css("font-weight", "bold")
:css("margin-bottom", "10px")
:wikitext("Bosses")
-- Variantes
local var = html:tag("div")
:css("margin-bottom", "24px")
var:tag("span")
:css{
["background-color"] = "#232329",
["border-radius"] = "7px 0 0 7px",
padding = "7px 20px",
["font-size"] = "1em",
color = "#cbcdd7",
["font-weight"] = "600"
}
:wikitext("Unbound Crimsonveil")
var:tag("span")
:css{
["background-color"] = "#19171c",
["border-radius"] = "0 7px 7px 0",
padding = "7px 20px",
["font-size"] = "1em",
color = "#fff",
["font-weight"] = "600",
border = "2px solid #c7a047",
["border-left"] = "0"
}
:wikitext("Archon Crimsonveil")
-- Container principal
local main = html:tag("div")
:css{
display = "flex",
["align-items"] = "center"
}
-- Imagem
main:tag("div")
:css{ width = "110px", flex = "none" }
:wikitext(string.format("[[Arquivo:%s|90x90px]]", img))
-- Nome + frase
local textBox = main:tag("div")
textBox:tag("div")
:css{ ["font-size"] = "1.2em", ["font-weight"] = "bold", color = "#e82b2b" }
:wikitext(nome)
textBox:tag("div")
:css{ ["font-size"] = "95%", color = "#eaa85d", ["font-style"] = "italic" }
:wikitext(string.format('"%s"', frase))
-- Stats
local stats = main:tag("div")
:css{
["margin-left"] = "auto",
display = "flex",
["flex-direction"] = "column",
["align-items"] = "flex-end",
gap = "6px"
}
local statBox = stats:tag("div")
:css{
["background-color"] = "#222126",
["border-radius"] = "8px",
padding = "12px 20px",
["min-width"] = "170px"
}
local sline = statBox:tag("div")
:css{
display = "flex",
["align-items"] = "center",
gap = "18px"
}
sline:tag("span")
:attr("title", "HP")
:css{ color = "#fb3d3d", ["font-weight"] = "bold" }
:wikitext(string.format('<span style="font-size:1.15em;">❤️ %s</span>', hp))
sline:tag("span")
:attr("title", "EXP")
:css{ color = "#ffe568", ["font-weight"] = "bold" }
:wikitext(string.format('<span style="font-size:1.08em;">💰 %s</span>', exp))
sline:tag("span")
:attr("title", "Nível")
:css{ color = "#6ca8fb", ["font-weight"] = "bold" }
:wikitext(string.format('<span style="font-size:1.04em;">⚔️ %s</span>', nivel))
-- Frescor / forte / reflete
local infoLine = stats:tag("div")
:css{
["margin-top"] = "5px",
["font-size"] = "90%",
color = "#cfccff"
}
infoLine:wikitext(string.format("<b>Necessario:</b> %s ", fresco))
infoLine:wikitext(string.format('<span style="margin-left:12px;"><b>Forte:</b> %s</span>', forte))
infoLine:wikitext(string.format('<span style="margin-left:12px;"><b>Reflete:</b> %s</span>', reflete))
-- Loot table
local loot = html:tag("div")
:css{
["margin-top"] = "28px",
background = "#232329",
["border-radius"] = "10px",
padding = "18px"
}
local tableEl = loot:tag("table")
:css{
width = "100%",
color = "#fff",
["table-layout"] = "auto"
}
local function row(label, color, content)
local tr = tableEl:tag("tr")
tr:tag("th")
:css{
["text-align"] = "left",
color = color,
padding = "6px",
["font-size"] = "1.07em"
}
:wikitext(label)
tr:tag("td"):wikitext(content)
end
row("Normal:", "#f3e8bb", normal)
row("Elite:", "#aeccff", elite)
row("Hard:", "#e6e5ff", hard)
row("Extra:", "#f9538f", extra)
return tostring(html)
end
return p