Module:ChapterLink

-- This module was taken and adapted from the Kubera Wiki -- -- -- -- This module needs to be updated every Sunday when the new Naver and LINE episodes are released. -- -- How webtoon numbering for Naver is calculated: -- Season 1 Prologue (Episode 0): 1 -- Episodes 1 to 79: episode # + 1 -- Season 2 Prologue (Episode 2-0): 81 -- Episodes 2-1 to 2-81: episode # + 81 -- Episodes 2-82 onwards: episode # + 82 -- -- -- How webtoon numbering for LINE is calculated: -- Season 1 Prologue (Episode 0): 1 -- Episodes 1 to 78: episode # + 1 -- Episode 79: - -- Season 2 Prologue (Episode 2-0): 80 -- Episodes 2-1 to 2-140: episode # + 80 -- Episodes 2-141 onwards: episode # + 81 -- -- local p = {} function p.GetNumber( frame ) local LATEST_NAVER = 162  -- Update this on Sundays - most recent episode # local LATEST_WEBTOONS = 162 -- Update this on Sundays - most recent episode # local site = frame.args[1] local season = frame.args[2] local episode = frame.args[3] local LinkNumber = 0 local LinkTxt = "Something went wrong." -- Get the link number. episode = tonumber( episode ) -- Return Naver link if (site == "naver") then if (season == "1") then LinkNumber = episode + 1 elseif (season == "2") then if (episode <= 81) then LinkNumber = episode + 81 else LinkNumber = episode + 82 end end if (season == "1") or (episode <= LATEST_NAVER) then LinkTxt = "[http://comic.naver.com/webtoon/detail.nhn?titleId=183559&no=" .. LinkNumber .. " Naver] (Korean)" else LinkTxt = "Not yet available on Naver (Korean)" end -- Return LINE link elseif (site == "line") then if (season == "1") then LinkNumber = episode + 1 elseif (season == "2") then if (episode <= 140) then LinkNumber = episode + 80 else LinkNumber = episode + 81 end end if (episode <= LATEST_WEBTOONS) or (season == "1") then LinkTxt = "[http://webtoons.com/viewer?titleNo=95&episodeNo=" .. LinkNumber .. " LINE] (English)" -- Chapter 79 unavailable on LINE if (season == "1") and (episode == 79) then LinkTxt = "Not available on LINE (English)" end else LinkTxt = "Not yet available on LINE (English)" end end return LinkTxt end return p --