Module:UpdateScheduleTemp

require("Module:Util") require("Module:Database")

local p = {}

-- args: list of unit inames function p.jp( frame ) local units  = mw.loadData("Module:DataJP/MasterParam/Unit") local jobs   = mw.loadData("Module:DataJP/MasterParam/Job") local jobsets = mw.loadData("Module:DataJP/MasterParam/JobSet") local gears  = mw.loadData("Module:DataJP/MasterParam/Artifact") local cards  = mw.loadData("Module:DataJP/MasterParam/ConceptCard") local unitsLoc = mw.loadData("Module:Loc/en/LocalizedMasterParam/Unit") local jobsLoc = mw.loadData("Module:Loc/en/LocalizedMasterParam/Job") local gearsLoc = mw.loadData("Module:Loc/en/LocalizedMasterParam/Artifact") local typeKeys = { unit  = "New Units", hard  = "Hard Quests Added", job   = "New Jobs", master = "Character Quests Added", gate  = "Enlightenment Added", job   = "New Jobs", gear  = "New Gear", card  = "New Cards", event = "Event", } local sb = { '{| class="wikitable sortable" width="100%"\n', '! data-sort-type="isoDate" width="115px" class="shortspacer" | JP Date\n', '! width="115px" | Type\n', '! class="spacer" | Description\n', '! data-sort-type="isoDate" width="115px" class="shortspacer" | GL Date', } for i, entry in pairs(mw.loadData("Module:UpdateSchedule/Data")) do if entry.jpDate then

table.insert( sb, "\n|-\n|" ) table.insert( sb, entry.jpDate or 'data-sort-value="9999-12-31"|' ) table.insert( sb, "\n|" ) table.insert( sb, typeKeys[entry.type] or entry.type ) if entry.name then table.insert( sb, " "..entry.name.." " ) end table.insert( sb, "\n|" ) for j, subentry in ipairs( entry ) do     if type(subentry) == "string" then subentry = {subentry} end local type = subentry.type or entry.type local iname = subentry[1] if type == "job" or type == "master" or type == "gate" then local unit = units[iname] or {rare = 0, jobsets = {}} local name = (unitsLoc[iname] or mw.loadData("Module:LocJP/en/LocalizedMasterParam/Unit")[iname] or {NAME = unit.name or iname}).NAME table.insert(sb, " [[File:")        table.insert(sb, unit.img and ("Game,PortraitsM,"..unit.img) or "Game,PortraitsS,unknown")        table.insert(sb, ".png|29px|")        table.insert(sb, name)        table.insert(sb, "|link=")        table.insert(sb, name)        table.insert(sb, "]] ") if type == "job" then local js  = unit.jobsets[subentry[2]] if subentry[3] ~= false then js = ((jobsets[js] or {}).jobc or {})[iname] end js = jobsets[js] or {} local job = jobs[js.job] or {iname = js.job} name = name.." "..((jobsLoc[job.iname] or mw.loadData("Module:LocJP/en/LocalizedMasterParam/Job")[job.iname] or {NAME = job.name or job.iname}).NAME or "???") table.insert(sb, " [[File:")         table.insert(sb, job.ranks and ("Game,ItemIcon,"..job.ranks[1].eqid1) or job.ac2d and ("Game,JobIconM,"..job.ac2d) or job.mdl and ("Game,JobIconM,"..job.mdl) or "Item_IT_UNKNOWN")          table.insert(sb, ".png|29px]] ") elseif type == "master" then table.insert(sb, " ") elseif type == "gate" then table.insert(sb, " ") end table.insert(sb, " ") table.insert(sb, name) table.insert(sb, " ") else local obj = {} local name = nil local img = nil local rare = nil local typeI = nil if type == "unit" or type == "hard" then obj = units[iname] or {} name = (unitsLoc[iname] or mw.loadData("Module:LocJP/en/LocalizedMasterParam/Unit")[iname] or {}).NAME or obj.name if type == "unit" then img = obj.img and ("Game,Portraits,"..obj.img) or "Game,PortraitsS,unknown" else img = obj.piece and ("Game,ItemIcon,"..obj.piece) or "Game,PortraitsS,unknown" typeI = 1 end --       elseif type == "gear" then          obj = gears[iname] or {}          name = (gearsLoc[iname] or mw.loadData("Module:LocJP/en/LocalizedMasterParam/Artifact")[iname] or {}).NAME or obj.name          img = obj.icon and ("Game,ArtiIcon,"..obj.icon)          rare = obj.rini          typeI = 2        elseif type == "card" then          obj = cards[iname] or {}          name = (mw.loadData("Module:LocJP/en/LocalizedMasterParam/ConceptCard")[iname] or {}).NAME or obj.name          img = obj.icon and ("Game,ConceptCardIcon,"..obj.icon)          typeI = 4 end if name == nil then name = iname end table.insert(sb, itemIcon( (img or "Item_IT_UNKNOWN")..".png", name, name, 64, rare or obj.rare or 0, typeI or 0, " "..name.." " ))     end end table.insert( sb, "\n|" ) table.insert( sb, entry.glDate or 'data-sort-value="9999-12-31"|' ) --sb = {table.concat( sb )} end end table.insert( sb, "\n|}" ) return table.concat(sb) end

return p