Module:Events

--Super Hero, Super Skill, Super Build return {   ["Dilboom Genocide"]= {        starts={12,2,2019}, ends={15,23,2,2019},        image="",--"Dilboom Genocide 2016.jpg",        event_type="kill",        kill_targets={"Dilboom"},        best_maps={"Level 9"},        rewards = {            {rewards="Gems,50",kill_count=0},            {rewards="Coins,1000;log,10;Super Hero,1;Super Skill,1;Epiome_Shard,5",kill_count=3000},            {rewards="Coins,1500;log,20;Super Hero,1;Super Skill,2;Izumi_Shard,5",kill_count=5000},            {rewards="Coins,2000;Super Skill,2;Super Build,2;Hippolyta_Shard,5;Artemis_Shard,5",kill_count=10000},            {rewards="Coins,2500;Super Hero,3;Super Build,3;Tomoe_Shard,5;Morgan_Shard,5",kill_count=15000},            {rewards="Coins,3000;Chiyome_Shard,5;Athena_Shard,5;Joan_Shard,5;Priscilla_Shard,5",kill_count=20000},        },    }, local f = require("Module:Functions") local event = mw.loadData('Module:Events/data') local p = {}

function eventSorted(datas, var) local key = {} local keydata = {} local more for name, data in pairs(datas) do       if var == nil then table.insert(key, eventDate(data)) else table.insert(key, data.lvl) more='less' end table.insert(keydata, name) end return f.tableSort(key,keydata,more) end function eventDate(data) if data.ends[1] ~= nil then return ((((data.ends[3]*100)+data.ends[2])*100)+data.ends[1]) else return 0 end end function active local currentDate = ((((os.date('*t').year*100)+os.date('*t').month)*100)+os.date('*t').day) for name, data in pairs(event) do       if eventDate(data)-currentDate > 0 then return name end end return nil end function missingImage(picture) local img = '' if picture == "" then img = 'Missing.jpg' else img = picture end return img end function p.event(frame) local typ = frame.args[1] local data = {' '} local sorted = eventSorted(event) local active = active local c = 0 if active ~= nil then table.insert(data, '==Current Event==') table.insert(data, '')--|link='..active..' end for name, dat in pairs(sorted) do       event_data=event[dat] if dat ~= active then if c == 0 then table.insert(data, '==Past Event==') end c = c + 1 if c < 9 or typ~='mainPage' then table.insert(data, '')--|link='..dat..' end end end table.insert(data,' ') for i, dat in pairs(data) do mw.log(dat) end return table.concat(data,"\n") end return p