Module:Rotations
Jump to navigation
Jump to search
Module documentation
This documentation is transcluded from Module:Rotations/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Rotations/doc. [edit]
Module:Rotations requires Module:Purge.
Module:Rotations is required by Module:Rotations/Merchant.
Module:Rotations is required by Module:Rotations/Pumpkin Parties.
Module:Rotations is required by Module:Rotations/Shattered Worlds.
Module:Rotations is required by Module:Rotations/Wilderness Flash Events.
Module:Rotations is required by Module:Sandbox/User:Crazye97.
| Function list |
|---|
| L 26 — p.to_days L 30 — p.to_minutes L 38 — p.add_purge L 50 — p.add_purge2 L 61 — p.plural L 72 — p.on_off L 96 — p.rotation_days L 114 — p.rotation_minutes L 127 — p.simple_on_off L 147 — date_of L 156 — date_of_full L 164 — p.simple_table L 217 — p.simple_table_minutes L 254 — p.raven L 276 — p.castaways L 342 — p.sinkholes L 349 — p.guthix_cache L 386 — p.big_chinchompa L 393 — p.supply_run L 400 — p.arcbirds_time L 426 — spotlight_table L 477 — get_spotlight_list L 509 — p.spotlight L 513 — to_row L 525 — p.next_spotlight L 565 — p.vorago L 581 — p.rots L 652 — p.th_dnd L 666 — p.circus L 682 — p.circus_city L 765 — p.circus_city_table L 808 — p.circus_city_name L 817 — p.circus_city_list L 833 — p.araxxor L 848 — is_open L 921 — p.Icxan L 941 — p.EDSpotlight L 957 — p.arcbirds |
--[[ <nowiki>
Various functions for activities that have time based rotations
--]]
local p = {}
local purge = require('Module:Purge')._purge
local seconds_in_day = 24 * 60 * 60
local seconds_in_minute = 60
local _on_ = 'table-bg-green'
local _off_ = 'table-bg-grey'
local yesno = {
[true] = _on_,
[false] = _off_
}
local unit_seconds_from_name = {
minute = seconds_in_minute,
day = seconds_in_day
}
local lang = mw.language.new('en')
function p.to_days(seconds)
return math.floor(seconds / seconds_in_day)
end
function p.to_minutes(seconds)
return math.floor(seconds / seconds_in_minute)
end
--[[
Adds a table row with a purge button to the table passed
Also gives the table an anchor id so that clicking purge will return readers to the table
--]]
function p.add_purge(builder,cols)
local page_title = mw.title.getCurrentTitle().fullText
local url = tostring(mw.uri.fullUrl(page_title..'#reload','action=purge'))
builder:attr('id','reload')
builder:tag('tr')
:tag('td')
:attr({ colspan = cols or 1 })
:wikitext(purge('reload'))
:done()
:done()
end
function p.add_purge2(tabl, td)
local page_title = mw.title.getCurrentTitle().fullText
local url = tostring(mw.uri.fullUrl(page_title..'#reload','action=purge'))
tabl:attr('id','reload')
td:wikitext(' '..purge('reload'))
:done()
end
--[[
Returns the plural of the word
--]]
function p.plural(word, n, plural)
if n == 1 then
return word
else
return plural or (word .. 's')
end
end
--[[
--]]
function p.on_off(on_time, total_time, offset, unit_seconds)
local units_after_utc = math.floor(os.time() / unit_seconds)
local units_into_start = (units_after_utc + offset) % total_time
local on = units_into_start < on_time
local units_until_change
if on then
units_until_change = on_time - units_into_start
else
units_until_change = total_time - units_into_start
end
return on, units_until_change
end
--[[
Returns a number that can be used to identify the rotation based on:
* The number of days per rotation
* The number of rotations available
* The offset of days such that Tuesday 1 January 1970 - offset would be the starting day for rotation 1 (the absolute value of this should be less than interval * rotation_count)
Also returns a second value that determines how many days until the next rotation
--]]
function p.rotation_days(interval, rotation_count, offset)
local days_after_utc = p.to_days(os.time())
local days_into_period = (days_after_utc + offset) % (interval * rotation_count)
local rotation = math.floor(days_into_period / interval) + 1
local days_until_next_rotation = interval - days_into_period % interval
return rotation, days_until_next_rotation
end
--[[
Returns a number that can be used to identify the rotation based on:
* The number of minutes per rotation
* The number of rotations available
* The offset of minutes such that Tuesday 1 January 1970 - offset would be the starting time for rotation 1
Also returns a second value that determines how many minutes until the next rotation
--]]
function p.rotation_minutes(interval, rotation_count, offset)
local minutes_after_utc = p.to_minutes(os.time())
local minutes_into_period = (minutes_after_utc + offset) % (interval * rotation_count)
local rotation = math.floor(minutes_into_period / interval) + 1
local minutes_until_next_rotation = interval - minutes_into_period % interval
return rotation, minutes_until_next_rotation
end
--[[
--]]
function p.simple_on_off(on_time, total_time, offset, unit_name)
local unit_seconds = unit_seconds_from_name[unit_name]
local on, change_time = p.on_off(on_time, total_time, offset, unit_seconds)
local ret_table = mw.html.create('table')
:addClass('wikitable')
:css({ ['text-align'] = 'center',
float = 'right' })
:tag('tr')
:tag('td')
:wikitext('Time until ' .. (on and 'end' or 'start') .. ': ' .. change_time .. ' ' .. p.plural(unit_name, change_time))
:addClass(yesno[on])
:done()
:done()
p.add_purge(ret_table)
return ret_table
end
local function date_of(i_rot, interval, curr_rot, next_in, total_rots)
local s = os.time() + seconds_in_day * (next_in + interval * ((i_rot - curr_rot - 1) % total_rots) )
if i_rot==curr_rot then
return 'Now!'
else
return lang:formatDate('j M', '@' .. s, nil)
end
end
local function date_of_full(i_rot, interval, curr_rot, next_in, total_rots)
local s = os.time() + seconds_in_day * (next_in + interval * ((i_rot - curr_rot - 1)) )
return lang:formatDate('j F Y', '@' .. s, nil)
end
--[[
--]]
function p.simple_table(rotation_names, interval, offset, dated)
local rotation, next = p.rotation_days(interval, #rotation_names, offset)
local align = 'center'
if dated then
align = 'left'
pad = '0.5em'
end
local ret_table = mw.html.create('table')
:addClass('wikitable')
:css({ ['text-align'] = align,
margin = '3px',
float = 'right' })
:tag('caption')
:wikitext('Current rotation')
:done()
local tr
for i, v in ipairs(rotation_names) do
tr = ret_table:tag('tr')
tr:tag('td'):addClass(yesno[i==rotation])
:wikitext(v)
:done()
:done()
:done()
if dated then
tr:tag('td')
:addClass(yesno[i==rotation])
:css({
['text-align'] = 'right',
['font-size'] = '80%', })
:wikitext(date_of(i, interval, rotation, next, #rotation_names))
end
end
td = ret_table:tag('tr'):tag('td')
td :css('text-align', 'center')
:wikitext("'''Next: "..next..' '..p.plural('day', next).."'''")
:done()
:done()
if dated then
td:attr('colspan', 2)
end
--if dated then
p.add_purge2(ret_table, td)
--else
-- p.add_purge(ret_table)
--end
return ret_table
end
--[[
--]]
function p.simple_table_minutes(rotation_names, interval, offset)
local rotation, next = p.rotation_minutes(interval, #rotation_names, offset)
local align = 'center'
local ret_table = mw.html.create('table')
:addClass('wikitable')
:css({ ['text-align'] = align,
margin = '3px',
float = 'right' })
:tag('caption')
:wikitext('Current rotation')
:done()
local td
for i, v in ipairs(rotation_names) do
td = ret_table:tag('tr'):tag('td')
td :addClass(yesno[i==rotation])
:wikitext(v)
:done()
:done()
:done()
end
td = ret_table:tag('tr'):tag('td')
td :css('text-align', 'center')
:wikitext("'''Next: "..next..' '..p.plural('minute', next).."'''")
:done()
:done()
p.add_purge2(ret_table, td)
return ret_table
end
--[=======================================================[
-- ON/OFF
--]=======================================================]
--[==========[
-- Ravens
--]==========]
function p.raven()
local on, change_time = p.on_off((23+50/60)/24, 13, 7, seconds_in_day)
local text
if on then
text = '<b>There is currently a raven spawned. </b>'
else
local last = 13 - change_time
local date_format = "%e %B %Y"
local last_date = os.date(date_format, os.time() - last * seconds_in_day)
local next_date = os.date(date_format, os.time() + change_time * seconds_in_day)
text = 'The last raven spawned <b>' .. last .. ' ' .. p.plural('day', last) .. ' ago</b> on ' .. last_date .. '. The next raven will spawn on ' .. next_date .. ' (in <b>' .. change_time .. ' ' .. p.plural('day', change_time) .. '</b>). '
end
return text .. purge()
end
--[==========[
-- Castaways
--]==========]
function p.castaways(frame)
local args = frame:getParent().args
local bottle = args.bottle
if (bottle == nil) then
bottle = 1
end
local offset = 7
local hidewarning = args.hidewarning
if (hidewarning == nil) then
hidewarning = 'no'
end
local starttext = args.starttext
if (starttext == nil) then
starttext = 'This message in a bottle'
end
if (bottle == "3") then
offset = 6
end
if (bottle == "5") then
offset = 5
end
if (bottle == "6") then
offset = 3
end
if (bottle == "7") then
offset = 8
end
if (bottle == "9") then
offset = 9
end
if (bottle == "10") then
offset = 5
end
local on, change_time = p.on_off(1, bottle, offset, seconds_in_day)
local text
if on then
text = starttext..' is currently <span style="font-weight:bold;">visible</span>. '
else
local last = bottle - change_time
local date_format = "%e %B"
local last_date = os.date(date_format, os.time() - last * seconds_in_day)
local next_date = os.date(date_format, os.time() + change_time * seconds_in_day)
text = starttext..' was last visible <span style="font-weight:bold;">' .. last .. ' ' .. p.plural('day', last) .. ' ago</span> on ' .. last_date .. '. It will be visible again in <span style="font-weight:bold;">' .. change_time .. ' ' .. p.plural('day', change_time) .. '</span> on ' .. next_date .. '. '
end
text = text .. purge()
if (hidewarning ~= 'yes') then
text = text .. ' Once a message in a bottle is found, and when a player walks near its spawn location while it is visible, it will always be visible, unless the message in the bottle or its treasure map is in the player\'s bank or backpack.'
end
return text
end
--[=============[
-- Sinkholes
--]=============]
function p.sinkholes()
return p.simple_on_off(15, 60, 30, 'minute')
end
--[================[
-- Guthixian Cache
--]================]
function p.guthix_cache()
local on, change_time = p.on_off(10, 60, 0, seconds_in_minute) --For the Hourly event
local on2, change_time2 = p.on_off(10, 3*60, 0, seconds_in_minute) --For the Guthixian Boost
--Copied from p.simple_on_off; modified
local ret_table = mw.html.create('table')
:addClass('wikitable')
:css('float','right')
:css('clear','right')
:tag('tr')
:tag('th')
:wikitext('Time until ' .. (on and 'end' or 'start'))
:css('text-align','right')
:done()
:tag('td')
:wikitext(change_time .. ' ' .. p.plural('minute', change_time))
:addClass(yesno[on])
:done()
:done()
:tag('tr')
:tag('th')
:wikitext('Time until boosts ' .. (on2 and 'end' or 'start'))
:css('text-align','right')
:done()
:tag('td')
:wikitext(change_time2 .. ' ' .. p.plural('minute', change_time2))
:addClass(yesno[on2])
:done()
:done()
p.add_purge(ret_table,2)
return ret_table
end
--[==================[
-- Big chinchompa
--]==================]
function p.big_chinchompa()
return p.simple_on_off(20, 60, 30, 'minute')
end
--[================[
-- Supply run
--]================]
function p.supply_run()
return p.simple_on_off(25, 12 * 60, 0, 'minute')
end
--[================[
-- Arc Bird time
--]================]
function p.arcbirds_time()
local offset = 20
local today_time = os.time()-offset-p.to_days(os.time()-offset)*24*60*60
local interval = 30.5*60 + 30.5*10/(24*60)
local on_time = 9*60+57
local on, last = ((today_time % interval) <= on_time), ((today_time % interval))
local text
if on then
text = 'There is currently a bird spawned. It will stay for another <b>' ..p.to_minutes(on_time-last).. ' ' ..p.plural('minute', p.to_minutes(on_time-last)).. '.</b>'
else
text = 'The last bird spawned <b>' ..p.to_minutes(last).. ' ' ..p.plural('minute', p.to_minutes(last)).. '</b> ago. The next spawn is in <b>' ..p.to_minutes(interval-last).. ' ' ..p.plural('minute', p.to_minutes(interval-last)).. '.</b>'
end
return text .. purge()
end
--[=======================================================[
-- Cycles
--]=======================================================]
--[=======================[
-- Minigame spotlight
--]=======================]
--modified version of p.simple_table
local function spotlight_table(rotation_names, interval, offset)
local rotation, next = p.rotation_days(interval, #rotation_names, offset)
local align = 'left'
local pad = '0.5em'
local ret_table = mw.html.create('table')
:addClass('wikitable')
:css({ ['text-align'] = align,
margin = '3px',
float = 'right' })
:tag('caption')
:wikitext('Current rotation')
:done()
local td
local starti = 0
for i,v in ipairs(rotation_names) do
if date_of(i, interval, rotation, next, #rotation_names) == 'Now!' then
starti = i-1
break
end
end
local j = 0
local i, v
while j < #rotation_names do
i = ((starti + j) % #rotation_names)+1
v = '[['..rotation_names[i]..']]'
td = ret_table:tag('tr'):tag('td')
td :addClass(yesno[i==rotation])
:wikitext(v)
:done()
:done()
:done()
td:css('padding-left', '0.5em')
:tag('span')
:css({ ['float'] = 'right',
['text-align'] = 'right',
['font-size'] = '80%',
['margin-left'] = '5px' })
:wikitext(date_of(i, interval, rotation, next, #rotation_names))
j = j + 1
end
td = ret_table:tag('tr'):tag('td')
td :css('text-align', 'center')
:wikitext("'''Next: "..next..' '..p.plural('day', next).."'''")
:done()
:done()
p.add_purge2(ret_table, td)
return ret_table
end
local function get_spotlight_list()
return {
'Pest Control',
'Soul Wars',
'Fist of Guthix',
'Barbarian Assault',
'Conquest',
'Fishing Trawler',
'The Great Orb Project',
'Flash Powder Factory',
'Castle Wars',
'Stealing Creation',
'Cabbage Facepunch Bonanza',
'Heist',
'Soul Wars',
'Barbarian Assault',
'Conquest',
'Fist of Guthix',
'Castle Wars',
'Pest Control',
'Soul Wars',
'Fishing Trawler',
'The Great Orb Project',
'Flash Powder Factory',
'Stealing Creation',
'Cabbage Facepunch Bonanza',
'Heist',
'Trouble Brewing',
'Castle Wars'
}
end
function p.spotlight()
return spotlight_table(get_spotlight_list(), 3, -49) -- -49 to force same order as news post
end
local function to_row(val, spans)
return string.format('|-\n!%sNext spotlight\n|%s%s %s', --use wikicode until infoboxes are modulised
spans[1] and ('colspan="' .. spans[1] .. '"|') or '',
spans[2] and ('colspan="' .. spans[2] .. '"|') or '',
val,
purge()
)
end
--find the date of the next spotlighted minigame
--returns '' if minigame is not found in the list
--returns a row with the date of the next spotlight, or 'Now!'
function p.next_spotlight(frame)
local interval, offset = 3, -49
local rotations = get_spotlight_list()
local args = frame:getParent().args
local name = args[1]
local spans = {args[2], args[3]}
local rotation, next_in = p.rotation_days(interval, #rotations, offset)
local pos = {}
local found = false
for i,v in ipairs(rotations) do
if name == v then
pos[i] = '0'
found = true
end
end
if not found then
return ''
end
for i,v in pairs(pos) do
if i == rotation then
return to_row("'''Now!'''", spans)
end
pos[i] = os.time() + seconds_in_day * (next_in + interval * ((tonumber(i) - rotation - 1) % #rotations) )
end
local next_rot = os.time() + seconds_in_day*365
for i,v in pairs(pos) do
if next_rot > v then
next_rot = v
end
end
return to_row(lang:formatDate('j F', '@' .. next_rot, nil), spans)
end
--[============[
-- Vorago
--]============]
function p.vorago()
local rotations = {
'Ceiling collapse',
'Scopulus',
'Vitalis',
'Green bomb',
'Team Split',
'The end',
}
return p.simple_table(rotations, 7, -6, false) -- -6 to force "the end" to be last
end
--[==========[
-- Rots
--]==========]
-- Array borrowed from http://www.pso-clan.com/rotations.js
function p.rots()
local b = {
A = 'Ahrim',
D = 'Dharok',
G = 'Guthan',
K = 'Karil',
T = 'Torag',
V = 'Verac'
}
local rotations = {
{{b.D,b.T,b.V},{b.K,b.A,b.G}},
{{b.K,b.T,b.G},{b.A,b.D,b.V}},
{{b.K,b.G,b.V},{b.A,b.T,b.D}},
{{b.G,b.T,b.V},{b.K,b.A,b.D}},
{{b.K,b.T,b.V},{b.A,b.G,b.D}},
{{b.A,b.G,b.D},{b.K,b.T,b.V}},
{{b.K,b.A,b.D},{b.G,b.T,b.V}},
{{b.A,b.T,b.D},{b.K,b.G,b.V}},
{{b.A,b.D,b.V},{b.K,b.T,b.G}},
{{b.K,b.A,b.G},{b.T,b.D,b.V}},
{{b.A,b.T,b.G},{b.K,b.D,b.V}},
{{b.A,b.G,b.V},{b.K,b.T,b.D}},
{{b.K,b.A,b.T},{b.G,b.D,b.V}},
{{b.K,b.A,b.V},{b.D,b.T,b.G}},
{{b.A,b.T,b.V},{b.K,b.D,b.G}},
{{b.K,b.D,b.G},{b.A,b.T,b.V}},
{{b.D,b.T,b.G},{b.K,b.A,b.V}},
{{b.G,b.D,b.V},{b.K,b.A,b.T}},
{{b.K,b.T,b.D},{b.A,b.G,b.V}},
{{b.K,b.D,b.V},{b.A,b.T,b.G}}
}
local days_after_utc = p.to_days(os.time())
local rotation = (days_after_utc % 20) + 1
rotation = rotations[rotation]
local today = os.date("%e %B %Y")
local ret = mw.html.create('table')
:addClass('wikitable')
:css({ ['text-align'] = 'center',
float = 'right' })
:tag('caption')
:wikitext(today)
:done()
:tag('tr')
:tag('th')
:wikitext('West')
:done()
:tag('th')
:attr('rowspan','4')
:done()
:tag('th')
:wikitext('East')
:done()
:done()
local s1,s2 = unpack(rotation)
for i=1,3 do
ret:tag('tr')
:tag('td')
:wikitext(s1[i])
:done()
:tag('td')
:wikitext(s2[i])
:done()
end
p.add_purge(ret,3)
return ret
end
--[==========[
-- TH D&D
--]==========]
function p.th_dnd()
local rotations = {
'[[Evil Tree]]',
'[[Shooting Star]]',
'[[Penguin Hide and Seek]]',
'[[Circus]]'
}
return p.simple_table(rotations, 7, 1, false)
end
--[========================[
-- Circus city template
--]========================]
function p.circus(frame)
local args = frame:getParent().args
local disp = mw.text.trim( string.lower(args[1] or '') )
if disp == 'list' then
return p.circus_city_list()
elseif disp == 'city' then
return p.circus_city_name()
else
return p.circus_city_table()
end
end
--[======================[
-- Circus city (both)
-- Simple return vals
--]======================]
function p.circus_city()
local rotations = {
{
name = '[[Tree Gnome Stronghold]] - south of the entrance; near the gate',
text = 'Tree Gnome Stronghold',
coord = '2444,3381',
short = 'Tree Gnome'
},
{
name = '[[Seers\' Village]]',
text = 'Seers\' Village',
coord = '2689,3475',
short = 'Seers\' Village'
},
{
name = '[[Catherby]]',
text = 'Catherby',
coord = '2791,3456',
short = 'Catherby'
},
{
name = '[[Taverley]]',
text = 'Taverley',
coord = '2891,3470',
short = 'Taverley'
},
{
name = '[[Edgeville]]',
text = 'Edgeville',
coord = '3118,3504',
short = 'Edgeville'
},
{
name = '[[Falador]]',
text = 'Falador',
coord = '3027,3349',
short = 'Falador'
},
{
name = '[[Rimmington]]',
text = 'Rimmington',
coord = '2950,3234',
short = 'Rimmington'
},
{
name = '[[Draynor Village]]',
text = 'Draynor Village',
coord = '3098,3213',
short = 'Draynor'
},
{
name = '[[Al Kharid]]',
text = 'Al Kharid',
coord = '3313,3206',
short = 'Al Kharid'
},
{
name = '[[Lumbridge]]',
text = 'Lumbridge',
coord = '3210,3276',
short = 'Lumbridge'
},
{
name = '[[Varrock]] - east of [[Statue (Saradomin)|Saradomin Statue]], on [[King\'s Road]]',
text = 'Varrock - east of Saradomin Statue, on King\'s Road',
coord = '3300,3467',
short = 'King\'s Road'
},
{
name = '[[Varrock]] - north of [[Gertrude]]\'s house',
text = 'Varrock - north of Gertrude\'s house',
coord = '3144,3424',
short = 'Gertrude\'s'
}
}
local rotation,next = p.rotation_days(7,#rotations,1)
return rotations,rotation,next
end
--[======================[
-- Circus city (both)
-- Pretty table
--]======================]
function p.circus_city_table()
local rotations,rot,next = p.circus_city()
local map = '{{Map|mtype=square|' .. rotations[rot].coord .. '|width=250|height=250}}'
local loc = rotations[rot].name
local ret = mw.html.create('table')
:addClass('wikitable')
:css('text-align','center')
:tag('tr')
:tag('th')
:wikitext('Current location:')
:done()
:tag('td')
:attr('rowspan','13')
:wikitext(mw.getCurrentFrame():preprocess(map))
:done()
:done()
for i, v in ipairs(rotations) do
ret:tag('tr')
:tag('td')
:addClass(yesno[i==rot])
:wikitext(v.short)
:done()
:done()
end
ret :tag('tr')
:tag('td')
:attr('colspan','2')
:wikitext(loc)
:done()
:done()
local td = ret:tag('tr'):tag('td')
td :attr('colspan','2')
:wikitext("'''Days until next: "..next.."'''")
:done()
:done()
:done()
p.add_purge2(ret, td)
return ret
end
--[====================[
-- Circus city name
--]====================]
function p.circus_city_name()
local rotations,rot = p.circus_city()
return rotations[rot].name
end
--[======================[
-- Circus city list
-- List of maplinks
--]======================]
function p.circus_city_list()
local ul = mw.html.create('ul')
local rotations = p.circus_city()
local frame = mw.getCurrentFrame()
for _, v in ipairs(rotations) do
local maplink = '{{Maplink|mtype=square|' .. v.coord .. '|text=' .. v.text .. '}}'
ul:tag('li'):wikitext(frame:preprocess(maplink))
end
return ul
end
--[===========[
-- Araxxor
--]===========]
function p.araxxor(frame)
--get argument for number of future rows. default is 6
local args = frame:getParent().args
numberrotations = tonumber(args[1] or 6) or 6
--local declarations / functions
---array of paths
local rax_rotations = {
'Minions',
'Acid',
'Darkness'
}
---get current rotation details
local rotation, days_to_next = p.rotation_days(4, 3, 3)
---set true/false for open paths
function is_open(path)
if path == rotation then
return false
else
return true
end
end
--current rotation table
local t = mw.html.create('table'):addClass('wikitable'):css('text-align','center')
local thp = t:tag('th'):attr('colspan', '5'):addClass('table-bg-grey'):wikitext('Current Rotation on ' .. lang:formatDate('j F Y'))
local th = t:tag('tr')
local tb = t:tag('tr')
for i=1,3 do
th:tag('th'):wikitext('Path ' .. i .. ' (' .. rax_rotations[i] .. ')')
local td = tb:tag('td')
if i == rotation then
td:wikitext('Closed'):addClass(_off_)
else
td:wikitext('Open'):addClass(_on_)
end
end
local td = t:tag('th'):attr('colspan', '3'):wikitext('Days until next rotation: ' .. days_to_next)
local cocoon
if is_open(1) and is_open(2) then
cocoon = 'I died covered in acid and spiders.'
elseif is_open(1) and is_open(3) then
cocoon = 'I died in the dark, covered in spiders.'
elseif is_open(2) and is_open(3) then
cocoon = 'I died in a dark acid pool.'
end
t:tag('tr'):tag('td'):attr('colspan','3'):css('font-style','italic'):wikitext(cocoon)
p.add_purge2(t,thp)
--future rotations table
---set table
local f = mw.html.create('table'):addClass('wikitable mw-collapsible mw-collapsed'):css('text-align','center')
---Current rotation:
---Future Rotations:
----Header rows
f :tag('caption'):css('text-align','left'):wikitext("''Show/hide future rotations''")
:tag('tr'):tag('th'):attr('colspan', '5'):addClass('table-bg-grey'):wikitext('Future Rotations'):done()
local th2 = f:tag('tr')
th2
:tag('th'):wikitext('Start Date'):done()
:tag('th'):wikitext('End Date'):done()
for i=1,3 do
th2:tag('th'):wikitext('Path ' .. i .. ' (' .. rax_rotations[i] .. ')')
end
----Body rows, number of rows based on input parameter
for j=1,numberrotations,1 do ----loop through number of rows specified in args
local thisrotation = p.rotation_days(4, 3, 3+4*j)
local tb2 = f:tag('tr')
tb2
:tag('td'):wikitext(lang:formatDate('j F Y', string.format('+%s day', days_to_next +(4*(j-1)) ))):done()
:tag('td'):wikitext(lang:formatDate('j F Y', string.format('+%s day', days_to_next +(4*(j-1)) +3 ))):done()
for i=1,3 do
local td = tb2:tag('td')
if i == thisrotation then
td:wikitext('Closed'):addClass(_off_)
else
td:wikitext('Open'):addClass(_on_)
end
end
end
--return elements
return t, f
end
--[============[
-- Icxan
--]============]
function p.Icxan()
local rotations = {
'Grotworm Lair (Port Sarim)',
'Wizards\' Tower',
'Nardah',
'Slayer Tower (Canifis)',
'Sawmill (Varrock)',
'Draynor Manor',
'White Wolf Mountain',
'Skavid caves',
'Oo\'glog',
'Falador',
}
return p.simple_table_minutes(rotations, 60, 180) -- -120 in order to fix the time offst.
end
--[============[
-- Elite Dungeon spotlight
--]============]
function p.EDSpotlight()
local rotations = {
'Temple of Aminishi',
'Dragonkin Laboratory',
'The Shadow Reef',
'Temple of Aminishi', --loop twice to show next spotlight of each
'Dragonkin Laboratory',
'The Shadow Reef'
}
return spotlight_table(rotations, 1, 0) -- -120 in order to fix the time offst.
end
--[============[
-- Arc Birds
--]============]
function p.arcbirds()
local rotations = {
'Crested Sillago Snatcher',
'Shrine Ibis',
'Gongdung Peligorn',
'Cyclosis Cockatiel',
'Titchy Tinamou',
'Tuai Leit Toucan',
'Waiko Warbler'
}
return spotlight_table(rotations, 1, 3)
end
return p