-- <pre>
local heroLoader = require('Module:Hero')
local skillData = require('Module:Skill')
local p = {}
-- These are the names used on the module sub-page name for the hero, not the display name which doesn't always match.
local HEROES = {
	"Aira the Ice Mage",
	"Akayuki the Samurai",
	"Amethyst the Dark Assassin",
	"Andras the Demon God",
	"Android Bot",
	"Angard the Black Dragon",
	"Angel Mage",
	"Angie the Angel",
	"Ann the Witch's Disciple",
	"Athos the Bulwark",
	"Aoyuki the Blade Master",
	"Aratoron the Battery Commander",
	"Aria the Mermaid",
	"Attack Fairy",
	"Bandit Boss",
	"Bas the Twin God of Grace",
	"Beast King",
	"Bellial the Demon God",
	"Bibi the Circus Master",
	"Black Magician",
	"Blade Golem",
	"Bond Girl",
	"Caligo the Dual Swordsman",
	"Card Soldier",
	"Cassius the Champion",
	"Cetrine the Fortune Teller",
	"Chris the Explorer",
	"Clara the Cleric",
	"Corrupted Bard Girl",
	"Cosmo the Android",
	"Crosselle the Demon God",
	"Daine the Thunder Fairy",
	"Deep V Joe",
	"Demon Girl",
	"Demon Swordsman",
	"Demonia the Devil",
	"Devil Monk",
	"Didi the Pirate",
	"Driard the Queen of Wood Elemental",
	"Elen the Noble",
	"Elf Archer",
	"Eliza the Guardian of Love",
	"Ella the Ice Princess",
	"Elliot the Wild",
	"Eneria the Thunder Lord",
	"Ente the Forest Master",
	"Erina the Legendary Hero",
	"Eris the Dancer",
	"Esmeralda the Knife Juggler",
	"Ethan the Red Beast",
	"Fencolt the Preacher of Justice",
	"Fenrir the Guardian",
	"Fira the Fire Mage",
	"Fire Elemental",
	"Fire Fairy",
	"Fox Girl",
	"Gabrielle the Archangel",
	"Giant Skeleton",
	"Goblin Tank",
	"Haete the Mythic Beast",
	"Hani the Bee",
	"Hashir the Fallen Angel",
	"Hero Statue",
	"Imp Millionaire",
	"Irene the Magical Girl",
	"Isabella the Vampire",
	"Jane the Jungle Girl",
	"Joy the Nurse",
	"Kaden the Hero",
	"Kamael the God of Healing and Harvest",
	"Kamelot the Knight",
	"Kang-Kang the Oriental Undead",
	"Karladriel the Link Dragon",
	"Kiki the Assassin",
	"Killer Robot",
	"Knight from an alternative universe",
	"Lara the Squire",
	"Lava Golem MK-1024",
	"Lena the Sword Master",
	"Li the Monk",
	"Lilith the Demonic Princess",
	"Louise the Inventor",
	"Lulu the Princess",
	"Luna the Witch",
	"Mad Scientist",
	"Mai the Geomancer",
	"Mana the Captain",
	"Mary the Engineer",
	"Melissa the Leaf Mage",
	"Mikan the Idol",
	"Mimi the Crossbow Girl",
	"Mina the Mystic Girl",
	"Ming the High Geomancer",
	"Nana the Fairy",
	"Neuth the Goddess of the Sky",
	"Nina the Ninja",
	"Noble Orc",
	"Nora the Sailor",
	"Ogre King",
	"Olav the Bodyguard",
	"Oni Girl",
	"Orc Hero",
	"Penzu the Ancient Dragon",
	"Phoenix the Queen of Fire Elemental",
	"Plitvice the Goddess",
	"Pymon the Demon God",
	"Rika the Vampire Princess",
	"Rin the Kungfu Girl",
	"Ringo the Bard",
	"Robin the Angelic Knight",
	"Rock the Thief",
	"Rosita the Maid",
	"Russell the Mercenary",
	"Sagara the Dragon Lord",
	"Samurai Girl",
	"Skeleton Knight",
	"Support Fairy",
	"Sylvia the Archer",
	"Tanksalot the Tanker",
	"Tath the Twin God of Carnage",
	"Terra the Princess",
	"Tina the Pirate",
	"Triton the King of Water Elemental",
	"Troll Knight",
	"Twin Dancers",
	"Twin Priestess",
	"Vampire Idol",
	"Vampire Knight",
	"Vampire Swordsman",
	"Vega the Gambler",
	"Veronica the Plant Master",
	"Water Fairy",
	"Weapon Master",
	"White Tiger",
	"Witch's Knight",
	"Wood Fairy",
	"Banana Guard",
	"Breakfast Princess",
	"Cinnamon Bun",
	"Clown Nurse",
	"Finn the Human",
	"Hot Dog Princess",
	"Ice King",
	"Jake the Dog",
	"Earl of Lemongrab",
	"Lumpy Space Princess",
	"Magic Man",
	"Marceline the Vampire Queen",
	"Mr. Pig",
	"Party Pat",
	"Peppermint Butler",
	"Slime Princess",
	"Tree Trunks",
	"Wildberry Princess",
function p.numberOfHeroes(pFrame)
	return #HEROES
function p.simpleList(pFrame)
	local t = {}
	for i = 1, #HEROES do
		t[#t+1] = '*[['..HEROES[i]..']]'
	return table.concat(t, '\n')
-- Merge table 2 onto table 1 -
-- @param t1 {table} Base table
-- @param t2 {table} Table to merge
-- @return {table} Merged table
local function tableMerge(t1, t2)
	for k,v in pairs(t2) do
		if type(v) == "table" then
			if type(t1[k] or false) == "table" then
				tableMerge(t1[k] or {}, t2[k] or {})
				t1[k] = v
			t1[k] = v
	return t1
-- mw.loadData shortcut for merging data for a specific hero's evolution
-- @param heroData {string} Hero to retrieve
-- @param stars {int} Star version of Hero to retrieve
-- @return {table} Table of hero data
local function normalizeHeroEvolution(heroData, stars)
	if heroData.evolutions[stars] ~= nil then
		return tableMerge(tableMerge({}, heroData), heroData.evolutions[stars])
	return error( "Invalid star amount entered" )
local function green(text)
    return '<span class="greentext">'..text..'</span>'
local function _getTableHeader()
	local t = {}
	t[#t+1] = '{| class="wikitable sortable oddrow"'
	t[#t+1] = '! [[Tier]]'
	t[#t+1] = '! class="unsortable"|Image'
	t[#t+1] = '! Name'
	t[#t+1] = '! Type'
	t[#t+1] = '! Star'
	t[#t+1] = '! ATK'
	t[#t+1] = '! HP'
	t[#t+1] = '! FIRE'
	t[#t+1] = '! WATER'
	t[#t+1] = '! WOOD'
	t[#t+1] = '! HEAL'
	t[#t+1] = '! DEF'
	t[#t+1] = '! CRIT'
	t[#t+1] = '! FREEZE'
	t[#t+1] = '! TAUNT'
	t[#t+1] = '! BUFF'
	t[#t+1] = '! Dash'
	t[#t+1] = '! Passive'
	t[#t+1] = '! Skill'
	return table.concat(t, '\n')
local _tierRankOrder = { ["G"]=1, ["S+"]=2, ["S"]=3, ["A+"]=4, ["A"]=5, ["B+"]=6, ["B"]=7, ["C+"]=8, ["C"]=9, ["D"]=10, ["F"]=11 }
local _tierRankColor = { ["G"]="color-tier-g", ["S+"]="color-tier-sP", ["S"]="color-tier-s", ["A+"]="color-tier-aP", ["A"]="color-tier-a", ["B+"]="color-tier-bP", ["B"]="color-tier-b", ["C+"]="color-tier-cP", ["C"]="color-tier-c", ["D"]="color-tier-d", ["F"]="color-tier-f" }
local _typeOrder = { ["attack"]=1, ["fire"]=2, ["water"]=3, ["wood"]=4, ["support"]=5 }
local _baseOrder = { ["story"]=1, ["raid"]=2, ["normal"]=3, ["fairy"]=4 }
local function getDash(pHero)
    local dash = pHero.dash
    local val = pHero.dashValue
    if dash=="4 adjacent" then
        return "4 blocks ""%")
    elseif dash=="8 adjacent" then
        return "8 blocks ""%")
    elseif dash=="heal" then
        return "HEAL"
    elseif dash=="buff" then
        return "ATK BUFF"
    elseif dash=="vertical" then
        return "Vertical ""%")
    elseif dash=="horizontal" then
        return "Horizontal ""%")
    elseif dash=="2 radius" then
        return "2-block radius ""%")
    elseif dash=="repeat" then
        return "Repeat at ""%")
    elseif dash=="path" then
        return "Path ""x"..val).." at ""75%")
    elseif dash=="machine gun" then
        return "Machine&nbsp;gun ""%").." + ""10%").." per"
        return val and dash..": ""%") or dash
local function getPassive(pHero)
    return pHero.passive .. " : " .. pHero.passiveValue .. "%" .. (pHero.passiveValue2 and " / " .. pHero.passiveValue2 or "")
local function getSkill(pHero)
    --return "[["..pHero.skill.."]] Lv."..pHero.skillLevel
    local tSkill = pHero.skill;
    if == "Ringo the Bard" then tSkill = tSkill..'-Ringo' end
    if == "Lulu the Princess" then tSkill = tSkill..'-Lulu' end
	return skillData._shortSkillMessage(tSkill, pHero.skillLevel)
local function _getTableRow(pHero)
	local t = {}
	t[#t+1] = '|- class="rowBackground-'..(pHero.base or "normal")..'"'
	t[#t+1] = 'style="text-align:center;" class="'..(_tierRankColor[pHero.tierPvP] or '')..'" data-sort-value="'..(_tierRankOrder[pHero.tierPvP] or '')..'"|'..pHero.tierPvP
	t[#t+1] = "[[File:"..pHero.image.."|42px|link=""|&nbsp;]]"
	t[#t+1] = "[[" .. .. "]]"
	t[#t+1] = 'style="text-align:center;" data-sort-value="'..string.lower(pHero.type)..'"|'..heroLoader.getTypeIcon(pHero.type, 21)
	t[#t+1] = 'style="text-align:center;"|'..heroLoader._evolutionNum(pHero.stars)
	t[#t+1] = pHero.attack or ""
	t[#t+1] = pHero.hp or ""
	t[#t+1] = or ""
	t[#t+1] = pHero.water or ""
	t[#t+1] = pHero.wood or ""
	t[#t+1] = pHero.heal or ""
	t[#t+1] = pHero.defense or ""
	t[#t+1] = pHero.critical or ""
	t[#t+1] = pHero.freeze or ""
	t[#t+1] = pHero.taunt or ""
	t[#t+1] = pHero.buff or ""
	t[#t+1] = getDash(pHero)
	t[#t+1] = getPassive(pHero)
	t[#t+1] = getSkill(pHero)
	return table.concat(t, '\n|')
function p.table(pFrame)
	local args = pFrame.arguments
	local limits = { stars = "highest" }
	local tHero = nil
	local heroList = {}
	-- Add to list and limit
	for i = 1, #HEROES do
		tHero = heroLoader.loadHero(HEROES[i])
		if tHero ~= nil then
			if type(limits.stars) == "number" then
				if tHero.evolutions[limits.stars] ~= nil then
					heroList[#heroList+1] = normalizeHeroEvolution(tHero, limits.stars)
			else--if limits.stars == "highest" then
				for j = 6, 1, -1 do
					if tHero.evolutions[j] ~= nil then
						heroList[#heroList+1] = normalizeHeroEvolution(tHero, j)
			heroList[#heroList+1] = HEROES[i]
	-- sort
	table.sort(heroList, function(a, b)
		if type(a) == "string" or type(b) == "string" then
			return type(a) ~= "string"
		elseif a.type ~= b.type then
			return (_typeOrder[a.type] or 100) < (_typeOrder[b.type] or 100)
		elseif a.tierPvP ~= b.tierPvP then
		    return (_tierRankOrder[a.tierPvP] or 100) < (_tierRankOrder[b.tierPvP] or 100)
		else--if a.base ~= b.base then
		    return (_baseOrder[a.base] or 100) < (_baseOrder[b.base] or 100)
		--return (_tierRankOrder[a.tierPvP] or 100) < (_tierRankOrder[b.tierPvP] or 100)
	-- Add to screen
	local t = {}
	t[#t+1] = _getTableHeader()
	for i = 1, #heroList do
		tHero = heroList[i]
		if type(tHero) ~= "string" then
		    local good,tRow = pcall(_getTableRow, tHero)
		    if good then
			    t[#t+1] = tRow
    			t[#t+1] = "|-"
    			t[#t+1] = '|colspan="2"|[Error]'
    			t[#t+1] = '| [[' .. ( and or "[Error displaying]") .. ']]'
			t[#t+1] = "|-"
			t[#t+1] = '|'
			t[#t+1] = '|'
			t[#t+1] = '| [[' .. tHero .. ']]'
	t[#t+1] = '|}'
	return table.concat(t, '\n')
return p

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.