mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Skill fixes (#9113)
* Added local storage setting for spell drawer * Added new spell styles * Fixed typo
This commit is contained in:
@@ -21,16 +21,13 @@ div(v-if='user.stats.lvl > 10')
|
|||||||
@click='castStart(skill)',
|
@click='castStart(skill)',
|
||||||
v-for='(skill, key) in spells[user.stats.class]',
|
v-for='(skill, key) in spells[user.stats.class]',
|
||||||
v-if='user.stats.lvl >= skill.lvl',
|
v-if='user.stats.lvl >= skill.lvl',
|
||||||
popover-trigger='mouseenter',
|
v-b-popover.hover.auto='skill.notes()')
|
||||||
popover-placement='top',
|
|
||||||
:popover='skillNotes(skill)')
|
|
||||||
.spell.col-12.row
|
.spell.col-12.row
|
||||||
.col-8.details
|
.col-8.details
|
||||||
a(:class='{"disabled": spellDisabled(key)}')
|
a(:class='{"disabled": spellDisabled(key)}')
|
||||||
p.title {{skill.text()}}
|
div.img(:class='`shop_${skill.key} shop-sprite item-img`')
|
||||||
p.notes {{skill.notes()}}
|
span.title {{skill.text()}}
|
||||||
.col-4.mana
|
.col-4.mana
|
||||||
.img(:class='`shop_${skill.key} shop-sprite item-img`')
|
|
||||||
.mana-text
|
.mana-text
|
||||||
.svg-icon(v-html="icons.mana")
|
.svg-icon(v-html="icons.mana")
|
||||||
div {{skill.mana}}
|
div {{skill.mana}}
|
||||||
@@ -52,23 +49,33 @@ div(v-if='user.stats.lvl > 10')
|
|||||||
|
|
||||||
.spell:hover {
|
.spell:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
border: solid 2px #50b5e9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spell {
|
.spell {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
|
border: solid 2px transparent;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
box-shadow: 0 2px 2px 0 rgba(26, 24, 29, 0.16), 0 1px 4px 0 rgba(26, 24, 29, 0.12);
|
box-shadow: 0 2px 2px 0 rgba(26, 24, 29, 0.16), 0 1px 4px 0 rgba(26, 24, 29, 0.12);
|
||||||
border-radius: 2px;
|
border-radius: 1000px;
|
||||||
color: #4e4a57;
|
color: #4e4a57;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
.details {
|
.details {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding-top: .5em;
|
padding-top: .5em;
|
||||||
|
|
||||||
p {
|
.img {
|
||||||
margin-bottom: .5em;
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
width: 50%;
|
||||||
|
padding-bottom: .7em;
|
||||||
|
vertical-align: bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notes {
|
.notes {
|
||||||
@@ -83,6 +90,7 @@ div(v-if='user.stats.lvl > 10')
|
|||||||
|
|
||||||
.mana-text {
|
.mana-text {
|
||||||
margin-bottom: .2em;
|
margin-bottom: .2em;
|
||||||
|
padding-top: 1.1em;
|
||||||
|
|
||||||
div {
|
div {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -142,6 +150,7 @@ div(v-if='user.stats.lvl > 10')
|
|||||||
<script>
|
<script>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import isArray from 'lodash/isArray';
|
import isArray from 'lodash/isArray';
|
||||||
|
import bPopover from 'bootstrap-vue/lib/directives/popover';
|
||||||
|
|
||||||
import spells from '../../../common/script/content/spells';
|
import spells from '../../../common/script/content/spells';
|
||||||
|
|
||||||
@@ -152,6 +161,7 @@ import MouseMoveDirective from 'client/directives/mouseposition.directive';
|
|||||||
|
|
||||||
import mana from 'assets/svg/mana.svg';
|
import mana from 'assets/svg/mana.svg';
|
||||||
import quests from 'common/script/content/quests';
|
import quests from 'common/script/content/quests';
|
||||||
|
import { CONSTANTS, setLocalSetting, getLocalSetting } from 'client/libs/userlocalManager';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [notifications],
|
mixins: [notifications],
|
||||||
@@ -160,6 +170,7 @@ export default {
|
|||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
mousePosition: MouseMoveDirective,
|
mousePosition: MouseMoveDirective,
|
||||||
|
bPopover,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@@ -183,6 +194,11 @@ export default {
|
|||||||
if (keyEvent.keyCode !== 27) return;
|
if (keyEvent.keyCode !== 27) return;
|
||||||
this.castCancel();
|
this.castCancel();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const spellDrawerState = getLocalSetting(CONSTANTS.keyConstants.SPELL_DRAWER_STATE);
|
||||||
|
if (spellDrawerState === CONSTANTS.valueConstants.SPELL_DRAWER_CLOSED) {
|
||||||
|
this.$store.state.spellOptions.spellDrawOpen = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({user: 'user.data'}),
|
...mapState({user: 'user.data'}),
|
||||||
@@ -191,8 +207,15 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
drawerToggled (openChanged) {
|
drawerToggled (newState) {
|
||||||
this.$store.state.spellOptions.spellDrawOpen = openChanged;
|
this.$store.state.spellOptions.spellDrawOpen = newState;
|
||||||
|
|
||||||
|
if (newState) {
|
||||||
|
setLocalSetting(CONSTANTS.keyConstants.SPELL_DRAWER_STATE, CONSTANTS.valueConstants.SPELL_DRAWER_OPEN);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setLocalSetting(CONSTANTS.keyConstants.SPELL_DRAWER_STATE, CONSTANTS.valueConstants.SPELL_DRAWER_CLOSED);
|
||||||
},
|
},
|
||||||
spellDisabled (skill) {
|
spellDisabled (skill) {
|
||||||
if (skill === 'frost' && this.user.stats.buffs.streaks) {
|
if (skill === 'frost' && this.user.stats.buffs.streaks) {
|
||||||
|
|||||||
23
website/client/libs/userlocalManager.js
Normal file
23
website/client/libs/userlocalManager.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
const CONSTANTS = {
|
||||||
|
keyConstants: {
|
||||||
|
SPELL_DRAWER_STATE: 'spell-drawer-state',
|
||||||
|
},
|
||||||
|
valueConstants: {
|
||||||
|
SPELL_DRAWER_CLOSED: 'spell-drawer-closed',
|
||||||
|
SPELL_DRAWER_OPEN: 'spell-drawer-open',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
function setLocalSetting (key, value) {
|
||||||
|
localStorage.setItem(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLocalSetting (key) {
|
||||||
|
return localStorage.getItem(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
CONSTANTS,
|
||||||
|
getLocalSetting,
|
||||||
|
setLocalSetting,
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user