feat: add sprite spawns

This commit is contained in:
insects 2025-03-13 14:36:23 +01:00
parent 0581c53454
commit ca352fc531
13 changed files with 379 additions and 13 deletions

View file

@ -34,7 +34,7 @@
<% pop = instance.pops.find { |pop| pop.name == nm[:name].parameterize } %>
<% mins = ActiveSupport::Duration.build(Time.current - pop.created_at) %>
<div class="timer">
<div>» <%= (120.minutes - mins).in_minutes.floor %>m</div>
<div>» <%= (120.minutes - mins).in_minutes.ceil %>m</div>
<div class="progress-container">
<span class="progress-bar" style="width: <%= (mins.in_minutes / 120) * 100 %>%"></span>
</div>
@ -55,14 +55,14 @@
<% end %>
<% if nm[:weather] && forecast[0][:curr_weather] != nm[:weather] %>
<% 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
<%= Weather.get_weather_name(nm[:weather]) %> in <%= ((next_pattern[:time] - Time.now.utc) / 1.minutes).ceil %>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
<%= Weather.get_weather_name(nm[:spawned_by][:weather]) %> in <%= ((next_pattern[:time] - Time.now.utc) / 1.minutes).ceil %>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>
Night in <%= ((Clock.to_earth_time(Clock.get_current_eorzea_time.change(hour: 18)) - Time.now.utc) / 1.minutes).ceil %>m
<% end %>
</div>
</div>
@ -87,4 +87,12 @@
</div>
</section>
<% end %>
<a href="/maps/<%= @instance.zone %>_full.jpg" target="_blank">
<button>full map (new tab)</button>
</a>
<%= form_with url: clone_instance_path(instance: @instance.public_id), html: { style: "display: inline-block;" } do |f| %>
<%= f.submit "clone instance" %>
<% end %>
</div>