diff options
author | David Gay <david@davidgay.org> | 2021-06-16 20:49:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-16 20:49:59 -0400 |
commit | 6dfaa7453591910e1373d92d8a09ddf384ebe834 (patch) | |
tree | ccec71ec425808ea82a3bfbcd36490f1cdcb666d /app/views/characters | |
parent | 007896b0057b8aecbf74dddd269b57efe3f6e0e6 (diff) | |
parent | 0d6a82102061ff58b7ba34b09c4be9687c21ab2a (diff) |
Merge pull request #16 from dtgay/0.1.11
0.1.11
Diffstat (limited to 'app/views/characters')
-rw-r--r-- | app/views/characters/bestiary/index.html.erb | 22 | ||||
-rw-r--r-- | app/views/characters/items/index.html.erb | 4 | ||||
-rw-r--r-- | app/views/characters/show.html.erb | 26 | ||||
-rw-r--r-- | app/views/characters/skills/_infix_slot.html.erb | 3 | ||||
-rw-r--r-- | app/views/characters/skills/index.html.erb | 57 | ||||
-rw-r--r-- | app/views/characters/spells/index.html.erb | 10 |
6 files changed, 97 insertions, 25 deletions
diff --git a/app/views/characters/bestiary/index.html.erb b/app/views/characters/bestiary/index.html.erb new file mode 100644 index 0000000..f7376e9 --- /dev/null +++ b/app/views/characters/bestiary/index.html.erb @@ -0,0 +1,22 @@ +<h1 class="text-3xl mb-4">Bestiary</h1> + +<% if @monster_kills.any? %> + <table class="table-auto"> + <thead> + <tr> + <th class="table-header-padded">Monster</th> + <th class="table-header-padded">Kills</th> + </tr> + </thead> + <tbody> + <% @monster_kills.ordered_by_monster_name.each do |mk| %> + <tr> + <td class="table-cell-padded"><%= mk.monster.name %></td> + <td class="table-cell-padded"><%= mk.quantity %></td> + </tr> + <% end %> + </tbody> + </table> +<% else %> + <p>You haven't killed any monsters yet.</p> +<% end %> diff --git a/app/views/characters/items/index.html.erb b/app/views/characters/items/index.html.erb index 671e68f..57e8531 100644 --- a/app/views/characters/items/index.html.erb +++ b/app/views/characters/items/index.html.erb @@ -35,6 +35,10 @@ character_items: @character.character_items.ordered_by_item_name.select { |ci| ci.item.has_tag?("currency") } %> +<%= render "characters/items/inventory_section", heading: "Omens", + character_items: @character.character_items.ordered_by_item_name.select { |ci| + ci.item.has_tag?("omen") } %> + <%= render "characters/items/inventory_section", heading: "Seeds", character_items: @character.character_items.ordered_by_item_name.select { |ci| ci.item.has_tag?("seed") } %> diff --git a/app/views/characters/show.html.erb b/app/views/characters/show.html.erb index a7b7c0e..96a87f8 100644 --- a/app/views/characters/show.html.erb +++ b/app/views/characters/show.html.erb @@ -5,6 +5,7 @@ <div class="text-lg text-display mb-4"> <ul class="flex flex-row"> <li class="mr-2"><%= link_to "Titles", character_titles_path(@character) %></li> + <li class="mr-2"><%= link_to "Bestiary", character_bestiary_path(@character) %></li> <li class="mr-2"><%= link_to "Rankings", character_rankings_path(@character) %></li> </ul> </div> @@ -149,31 +150,6 @@ </div> </div> -<div class="my-6"> - <h2 class="text-xl mb-4">Skills</h2> - - <table class="table-auto mb-8"> - <thead> - <tr> - <th class="table-header-padded">Skill</th> - <th class="table-header-padded">Level</th> - <th class="table-header-padded">XPTNL</th> - <th class="table-header-padded">Total XP</th> - </tr> - </thead> - <tbody> - <% @character.character_skills.ordered_by_skill_name.each do |cs| %> - <tr> - <td class="table-cell-padded"><%= cs.skill.name %></td> - <td class="table-cell-padded"><%= cs.level %></td> - <td class="table-cell-padded"><%= cs.xp_to_next_level %></td> - <td class="table-cell-padded"><%= cs.xp %></td> - </tr> - <% end %> - </tbody> - </table> -</div> - <% if @character == current_char %> <%= link_to "Manage account", edit_user_registration_path, class: "text-sm" %> <% end %> diff --git a/app/views/characters/skills/_infix_slot.html.erb b/app/views/characters/skills/_infix_slot.html.erb new file mode 100644 index 0000000..0113596 --- /dev/null +++ b/app/views/characters/skills/_infix_slot.html.erb @@ -0,0 +1,3 @@ +<div class="flex justify-between items-center border-t border-gray-700 p-2"> + <%= yield %> +</div> diff --git a/app/views/characters/skills/index.html.erb b/app/views/characters/skills/index.html.erb new file mode 100644 index 0000000..d804384 --- /dev/null +++ b/app/views/characters/skills/index.html.erb @@ -0,0 +1,57 @@ +<h2 class="text-3xl mb-2">Skills</h2> +<div class="grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"> + <% @character.character_skills.ordered_by_skill_name.each do |cs| %> + <div> + <div class="rounded border border-gray-700"> + <div class="flex p-1"> + <div class="flex-grow"> + <div class="text-xl text-display mb-1"> + <%= cs.skill.name %> + </div> + <div class="flex items-center text-xs"> + <span class="bg-gray-700 px-1 py-0.5 rounded mr-1">XP</span><%= cs.xp %> + </div> + </div> + <div class="text-xl m-2 text-display"> + <%= cs.level %> + </div> + </div> + <div class="border border-gray-700 h-2 mt-1 -mb-px -mx-px"> + <div class="bg-gray-600 h-full" style="width: <%= cs.percentage_of_skill_level_completed %>%"> + </div> + </div> + <% @character.item_infixes.where(skill: cs.skill).each do |ii| %> + <%= render "characters/skills/infix_slot" do %> + <div> + <%= ii.item.name %> + </div> + <div> + <%= button_to "Remove", character_item_infix_path(id: ii.id), method: :delete %> + </div> + <% end %> + <% end %> + <% @character.available_infixes(cs.skill).times do %> + <%= render "characters/skills/infix_slot" do %> + <%# TODO: Don't load all into memory %> + <% infixable_items = @character.items.select {|i| i.infixable?(cs.skill)} %> + <% if infixable_items.any? %> + <%= form_with url: character_item_infixes_path, class: "w-full" do |f| %> + <div class="flex space-x-1"> + <div class="flex-grow"> + <%= f.select :item_id, infixable_items.map { |i| [i.name, i.id]}, {}, class: "w-full" %> + <%= f.hidden_field :skill_id, value: cs.skill.id %> + </div> + <div> + <%= f.submit "Infix" %> + </div> + </div> + <% end %> + <% else %> + <div class="text-gray-500">No omens to infix.</div> + <% end %> + <% end %> + <% end %> + </div> + </div> + <% end %> +</div> diff --git a/app/views/characters/spells/index.html.erb b/app/views/characters/spells/index.html.erb new file mode 100644 index 0000000..5f415a3 --- /dev/null +++ b/app/views/characters/spells/index.html.erb @@ -0,0 +1,10 @@ +<h2 class="text-3xl mb-2">Spells</h2> +<div data-controller="activity-select"> + <%= form_with url: start_activity_path, method: :post do |f| %> + <%= f.select :id, @spell_activities.map { |a| [a.name, a.id] }, {}, + { data: { activity_select_target: "select", action: "activity-select#load" } } %> + <%= f.number_field :actions, value: 1, size: 5, min: 1, max: 2_000_000_000 %> + <%= f.submit "Cast" %> + <% end %> + <div data-activity-select-target="output" class="my-1"></div> +</div> |