Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:TagCreatures: Difference between revisions

From Teriock
// via Wikitext Extension for VSCode
 
// via Wikitext Extension for VSCode
Line 1: Line 1:
local tags = {
return {
traits = {
traits = {
undead = {
undead = { text = 'Undead', link = 'Undead creatures', symbol = '🪦' },
text = 'Undead',
corporeal = { text = 'Corporeal', link = 'Corporeal undead creatures', symbol = '🧟‍♀️' },
link = 'Undead creatures',
skeletal = { text = 'Skeletal', link = 'Skeletal undead creatures', symbol = '🦴' },
symbol = '🪦',
spectral = { text = 'Spectral', link = 'Spectral undead creatures', symbol = '👻' },
},
minor = { text = 'Minor', link = 'Minor undead creatures', symbol = '🧟' },
corporeal = {
full = { text = 'Full', link = 'Full undead creatures', symbol = '💀' },
text = 'Corporeal',
greater = { text = 'Greater', link = 'Greater undead creatures', symbol = '🧛' },
link = 'Corporeal undead creatures',
outsider = { text = 'Outsider', link = 'Outsider creatures', symbol = '👽️' },
symbol = '🧟‍♀️',
angelic = { text = 'Angelic', link = 'Angelic creatures', symbol = '😇' },
},
demonic = { text = 'Demonic', link = 'Demonic creatures', symbol = '👿' },
skeletal = {
elemental = { text = 'Elemental', link = 'Elemental creatures', symbol = '🌞' },
text = 'Skeletal',
plant = { text = 'Plant', link = 'Plant creatures', symbol = '🌿' },
link = 'Skeletal undead creatures',
construct = { text = 'Construct', link = 'Construct creatures', symbol = '🗿' },
symbol = '🦴',
draconic = { text = 'Draconic', link = 'Draconic creatures', symbol = '🐲' },
},
fae = { text = 'Fae', link = 'Fae creatures', symbol = '🧚' },
spectral = {
animal = { text = 'Animal', link = 'Animal creatures', symbol = '🦀' },
text = 'Spectral',
common = { text = 'Common', link = 'Common animal creatures', symbol = '🐾' },
link = 'Spectral undead creatures',
ooze = { text = 'Ooze', link = 'Ooze creatures', symbol = '💩' },
symbol = '👻',
monstrous = { text = 'Monstrous', link = 'Monstrous creatures', symbol = '🧌' },
},
humanoid = { text = 'Humanoid', link = 'Humanoid creatures', symbol = '👤' },
minor = {
partial = { text = 'Partial', link = 'Partial humanoid creatures', symbol = '🐒' },
text = 'Minor',
aquatic = { text = 'Aquatic', link = 'Aquatic creatures', symbol = '🐟️' },
link = 'Minor undead creatures',
symbol = '🧟',
},
full = {
text = 'Full',
link = 'Full undead creatures',
symbol = '💀',
},
greater = {
text = 'Greater',
link = 'Greater undead creatures',
symbol = '🧛',
},
outsider = {
text = 'Outsider',
link = 'Outsider creatures',
symbol = '👽️',
},
angelic = {
text = 'Angelic',
link = 'Angelic creatures',
symbol = '😇',
},
demonic = {
text = 'Demonic',
link = 'Demonic creatures',
symbol = '👿',
},
elemental = {
text = 'Elemental',
link = 'Elemental creatures',
symbol = '🌞',
},
plant = {
text = 'Plant',
link = 'Plant creatures',
symbol = '🌿'
},
construct = {
text = 'Construct',
link = 'Construct creatures',
symbol = '🗿'
},
draconic = {
text = 'Draconic',
link = 'Draconic creatures',
symbol = '🐲',
},
fae = {
text = 'Fae',
link = 'Fae creatures',
symbol = '🧚',
},
animal = {
text = 'Animal',
link = 'Animal creatures',
symbol = '🦀',
},
common = {
text = 'Common',
link = 'Common animal creatures',
symbol = '🐾',
},
ooze = {
text = 'Ooze',
link = 'Ooze creatures',
symbol = '💩',
},
monstrous = {
text = 'Monstrous',
link = 'Monstrous creatures',
symbol = '🧌',
},
humanoid = {
text = 'Humanoid',
link = 'Humanoid creatures',
symbol = '👤',
},
partial = {
text = 'Partial',
link = 'Partial humanoid creatures',
symbol = '🐒',
},
aquatic = {
text = 'Aquatic',
link = 'Aquatic creatures',
symbol = '🐟️',
},
}
}
}
}
local function makeTag(frame, key, value, makeCat, transparent)
    if not tags[key] or not tags[key][value] then
        if value then
            local out = frame:preprocess("{{ucfirst:" .. tostring(value) .. "}}")
-- local out = 'pranked'
            if not ('.' == out:sub(-1)) then
                out = out .. '.'
            end
            return out
        else
            return ''
        end
    end
    local tag = tags[key][value]
    if tag.no then
        local out = frame:preprocess("{{ucfirst:" .. tag.text .. "}}")
        if not ('.' == out:sub(-1)) then
            out = out .. '.'
        end
        return out
    end
    if tag.tags then
        local out = ''
        for _, t in ipairs(tag.tags) do
            out = out .. makeTag(frame, key, t, makeCat, transparent)
        end
        return out
    end
    local tagText = "{{Tag|{{ucfirst:" .. tag.text .. "}}"
    if tag.symbol then
        tagText = tagText .. "|" .. tag.symbol
    end
    if tag.link then
        tagText = tagText .. "|l=:Category:{{ucfirst:" .. tag.link .. "}}"
    end
    if tag.color then
        tagText = tagText .. "|c=" .. tag.color
    end
    if transparent then
        tagText = tagText .. "|o=1"
    end
    tagText = tagText .. "}}"
    -- out = frame:preprocess(tagText)
    out = tagText
    return out
end

Revision as of 19:03, 12 August 2025

Documentation for this module may be created at Module:TagCreatures/doc

return {
	traits = {
		undead = { text = 'Undead', link = 'Undead creatures', symbol = '🪦' },
		corporeal = { text = 'Corporeal', link = 'Corporeal undead creatures', symbol = '🧟‍♀️' },
		skeletal = { text = 'Skeletal', link = 'Skeletal undead creatures', symbol = '🦴' },
		spectral = { text = 'Spectral', link = 'Spectral undead creatures', symbol = '👻' },
		minor = { text = 'Minor', link = 'Minor undead creatures', symbol = '🧟' },
		full = { text = 'Full', link = 'Full undead creatures', symbol = '💀' },
		greater = { text = 'Greater', link = 'Greater undead creatures', symbol = '🧛' },
		outsider = { text = 'Outsider', link = 'Outsider creatures', symbol = '👽️' },
		angelic = { text = 'Angelic', link = 'Angelic creatures', symbol = '😇' },
		demonic = { text = 'Demonic', link = 'Demonic creatures', symbol = '👿' },
		elemental = { text = 'Elemental', link = 'Elemental creatures', symbol = '🌞' },
		plant = { text = 'Plant', link = 'Plant creatures', symbol = '🌿' },
		construct = { text = 'Construct', link = 'Construct creatures', symbol = '🗿' },
		draconic = { text = 'Draconic', link = 'Draconic creatures', symbol = '🐲' },
		fae = { text = 'Fae', link = 'Fae creatures', symbol = '🧚' },
		animal = { text = 'Animal', link = 'Animal creatures', symbol = '🦀' },
		common = { text = 'Common', link = 'Common animal creatures', symbol = '🐾' },
		ooze = { text = 'Ooze', link = 'Ooze creatures', symbol = '💩' },
		monstrous = { text = 'Monstrous', link = 'Monstrous creatures', symbol = '🧌' },
		humanoid = { text = 'Humanoid', link = 'Humanoid creatures', symbol = '👤' },
		partial = { text = 'Partial', link = 'Partial humanoid creatures', symbol = '🐒' },
		aquatic = { text = 'Aquatic', link = 'Aquatic creatures', symbol = '🐟️' },
	}
}