module InstanceHelper
  def is_day?
    et = Clock.get_current_eorzea_time
    et.between?(et.change(hour: 6), et.change(hour: 18))
  end
  def has_missing_reqs?(nm, forecast)
    et = Clock.get_current_eorzea_time
    if nm[:weather] && nm[:weather] != forecast[0][:curr_weather]
      return true
    end
    if nm[:spawned_by][:weather] && nm[:spawned_by][:weather] != forecast[0][:curr_weather]
      return true
    end
    if nm[:night_only] && is_day?
      return true
    end
    if nm[:spawned_by][:night_only] && is_day?
      return true
    end
    false
  end

  def get_map_x(zone)
    case zone
    when "anemos" then 1584
    end
  end

  def get_map_y(zone)
    case zone
    when "anemos" then 1249
    end
  end

  def has_fairy?(instance, fairy)
    instance.fairies.any? { |f| "#{fairy[:x]},#{fairy[:y]}" == f.location }
  end
end
