feat: display time until pop is possible

This commit is contained in:
insects 2025-03-11 15:38:53 +01:00
parent 3ddbc2d4b1
commit fb9ed4546a
3 changed files with 39 additions and 1 deletions

View file

@ -1,7 +1,7 @@
<div id="nm-list">
<% APP_DATA[instance.zone.to_sym][:nms].each do |nm| %>
<% is_popped = instance.pops.filter { |pop| (Time.current - 120.minutes) <= pop.created_at }.any? { |pop| pop.name == nm[:name].parameterize } %>
<section class="<%= class_names(popped: is_popped) %>">
<section class="<%= class_names(popped: is_popped, missing_reqs: has_missing_reqs?(nm, forecast)) %>">
<div>
<img src="<%= "/#{nm[:element]}.png" %>" alt="<%= nm[:element] %>" width="30" />
</div>
@ -38,6 +38,13 @@
<% next_pattern = forecast.find { |f| f[:curr_weather] == nm[:weather] } %>
<%= Weather.get_weather_name(nm[:weather]) %> in <%= ((next_pattern[:time] - Time.now.utc) / 1.minutes).floor %>m
<% end %>
<% if nm[:spawned_by][:weather] && forecast[0][:curr_weather] != nm[:spawned_by][:weather] %>
<% next_pattern = forecast.find { |f| f[:curr_weather] == nm[:spawned_by][:weather] } %>
<%= Weather.get_weather_name(nm[:spawned_by][:weather]) %> in <%= ((next_pattern[:time] - Time.now.utc) / 1.minutes).floor %>m
<% end %>
<% if (nm[:night_only] || nm[:spawned_by][:night_only]) && is_day? %>
<div>Night in <%= ((Clock.to_earth_time(Clock.get_current_eorzea_time.change(hour: 18)) - Time.now.utc) / 1.minutes).floor %>m</div>
<% end %>
<% end %>
</div>
<div class="action needs_pwd">