WARFRAME Wiki
Advertisement
WARFRAME Wiki
Lotusiconsmall
Please do not use this article for critical in-game information!
This article is archived.
The content was relevant to an obsolete version of Warframe, and has since been removed, retrieved, and/or revamped.

All of this module's functions have been moved to Module:Void and reworked. This page is kept up for archival reasons.


--WARFRAME Wiki Sorted Void Drop Table By Rewards 
--http://warframe.wikia.com/
--Originally written by User:NoBrainz
--Heavily modified by User:Falterfire <-- The person to message if something goes wrong

-- These functions are used by 
-- * Void Relic/ByRarity
-- * Void_Relic/ByRewards
-- * Void_Relic/ByRelic
-- * and related subpages

--Pulls from Module:Void/data
--Data in Void:data is structure as
local tierCol = 1 -- [1] = Tier (ex "Lith")
local nameCol = 2 -- [2] = Name (ex "A1 Common*") (* means vaulted)
local itemCol = 3 -- [3] = Item (ex "VASTO")
local partCol = 4 -- [4] = Part (ex "RECEIVER")

local p = {}

local VoidData = mw.loadData( 'Module:Void/data' )

local Void = require( "Module:Void" )
local Icon = require( "Module:Icon" )
local Shared = require( "Module:Shared" )	-- TODO: Replace M:Shared with M:Table and move Shared.relicLoop() here or in M:Void

local ttStart = '<span style="border-bottom: 1px dotted;" class="relic-tooltip" data-param="'
local ttCenter = '">'
local ttEnd = '</span>'

function p.byReward(frame)
    local data = {}
    
    for _, relic in pairs(VoidData["Relics"]) do
        for i, drop in pairs(relic.Drops) do
            local newObj = {Tier = relic.Tier, Name = relic.Name, Rarity = drop.Rarity, Vaulted = relic.Vaulted ~= nil, IsBaro = relic.IsBaro == 1}
            if (data[drop.Item] == nil) then
                data[drop.Item] = {}
            end
            if(data[drop.Item][drop.Part] == nil) then
                data[drop.Item][drop.Part] = {}
            end
            table.insert(data[drop.Item][drop.Part], newObj)
        end
    end
    
    local fullTable = {'{|class="bigmodtable" style="line-height:16px; font-size:14px;"'}
    
    for item, parts in Shared.skpairs(data) do
        --seperate locals instead of calling each one inside table.insert for easier troubleshooting, if the need comes
        local count = Shared.tableCount(parts) 
        local image = Icon._Prime(item, nil, "64")
        local itemName = Void.getItemName(item)
        
        table.insert(fullTable,('\n|-\n|rowspan="'..count..'"|'..image..'<br/>'..'[['..itemName..']]'))
        
        local firstRow = true
        for part, drops in Shared.skpairs(parts) do
            if(firstRow) then
                firstRow = false
            else
                table.insert(fullTable,"\n|-")
            end
            
            local partName = Void.getPartName(part)
            table.insert(fullTable,("\n|"..partName.."\n|"))

            for i, drop in pairs(drops) do
                if(i > 1) then
                    table.insert(fullTable,"<br/>")
                end
                
                local dropTier = drop.Tier
                local dropName = drop.Name
                local dropRarity = drop.Rarity
                table.insert(fullTable,(ttStart..dropTier..' '..dropName..ttCenter.."[["..dropTier..' '..dropName.."]]"..ttEnd.." "..dropRarity))
                
                if(drop.Vaulted ~= nil) then
                    table.insert(fullTable," ([[Prime Vault|V]])")
                end
                if(drop.IsBaro) then
                    table.insert(fullTable," ([[Baro Ki'Teer|B]])")
                end
            end
        end
    end
    table.insert(fullTable,"\n|}")
    
    return table.concat(fullTable)
end

--New function written by User:Falterfire
--For Void Relics/ByRewards/SimpleTable
function p.simpleRewardTable(frame)
    local data = {}
 
    --Collect data for each relic
    for _, relic in pairs(VoidData["Relics"]) do
        local vault = "No"
        if(relic.Vaulted ~= nil) then
            vault = "Yes"
        end
        
        --For each relic, need each drop
        for i, drop in pairs(relic.Drops) do
            --Custom objects are great
            local thisObj = {Item = drop.Item, Part = drop.Part, Tier = relic.Tier,
                            Name = relic.Name, Rarity = drop.Rarity, Vaulted = vault}
            table.insert(data, thisObj)
        end
    end

    local function sorter(r1, r2)
        if(r1.Item == r2.Item) then
            if(r1.Part == r2.Part) then
                return r1.Vaulted < r2.Vaulted
            else
                return r1.Part < r2.Part
            end
        else
            return r1.Item < r2.Item
        end
    end
            
    table.sort(data, sorter)
 
    local rewards = {}
    -- Just manually sending back all table data
    -- Because this is easier than trying to format just rows
    local strTable = {'{| class="article-table sortable" style="width: 600px;margin: auto;" cellspacing="1" cellpadding="1" border="2"'}
    local col1 = '\n|-'
    local col2 = '\n! scope="col"|Item'
    local col3 = '\n! scope="col"|Part'
    local col4 = '\n! scope="col"|Tier'
    local col5 = '\n! scope="col"|Name'
    local col6 = '\n! scope="col"|Rarity'
    local col7 = '\n! scope="col"|Vaulted?'
    table.insert(strTable, (col1..col2..col3..col4..col5..col6..col7))
    
    for i, Row in pairs(data) do
        local ItemName = '[['..Void.getItemName(Row.Item)..']]'
        local PartName = Void.getPartName(Row.Part)
        local rowStr = '\n|- \n|'..ItemName..'||'..PartName..'||'..Row.Tier..'||'..ttStart..Row.Tier..' '..Row.Name..ttCenter..'[['..Row.Tier..' '..Row.Name..'|'..Row.Name..']]'..ttEnd..'||'..Row.Rarity..'||'..(Row.Vaulted)
        table.insert(strTable, rowStr)
    end
    --Add final closing bracket and send it back
    table.insert(strTable, '\n|}')
    return table.concat(strTable)
end

function p.relicsTable(frame)
    --Function by User:Falterfire
    --Finds all related relics and auto-generates a table
    --args:
    --  <no args> - all unvaulted relics
    --  vaulted   - all vaulted relics
    --  baro      - all Baro relics
 
    --Just hardcoding in the four types
    --Fine as long as somebody knows how to fix this if DE introduces 5th rarity
    local data = {["Lith"] = {}, ["Meso"] = {}, ["Neo"] = {}, ["Axi"] = {}}
    local filter = frame.args ~= nil and frame.args[1]
 
    -- collect data
    if(filter == "vaulted") then
        for _,relic in pairs(VoidData["Relics"]) do
            local tier = relic.Tier
 
            if(relic.Vaulted ~= nil) then
                table.insert(data[tier], relic)
            end
        end
    elseif(filter == "baro") then
        for _,relic in pairs(VoidData["Relics"]) do
            local tier = relic.Tier
 
            if(relic.IsBaro == 1) then
                table.insert(data[tier], relic)
            end
        end
    else
        for _,relic in pairs(VoidData["Relics"]) do
            local tier = relic.Tier
 
            if(relic.Vaulted == nil) then
                table.insert(data[tier], relic)
            end
        end
    end
 
    --Setting up the table properly
    local tableStr = {"{| class=\"article-table\" cellspacing=\"1\" cellpadding=\"1\" border=\"2\" style=\"margin:auto\""}
    local col1 = '\n! scope="col" style="width:25%;" | Lith'
    local col2 = '\n! scope="col" style="width:25%;" | Meso'
    local col3 = '\n! scope="col" style="width:25%;" | Neo'
    local col4 = '\n! scope="col" style="width:25%;" | Axi'
    local col5 = '\n|-'
    table.insert(tableStr, (col1..col2..col3..col4..col5))
 
    --Loop through each tier
    --And add all the relics for each one
    for tier in Shared.relicLoop() do
        table.insert(tableStr, '\n|')
        for i, relic in pairs(data[tier]) do
            local relicText = relic.Tier.." "..relic.Name
            table.insert(tableStr, ('\n*'..ttStart..relicText..ttCenter.."[["..relicText.."]]"..ttEnd))
        end
    end
 
    --then just close out the table
    table.insert(tableStr, '\n|}')
 
    --and send it back
    return table.concat(tableStr)
end

function p.byRelic(frame)
    --Added by User:Falterfire
 
    --First, setting up the table columns.
    local tableStr = {'{| class="article-table sortable"'}
    local col1 = "\n! Tier"
    local col2 = "\n! Type"
    local col3 = "\n! Common rewards"
    local col4 = "\n! Uncommon rewards"
    local col5 = "\n! Rare rewards"
    table.insert(tableStr, (col1..col2..col3..col4..col5))
 
    --Now the fun part: Building each table row
    for i, relic in pairs(VoidData["Relics"]) do
        --First, new row indicator
        table.insert(tableStr, "\n|-")
        --Tier & Relic are easy
        table.insert(tableStr, ("\n| "..relic.Tier))
        table.insert(tableStr, ("\n| ".."[["..relic.Tier.." "..relic.Name.."|"..relic.Name.."]]"))
 
        local commonStr = "\n| "
        local uncommonStr = "\n| "
        local rareStr = "\n| "
        for j, drop in pairs(relic.Drops) do
            local itemName = Void.getItemName(drop.Item)
            local partName = Void.getPartName(drop.Part)
            if(drop.Rarity == "Common") then
                commonStr = commonStr.."\n* [["..itemName.."|"..itemName.." "..partName.."]]"
            elseif(drop.Rarity == "Uncommon") then
                uncommonStr = uncommonStr.."\n* [["..itemName.."|"..itemName.." "..partName.."]]"
            else
                rareStr = rareStr.."\n* [["..itemName.."|"..itemName.." "..partName.."]]"
            end
        end
        
        table.insert(tableStr, (commonStr..uncommonStr..rareStr))
    end
    --Close out the table
    table.insert(tableStr, "\n|}")
 
    --And send it back
    return table.concat(tableStr)
end

function p.byRarity(frame)
    --Added by User:Falterfire
    --Twoooo Grakata. Or arguments. Whichever.
    local platform = frame.args ~= nil and frame.args[1] or "PC"
    local checkTier = frame.args ~= nil and frame.args[2] or "Lith"

    local dataIndex = {["Common"] = 1, ["Uncommon"] = 2, ["Rare"] = 3}
    local data = {[1] = {}, [2] = {}, [3] = {}}
 
    -- collect data
    for _,relic in pairs(VoidData["Relics"]) do
        local tier = relic.Tier
        local name = relic.Name
        --So first make sure this row is the right tier
        if(tier == checkTier) then
            for _, drop in pairs(relic.Drops) do
                local rarity = drop.Rarity
                local item = drop.Item
                local part = drop.Part
                
                if(data[dataIndex[rarity]][item.."|"..part] == nil) then
                    data[dataIndex[rarity]][item.."|"..part] = 1
                end
            end
        end
    end
 
    --Now we can actually format the table
    --Starting with all the column headers
    local tableStr = {'{| class="article-table"'}
    local col1 = '\n! style="width:33%;text-align:center;" | Common'
    local col2 = '\n! style="width:33%;text-align:center;" | Uncommon'
    local col3 = '\n! style="width:33%;text-align:center;" | Rare'
    table.insert(tableStr, (col1..col2..col3..'\n|-'..'\n|'))
    --Then go through each rarity
    --Each rarity is the same steps:
    for rarity, _ in ipairs(data) do
        --1. Loop through each item in that rarity
        for itemStr, _ in Shared.skpairs(data[rarity]) do
            --2. Get the item & part
            local sp1, _ = string.find(itemStr, "|")
            local itemName = Void.getItemName(string.sub(itemStr, 1, sp1 - 1))
            local partName = Void.getPartName(string.sub(itemStr, sp1 + 1))
            --3. Add the appropriate link to the table
            table.insert(tableStr, ("\n* [["..itemName.."|"..itemName.." "..partName.."]]"))
        end
        if (rarity ~= 3) then table.insert(tableStr, "\n|") end
    end
    
    --Finally, add the end of the table
    table.insert(tableStr, "\n|}")

    --and send it back
    return table.concat(tableStr)
end

return p
Advertisement