Feast 2.0!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

131 lines
2.9 KiB

  1. <template>
  2. <div class="character-layout">
  3. <button @click="$emit('exit')" class="profile-exit">Exit</button>
  4. <div class="character-items">
  5. <ItemView @click.native="useItem(item)" :item="item" v-for="(item, index) in world.player.items" :key="'item-' + index" />
  6. </div>
  7. <div class="character-containers">
  8. <ContainerView :container="container" v-for="(container, index) in world.player.containers" :key="'explore-container-' + index" />
  9. </div>
  10. <div class="character-stats">
  11. <Statblock :subject="world.player" :initiative="0" />
  12. </div>
  13. <EquipmentView class="character-equipment" :subject="world.player" />
  14. </div>
  15. </template>
  16. <script lang="ts">
  17. import { Component, Prop, Vue } from 'vue-property-decorator'
  18. import Statblock from './Statblock.vue'
  19. import ContainerView from './ContainerView.vue'
  20. import ItemView from './ItemView.vue'
  21. import EquipmentView from './EquipmentView.vue'
  22. import { Creature } from '@/game/creature'
  23. import { World } from '@/game/world'
  24. import { LogEntry } from '@/game/interface'
  25. import { Item, ItemKind, Equipment } from '@/game/items'
  26. @Component({
  27. components: {
  28. Statblock, ContainerView, ItemView, EquipmentView
  29. }
  30. })
  31. export default class Explore extends Vue {
  32. @Prop()
  33. world!: World
  34. useItem (item: Item): void {
  35. switch (item.kind) {
  36. case ItemKind.Key:
  37. break
  38. case ItemKind.Consumable:
  39. item.actions[0].execute(this.world.player, this.world.player)
  40. break
  41. case ItemKind.Equipment:
  42. this.world.player.equip(item as Equipment, (item as Equipment).slot)
  43. this.world.player.items = this.world.player.items.filter(i => item !== i)
  44. break
  45. }
  46. }
  47. }
  48. </script>
  49. <style scoped>
  50. .character-layout {
  51. flex: 10;
  52. position: relative;
  53. display: grid;
  54. grid-template-areas:
  55. "exit stats"
  56. "items stats"
  57. "items equipment"
  58. "containers containers";
  59. grid-template-rows: 100px 1fr 1fr 0.25fr;
  60. grid-template-columns: 1fr 1fr;
  61. width: 100%;
  62. height: 100%;
  63. margin: auto;
  64. }
  65. .character-items {
  66. background: #222;
  67. grid-area: items;
  68. display: grid;
  69. grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
  70. grid-template-rows: repeat(10, 1fr);
  71. justify-items: center;
  72. align-items: start;
  73. overflow-x: hidden;
  74. overflow-y: scroll;
  75. }
  76. .character-items > .item-view {
  77. flex: 1 1;
  78. height: 4rem;
  79. max-height: 4rem;
  80. width: 6rem;
  81. max-width: 6rem;
  82. }
  83. .character-containers {
  84. background: #222;
  85. grid-area: containers;
  86. display: flex;
  87. flex-direction: row;
  88. }
  89. .character-equipment {
  90. grid-area: equipment;
  91. }
  92. .character-stats {
  93. background: #111;
  94. grid-area: stats;
  95. }
  96. .profile-exit {
  97. grid-area: exit;
  98. width: 100%;
  99. padding: 4pt;
  100. flex: 0 1;
  101. background: #333;
  102. border-color: #666;
  103. border-style: outset;
  104. user-select: none;
  105. color: #eee;
  106. font-size: 36px;
  107. }
  108. .profile-exit:hover {
  109. background: #444;
  110. }
  111. .profile-exit:active {
  112. background: #666;
  113. border-style: inset;
  114. }
  115. </style>