From 0872551dd2285dc9120a07c7aac8399a8a07a90b Mon Sep 17 00:00:00 2001 From: Key Date: Thu, 9 Jul 2020 16:04:48 +0200 Subject: [PATCH 001/135] First setup character json --- character_template.json | 96 +++++++++++++++++++++++++++++++++++++++++ spell_template.json | 0 2 files changed, 96 insertions(+) create mode 100644 character_template.json delete mode 100644 spell_template.json diff --git a/character_template.json b/character_template.json new file mode 100644 index 000000000..71c45cb74 --- /dev/null +++ b/character_template.json @@ -0,0 +1,96 @@ +{ + "computed_values": { + + "display": { + "name": "String", + "avatar": "String", + "hit_points": "Integer", + "armor_class": "Integer", + "level": "Integer", + "proficiency": "Integer", + "initiative": "Integer", + "speed": { + "walking": "Integer" + } + }, + "sheet": { + "abilities": { + "strength": "Integer", + "dexterity": "Integer", + "constitution": "Integer", + "intelligence": "Integer", + "wisdom": "Integer", + "charisma": "Integer" + }, + "saving_throws": { + "strength": "Integer" + }, + "skills": { + "history": "Integer" + }, + "senses": { + "perception": "Integer", + "investigation": "Integer", + "insight": "Integer" + }, + "defenses": { + "resistant": "Boolean" + } + } + }, + "base_values": { + "name": "String", + "player_name": "String", + "avatar": "String", + "advancement": "Milestone/Experience", + "hit_point_type": "fixed/rolled", + "experience": "Integer", + "hit_dice": "Integer", + "classes": [ + { + "name": "Barbarian", + "level": "Integer", + "hit_dice": "Integer", + "rolled_hit_points": { + "2": "Integer" + }, + "spell_casting_ability": "String" + } + ], + "skill_proficiencies": ["String"], + "skill_expertises": ["String"], + "saving_throw_proficiencies": ["String"], + "abilities": { + "strength": "Integer", + "dexterity": "Integer", + "constitution": "Integer", + "intelligence": "Integer", + "wisdom": "Integer", + "charisma": "Integer" + } + }, + "modifiers": [ + { + "type": "Bonus/Set Score", + "name": "String", + "value": "Integer", + "ref": "abilities.max.strength" + }, + { + "type": "Bonus/Set Score", + "name": "String", + "value": "Integer", + "ref": "abilities.strength" + }, + { + "name": "Ability Score Improvement 4", + "value": "2", + "ref": "abilities.constitution" + }, + { + "name" : "Ring", + "value": "1", + "ref": "saving_throws.charisma" + } + ] +} \ No newline at end of file diff --git a/spell_template.json b/spell_template.json deleted file mode 100644 index e69de29bb..000000000 From 8cd45d4e6863eeac8c25680c5a13eb106eca8e41 Mon Sep 17 00:00:00 2001 From: Key Date: Thu, 16 Jul 2020 17:50:07 +0200 Subject: [PATCH 002/135] Create a new character and set general info --- character_template.json | 106 +++-- src/components/slides/encounter/AddNpc.vue | 2 - src/routes.js | 2 +- src/store/modules/content.js | 2 +- src/views/MyContent/Players/EditPlayer.vue | 424 ------------------ .../MyContent/Players/EditPlayer/general.vue | 146 ++++++ .../MyContent/Players/EditPlayer/index.vue | 126 ++++++ src/views/MyContent/Players/Players.vue | 35 +- 8 files changed, 363 insertions(+), 480 deletions(-) delete mode 100644 src/views/MyContent/Players/EditPlayer.vue create mode 100644 src/views/MyContent/Players/EditPlayer/general.vue create mode 100644 src/views/MyContent/Players/EditPlayer/index.vue diff --git a/character_template.json b/character_template.json index 71c45cb74..59b2e0853 100644 --- a/character_template.json +++ b/character_template.json @@ -1,5 +1,5 @@ { - "computed_values": { + "character_computed": { "display": { "name": "String", @@ -38,28 +38,37 @@ } } }, - "base_values": { - "name": "String", - "player_name": "String", - "avatar": "String", - "advancement": "Milestone/Experience", - "hit_point_type": "fixed/rolled", - "experience": "Integer", - "hit_dice": "Integer", - "classes": [ - { - "name": "Barbarian", - "level": "Integer", - "hit_dice": "Integer", - "rolled_hit_points": { - "2": "Integer" - }, - "spell_casting_ability": "String" - } - ], - "skill_proficiencies": ["String"], - "skill_expertises": ["String"], - "saving_throw_proficiencies": ["String"], + "character_base": { + "general": { + "control": "String", + "player_name": "String", + "character_name": "String", + "avatar": "String", + "advancement": "Milestone/Experience", + "hit_point_type": "fixed/rolled" + }, + "race": { + "race_name": "String", + "race_description": "String" + }, + "class": { + "experience": "Integer", + "classes": [ + { + "main": "Boolean", + "name": "Barbarian", + "level": "Integer", + "hit_dice": "Integer", + "rolled_hit_points": { + "2": "Integer" + }, + "spell_casting_ability": "String", + "speed": { + "base": "Integer" + } + } + ] + }, "abilities": { "strength": "Integer", "dexterity": "Integer", @@ -67,30 +76,31 @@ "intelligence": "Integer", "wisdom": "Integer", "charisma": "Integer" - } - }, - "modifiers": [ - { - "type": "Bonus/Set Score", - "name": "String", - "value": "Integer", - "ref": "abilities.max.strength" - }, - { - "type": "Bonus/Set Score", - "name": "String", - "value": "Integer", - "ref": "abilities.strength" }, - { - "name": "Ability Score Improvement 4", - "value": "2", - "ref": "abilities.constitution" - }, - { - "name" : "Ring", - "value": "1", - "ref": "saving_throws.charisma" - } - ] + "modifiers": [ + { + "type": "Bonus/Set Score/proficiency/expertise", + "name": "String", + "value": "Integer", + "ref": "ability.strength", + "origin": "race" + }, + { + "type": "Bonus/Set Score", + "name": "String", + "value": "Integer", + "ref": "class" + }, + { + "name": "Ability Score Improvement 4", + "value": "2", + "ref": "abilities.constitution" + }, + { + "name" : "Ring", + "value": "1", + "ref": "saving_throws.charisma" + } + ] + }, } \ No newline at end of file diff --git a/src/components/slides/encounter/AddNpc.vue b/src/components/slides/encounter/AddNpc.vue index 399813768..51ca83e7d 100644 --- a/src/components/slides/encounter/AddNpc.vue +++ b/src/components/slides/encounter/AddNpc.vue @@ -201,8 +201,6 @@ } else { this.add_entity_demo(this.entity); } - } else { - //console.log('Not valid'); } }) }, diff --git a/src/routes.js b/src/routes.js index df9bc4212..44c654e82 100644 --- a/src/routes.js +++ b/src/routes.js @@ -45,7 +45,7 @@ const EditCampaign = () => import('@/views/MyContent/Campaigns/EditCampaign.vue' const Encounters = () => import('@/views/MyContent/Encounters'); const EditEncounter = () => import('@/views/MyContent/Encounters/Edit'); const Players = () => import('@/views/MyContent/Players/Players.vue'); -const EditPlayer = () => import('@/views/MyContent/Players/EditPlayer.vue'); +const EditPlayer = () => import('@/views/MyContent/Players/EditPlayer'); const Reminders = () => import('@/views/MyContent/Reminders'); const EditReminder = () => import('@/views/MyContent/Reminders/EditReminder.vue'); const Characters = () => import('@/views/MyContent/Characters'); diff --git a/src/store/modules/content.js b/src/store/modules/content.js index f4473a420..b1b66a68d 100644 --- a/src/store/modules/content.js +++ b/src/store/modules/content.js @@ -3,7 +3,7 @@ import Vue from 'vue' const campaigns_ref = db.ref('campaigns/'); const encounters_ref = db.ref('encounters'); -const players_ref = db.ref('players'); +const players_ref = db.ref('characters_computed'); const npcs_ref = db.ref('npcs'); const users_ref = db.ref('users'); const tiers_ref = db.ref('tiers'); diff --git a/src/views/MyContent/Players/EditPlayer.vue b/src/views/MyContent/Players/EditPlayer.vue deleted file mode 100644 index 4f9c97567..000000000 --- a/src/views/MyContent/Players/EditPlayer.vue +++ /dev/null @@ -1,424 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/general.vue b/src/views/MyContent/Players/EditPlayer/general.vue new file mode 100644 index 000000000..6eaade2fe --- /dev/null +++ b/src/views/MyContent/Players/EditPlayer/general.vue @@ -0,0 +1,146 @@ + + + + + \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue new file mode 100644 index 000000000..c7871a58e --- /dev/null +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -0,0 +1,126 @@ + + + + + \ No newline at end of file diff --git a/src/views/MyContent/Players/Players.vue b/src/views/MyContent/Players/Players.vue index 0b0c478a0..2b045b522 100644 --- a/src/views/MyContent/Players/Players.vue +++ b/src/views/MyContent/Players/Players.vue @@ -18,9 +18,9 @@ ) - + New Player - + @@ -46,7 +46,7 @@
@@ -171,6 +171,32 @@ } }, methods: { + addPlayer() { + const character_base = { + general: { + character_name: "Unnamed Character", + advancement: "milestone", + hit_point_type: "fixed" + } + } + const character_computed = { + display: { + character_name: "Unnamed Character", + level: 1 + } + } + + //Add if not overencumbered + if(!this.overencumbered) { + db.ref(`characters_base/${this.userId}`).push(character_base).then(res => { + //Returns the key of the added entry + const key = res.getKey(); + + db.ref(`characters_computed/${this.userId}/${key}`).set(character_computed); + this.$router.replace(`/players/${key}`) + }); + } + }, confirmDelete(key, player, control) { this.$snotify.error('Are you sure you want to delete ' + player + '?', 'Delete player', { timeout: false, @@ -211,7 +237,8 @@ } } //Remove player - db.ref('players/' + this.userId).child(key).remove(); + db.ref('character_computed/' + this.userId).child(key).remove(); + db.ref('character_base/' + this.userId).child(key).remove(); } } } From b619a04238a8a63e9e87bed9b46959479fd731ae Mon Sep 17 00:00:00 2001 From: Key Date: Thu, 16 Jul 2020 18:17:00 +0200 Subject: [PATCH 003/135] Added Race component --- .../MyContent/Players/EditPlayer/general.vue | 8 +--- .../MyContent/Players/EditPlayer/index.vue | 29 ++++++++--- .../MyContent/Players/EditPlayer/race.vue | 48 +++++++++++++++++++ 3 files changed, 72 insertions(+), 13 deletions(-) create mode 100644 src/views/MyContent/Players/EditPlayer/race.vue diff --git a/src/views/MyContent/Players/EditPlayer/general.vue b/src/views/MyContent/Players/EditPlayer/general.vue index 6eaade2fe..a7c0ecb7d 100644 --- a/src/views/MyContent/Players/EditPlayer/general.vue +++ b/src/views/MyContent/Players/EditPlayer/general.vue @@ -17,7 +17,7 @@

{{ errors.first('player_name') }}

- + { if (result) { db.ref(`characters_base/${this.userId}/${this.playerId}/general/player_name`).set(this.character.player_name); diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue index c7871a58e..0d36144f3 100644 --- a/src/views/MyContent/Players/EditPlayer/index.vue +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -6,19 +6,27 @@
  • - General + {{ label }}
+
@@ -29,6 +37,7 @@ import { mapGetters, mapActions } from 'vuex'; import { db } from '@/firebase'; import General from './general'; + import Race from './race'; export default { name: 'Players', @@ -37,12 +46,18 @@ }, components: { OverEncumbered, - General + General, + Race }, data() { return { playerId: this.$route.params.id, - tab: 'general' + tabs: [ + { value: 'general', label: "General" }, + { value: 'race', label: "Race" }, + { value: 'class', label: "Class" } + ], + current_tab: 'general' } }, firebase() { @@ -105,9 +120,11 @@ padding: 0; display: flex; justify-content: flex-start; + user-select: none; li { cursor: pointer; + padding: 0 10px; &.active { color: #2c97de; diff --git a/src/views/MyContent/Players/EditPlayer/race.vue b/src/views/MyContent/Players/EditPlayer/race.vue new file mode 100644 index 000000000..906a7840f --- /dev/null +++ b/src/views/MyContent/Players/EditPlayer/race.vue @@ -0,0 +1,48 @@ + + + + + \ No newline at end of file From ac98d22b7a2c0920f9f143c213c609357158c542 Mon Sep 17 00:00:00 2001 From: Key Date: Fri, 17 Jul 2020 11:25:31 +0200 Subject: [PATCH 004/135] Added description to race --- src/views/MyContent/Players/EditPlayer/race.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/views/MyContent/Players/EditPlayer/race.vue b/src/views/MyContent/Players/EditPlayer/race.vue index 906a7840f..1c5acb390 100644 --- a/src/views/MyContent/Players/EditPlayer/race.vue +++ b/src/views/MyContent/Players/EditPlayer/race.vue @@ -9,9 +9,16 @@ id="race" type="text" v-model="race.race_name" - name="race" placeholder="Race"/> -

{{ errors.first('race') }}

+
+
+ +
From 5da4b7ecc943a5c4b029fa3d0a54aa3ef5afb12b Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 17 Jul 2020 12:37:56 +0200 Subject: [PATCH 005/135] Started with modifier form --- character_template.json | 27 ++--- .../MyContent/Players/EditPlayer/class.vue | 35 +++++++ .../MyContent/Players/EditPlayer/index.vue | 10 +- .../MyContent/Players/EditPlayer/modifier.vue | 99 +++++++++++++++++++ src/views/MyContent/Players/Players.vue | 10 +- 5 files changed, 159 insertions(+), 22 deletions(-) create mode 100644 src/views/MyContent/Players/EditPlayer/class.vue create mode 100644 src/views/MyContent/Players/EditPlayer/modifier.vue diff --git a/character_template.json b/character_template.json index 59b2e0853..a1330c8ed 100644 --- a/character_template.json +++ b/character_template.json @@ -1,6 +1,5 @@ { "character_computed": { - "display": { "name": "String", "avatar": "String", @@ -64,7 +63,13 @@ }, "spell_casting_ability": "String", "speed": { - "base": "Integer" + "walking": { + "base": "Integer" + } + }, + "armor_class": { + "base": "Integer", + "dexterity": "Boolean" } } ] @@ -84,23 +89,7 @@ "value": "Integer", "ref": "ability.strength", "origin": "race" - }, - { - "type": "Bonus/Set Score", - "name": "String", - "value": "Integer", - "ref": "class" - }, - { - "name": "Ability Score Improvement 4", - "value": "2", - "ref": "abilities.constitution" - }, - { - "name" : "Ring", - "value": "1", - "ref": "saving_throws.charisma" } ] - }, + } } \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/class.vue b/src/views/MyContent/Players/EditPlayer/class.vue new file mode 100644 index 000000000..c35944845 --- /dev/null +++ b/src/views/MyContent/Players/EditPlayer/class.vue @@ -0,0 +1,35 @@ + + + + + \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue index 0d36144f3..ad8b05847 100644 --- a/src/views/MyContent/Players/EditPlayer/index.vue +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -27,6 +27,12 @@ :playerId="playerId" :userId="userId" /> + @@ -38,6 +44,7 @@ import { db } from '@/firebase'; import General from './general'; import Race from './race'; + import Class from './class'; export default { name: 'Players', @@ -47,7 +54,8 @@ components: { OverEncumbered, General, - Race + Race, + Class }, data() { return { diff --git a/src/views/MyContent/Players/EditPlayer/modifier.vue b/src/views/MyContent/Players/EditPlayer/modifier.vue new file mode 100644 index 000000000..9ddedd320 --- /dev/null +++ b/src/views/MyContent/Players/EditPlayer/modifier.vue @@ -0,0 +1,99 @@ + + + + + \ No newline at end of file diff --git a/src/views/MyContent/Players/Players.vue b/src/views/MyContent/Players/Players.vue index 2b045b522..ad395825a 100644 --- a/src/views/MyContent/Players/Players.vue +++ b/src/views/MyContent/Players/Players.vue @@ -177,6 +177,12 @@ character_name: "Unnamed Character", advancement: "milestone", hit_point_type: "fixed" + }, + class: { + classes: { + main: true, + level: 1 + } } } const character_computed = { @@ -237,8 +243,8 @@ } } //Remove player - db.ref('character_computed/' + this.userId).child(key).remove(); - db.ref('character_base/' + this.userId).child(key).remove(); + db.ref('characters_computed/' + this.userId).child(key).remove(); + db.ref('characters_base/' + this.userId).child(key).remove(); } } } From 65686fb623305a5d9c7412341524fe93ba78cb00 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 17 Jul 2020 19:56:13 +0200 Subject: [PATCH 006/135] Create modifiers under race --- src/css/styles.scss | 61 ++++++++---- src/mixins/skills.js | 4 +- .../MyContent/Players/EditPlayer/index.vue | 37 ++++++- .../MyContent/Players/EditPlayer/modifier.vue | 51 ++++++++-- .../MyContent/Players/EditPlayer/race.vue | 98 ++++++++++++++++++- src/views/MyContent/Players/Players.vue | 2 +- 6 files changed, 220 insertions(+), 33 deletions(-) diff --git a/src/css/styles.scss b/src/css/styles.scss index 069a70e57..90a8ad6c3 100644 --- a/src/css/styles.scss +++ b/src/css/styles.scss @@ -21,6 +21,7 @@ $gray: #262626; $gray-darker: #232323; $gray-dark: #191919; +$gray-darkest: #141414; $gray-light: #b2b2b2; $gray-hover: #5c5757; $gray-active: #302f2f; @@ -1167,25 +1168,47 @@ ul.nav { margin-bottom: 1px; } } -.modal-content { - border-radius: 0 !important; - border: none; - background: $gray-dark !important; - color: $gray-light !important; -} -.modal-content .btn { - color: $white !important; -} -.modal-header, .modal-footer { - border-color: $black !important; -} -.modal .close { - color: $red; - text-shadow: none; - opacity: 1; -} -.modal .close:hover { - color: $red; +.modal-dialog { + margin-top: calc(1.75rem + 60px) !important; + + .modal-content { + border-radius: 0 !important; + border: none; + background: $gray-dark !important; + color: $gray-light !important; + + .modal-header { + border-color: $black !important; + border-radius: 0; + height: 50px; + + .modal-title { + line-height: 20px; + margin-bottom: 0; + } + .close { + color: $red; + text-shadow: none; + opacity: 1; + height: 50px; + line-height: 20px; + + &:hover { + color: $red !important; + } + } + } + .modal-body { + padding-top: calc(1rem + 50px); + + .form-control, .custom-select { + border-color: $gray-hover !important; + } + } + .modal-footer { + border-color: $gray-hover; + } + } } .popover { border-radius: 0 !important; diff --git a/src/mixins/skills.js b/src/mixins/skills.js index 4fc2eaf8e..36939bdce 100644 --- a/src/mixins/skills.js +++ b/src/mixins/skills.js @@ -3,7 +3,7 @@ export const skills = { return { skillList: { 'acrobatics': { skill: 'Acrobatics', ability: 'dexterity' }, - 'animal Handling': { skill: 'Animal Handling', ability: 'wisdom' }, + 'animalHandling': { skill: 'Animal Handling', ability: 'wisdom' }, 'arcana': { skill: 'Arcana', ability: 'intelligence' }, 'athletics': { skill: 'Athletics', ability: 'strength' }, 'deception': { skill: 'Deception', ability: 'charisma' }, @@ -17,7 +17,7 @@ export const skills = { 'performance': { skill: 'Performance', ability: 'charisma' }, 'persuasion': { skill: 'Persuasion', ability: 'charisma' }, 'religion': { skill: 'Religion', ability: 'intelligence' }, - 'sleight of Hand': { skill: 'Sleight Of Hand', ability: 'dexterity' }, + 'sleightOfHand': { skill: 'Sleight Of Hand', ability: 'dexterity' }, 'stealth': { skill: 'Stealth', ability: 'dexterity' }, 'survival': { skill: 'Survival', ability: 'wisdom' }, } diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue index ad8b05847..ffc36f993 100644 --- a/src/views/MyContent/Players/EditPlayer/index.vue +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -26,12 +26,14 @@ :character_race="base_values.race" :playerId="playerId" :userId="userId" + :modifiers="race_modifiers" /> @@ -100,6 +102,30 @@ return this.$store.getters.getUser.uid; } }, + //Turn modifiers into an array, but save the keys + modifiers() { + if(this.base_values.modifiers) { + let returnArray = []; + for(const [key, value] of Object.entries(this.base_values.modifiers)) { + let mod = value; + mod['.key'] = key; + returnArray.push(mod); + } + return returnArray; + } return []; + }, + race_modifiers() { + const modifiers = this.modifiers.filter(mod => { + return mod.origin === 'race'; + }); + return modifiers; + }, + class_modifiers() { + const modifiers = this.modifiers.filter(mod => { + return mod.origin === 'class'; + }); + return modifiers; + } }, methods: { ...mapActions([ @@ -110,7 +136,7 @@ show: true, type, }) - }, + } } } @@ -118,17 +144,18 @@ \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue index ffc36f993..5cf5f6495 100644 --- a/src/views/MyContent/Players/EditPlayer/index.vue +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -30,7 +30,8 @@ /> {{ data.row.subtarget || data.item }} +
Date: Sun, 19 Jul 2020 23:03:56 +0200 Subject: [PATCH 011/135] Crteate class features --- .../MyContent/Players/EditPlayer/class.vue | 174 +++++++++++------- .../MyContent/Players/EditPlayer/modifier.vue | 10 + 2 files changed, 114 insertions(+), 70 deletions(-) diff --git a/src/views/MyContent/Players/EditPlayer/class.vue b/src/views/MyContent/Players/EditPlayer/class.vue index 1d0edb18a..d666a0612 100644 --- a/src/views/MyContent/Players/EditPlayer/class.vue +++ b/src/views/MyContent/Players/EditPlayer/class.vue @@ -2,77 +2,94 @@
-
-

Level {{ main.level }} {{ main.name }}

-
-
- - +
+
+

Level {{ subclass.level }} {{ subclass.name }}

+
+
+ + +
+
+ + +
-
- - + +

Hit Points

+
+
+ + +
+
+ + +
+
+ +
-
-

Hit Points

-
-
- +
+ -
-
- - -
-
- -
-
- -

Armor Class

-
- - -
-
- -
- - - - + v-model="subclass.base_armor_class" + placeholder="Base Armor Class"/>
+ + +

{{ subclass.name || "Class" }} features

+
@@ -81,11 +98,9 @@ + + \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/class.vue b/src/views/MyContent/Players/EditPlayer/class.vue index 074c1ea44..09b82af45 100644 --- a/src/views/MyContent/Players/EditPlayer/class.vue +++ b/src/views/MyContent/Players/EditPlayer/class.vue @@ -47,9 +47,7 @@ {{ subclass.rolled_hit_points ? totalRolled(classKey) : 0 }} -
+
@@ -257,9 +255,7 @@ -
- -
+
@@ -294,7 +288,7 @@ import { dice } from '@/mixins/dice.js'; export default { - name: 'CharacterRace', + name: 'CharacterClass', mixins: [modifierMixin, abilities, weapons, skills, dice], props: [ "base_class", @@ -374,6 +368,14 @@ } } return returnModifiers; + }, + reversedLevels() { + let levelArray = []; + + for(let i = 2; i <= this.classes[this.rollHP].level; i++) { + levelArray.push(i); + } + return levelArray.reverse(); } }, methods: { @@ -387,7 +389,7 @@ totalRolled(classKey) { let totalRolled = 0; for(const [key, value] of Object.entries(this.classes[classKey].rolled_hit_points)) { - if(this.classes[classKey].level >= key) { + if(this.classes[classKey].level >= key && value) { totalRolled = totalRolled + parseInt(value); } } @@ -503,10 +505,15 @@ } } .roll_hp { + width: 100%; display: grid; grid-template-columns: 60px 60px max-content; margin-bottom: 5px; grid-column-gap: 10px; + grid-template-areas: + "label input button"; + justify-content: center; + align-content: center; label { line-height: 38px; @@ -516,6 +523,9 @@ text-align: center; } } + .hidden { + visibility: hidden; + } h4.feature-title { display: flex; justify-content: space-between; diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue index 3d14a3bfb..2632b542d 100644 --- a/src/views/MyContent/Players/EditPlayer/index.vue +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -37,6 +37,13 @@ :userId="userId" :modifiers="class_modifiers" /> +
@@ -49,6 +56,7 @@ import General from './general'; import Race from './race'; import Class from './class'; + import Abilities from './abilities'; export default { name: 'Players', @@ -59,7 +67,8 @@ OverEncumbered, General, Race, - Class + Class, + Abilities }, data() { return { @@ -67,7 +76,8 @@ tabs: [ { value: 'general', label: "General" }, { value: 'race', label: "Race" }, - { value: 'class', label: "Class" } + { value: 'class', label: "Class" }, + { value: 'abilities', label: "Abilities" } ], current_tab: 'general' } @@ -129,7 +139,13 @@ return origin[0] === 'class'; }); return modifiers; - } + }, + ability_modifiers() { + const modifiers = this.modifiers.filter(mod => { + return mod.target === 'ability'; + }); + return modifiers; + }, }, methods: { ...mapActions([ From 8a67f67b5ef51a2bf79c3116a17f34b285b25335 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 26 Jul 2020 14:08:02 +0200 Subject: [PATCH 017/135] Started with computing --- src/mixins/dice.js | 14 ++ .../Players/EditPlayer/abilities.vue | 6 +- .../MyContent/Players/EditPlayer/class.vue | 11 +- .../MyContent/Players/EditPlayer/general.vue | 38 ++++-- .../MyContent/Players/EditPlayer/index.vue | 128 +++++++++++++++++- .../MyContent/Players/EditPlayer/race.vue | 1 + 6 files changed, 173 insertions(+), 25 deletions(-) diff --git a/src/mixins/dice.js b/src/mixins/dice.js index f4739323c..df3d7e7b2 100644 --- a/src/mixins/dice.js +++ b/src/mixins/dice.js @@ -19,6 +19,17 @@ export const dice = { }); } }, + computed: { + dice_types() { + return [ + { value: 4, text: "d4", average: this.calcAverage(4) }, + { value: 6, text: "d6", average: this.calcAverage(6) }, + { value: 8, text: "d8", average: this.calcAverage(8) }, + { value: 10, text: "d10", average: this.calcAverage(10) }, + { value: 12, text: "d12", average: this.calcAverage(12) }, + ]; + } + }, methods: { rollD(d=20, n=1, m=0, notify=false) { m = parseInt(m); //Removes + from modifier @@ -73,5 +84,8 @@ export const dice = { rollD100(n=1,m=0) { return this.rollD(100,n,m) }, + calcAverage(value, amount = 1) { + return Math.ceil(((value + 1)/2)*amount); + } } } diff --git a/src/views/MyContent/Players/EditPlayer/abilities.vue b/src/views/MyContent/Players/EditPlayer/abilities.vue index 0062dc6e5..0a7cf36c5 100644 --- a/src/views/MyContent/Players/EditPlayer/abilities.vue +++ b/src/views/MyContent/Players/EditPlayer/abilities.vue @@ -8,7 +8,7 @@ :id="value" @change="saveAbility(value)" autocomplete="off" - type="text" + type="number" v-model="ability_scores[value]" />
@@ -48,7 +48,9 @@ }, methods: { saveAbility(ability) { - db.ref(`characters_base/${this.userId}/${this.playerId}/abilities/${ability}`).set(this.ability_scores[ability]); + const score = (this.ability_scores[ability]) ? parseInt(this.ability_scores[ability]) : 0; + db.ref(`characters_base/${this.userId}/${this.playerId}/abilities/${ability}`).set(score); + this.$emit("change", `abilities.${ability}`); } } } diff --git a/src/views/MyContent/Players/EditPlayer/class.vue b/src/views/MyContent/Players/EditPlayer/class.vue index 09b82af45..ffcdfc5d5 100644 --- a/src/views/MyContent/Players/EditPlayer/class.vue +++ b/src/views/MyContent/Players/EditPlayer/class.vue @@ -39,7 +39,7 @@
- +
@@ -305,13 +305,6 @@ }, data() { return { - dice: [ - { value: "4", text: "d4" }, - { value: "6", text: "d6" }, - { value: "8", text: "d8" }, - { value: "10", text: "d10" }, - { value: "12", text: "d12" }, - ], armor_types: [ { value: "light", label: "Light armor" }, { value: "medium", label: "Medium armor" }, @@ -451,7 +444,7 @@ db.ref(`characters_base/${this.userId}/${this.playerId}/class/classes/${key}/level`).set(value); }, saveBaseHiPoints(key) { - const value = this.classes[key].base_hit_points; + const value = (this.classes[key].base_hit_points) ? parseInt(this.classes[key].base_hit_points) : 0; db.ref(`characters_base/${this.userId}/${this.playerId}/class/classes/${key}/base_hit_points`).set(value); }, saveHitDice(key) { diff --git a/src/views/MyContent/Players/EditPlayer/general.vue b/src/views/MyContent/Players/EditPlayer/general.vue index 48d701ed3..0d09d1074 100644 --- a/src/views/MyContent/Players/EditPlayer/general.vue +++ b/src/views/MyContent/Players/EditPlayer/general.vue @@ -61,19 +61,24 @@
-
- +
- - + +
+
+ +
+ + +
@@ -128,8 +133,10 @@ }, saveAdvancement() { db.ref(`characters_base/${this.userId}/${this.playerId}/general/advancement`).set(this.character.advancement); + this.$emit("change", "general.advancement"); }, saveHpType() { + //Make sure the rolled HP object exists when type is rolled if(this.character.hit_point_type === "rolled") { for(const classKey in this.classes) { const Class = this.classes[classKey]; @@ -139,11 +146,16 @@ } } db.ref(`characters_base/${this.userId}/${this.playerId}/general/hit_point_type`).set(this.character.hit_point_type); + this.$emit("change", "general.advancementhit_point_type"); } } } \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue index 2632b542d..d0373c559 100644 --- a/src/views/MyContent/Players/EditPlayer/index.vue +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -15,12 +15,14 @@
+
{{ computed_values }}
@@ -51,6 +56,9 @@ + + \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/general.vue b/src/views/MyContent/Players/EditPlayer/general.vue index 0d09d1074..e98e4d5c0 100644 --- a/src/views/MyContent/Players/EditPlayer/general.vue +++ b/src/views/MyContent/Players/EditPlayer/general.vue @@ -31,23 +31,32 @@ placeholder="Character name"/>

{{ errors.first('character_name') }}

-
- - -

{{ errors.first('avatar') }}

+
+
+
+ + +

{{ errors.first('avatar') }}

+
- +
-
-
- -
+
+
- -
- - -
+ +
@@ -108,8 +112,9 @@ } }, created() { - this.$validator.attach('player_name', 'required|max:30'); - this.$validator.attach('character_name', 'required|max:35'); + this.$validator.attach({ name:'player_name', rules: 'required|max:30' }); + this.$validator.attach({ name:'character_name', rules: 'required|max:35' }); + this.$validator.attach({ name:'avatar', rules: 'url' }); }, methods: { savePlayerName() { @@ -128,8 +133,12 @@ }); }, saveAvatar() { - db.ref(`characters_base/${this.userId}/${this.playerId}/general/avatar`).set(this.character.avatar); - db.ref(`characters_computed/${this.userId}/${this.playerId}/display/avatar`).set(this.character.avatar); + this.$validator.validate('avatar', this.character.avatar).then((result) => { + if(result) { + db.ref(`characters_base/${this.userId}/${this.playerId}/general/avatar`).set(this.character.avatar); + db.ref(`characters_computed/${this.userId}/${this.playerId}/display/avatar`).set(this.character.avatar); + } + }); }, saveAdvancement() { db.ref(`characters_base/${this.userId}/${this.playerId}/general/advancement`).set(this.character.advancement); @@ -155,7 +164,16 @@ \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue index d0373c559..a6c2dc1ed 100644 --- a/src/views/MyContent/Players/EditPlayer/index.vue +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -15,7 +15,9 @@
-
{{ computed_values }}
+ { + return mod.target === 'initiative'; + }); + return modifiers; + } }, watch: { base_values: { @@ -249,6 +259,15 @@ const proficiency = this.xpTable[computed_level].proficiency; db.ref(`characters_computed/${this.userId}/${this.playerId}/display/proficiency`).set(proficiency); + //Initiative + let initiative = this.calcMod(ability_scores.dexterity); + + //Add Initiative Modifiers + for(const modifier of this.initiative_modifiers) { + initiative = this.addModifier(initiative, modifier, proficiency, ability_scores); + } + db.ref(`characters_computed/${this.userId}/${this.playerId}/display/initiative`).set(initiative); + //Armor Class let armor_class = (this.base_values.class.classes.main.base_armor_class) ? this.base_values.class.classes.main.base_armor_class : 10; armor_class = armor_class + this.calcMod(ability_scores.dexterity); diff --git a/src/views/MyContent/Players/EditPlayer/modifier.vue b/src/views/MyContent/Players/EditPlayer/modifier.vue index 130dabfaf..f587cc108 100644 --- a/src/views/MyContent/Players/EditPlayer/modifier.vue +++ b/src/views/MyContent/Players/EditPlayer/modifier.vue @@ -143,6 +143,10 @@ { value: "speed", text: "Speed" + }, + { + value: "initiative", + text: "Initiative" } ], modifier_restriction: [ diff --git a/src/views/MyContent/Players/EditPlayer/race.vue b/src/views/MyContent/Players/EditPlayer/race.vue index 73539f096..30675d0f2 100644 --- a/src/views/MyContent/Players/EditPlayer/race.vue +++ b/src/views/MyContent/Players/EditPlayer/race.vue @@ -128,9 +128,11 @@ }, saveRaceSpeed() { db.ref(`characters_base/${this.userId}/${this.playerId}/race/walking_speed`).set(this.race.walking_speed); + this.$emit("change", "race.speed"); }, saveRaceDescription() { db.ref(`characters_base/${this.userId}/${this.playerId}/race/race_description`).set(this.race.race_description); + this.$emit("change", "race.description"); } } } From e35f9baeefe64c84db2f793c2b43bf757cf28714 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 26 Jul 2020 18:57:28 +0200 Subject: [PATCH 019/135] Add feats under race --- .../MyContent/Players/EditPlayer/class.vue | 24 +++- .../MyContent/Players/EditPlayer/index.vue | 30 ++++- .../MyContent/Players/EditPlayer/race.vue | 113 +++++++++++++++++- 3 files changed, 162 insertions(+), 5 deletions(-) diff --git a/src/views/MyContent/Players/EditPlayer/class.vue b/src/views/MyContent/Players/EditPlayer/class.vue index 60659d3f2..6237b65c1 100644 --- a/src/views/MyContent/Players/EditPlayer/class.vue +++ b/src/views/MyContent/Players/EditPlayer/class.vue @@ -1,5 +1,5 @@ diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue index 8f7285e58..c449507b6 100644 --- a/src/views/MyContent/Players/EditPlayer/index.vue +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -1,9 +1,29 @@
- +
@@ -481,7 +481,7 @@ noPadding: true, right: true, maxContent: true - } + } } } }, @@ -681,7 +681,6 @@ addFeature(key, level) { const feature = { name: `Level ${level} feature` } db.ref(`characters_base/${this.userId}/${this.playerId}/class/classes/${key}/features/level_${level}`).push(feature); - this.$emit("change", "class.add_feature"); }, deleteFeature(classKey, level, key) { //Delete all modifiers linked to this feature diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue index b916f184c..9b879e90c 100644 --- a/src/views/MyContent/Players/EditPlayer/index.vue +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -52,11 +52,9 @@ @@ -229,25 +226,7 @@ return mod.target === 'initiative'; }); return modifiers; - }, - feats() { - if(this.base_values.feats) { - let returnArray = []; - for(const [key, value] of Object.entries(this.base_values.feats)) { - let mod = value; - mod['.key'] = key; - returnArray.push(mod); - } - return returnArray; - } return []; - }, - race_feats() { - const feats = this.feats.filter(mod => { - const origin = mod.origin.split("."); - return origin[0] === 'race'; - }); - return feats; - }, + } }, methods: { ...mapActions([ diff --git a/src/views/MyContent/Players/EditPlayer/race.vue b/src/views/MyContent/Players/EditPlayer/race.vue index 4323b6919..3a2df6aea 100644 --- a/src/views/MyContent/Players/EditPlayer/race.vue +++ b/src/views/MyContent/Players/EditPlayer/race.vue @@ -32,7 +32,7 @@ />
-

+ - +

- Feats - Add feat + Traits + Add trait

- + - {{ feat.name }} + {{ trait.name }} @@ -85,22 +85,22 @@
+ v-model="race.traits[key].name" + placeholder="Trait"/>

Modifiers - Add Modifier + Add Modifier

+{{ player.tempHp }} - +{{ player.tempHp }} - -
-
- - - -
-
-
- {{ player.level ? player.level : calculatedLevel(player.experience) }}
@@ -106,6 +89,30 @@ components: { GiveCharacterControl }, + data() { + return { + advancement_options: [ + { + value: "experience", + label: "Experience" + }, + { + value: "milestone", + label: "Milestone" + } + ], + hit_point_options: [ + { + value: "fixed", + label: "Fixed" + }, + { + value: "rolled", + label: "Rolled" + } + ] + } + }, computed: { character() { return (this.general) ? this.general : {}; diff --git a/src/views/MyContent/Players/EditPlayer/modifier-table.vue b/src/views/MyContent/Players/EditPlayer/modifier-table.vue new file mode 100644 index 000000000..15cbfde2f --- /dev/null +++ b/src/views/MyContent/Players/EditPlayer/modifier-table.vue @@ -0,0 +1,99 @@ + + + + + \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/race.vue b/src/views/MyContent/Players/EditPlayer/race.vue index 3a2df6aea..991110d38 100644 --- a/src/views/MyContent/Players/EditPlayer/race.vue +++ b/src/views/MyContent/Players/EditPlayer/race.vue @@ -2,8 +2,9 @@

Race

- -
- -
- -
- -

Traits @@ -94,54 +65,29 @@

-

- Modifiers - Add Modifier -

- - - - - + + +
- + + {{ modifier['.key'] ? 'Edit' : 'New' }} - + diff --git a/src/views/MyContent/Players/EditPlayer/modifier.vue b/src/views/MyContent/Players/EditPlayer/modifier.vue index 15971476c..631199d5b 100644 --- a/src/views/MyContent/Players/EditPlayer/modifier.vue +++ b/src/views/MyContent/Players/EditPlayer/modifier.vue @@ -1,238 +1,257 @@ \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/race.vue b/src/views/MyContent/Players/EditPlayer/race.vue index 73096352e..4fad500c1 100644 --- a/src/views/MyContent/Players/EditPlayer/race.vue +++ b/src/views/MyContent/Players/EditPlayer/race.vue @@ -78,7 +78,7 @@ - + @@ -88,11 +88,9 @@ import ModifierTable from './modifier-table.vue'; import Modifier from './modifier.vue'; import { db } from '@/firebase'; - import { modifierMixin } from '@/mixins/modifiers.js'; export default { name: 'CharacterRace', - mixins: [modifierMixin], props: [ "character_race", "modifiers", @@ -169,6 +167,10 @@ ] }); }, + modifierSaved() { + this.modal = false; + this.$emit("change", "modifier.saved"); + } } } From 88edbb25a68e814dc111090b60b60382bb1be53a Mon Sep 17 00:00:00 2001 From: Key Date: Fri, 30 Oct 2020 18:14:49 +0100 Subject: [PATCH 059/135] comma added --- src/mixins/dice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mixins/dice.js b/src/mixins/dice.js index 73ae05fbb..693b50948 100644 --- a/src/mixins/dice.js +++ b/src/mixins/dice.js @@ -91,7 +91,7 @@ export const dice = { clearInterval(timer); } }, stepTime); - } + }, calcAverage(value, amount = 1) { return Math.ceil(((value + 1)/2)*amount); } From 98fc64b5b274be558b40728720f5dce4237ff0e2 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 5 Nov 2020 16:43:18 +0100 Subject: [PATCH 060/135] Bootstrap stuff replaced with Quasar --- .../MyContent/Players/EditPlayer/class.vue | 454 +++++++++++------- .../MyContent/Players/EditPlayer/modifier.vue | 26 +- .../MyContent/Players/EditPlayer/race.vue | 50 +- 3 files changed, 315 insertions(+), 215 deletions(-) diff --git a/src/views/MyContent/Players/EditPlayer/class.vue b/src/views/MyContent/Players/EditPlayer/class.vue index 062673671..ee8a87385 100644 --- a/src/views/MyContent/Players/EditPlayer/class.vue +++ b/src/views/MyContent/Players/EditPlayer/class.vue @@ -29,187 +29,280 @@ Delete class
- - + />
- - + />
- - + + +
-

- Hit points - - {{ subclass.level }}d{{ subclass.hit_dice }} | - - {{ calcMod(computed.sheet.abilities.constitution) > 0 ? "+" : "" }}{{ calcMod(computed.sheet.abilities.constitution) }} - | - - {{ classTotalHP(classKey, 'total') }} - - -

- - - - - - + + + + +
+ + +
+ +
+ + {{ subclass.rolled_hit_points ? totalRolled(classKey) : 0 }} + + +
+
+
+
-
- -
- - {{ subclass.rolled_hit_points ? totalRolled(classKey) : 0 }} - - + + + + +
+
+ + +
+
+ +
+
+ +
+
-
- - - -

- Spell casting - - - {{ computed.sheet.classes[classKey].spell_attack > 0 ? "+" : "" }}{{ computed.sheet.classes[classKey].spell_attack }} - | - {{ computed.sheet.classes[classKey].spell_save_dc }} - - {{ subclass.casting_ability.capitalize() }} modifier: {{ computed.sheet.abilities ? calcMod(computed.sheet.abilities.wisdom) : 0 }}
- Proficiency bonus: {{ computed.display.proficiency }} -
- - Base: 8
- {{ subclass.casting_ability.capitalize() }} modifier: {{ computed.sheet.abilities ? calcMod(computed.sheet.abilities.wisdom) : 0 }}
- Proficiency bonus: {{ computed.display.proficiency }} -
-
-

- -
- - -
-
- - -
-
- - -
- -
+ + + + + + +
+
+ +
+
+ + + +
+
+ +
+
+ +
+
+
+ - -

- Proficiencies - +{{ computed.display.proficiency }} -

- -
- -
-
- - - -
-
- -
-
- -
-
-

{{ subclass.name || "Class" }} features

diff --git a/src/views/MyContent/Players/EditPlayer/equipment.vue b/src/views/MyContent/Players/EditPlayer/equipment/index.vue similarity index 68% rename from src/views/MyContent/Players/EditPlayer/equipment.vue rename to src/views/MyContent/Players/EditPlayer/equipment/index.vue index 83b0fd5ab..c0dc6c2b6 100644 --- a/src/views/MyContent/Players/EditPlayer/equipment.vue +++ b/src/views/MyContent/Players/EditPlayer/equipment/index.vue @@ -15,39 +15,39 @@ + + \ No newline at end of file diff --git a/src/views/MyContent/Players/EditPlayer/index.vue b/src/views/MyContent/Players/EditPlayer/index.vue index 67832b98a..0b692c13f 100644 --- a/src/views/MyContent/Players/EditPlayer/index.vue +++ b/src/views/MyContent/Players/EditPlayer/index.vue @@ -220,54 +220,11 @@ }); return modifiers; }, - feat_modifiers() { - const modifiers = this.modifiers.filter(mod => { - const origin = mod.origin.split("."); - return origin[0] === 'feat'; - }); - return modifiers; - }, ability_modifiers() { const modifiers = this.modifiers.filter(mod => { return mod.target === 'ability'; }); return modifiers; - }, - saving_throw_modifiers() { - const modifiers = this.modifiers.filter(mod => { - return mod.target === 'saving_throw'; - }); - return modifiers; - }, - hp_modifiers() { - const modifiers = this.modifiers.filter(mod => { - return mod.target === 'hp'; - }); - return modifiers; - }, - ac_modifiers() { - const modifiers = this.modifiers.filter(mod => { - return mod.target === 'ac'; - }); - return modifiers; - }, - skill_modifiers() { - const modifiers = this.modifiers.filter(mod => { - return mod.target === 'skill'; - }); - return modifiers; - }, - speed_modifiers() { - const modifiers = this.modifiers.filter(mod => { - return mod.target === 'speed'; - }); - return modifiers; - }, - initiative_modifiers() { - const modifiers = this.modifiers.filter(mod => { - return mod.target === 'initiative'; - }); - return modifiers; } }, methods: { @@ -277,11 +234,17 @@ setBuildType() { db.ref(`characters_base/${this.userId}/${this.playerId}/general/build`).set(this.build); }, + modifierFilter(modifiers, type) { + const filtered = modifiers.filter(mod => { + return mod.target === type; + }); + return filtered; + }, compute(origin) { // eslint-disable-next-line console.log("change made. Origin: ", origin); origin = origin.split("."); - let modifiers = this.modifiers; + let modifiers = [...this.modifiers]; //Copy the modifiers so they can be manipulated during the compute const hit_point_type = this.base_values.general.hit_point_type; @@ -373,6 +336,22 @@ } } } + + //If modifiers are linked to an item, the item must be equipped in order for the modifier to apply + //if the item is not equipped, remove the modifier from the modifier list. + if(this.computed_values.equipment) { + for(const [itemKey, item] of Object.entries(this.computed_values.equipment.items)) { + for(const index in modifiers) { + const modifier = modifiers[index]; + const origin = modifier.origin.split("."); + + //Remove the modifier if the item is not equipped + if(origin[0] === "equipment" && origin[1] === itemKey && !item.equipped) { + delete modifiers[index]; + } + } + } + } //Ability score maximums let ability_max = { @@ -389,7 +368,7 @@ //Add Ability Score Modifiers for(let [key, value] of Object.entries(ability_scores)) { - for(const modifier of this.ability_modifiers) { + for(const modifier of this.modifierFilter(modifiers, "ability")) { if(modifier.subtarget === key && modifier.type === 'bonus') { value = value + parseInt(modifier.value); } @@ -415,7 +394,7 @@ computed_hp = computed_hp + (computed_level * this.calcMod(ability_scores.constitution)); //Add HP modifiers - for(const modifier of this.hp_modifiers) { + for(const modifier of this.modifierFilter(modifiers, "hp")) { computed_hp = this.addModifier(computed_hp, modifier, proficiency, ability_scores, computed_level, classes); } db.ref(`characters_computed/${this.userId}/${this.playerId}/display/hit_points`).set(computed_hp); @@ -439,7 +418,7 @@ let initiative = this.calcMod(ability_scores.dexterity); //Add Initiative Modifiers - for(const modifier of this.initiative_modifiers) { + for(const modifier of this.modifierFilter(modifiers, "initiative")) { initiative = this.addModifier(initiative, modifier, proficiency, ability_scores, computed_level, classes); } db.ref(`characters_computed/${this.userId}/${this.playerId}/display/initiative`).set(initiative); @@ -451,7 +430,7 @@ armor_class = armor_class + this.calcMod(ability_scores.dexterity); //Add AC Modifiers - for(const modifier of this.ac_modifiers) { + for(const modifier of this.modifierFilter(modifiers, "ac")) { armor_class = this.addModifier(armor_class, modifier, proficiency, ability_scores, computed_level, classes); } db.ref(`characters_computed/${this.userId}/${this.playerId}/display/armor_class`).set(armor_class); @@ -461,7 +440,7 @@ let speed = (this.base_values.race.walking_speed) ? parseInt(this.base_values.race.walking_speed) : 0; //Add Speed Modifiers - for(const modifier of this.speed_modifiers) { + for(const modifier of this.modifierFilter(modifiers, "speed")) { speed = this.addModifier(speed, modifier, proficiency, ability_scores, computed_level, classes); } db.ref(`characters_computed/${this.userId}/${this.playerId}/display/speed`).set(speed); @@ -474,7 +453,7 @@ bonuses: {} }; for(const skill in this.skillList) { - for(const modifier of this.skill_modifiers) { + for(const modifier of this.modifierFilter(modifiers, "skill")) { //Save skill proficiencies as a boolean, don't save the bonus //This get's calculated front end, same goes for expertise //This way expertise can easily only be added if the proficiency is also true @@ -499,10 +478,10 @@ bonuses: {} }; for(const ability in ability_scores) { - for(const modifier of this.saving_throw_modifiers) { + for(const modifier of this.modifierFilter(modifiers, "saving_throw")) { //Save saving throw proficiencies as a boolean, don't save the bonus //This get's calculated front end - //This way it's easy tho show what saving throws have proficiency + //This way it's easy to show what saving throws have proficiency if(ability === modifier.subtarget) { if(modifier.type === "proficiency") { saving_throws.proficiencies[ability] = true; diff --git a/src/views/MyContent/Players/EditPlayer/modifier-table.vue b/src/views/MyContent/Players/EditPlayer/modifier-table.vue index d494af19a..ac94aa847 100644 --- a/src/views/MyContent/Players/EditPlayer/modifier-table.vue +++ b/src/views/MyContent/Players/EditPlayer/modifier-table.vue @@ -54,6 +54,14 @@ origin: { type: String, required: true + }, + userId: { + type: String, + required: true + }, + playerId: { + type: String, + required: true } }, data() { @@ -94,6 +102,7 @@ this.$emit('edit', { modifier, origin: this.origin }); }, deleteModifier(key) { + console.log(key) db.ref(`characters_base/${this.userId}/${this.playerId}/modifiers/${key}`).remove(); this.$emit("change", "modifier.deleted"); }, diff --git a/src/views/MyContent/Players/EditPlayer/race.vue b/src/views/MyContent/Players/EditPlayer/race.vue index dca1db922..911e95ded 100644 --- a/src/views/MyContent/Players/EditPlayer/race.vue +++ b/src/views/MyContent/Players/EditPlayer/race.vue @@ -78,6 +78,8 @@
From 359f202ec573cdc89a34b183c1bf37d98d0d4b24 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 17 Nov 2020 23:53:05 +0100 Subject: [PATCH 067/135] Add info to a modifier table --- .../MyContent/Players/EditPlayer/class.vue | 2 + .../Players/EditPlayer/equipment/index.vue | 38 ++++++++++++++++++- .../Players/EditPlayer/modifier-table.vue | 28 +++++++++++++- 3 files changed, 65 insertions(+), 3 deletions(-) diff --git a/src/views/MyContent/Players/EditPlayer/class.vue b/src/views/MyContent/Players/EditPlayer/class.vue index 5b662464b..6d4ddfedb 100644 --- a/src/views/MyContent/Players/EditPlayer/class.vue +++ b/src/views/MyContent/Players/EditPlayer/class.vue @@ -468,6 +468,7 @@ :origin="`race.trait.${key}`" :userId="userId" :playerId="playerId" + :info="featureModInfo" @edit="editModifier" /> @@ -630,6 +631,7 @@ roll_hp_modal: false, experience_modal: false, spells_known_modal: false, + featureModInfo: "

These modifiers only apply to your character if it meets the level requirement for this class.

", armor_types: [ { value: "light", label: "Light armor" }, { value: "medium", label: "Medium armor" }, diff --git a/src/views/MyContent/Players/EditPlayer/equipment/index.vue b/src/views/MyContent/Players/EditPlayer/equipment/index.vue index c0dc6c2b6..532fba321 100644 --- a/src/views/MyContent/Players/EditPlayer/equipment/index.vue +++ b/src/views/MyContent/Players/EditPlayer/equipment/index.vue @@ -75,6 +75,8 @@ :userId="userId" :playerId="playerId" @edit="editModifier" + title="Character modifiers" + :info="modifierInfo" /> @@ -135,6 +137,39 @@ +
+ + + + +