Module:Ep/Switcher

local p = {} -- function to take a given value of "ep" and return the episode's name and CxEE code function p.epSwitcher(frame, reference) -- Get ep value entered from template local ep   if reference and frame.args["ep"] then ep = frame.args["ep"] elseif reference and not isnotempty(frame.args["ep"]) then return " Undefined Episode ", "" elseif reference then ep = "0x00" elseif not isnotempty(frame.args[1]) then return "", "" else ep = frame.args[1] end local order = 0 if frame.args["order"] == "next" and not reference then order = 1 elseif frame.args["order"] == "previous" and not reference then order = -1 end local epIndex = 1 epArray = { { epName = "A Barrel of Fun", CxEE = "1x01"}, { epName = "A Fork in the Road", CxEE = "1x02"}, { epName = "In the Interest of Honesty", CxEE = "1x03"}, { epName = "Families and Feuds", CxEE = "1x04"}, { epName = "Reunions and Reminiscence", CxEE = "1x05"}, { epName = "A Soldier's Send Off", CxEE = "1x06"}, { epName = "Bonds in Blood", CxEE = "1x07"}, { epName = "Stairway to Heaven", CxEE = "1x08"}, { epName = "Dinner Party", CxEE = "1x09"}, { epName = "Like Weeds", CxEE = "1x10"}, { epName = "Found Family", CxEE = "1x11"}, { epName = "Two Heads Are Better Than One", CxEE = "1x12x1"}, { epName = "Surfing the Chaos Sea", CxEE = "1x12x2"}, { epName = "What's Up, Druid?", CxEE = "1x12x3"}, { epName = "The Boys Are Back in Town", CxEE = "1x13"}, { epName = "Best-laid Plans", CxEE = "1x14"}, { epName = "Rock and a Hard Place", CxEE = "1x15"}, { epName = "Only a Drop", CxEE = "1x16"}, { epName = "Gone Fishing", CxEE = "1x17"}, { epName = "No Man's Land", CxEE = "1x18"}, { epName = "A Cup of Tea", CxEE = "1x19"}, { epName = "Rough Water", CxEE = "1x20"}, { epName = "A Bit of Respite", CxEE = "1x21"}, { epName = "A Show of Force", CxEE = "1x22"}, --{ epName = "Campaign 1 Episode 23", CxEE = "1x23"}, }   -- Get episode name and CxEE code -- SHIKAR EPISODES if ep == "1" or ep == "01" or ep == "001" or ep == "Episode 1" or ep == "Episode 01" or ep == "Episode 001" or ep == "1x01" or ep == "A Barrel of Fun" or ep == "C1E1" then epIndex = 1 elseif ep == "2" or ep == "02" or ep == "002" or ep == "Episode 2" or ep == "Episode 02" or ep == "Episode 002" or ep == "1x02" or ep == "A Fork in the Road" or ep == "C1E2" then epIndex = 2 elseif ep == "3" or ep == "03" or ep == "003" or ep == "Episode 3" or ep == "Episode 03" or ep == "Episode 003" or ep == "1x03" or ep == "In the Interest of Honesty" or ep == "C1E3" then epIndex = 3 elseif ep == "4" or ep == "04" or ep == "004" or ep == "Episode 4" or ep == "Episode 04" or ep == "Episode 004" or ep == "1x04" or ep == "Families and Feuds" or ep == "C1E4" then epIndex = 4 elseif ep == "5" or ep == "05" or ep == "005" or ep == "Episode 5" or ep == "Episode 05" or ep == "Episode 005" or ep == "1x05" or ep == "Reunions and Reminiscence" or ep == "C1E5" then epIndex = 5 elseif ep == "6" or ep == "06" or ep == "006" or ep == "Episode 6" or ep == "Episode 06" or ep == "Episode 006" or ep == "1x06" or ep == "A Soldier's Send Off" or ep == "A Soldier&#39;s Send Off" or ep == "C1E6" then epIndex = 6 elseif ep == "7" or ep == "07" or ep == "007" or ep == "Episode 7" or ep == "Episode 07" or ep == "Episode 007" or ep == "1x07" or ep == "Bonds in Blood" or ep == "C1E7" then epIndex = 7 elseif ep == "8" or ep == "08" or ep == "008" or ep == "Episode 8" or ep == "Episode 08" or ep == "Episode 008" or ep == "1x08" or ep == "Stairway to Heaven" or ep == "C1E8" then epIndex = 8 elseif ep == "9" or ep == "09" or ep == "009" or ep == "Episode 9" or ep == "Episode 09" or ep == "Episode 009" or ep == "1x09" or ep == "Dinner Party" or ep == "C1E9" then epIndex = 9 elseif ep == "10" or ep == "010" or ep == "Episode 10" or ep == "Episode 010" or ep == "1x10" or ep == "Like Weeds" or ep == "C1E10" then epIndex = 10 elseif ep == "11" or ep == "011" or ep == "Episode 11" or ep == "Episode 011" or ep == "1x11" or ep == "Found Family" or ep == "C1E11" then epIndex = 11 elseif ep == "12.1" or ep == "012.1" or ep == "Episode 12.1" or ep == "Episode 012.1" or ep == "1x12x1" or ep == "Two Heads Are Better Than One" or ep == "C1E12P1" then epIndex = 12 elseif ep == "12.2" or ep == "012.2" or ep == "Episode 12.2" or ep == "Episode 012.2" or ep == "1x12x2" or ep == "Surfing the Chaos Sea" or ep == "C1E12P2" then epIndex = 13 elseif ep == "12.3" or ep == "012.3" or ep == "Episode 12.3" or ep == "Episode 012.3" or ep == "1x12x3" or ep == "What's Up, Druid?" or ep == "C1E12P3" or ep == "What&#39;s Up, Druid?" then epIndex = 14 elseif ep == "13" or ep == "013" or ep == "Episode 13" or ep == "Episode 013" or ep == "1x13" or ep == "The Boys Are Back in Town" or ep == "C1E13" then epIndex = 15 elseif ep == "14" or ep == "014" or ep == "Episode 14" or ep == "Episode 014" or ep == "1x14" or ep == "Best-laid Plans" or ep == "C1E14" then epIndex = 16 elseif ep == "15" or ep == "015" or ep == "Episode 15" or ep == "Episode 015" or ep == "1x15" or ep == "Rock and a Hard Place" or ep == "C1E15" then epIndex = 17 elseif ep == "16" or ep == "016" or ep == "Episode 16" or ep == "Episode 016" or ep == "1x16" or ep == "Only a Drop" or ep == "C1E16" then epIndex = 18 elseif ep == "17" or ep == "017" or ep == "Episode 17" or ep == "Episode 017" or ep == "1x17" or ep == "Gone Fishing" or ep == "C1E17" then epIndex = 19 elseif ep == "18" or ep == "018" or ep == "Episode 18" or ep == "Episode 018" or ep == "1x18" or ep == "No Man's Land" or ep == "No Man&#39;s Land" or ep == "C1E18" then epIndex = 20 elseif ep == "19" or ep == "019" or ep == "Episode 19" or ep == "Episode 019" or ep == "1x19" or ep == "A Cup of Tea" or ep == "C1E19" then epIndex = 21 elseif ep == "20" or ep == "020" or ep == "Episode 20" or ep == "Episode 020" or ep == "1x20" or ep == "Rough Water" or ep == "C1E20" then epIndex = 22 elseif ep == "21" or ep == "021" or ep == "Episode 21" or ep == "Episode 021" or ep == "1x21" or ep == "A Bit of Respite" or ep == "C1E21" then epIndex = 23 elseif ep == "22" or ep == "022" or ep == "Episode 22" or ep == "Episode 022" or ep == "1x22" or ep == "A Show of Force" or ep == "C1E22" then epIndex = 24 --elseif ep == "23" or ep == "023" or ep == "Episode 23" or ep == "Episode 023" or ep == "1x23" or ep == "Campaign 1 Episode 23" or ep == "C1E23" --   then epIndex = 25 else epIndex = -2 end epIndex = epIndex + order if order ~= 0 then ep = "" end if epIndex < 1 then return ep, "" elseif epIndex > #epArray then return ep, "" end return epArray[epIndex].epName, epArray[epIndex].CxEE end -- function to determine that a variable has a value function isnotempty(s) return s ~= nil and s~= '' end

return p