Module:Sandbox: Difference between revisionsGive feedback
No edit summary |
No edit summary |
||
| Line 79: | Line 79: | ||
end | end | ||
local stats_text = table.concat(stats, "\n| | local stats_text = table.concat(stats, "\\n|\\n| ") | ||
-- Generate components section if exists | -- Generate components section if exists | ||
| Line 94: | Line 94: | ||
if #component_names > 0 then | if #component_names > 0 then | ||
components_text = string.format( | components_text = string.format( | ||
"! colspan=\"4\" style=\"text-align:left; padding:0 12px; font-weight:bold; font-size:16px; font-family:'Retail Demo Bold',serif; %s\" | COMPONENTS:<br/>%s", | |||
(item_type == "Weapon" and "background-color: #9E630C; color: #DCCFC6;" or | (item_type == "Weapon" and "background-color: #9E630C; color: #DCCFC6;" or | ||
item_type == "Vitality" and "background-color: #203500; color: #C7C9C6;" or | item_type == "Vitality" and "background-color: #203500; color: #C7C9C6;" or | ||
"background-color: #372248; color: #C9C7CB;") | "background-color: #372248; color: #C9C7CB;"), | ||
table.concat(component_names, "<br/>{{ItemIcon|", "{{ItemIcon|", "}}") | |||
) | ) | ||
end | end | ||
end | end | ||
| Line 120: | Line 116: | ||
end | end | ||
-- | -- Build the infobox as separate parsed chunks | ||
local | local infobox_parts = { | ||
<div class="infobox_item" style="float:right; display:inline-block; vertical-align:top;"> | frame:preprocess(string.format( | ||
{| class="wikitable" style="text-align:left; border-collapse:collapse; width:312px; max-width:100%%; color: #FFEFD7; padding:12px; font-family:'Retail Demo Regular',serif; %s" | [[<div class="infobox_item" style="float:right; display:inline-block; vertical-align:top;"> | ||
! colspan="4" style="width:280px; padding:5px 12px; text-align:center; font-size:24px; font-family:'Retail Demo Bold',serif; %s" | {| class="wikitable" style="text-align:left; border-collapse:collapse; width:312px; max-width:100%%; color: #FFEFD7; padding:12px; font-family:'Retail Demo Regular',serif; %s" | ||
! colspan="4" style="width:280px; padding:5px 12px; text-align:center; font-size:24px; font-family:'Retail Demo Bold',serif; %s" | %s]], | |||
(item_type == "Weapon" and "background-color: #80550F;" or | |||
item_type == "Vitality" and "background-color: #4D7214;" or | |||
"background-color: #623585;"), | |||
(item_type == "Weapon" and "background-color: #C97A03;" or | |||
item_type == "Vitality" and "background-color: #659818;" or | |||
"background-color: #8B56B4;"), | |||
item.Name | |||
)), | |||
| %s | |||
frame:preprocess(string.format( | |||
"|-\n| colspan=4 class=\"infobox-image\" style=\"padding:5px; text-align:center;\" | [[File:%s.png|144px]]", | |||
item.Name | |||
)), | |||
-- | frame:preprocess(string.format( | ||
"|-\n| colspan=2 style=\"text-align:right; width:50%%; %s padding-right:0.5em;\" | Cost\n| colspan=2 style=\"padding-left:0.5em;\" | {{Souls|%s}}", | |||
(item_type == "Weapon" and "border-right:1px solid #C97A03;" or | |||
item_type == "Vitality" and "border-right:1px solid #659818;" or | |||
"border-right:1px solid #8B56B4;"), | |||
formatNum(item.Cost or 0) | |||
)), | |||
-- | frame:preprocess(string.format( | ||
"|-\n| colspan=2 style=\"text-align:right; width:50%%; %s padding-right:0.5em;\" | Tier\n| colspan=2 style=\"padding-left:0.5em;\" | %s", | |||
(item_type == "Weapon" and "border-right:1px solid #C97A03;" or | |||
item_type == "Vitality" and "border-right:1px solid #659818;" or | |||
"border-right:1px solid #8B56B4;"), | |||
item.Tier or "1" | |||
)), | |||
-- Shop | frame:preprocess(string.format( | ||
"|-\n| colspan=2 style=\"text-align:right; width:50%%; %s padding-right:0.5em;\" | Shop Bonus\n| colspan=2 style=\"padding-left:0.5em;\" | %s", | |||
(item_type == "Weapon" and "border-right:1px solid #C97A03;" or | |||
item_type == "Vitality" and "border-right:1px solid #659818;" or | |||
"border-right:1px solid #8B56B4;"), | |||
shop_bonus | |||
)), | |||
- | components_text ~= "" and frame:preprocess("|-\n"..components_text) or "", | ||
-- | frame:preprocess(string.format( | ||
"|-\n| colspan=\"4\" style=\"text-align:left; padding:0 12px; color:#FFEFD7; %s\" | %s", | |||
(item_type == "Weapon" and "background-color: #80550F;" or | |||
item_type == "Vitality" and "background-color: #4D7214;" or | |||
"background-color: #623585;"), | |||
item.Description or "" | |||
)), | |||
- | stats_text ~= "" and frame:preprocess("|-\n| "..stats_text) or "", | ||
frame:preprocess("|}\n</div>") | |||
} | |||
-- | -- Combine all parts and return | ||
return | return table.concat(infobox_parts) | ||
end | end | ||
return p | return p | ||