FANDOM


-- This module needs to be updated every Thursday when a new chapter is released.
 
local p = {}
 
local ChapterLink = require('Module:ChapterLink')
 
function p.getNumber(chapter)
    local LATEST_CHAPTER = ChapterLink.getLatest()
    if chapter == "Prologue" then
        return 0
    elseif chapter == "None" then
        return LATEST_CHAPTER+3
    elseif chapter == "Bonus Episode" then
        return 36
    elseif chapter == "Bonus Episode 2" then
        return 46
    else
        local wat, wat2, num = chapter:find("%a+%s*(%d+)")
        local chapter_num = tonumber(num)
        if(chapter_num > 46) then
            return chapter_num+3 --Bonus Episode 2 takes up another episode
        elseif(chapter_num > 36) then
            return chapter_num+2 --The Bonus Episode takes up one episode
        else
            return chapter_num+1 --Prologue is episode 0, so Chapter 1 is episode 2, Chapter 2 is episode 3 and so on
        end    
    end
end
 
function p.getFirstAppearanceNumber(frame)
    return p.getNumber(frame:getParent().args['first_appearance'])
end
 
function p.getFirstNamedNumber(frame)
    return p.getNumber(frame:getParent().args['first_named'])
end
 
return p
 
--[[Category:Lua modules]]

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.