Module:CosmeticInfo/Paragraph: Difference between revisions
From MCC Island Wiki
More actions
mNo edit summary |
fixes |
||
Line 13: | Line 13: | ||
end | end | ||
local function expand(frame, title, | local function expand(frame, title, ...) | ||
local args = {...} | |||
if frame.expandTemplate then | if frame.expandTemplate then | ||
return frame:expandTemplate{ title = title, args = | return frame:expandTemplate{ title = title, args = args } | ||
else | else | ||
return string.format("{{%s|%s}}", title, | return string.format("{{%s|%s}}", title, table.concat(args, "|")) | ||
end | end | ||
end | end | ||
Line 35: | Line 36: | ||
local out = {} | local out = {} | ||
table.insert(out, string.format("'''%s''' is %s %s", name, articleFor(rarity), expand(frame, "Rarity", rarity | table.insert(out, string.format("'''%s''' is %s %s", name, articleFor(rarity), expand(frame, "Rarity", rarity, "Text"))) | ||
if cType and cType ~= "Standard" then | if cType and cType ~= "Standard" then | ||
Line 59: | Line 60: | ||
typeToUse = "" | typeToUse = "" | ||
end | end | ||
local blueprintIcon = string.format('[[File:%s%s Cosmetic Blueprint.png|20px|link=]]', rarity, " " .. typeToUse) | local blueprintIcon = string.format('[[File:%s%s Cosmetic Blueprint.png|20px|link=]]', rarity, (typeToUse ~= "" and " " or "") .. typeToUse) | ||
table.insert(out, string.format(" Its %s blueprint form can be obtained in a number of ways:\n", blueprintIcon)) | table.insert(out, string.format(" Its %s blueprint form can be obtained in a number of ways:\n", blueprintIcon)) | ||
table.insert(out, '*' .. crates.makeSentence{ name = name } .. "\n") | table.insert(out, '*' .. crates.makeSentence{ name = name } .. "\n") | ||
Line 107: | Line 108: | ||
local bonus = info.isBonusTrophies{ name = name } | local bonus = info.isBonusTrophies{ name = name } | ||
local trophyType = bonus and "Bonus" or "Style" | local trophyType = bonus and "Bonus" or "Style" | ||
table.insert(out, "It is | table.insert(out, string.format( | ||
"It is %s, meaning players can apply [[Chroma Pack|chroma packs]] to it, allowing them to change its colour.", | |||
expand(frame, "Colorable") | |||
)) | |||
table.insert(out, '\n\n') | table.insert(out, '\n\n') | ||
table.insert(out, string.format("It can reward the player with up to %s: %s for owning it and an extra %s if all 4 [[Chroma Pack|chroma packs]] are applied to it.", | table.insert(out, string.format("It can reward the player with up to %s: %s for owning it and an extra %s if all 4 [[Chroma Pack|chroma packs]] are applied to it.", | ||
expand(frame, string.format("%s Trophy", trophyType), trophies+10 | expand(frame, string.format("%s Trophy", trophyType), trophies+10, "text=yes"), | ||
expand(frame, string.format("%s Trophy", trophyType), trophies), | expand(frame, string.format("%s Trophy", trophyType), trophies), | ||
expand(frame, string.format("%s Trophy", trophyType), 10) | expand(frame, string.format("%s Trophy", trophyType), 10) | ||
Line 118: | Line 122: | ||
if trophies > 0 then | if trophies > 0 then | ||
local trophyType = info.isBonusTrophies{ name = name } and "Bonus" or "Style" | local trophyType = info.isBonusTrophies{ name = name } and "Bonus" or "Style" | ||
table.insert(out, string.format("Owning it rewards the player with a total of %s.", expand(frame, string.format("%s Trophy", trophyType), trophies .. " | table.insert(out, string.format("Owning it rewards the player with a total of %s.", expand(frame, string.format("%s Trophy", trophyType), trophies .. "text=yes"))) | ||
if info.isArcaneGateCosmetic{ name = name} == true then | if info.isArcaneGateCosmetic{ name = name} == true then | ||
table.insert(out, string.format(" It also grants an extra perk tier of [[File:Perk-%s.png|24px]] [[%s]] while in the player's wardrobe.", stylePerk, stylePerk)) | table.insert(out, string.format(" It also grants an extra perk tier of [[File:Perk-%s.png|24px]] [[%s]] while in the player's wardrobe.", stylePerk, stylePerk)) |
Revision as of 12:35, 30 August 2025
Documentation for this module may be created at Module:CosmeticInfo/Paragraph/doc
local getArgs = require('Module:Arguments').getArgs
local info = require('Module:CosmeticInfo')
local crates = require('Module:CosmeticCrates')
local machine = require('Module:CosmeticMachine')
local p = {}
local function articleFor(word)
if word:sub(1,1):lower():match("[aeiou]") then
return "an"
end
return "a"
end
local function expand(frame, title, ...)
local args = {...}
if frame.expandTemplate then
return frame:expandTemplate{ title = title, args = args }
else
return string.format("{{%s|%s}}", title, table.concat(args, "|"))
end
end
function p.make(frame)
local args = getArgs(frame)
local name = args.name
local rarity = info.getRarity{ name = name }
local cType = info.getType{ name = name}
local category = info.getCategory{ name = name }
local collection = info.getCollection{ name = name }
local added_date = args.added_date or ""
local added_in = args.added_in or ""
local unlock_method = args.unlock_method
local stylePerk = args.style_perk or ""
local out = {}
table.insert(out, string.format("'''%s''' is %s %s", name, articleFor(rarity), expand(frame, "Rarity", rarity, "Text")))
if cType and cType ~= "Standard" then
table.insert(out, " and " .. expand(frame, "CosmeticType", cType))
end
table.insert(out, string.format(" %s [[cosmetic]], found within the %s, that was introduced ",
expand(frame, "CosmeticCategory", category),
expand(frame, "Collection", collection)
))
if added_date and added_date ~= "" then
table.insert(out, "on " .. added_date)
else
table.insert(out, "in [[Patch " .. added_in .. "]]")
end
table.insert(out, ".")
if info.isInCrateCollection{ name = name } == true then
local typeToUse = cType
if cType == "Standard" then
typeToUse = ""
end
local blueprintIcon = string.format('[[File:%s%s Cosmetic Blueprint.png|20px|link=]]', rarity, (typeToUse ~= "" and " " or "") .. typeToUse)
table.insert(out, string.format(" Its %s blueprint form can be obtained in a number of ways:\n", blueprintIcon))
table.insert(out, '*' .. crates.makeSentence{ name = name } .. "\n")
if cType == "Standard" then
local vendorPurchaseText = "* Purchasing from [[File:Head-Frank.png|20px|link=Frank]] [[Frank]] for "
local crate = crates.getCrate{ name = name }
if rarity == "Epic" then
vendorPurchaseText = vendorPurchaseText .. "'''8x'''"
elseif rarity == "Legendary" then
vendorPurchaseText = vendorPurchaseText .. "'''18x'''"
elseif rarity == "Mythic" then
vendorPurchaseText = vendorPurchaseText .. "'''2x'''"
end
vendorPurchaseText = vendorPurchaseText .. string.format(" [[File:%s.png|20px|link=%s]] [[%s]]s\n", crate, crate, crate)
table.insert(out, vendorPurchaseText)
elseif cType == "Exclusive" then
local vendorPurchaseText = "* Purchasing from [[File:Head-Big Cheese.png|20px|link=Big Cheese]] [[Big Cheese]] for "
local crate = crates.getCrate{ name = name }
if rarity == "Legendary" then
vendorPurchaseText = vendorPurchaseText .. "'''5x'''"
elseif rarity == "Mythic" then
vendorPurchaseText = vendorPurchaseText .. "'''15x'''"
end
vendorPurchaseText = vendorPurchaseText .. string.format(" [[File:%s.png|20px|link=%s]] [[%s]]s\n", crate, crate, crate)
table.insert(out, '*' .. vendorPurchaseText .. '\n')
end
table.insert(out, machine.makeSentences{ name = name, mode = list })
elseif info.isArcaneGateCosmetic{ name = name} == true then
local typeToUse = cType
if cType == "Standard" then
typeToUse = ""
end
local blueprintIcon = string.format('[[File:%s%s Cosmetic Blueprint.png|20px|link=]]', rarity, " " .. typeToUse)
table.insert(out, string.format(" Its %s blueprint form can be obtained in a number of ways:\n", blueprintIcon))
table.insert(out, "* '''8.3%''' chance from the [[File:Icon-Arcane Gate.png|20px|link=Arcane Gate]] [[Arcane Gate]]\n")
table.insert(out, "* Purchasing from [[File:Head-Suspicious Stu.png|20px|link=Suspicious Stu]] [[Suspicious Stu]] for '''2x''' [[File:Arcane Gate Key.png|20px|link=Arcane Gate Key]] [[Arcane Gate Key]]s\n")
table.insert(out, machine.makeSentences{ name = name, mode = "list" })
else
if args.unlock_method then
table.insert(out, " " .. unlock_method)
end
end
table.insert(out, '\n\n')
if info.isColorable{ name = name } == true then
local trophies = tonumber(info.getTrophiesAwarded{ name = name }) or 0
local bonus = info.isBonusTrophies{ name = name }
local trophyType = bonus and "Bonus" or "Style"
table.insert(out, string.format(
"It is %s, meaning players can apply [[Chroma Pack|chroma packs]] to it, allowing them to change its colour.",
expand(frame, "Colorable")
))
table.insert(out, '\n\n')
table.insert(out, string.format("It can reward the player with up to %s: %s for owning it and an extra %s if all 4 [[Chroma Pack|chroma packs]] are applied to it.",
expand(frame, string.format("%s Trophy", trophyType), trophies+10, "text=yes"),
expand(frame, string.format("%s Trophy", trophyType), trophies),
expand(frame, string.format("%s Trophy", trophyType), 10)
))
else
local trophies = tonumber(info.getTrophiesAwarded{ name = name }) or 0
if trophies > 0 then
local trophyType = info.isBonusTrophies{ name = name } and "Bonus" or "Style"
table.insert(out, string.format("Owning it rewards the player with a total of %s.", expand(frame, string.format("%s Trophy", trophyType), trophies .. "text=yes")))
if info.isArcaneGateCosmetic{ name = name} == true then
table.insert(out, string.format(" It also grants an extra perk tier of [[File:Perk-%s.png|24px]] [[%s]] while in the player's wardrobe.", stylePerk, stylePerk))
end
end
end
-- if info.getReputationAmount{ name = name} > 0 then
-- table.insert(out, '\n\n')
-- table.insert(out, "Its token form can be scavenged for ")
-- table.insert(out, '\n\n')
-- table.insert(out, '==== Blueprint Recipe ====\n')
-- table.insert(out, string.format(
-- "'''%s''''s blueprint form must be crafted at the [[Blueprint Assembler]] into a cosmetic token before use.",
-- name
-- ))
-- table.insert(out, '\nAlternatively, it can be scavenged for ')
-- end
return table.concat(out)
end
return p