Site News |
---|
Warning: This wiki contains spoilers. Read at your own risk! Social media: If you would like, please join our Discord server, and/or follow us on Twitter or Tumblr! Engage info: As the game has only recently released, we lack much key information. Please help add any info that you can. |
Module:GhbRotation
From Fire Emblem Wiki, your source on Fire Emblem information. By fans, for fans.
For use on Grand Hero Battle and possibly other locations later on. This module can be used to output Grand Hero Battle data, including the next rerun date, total number of reruns, and the current active Grand Hero Battle. Currently relevant only to the seven Grand Hero Battles in rotation: Lloyd, Michalis, Xander, Narcian, Navarre, Robin (female), and Ursula.
Only one parameter is used, the name of the relevant Grand Hero Battle:
{{#invoke:GhbRotation|Michalis}}
This outputs:
Rerun in rotation 271 times to date
Next rerun: April 30, 2023
local p = {}
--[[
Functions for each Grand Hero Battle. Lloyd was the first rotation GHB, on
9 February 2018, so he is number 0; the others follow on up to 6 (Ursula).
Then, call the main functions down below.
]]
function p.Lloyd()
return p.getGHBData(0)
end
function p.Michalis()
return p.getGHBData(1)
end
function p.Xander()
return p.getGHBData(2)
end
function p.Narcian()
return p.getGHBData(3)
end
function p.Navarre()
return p.getGHBData(4)
end
function p.RobinF()
return p.getGHBData(5)
end
function p.Ursula()
return p.getGHBData(6)
end
--[[
This gets the current Grand Hero Battle, by comparing today's date to
the rotation start date (8 February, 2018).
]]
function p.getGrandHeroBattle()
start_day = os.time( { year=2018, month=02, day=09, hour=07 } )
days_since_start = math.floor(os.difftime( os.time(), start_day ) / (24*60*60))
curr_ghb = days_since_start % 7
return curr_ghb
end
--[[
Produce the Grand Hero Battle data; first get the date of the next rerun,
then count how many reruns we've had so far, then check to see
which Grand Hero Battle is currently active.
]]
function p.getGHBData(ghb_number)
curr_ghb = p.getGrandHeroBattle()
-- Need to wrap around for Hero Battles with an ID number lower than the current one
if( ghb_number <= curr_ghb ) then
next_rerun_wrap = ghb_number + 7
else
next_rerun_wrap = ghb_number
end
next_rerun_days_away = next_rerun_wrap - curr_ghb
next_rerun = os.date("%B %e, %Y", os.time()+(24*60*60*next_rerun_days_away))
total_reruns = math.floor(os.difftime( os.time(), os.time( { year=2018, month=02, day=09+ghb_number } ) ) / (24*60*60)/7)
if( ghb_number == curr_ghb ) then
is_active = "<b>Currently available</b><br/>"
else
is_active = ""
end
return string.format("Rerun in rotation %s times to date<br/>%sNext rerun: %s", total_reruns, is_active, next_rerun)
end
return p