Added proficiencies for languages tools and weapons to the stats tab
This commit is contained in:
@@ -115,17 +115,14 @@
|
||||
</v-card>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-show="true"
|
||||
class="saving-throws"
|
||||
>
|
||||
<div class="saving-throws">
|
||||
<v-card>
|
||||
<v-list>
|
||||
<v-subheader>Saving Throws</v-subheader>
|
||||
<skill-list-tile
|
||||
v-for="save in savingThrows"
|
||||
:key="save._id"
|
||||
v-bind="save"
|
||||
:model="save"
|
||||
:data-id="save._id"
|
||||
@click="clickProperty({_id: save._id})"
|
||||
/>
|
||||
@@ -140,7 +137,7 @@
|
||||
<skill-list-tile
|
||||
v-for="skill in skills"
|
||||
:key="skill._id"
|
||||
v-bind="skill"
|
||||
:model="skill"
|
||||
:data-id="skill._id"
|
||||
@click="clickProperty({_id: skill._id})"
|
||||
/>
|
||||
@@ -148,6 +145,49 @@
|
||||
</v-card>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="weapons.length || tools.length || languages.length"
|
||||
class="proficiencies"
|
||||
>
|
||||
<v-card>
|
||||
<v-list>
|
||||
<v-subheader v-if="weapons.length">
|
||||
Weapons
|
||||
</v-subheader>
|
||||
<skill-list-tile
|
||||
v-for="weapon in weapons"
|
||||
:key="weapon._id"
|
||||
hide-modifier
|
||||
:model="weapon"
|
||||
:data-id="weapon._id"
|
||||
@click="clickProperty({_id: weapon._id})"
|
||||
/>
|
||||
<v-subheader v-if="tools.length">
|
||||
Tools
|
||||
</v-subheader>
|
||||
<skill-list-tile
|
||||
v-for="tool in tools"
|
||||
:key="tool._id"
|
||||
hide-modifier
|
||||
:model="tool"
|
||||
:data-id="tool._id"
|
||||
@click="clickProperty({_id: tool._id})"
|
||||
/>
|
||||
<v-subheader v-if="languages.length">
|
||||
Languages
|
||||
</v-subheader>
|
||||
<skill-list-tile
|
||||
v-for="language in languages"
|
||||
:key="language._id"
|
||||
hide-modifier
|
||||
:model="language"
|
||||
:data-id="language._id"
|
||||
@click="clickProperty({_id: language._id})"
|
||||
/>
|
||||
</v-list>
|
||||
</v-card>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="actions.length"
|
||||
class="actions"
|
||||
@@ -193,17 +233,28 @@
|
||||
import ActionListTile from '/imports/ui/properties/components/actions/ActionListTile.vue';
|
||||
import AttackListTile from '/imports/ui/properties/components/actions/AttackListTile.vue';
|
||||
|
||||
const getAttributeOfType = function(charId, type){
|
||||
return CreatureProperties.find({
|
||||
'ancestors.id': charId,
|
||||
type: 'attribute',
|
||||
attributeType: type,
|
||||
removed: {$ne: true},
|
||||
}, {
|
||||
const getProperties = function(creatureId, filter = {}){
|
||||
filter['ancestors.id'] = creatureId;
|
||||
filter.removed = {$ne: true};
|
||||
return CreatureProperties.find(filter, {
|
||||
sort: {order: 1}
|
||||
});
|
||||
};
|
||||
|
||||
const getAttributeOfType = function(creatureId, type){
|
||||
return getProperties(creatureId, {
|
||||
type: 'attribute',
|
||||
attributeType: type,
|
||||
});
|
||||
};
|
||||
|
||||
const getSkillOfType = function(creatureId, type){
|
||||
return getProperties(creatureId, {
|
||||
type: 'skill',
|
||||
skillType: type,
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AbilityListTile,
|
||||
@@ -243,52 +294,28 @@
|
||||
return getAttributeOfType(this.creatureId, 'hitDice');
|
||||
},
|
||||
checks(){
|
||||
return CreatureProperties.find({
|
||||
'ancestors.id': this.creatureId,
|
||||
type: 'skill',
|
||||
skillType: 'check',
|
||||
removed: {$ne: true},
|
||||
}, {
|
||||
sort: {order: 1},
|
||||
});
|
||||
return getSkillOfType(this.creatureId, 'check');
|
||||
},
|
||||
savingThrows(){
|
||||
return CreatureProperties.find({
|
||||
'ancestors.id': this.creatureId,
|
||||
type: 'skill',
|
||||
skillType: 'save',
|
||||
removed: {$ne: true},
|
||||
}, {
|
||||
sort: {order: 1},
|
||||
});
|
||||
return getSkillOfType(this.creatureId, 'save');
|
||||
},
|
||||
skills(){
|
||||
return CreatureProperties.find({
|
||||
'ancestors.id': this.creatureId,
|
||||
type: 'skill',
|
||||
skillType: 'skill',
|
||||
removed: {$ne: true},
|
||||
}, {
|
||||
sort: {order: 1},
|
||||
});
|
||||
return getSkillOfType(this.creatureId, 'skill');
|
||||
},
|
||||
tools(){
|
||||
return getSkillOfType(this.creatureId, 'tool');
|
||||
},
|
||||
weapons(){
|
||||
return getSkillOfType(this.creatureId, 'weapon');
|
||||
},
|
||||
languages(){
|
||||
return getSkillOfType(this.creatureId, 'language');
|
||||
},
|
||||
actions(){
|
||||
return CreatureProperties.find({
|
||||
'ancestors.id': this.creatureId,
|
||||
type: 'action',
|
||||
removed: {$ne: true},
|
||||
}, {
|
||||
sort: {order: 1},
|
||||
});
|
||||
return getProperties(this.creatureId, {type: 'action'});
|
||||
},
|
||||
attacks(){
|
||||
return CreatureProperties.find({
|
||||
'ancestors.id': this.creatureId,
|
||||
type: 'attack',
|
||||
removed: {$ne: true},
|
||||
}, {
|
||||
sort: {order: 1},
|
||||
});
|
||||
return getProperties(this.creatureId, {type: 'attack'});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
<template lang="html">
|
||||
<v-list-tile class="skill-list-tile" height="32px" v-on="hasClickListener ? {click} : {}">
|
||||
<v-list-tile-action class="prof-icon">
|
||||
<v-icon>{{icon}}</v-icon>
|
||||
</v-list-tile-action>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>
|
||||
<span class="prof-mod">
|
||||
{{displayedModifier}}
|
||||
</span>
|
||||
{{name}}<template v-if="conditionalBenefits">*</template>
|
||||
<v-icon size="20px" v-if="advantage > 0">arrow_upward</v-icon>
|
||||
<v-icon size="20px" v-if="advantage < 0">arrow_downward</v-icon>
|
||||
</v-list-tile-title>
|
||||
</v-list-tile-content>
|
||||
<v-list-tile
|
||||
class="skill-list-tile"
|
||||
height="32px"
|
||||
v-on="hasClickListener ? {click} : {}"
|
||||
>
|
||||
<v-list-tile-action class="prof-icon">
|
||||
<v-icon>{{ icon }}</v-icon>
|
||||
</v-list-tile-action>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>
|
||||
<span
|
||||
v-if="!hideModifier"
|
||||
class="prof-mod"
|
||||
>
|
||||
{{ displayedModifier }}
|
||||
</span>
|
||||
{{ model.name }}<template v-if="model.conditionalBenefits">
|
||||
*
|
||||
</template>
|
||||
<v-icon
|
||||
v-if="model.advantage > 0"
|
||||
size="20px"
|
||||
>
|
||||
arrow_upward
|
||||
</v-icon>
|
||||
<v-icon
|
||||
v-if="model.advantage < 0"
|
||||
size="20px"
|
||||
>
|
||||
arrow_downward
|
||||
</v-icon>
|
||||
</v-list-tile-title>
|
||||
</v-list-tile-content>
|
||||
</v-list-tile>
|
||||
</template>
|
||||
|
||||
@@ -21,40 +40,39 @@ import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
proficiency: Number,
|
||||
advantage: Number,
|
||||
fail: Number,
|
||||
value: Number,
|
||||
name: String,
|
||||
conditionalBenefits: Number,
|
||||
},
|
||||
methods: {
|
||||
click(e){
|
||||
this.$emit('click', e);
|
||||
},
|
||||
model: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
hideModifier: Boolean,
|
||||
},
|
||||
computed: {
|
||||
icon(){
|
||||
if (this.proficiency == 0.5){
|
||||
if (this.model.proficiency == 0.5){
|
||||
return 'brightness_2';
|
||||
} else if (this.proficiency == 1) {
|
||||
} else if (this.model.proficiency == 1) {
|
||||
return 'brightness_1'
|
||||
} else if (this.proficiency == 2){
|
||||
} else if (this.model.proficiency == 2){
|
||||
return 'album'
|
||||
} else {
|
||||
return 'radio_button_unchecked';
|
||||
}
|
||||
},
|
||||
displayedModifier(){
|
||||
let mod = this.value;
|
||||
if (this.fail){
|
||||
let mod = this.model.value;
|
||||
if (this.model.fail){
|
||||
return 'fail';
|
||||
} else {
|
||||
return numberToSignedString(mod);
|
||||
}
|
||||
},
|
||||
hasClickListener(){
|
||||
return this.$listeners && this.$listeners.click
|
||||
return this.$listeners && this.$listeners.click
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
click(e){
|
||||
this.$emit('click', e);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user