--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 --Pulls from Módulo: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( 'Módulo:Void/data' ) local Void = require( "Módulo:Void" ) local Icon = require( "Módulo:Icono" ) local Shared = require( "Módulo:Shared" ) 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, IsVaulted = relic.IsVaulted == 1, 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.IsVaulted) then table.insert(fullTable," ([[Bóveda Prime|B]])") 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.IsVaulted == 1) 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, IsVaulted = vault} table.insert(data, thisObj) end end local new function sorter(r1, r2) if(r1.Item == r2.Item) then if(r1.Part == r2.Part) then return r1.IsVaulted < r2.IsVaulted 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"|Artículo' local col3 = '\n! scope="col"|Parte' local col4 = '\n! scope="col"|Rango' local col5 = '\n! scope="col"|Nombre' local col6 = '\n! scope="col"|Rareza' local col7 = '\n! scope="col"|¿Retirado?' 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.IsVaulted 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.IsVaulted == 1) 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.IsVaulted == 0) 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! Rango" local col2 = "\n! Tipo" local col3 = "\n! Recompensas comunes" local col4 = "\n! Recompensas poco comunes" local col5 = "\n! Recompensas raras" 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 == "Común") then commonStr = commonStr.."\n* [["..itemName.."|"..itemName.." "..partName.."]]" elseif(drop.Rarity == "Poco común") 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 data = {["Común"] = {}, ["Poco común"] = {}, ["Raro"] = {}} -- 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[rarity][item.."|"..part] == null) then data[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;" | Común' local col2 = '\n! style="width:33%;text-align:center;" | Poco común' local col3 = '\n! style="width:33%;text-align:center;" | Raro' table.insert(tableStr, (col1..col2..col3..'\n|-'..'\n|')) --Then go through each rarity --Each rarity is the same steps: --1. Loop through each item in that rarity for itemStr, trash in Shared.skpairs(data["Común"]) do --2. Get the item & part sp1, trash = string.find(itemStr, "|") itemName = Void.getItemName(string.sub(itemStr, 1, sp1 - 1)) partName = Void.getPartName(string.sub(itemStr, sp1 + 1)) --3. Add the appropriate link to the table table.insert(tableStr, ("\n* [["..itemName.."|"..itemName.." "..partName.."]]")) end table.insert(tableStr, "\n|") for itemStr, trash in Shared.skpairs(data["Poco común"]) do sp1, trash = string.find(itemStr, "|") itemName = Void.getItemName(string.sub(itemStr, 1, sp1 - 1)) partName = Void.getPartName(string.sub(itemStr, sp1 + 1)) table.insert(tableStr, ("\n* [["..itemName.."|"..itemName.." "..partName.."]]")) end table.insert(tableStr, "\n|") for itemStr, trash in Shared.skpairs(data["Raro"]) do sp1, trash = string.find(itemStr, "|") itemName = Void.getItemName(string.sub(itemStr, 1, sp1 - 1)) partName = Void.getPartName(string.sub(itemStr, sp1 + 1)) table.insert(tableStr, ("\n* [["..itemName.."|"..itemName.." "..partName.."]]")) end --Finally, add the end of the table table.insert(tableStr, "\n|}") --and send it back return table.concat(tableStr) end return p
El contenido de la comunidad está disponible bajo CC-BY-SA
a menos que se indique lo contrario.