Skip to content

Commit

Permalink
[Spell Preview] Fix bug preventing spell previews from completely loa…
Browse files Browse the repository at this point in the history
…ding (#17)
  • Loading branch information
Akkadius authored Jan 18, 2022
1 parent 66ac4c1 commit 6f83b3f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.6.2]

### Spell Animation Previewer

* Fixed bug that prevented all previews from showing properly

## [1.6.1]

### Linux Auto Updates
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/app/eq-assets/eq-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ export default class EqAssets {
return ids
}

public static spellAnimationFileIds = []

public static getSpellAnimationFileIds() {

// return cached set
if (this.spellAnimationFileIds.length > 0) {
return this.spellAnimationFileIds
}

let ids = <any>[];
if (SpellAnimations[0].contents) {
SpellAnimations[0].contents.forEach((row) => {
Expand All @@ -55,6 +63,9 @@ export default class EqAssets {
return a - b;
});

// cache for second retrieval
this.spellAnimationFileIds = ids

return ids
}
}
26 changes: 16 additions & 10 deletions frontend/src/views/viewers/SpellAnimationViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
class="form-control ml-2 mb-4"
v-model="search"
v-on:keyup="triggerSearch"
@enter="triggerSearch"
placeholder="Search for spell names to find animations"
>
</div>
Expand Down Expand Up @@ -126,19 +127,24 @@ export default {
this.$router.push({ path: ROUTE.SPELL_ANIMATION_VIEWER, query: { q: this.search } }).catch(err => err)
}, 1000),
spellAnimSearch: function () {
console.log("trigger")
this.loaded = false
let foundAnim = {};
let filteredAnimations = []
for (let spellAnimMapping of spellAnimMappings) {
const spellName = spellAnimMapping[0].toLowerCase().trim()
const spellAnimId = spellAnimMapping[2]
if (spellName.includes(this.search.toLowerCase())) {
if (!foundAnim[spellAnimId] && animationPreviewExists[spellAnimId]) {
filteredAnimations.push(spellAnimId)
foundAnim[spellAnimId] = 1
let filteredAnimations = EqAssets.getSpellAnimationFileIds()
if (this.search !== "") {
filteredAnimations = []
for (let spellAnimMapping of spellAnimMappings) {
const spellName = spellAnimMapping[0].toLowerCase().trim()
const spellAnimId = spellAnimMapping[2]
if (spellName.includes(this.search.toLowerCase())) {
if (!foundAnim[spellAnimId] && animationPreviewExists[spellAnimId]) {
filteredAnimations.push(spellAnimId)
foundAnim[spellAnimId] = 1
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spire",
"version": "1.6.1",
"version": "1.6.2",
"repository": {
"type": "git",
"url": "https://github.com/Akkadius/spire.git"
Expand Down

0 comments on commit 6f83b3f

Please sign in to comment.