module EorzeaWeather

github.com/Rogueadyn/SaintCoinach/blob/f969b441584688c02dde2fadac548c4a5aaa3faa/SaintCoinach/Xiv/WeatherRate.cs

Constants

Locale
VERSION
Zone

Public Class Methods

find(weather, zone, time: Time.now, max_attempts: 60, count: 1) click to toggle source
# File lib/eorzea_weather.rb, line 44
def self.find(weather, zone, time: Time.now, max_attempts: 60, count: 1)
  weather = self.weather(weather)

  result = []
  forecast = self.forecast(zone, time)
  max_attempts.times do
    if forecast.weather == weather
      result << forecast
    end
    forecast = forecast.succ
  end

  result
end
find_next(weather, zone, time: Time.now, max_attempts: 60) click to toggle source
# File lib/eorzea_weather.rb, line 40
def self.find_next(weather, zone, time: Time.now, max_attempts: 60)
  find(weather, zone, time: time, max_attempts: max_attempts, count: 1)[0]
end
forecast(zone, time = Time.now) click to toggle source
# File lib/eorzea_weather.rb, line 59
def self.forecast(zone, time = Time.now)
  Calculator.new(self.zone(zone), time)
end
forecasts(zone, time: Time.now, count: 6) click to toggle source
# File lib/eorzea_weather.rb, line 63
def self.forecasts(zone, time: Time.now, count: 6)
  [forecast(zone, time)].tap do |result|
    [0, count - 1].max.times do
      result << result.last.succ
    end
  end
end
history(zone, time: Time.now, count: 6) click to toggle source
# File lib/eorzea_weather.rb, line 71
def self.history(zone, time: Time.now, count: 6)
  [forecast(zone, time)].tap do |result|
    [0, count - 1].max.times do
      result << result.last.prev
    end
  end.reverse
end
weather(o) click to toggle source
# File lib/eorzea_weather.rb, line 27
def self.weather(o)
  if o.kind_of?(String)
    o = Data::Locales::WEATHER_MAP[o] || o
    o = o.to_sym
  end
  if Data::Weathers::LIST.include?(o)
    return o
  else
    raise KeyError, "#{o} is not valid weather"
  end
end
zone(o) click to toggle source
# File lib/eorzea_weather.rb, line 15
def self.zone(o)
  case o
  when Zone
    o
  when String
    o = Data::Locales::ZONE_MAP[o] || o
    Data::Zones::MAP.fetch o.to_sym
  else
    Data::Zones::MAP.fetch o.to_sym
  end
end
zones() click to toggle source
# File lib/eorzea_weather.rb, line 11
def self.zones
  Data::Zones::MAP
end