mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-22 13:48:46 +00:00
fix(avatar transormation): move questProgress method to spells mixin so that it is always available
This commit is contained in:
parent
8d2ada1463
commit
734eae64a5
2 changed files with 23 additions and 24 deletions
|
|
@ -213,7 +213,6 @@ import Drawer from '@/components/ui/drawer';
|
|||
import MouseMoveDirective from '@/directives/mouseposition.directive';
|
||||
|
||||
import mana from '@/assets/svg/mana.svg';
|
||||
import * as quests from '@/../../common/script/content/quests';
|
||||
import { CONSTANTS, setLocalSetting, getLocalSetting } from '@/libs/userlocalManager';
|
||||
|
||||
export default {
|
||||
|
|
@ -227,7 +226,6 @@ export default {
|
|||
data () {
|
||||
return {
|
||||
spells,
|
||||
quests,
|
||||
applyingAction: false,
|
||||
spell: {},
|
||||
icons: Object.freeze({
|
||||
|
|
@ -280,6 +278,7 @@ export default {
|
|||
|
||||
return false;
|
||||
},
|
||||
// @TODO is this used?
|
||||
skillNotes (skill) {
|
||||
let notes = skill.notes();
|
||||
|
||||
|
|
@ -296,26 +295,6 @@ export default {
|
|||
|
||||
return notes;
|
||||
},
|
||||
questProgress () {
|
||||
const { user } = this;
|
||||
if (!user.party.quest) return 0;
|
||||
|
||||
const userQuest = this.quests.quests[user.party.quest.key];
|
||||
|
||||
if (!userQuest) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (userQuest.boss && user.party.quest.progress.up > 0) {
|
||||
return user.party.quest.progress.up;
|
||||
}
|
||||
|
||||
if (userQuest.collect && user.party.quest.progress.collectedItems > 0) {
|
||||
return user.party.quest.progress.collectedItems;
|
||||
}
|
||||
|
||||
return 0;
|
||||
},
|
||||
// @TODO: Move to mouse move component??
|
||||
mouseMoved ($event) {
|
||||
// @TODO: throttle
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import isArray from 'lodash/isArray';
|
||||
import * as quests from '@/../../common/script/content/quests';
|
||||
|
||||
// @TODO: Let's separate some of the business logic out of Vue if possible
|
||||
export default {
|
||||
|
|
@ -7,6 +8,26 @@ export default {
|
|||
if (keyEvent.keyCode !== 27) return;
|
||||
this.castCancel();
|
||||
},
|
||||
questProgress () {
|
||||
const { user } = this;
|
||||
if (!user.party.quest) return 0;
|
||||
|
||||
const userQuest = quests.quests[user.party.quest.key];
|
||||
|
||||
if (!userQuest) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (userQuest.boss && user.party.quest.progress.up > 0) {
|
||||
return user.party.quest.progress.up;
|
||||
}
|
||||
|
||||
if (userQuest.collect && user.party.quest.progress.collectedItems > 0) {
|
||||
return user.party.quest.progress.collectedItems;
|
||||
}
|
||||
|
||||
return 0;
|
||||
},
|
||||
async castStart (spell, member) {
|
||||
if (this.$store.state.spellOptions.castingSpell) {
|
||||
this.castCancel();
|
||||
|
|
@ -155,7 +176,7 @@ export default {
|
|||
|
||||
const questProgress = this.questProgress() - beforeQuestProgress;
|
||||
if (questProgress > 0) {
|
||||
const userQuest = this.quests.quests[this.user.party.quest.key];
|
||||
const userQuest = quests.quests[this.user.party.quest.key];
|
||||
if (userQuest.boss) {
|
||||
this.quest('questDamage', questProgress.toFixed(1));
|
||||
} else if (userQuest.collection && userQuest.collect) {
|
||||
|
|
@ -164,7 +185,6 @@ export default {
|
|||
}
|
||||
|
||||
return null;
|
||||
// @TODO: User.sync();
|
||||
},
|
||||
castCancel () {
|
||||
this.potionClickMode = false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue