Module:BlazingTwist/DragonStats/Database/DragonCardDB

From DreamWorks School of Dragons Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:BlazingTwist/DragonStats/Database/DragonCardDB/doc

local keyPool = {
	--[[dragons--]] {"TerribleTerror", "Gronckle", "Zippleback", "NightFury", "DeadlyNadder", "Nightmare", "Timberjack", "Thunderdrum", "WhisperingDeath", "Skrill", "Scauldron", "RumbleHorn", "Flightmare", "Hobblegrunt", "Smokebreath", "Typhoomerang", "Raincutter", "Boneknapper", "Hotburple", "Stormcutter", "Snafflefang", "Changewing", "FirewormQueen", "ScreamingDeath", "TideGlider", "Scuttleclaw", "SandWraith", "SweetDeath", "WoollyHowl", "Shivertooth", "Groncicle", "SpeedStinger", "Shockjaw", "Moldruffle", "Mudraker", "Deathsong", "Razorwhip", "GrappleGrounder", "SnowWraith", "Prickleboggle", "Sliquifier", "DevilishDervish", "Snaptrapper", "Quaken", "Thunderpede", "NightTerror", "ArmorWing", "Slithersong", "Shovelhelm", "Windwalker", "Eruptodon", "Singetail", "SilverPhantom", "Buffalord", "FlameWhipper", "TripleStryke", "Sentinel", "SentinelElder", "GrimGnasher", "Dramillion", "FireTerror", "DeathGripper", "LightFury", "CrimsonGoregutter", "Hobgobbler", "HobgobblerSpecial", "Skrillknapper", "FlightStinger", "NightlightBlackBlue", "NightlightBlackGreen", "NightlightWhite", "Zapplejack", "Galeslash", "Ridgesnipper", "Abomibumble", "Bonestormer", "Chimeragon", "Slitherwing", "Seastormer", "CavernCrasher", "Humbanger", "GoldenDragon", "Hushboggle", "Zipplewraith", "Goregripper", "Graveknapper", "Frostmare", "Sandbuster", "Songwing"},
	--[[barInfo--]] {"MaxBarValue", "FirePower", "MaxSpeed", "PitchRate", "TurnRate", "Acceleration"},
}
local typePool = {
	--[[dragonsMap--]] { key = 1, types = { {ki = 2} } },
}
local compressedDataTable = {
	{10, 6.7, 5.4, 6.5, 7.5, 9.7},
	{10, 7.1, 4.2, 8, 10, 9.7},
	{10, 7.2, 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3, 4.8},
	{10, 6.5, 9, 6, 6, 9.7},
	{10, 5.6, 7, 7, 7.5, 8.4},
	{10, 8.2, 8.2, 6, 6.3, 9.2},
	{10, 5.6, 8.4, 5, 6.3, 6.1},
	{10, 7.7, 7.4, 6, 5, 5.5},
	{10, 8.5, 7.6, 9, 7.5, 6.1},
	{10, 6, 7, 6, 8.8, 6.5},
	{10, 8, 8, 6, 7.5, 7.1},
	{10, 6, 7, 6, 8.8, 6.5},
	{10, 4, 8, 6, 8.8, 7.1},
}
local function resolveTypeMapping(targetTable, dataType, dataTable)
    if dataTable == nil then
        return
    end

    if dataType.ki ~= nil then
        local keyOrder = keyPool[dataType.ki]
        for i,key in ipairs(keyOrder) do
            targetTable[key] = dataTable[i]
        end
    else
        local pooledType = typePool[dataType.ti]
        local keyOrder = keyPool[pooledType.key]
        local subTypes = pooledType.types
        local numTypes = #subTypes
        local currentSubType = 1

        for i,key in ipairs(keyOrder) do
            local value = {}
            resolveTypeMapping(value, subTypes[currentSubType], dataTable[i])
            targetTable[key] = value
            currentSubType = (currentSubType % numTypes) + 1
        end
    end
end
local resultTable = {}
resolveTypeMapping(resultTable, {ti = 1}, compressedDataTable)
return resultTable