Super Animal Royale Wiki
Advertisement

Die Dokumentation für dieses Modul kann unter Modul:LTMShowcaser/Doku erstellt werden

p = {}

start_counter_from = 1655830800 -- Time in UNIX timestamp for last of The Bwoking Mode rotation
exceptions = {{1656435600, 1657645200, 1}} -- In format of: start timestamp, end timestamp, mode code (0 for bwoking, 1 for S.A.W vs Rebellion)

-- Here edit the main content of the presentation
modes = {[2] = "[[File:The_Bwoking_Dead_promo_artwork.jpg|500px|link=The Bwoking Dead]]<br>[[The Bwoking Dead]]<br> ", [1] = "[[File:SAW vs Rebellion 2.0.png|500px|link=S.A.W. vs Rebellion]]<br>[[S.A.W. vs Rebellion]]<br> ", [0] = "[[File:Mystery Mode promotional artwork.jpg|500px|link=Mysteriöser Modus]]<br>[[Mysteriöser Modus]]<br> "}

p.mode = function (f)
    current_modes = p.getcurrentmode()
    local mode_main = mw.html.create('p')
    mode_main:wikitext(modes[current_modes[3]])
    local lang = mw.language.getContentLanguage()
    mode_main:wikitext(lang:formatDate("M j – ", "@" .. tostring(current_modes[1])) .. lang:formatDate("M j", "@" .. tostring(current_modes[2])))
    return tostring(mode_main)
end

p.getcurrentmode = function (f)
    local highest_end = start_counter_from-1
    local last_mode = 1
    local now = os.time()
    for _, exception in ipairs(exceptions) do
        if exception[1] < now and exception[2] > now then
            return exception
        elseif exception[2] > highest_end and exception[2] < now then
            highest_end = exception[2]
            last_mode = exception[3]
        end
    end
    if last_mode == 0 then
        highest_end = highest_end - 604800
    end
    local mode = math.floor((os.time() - highest_end) / 604800) % 3
    local beginning_of_mode = os.time() - ((os.time() - highest_end) % 604800)  -- Very likely can be optimized but I'm not a smart animal and it won't be my machine doing these calculations :)
    return {beginning_of_mode, beginning_of_mode + 604800, mode}
end

return p
Advertisement