summaryrefslogtreecommitdiff
path: root/app/views/application/_results.html.erb
blob: 237dc122ab8dfaa976d93cbaa9889cdc9c78a1ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<div>
  <% results.each do |result| %>
    <% case result[:type] %>
    <% when "item" %>
      <p>You got <%= result[:quantity] %> <%= link_to result[:item].name, item_path(result[:item])%>.
        <% if result[:xp]&.any? %>
          (<%= result[:xp].map { |award| "#{award[:amount] * result[:quantity]} #{award[:skill].name} XP" }.join(", ") %>)
        <% end %>
      </p>
    <% when "hearth_amenity" %>
      <p>You constructed <%= result[:hearth_amenity].name %>.</p>
    <% when "hearth_planting" %>
      <p>You planted <%= link_to result[:hearth_planting].item.name,
                                 item_path(result[:hearth_planting].item) %> in the loam.</p>
    <% when "location" %>
      <p>You appear in <%= result[:location].name %>.</p>
    <% when "hearth_location" %>
      <% if current_char.hearth&.location %>
        <p>You appear in <%= result[:location].name %>.</p>
      <% else %>
        <p>Lacking a hearth to return to, you appear in an empty patch of land in <%= result[:location].name %>.</p>
      <% end %>
    <% when "activity" %>
      <p>You learned how to <%= result[:activity].name %>!</p>
    <% when "monster" %>
      <p>You encountered a <%= result[:monster].name %>.</p>
      <p class="text-xs italic"><%= result[:monster].description %></p>
    <% when "monster_spawn" %>
      <p>You found the <%= result[:monster_spawn].monster.name %>!</p>
      <p class="text-xs italic"><%= result[:monster_spawn].monster.description %></p>
    <% when "create_monster_spawn" %>
      <p>You've called a <%= result[:monster].name %>!</p>
    <% when "xp" %>
      <p class="text-xs">You gained <%= result[:xp] %> <%= result[:skill].name %> XP.</p>
    <% when "title" %>
      <p>You earned the title <%= render "application/components/text/title", title: result[:title] %>!</p>
    <% when "condition" %>
      <p>You gained the <%= result[:condition].name %> condition.</p>
    <% when "message" %>
      <p><%= result[:body] %></p>
    <% when "warning" %>
      <p class="text-yellow-500"><%= result[:message] %></p>
    <% when "error" %>
      <p class="text-red-500"><%= result[:message] %></p>
    <% when "br" %>
      <br />
    <% end %>
  <% end %>
</div>