Upgraded Inventory Search (#15417)

* fix: add search descriptions capability to items and equipment

* pet search working for mismatched pairs; mount still in progress

* added some comments about current issue to relevant portion of code

* search working on pet and mount names (except flying carpet)

* update comment text

* remove console.log(animals)

* add eggkey back in

* add mountName as property to animal object, amend filter function
This commit is contained in:
Natalie 2025-04-10 13:37:44 -04:00 committed by GitHub
parent 661b30e807
commit d48e4a664f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 7 deletions

View file

@ -410,7 +410,8 @@ export default {
const ownedItem = this.flatGear[gearKey];
const isSearched = !searchText
|| ownedItem.text().toLowerCase().indexOf(searchText) !== -1;
|| ownedItem.text().toLowerCase().indexOf(searchText) !== -1
|| ownedItem.notes().toLowerCase().indexOf(searchText) !== -1;
if (ownedItem.klass !== 'base' && isSearched) {
const { type } = ownedItem;

View file

@ -338,9 +338,10 @@ export default {
if (itemQuantity > 0 && isAllowed) {
const item = contentItems[itemKey];
const isSearched = !searchText || item.text()
.toLowerCase()
.indexOf(searchText) !== -1;
const isSearched = !searchText
|| item.text().toLowerCase().indexOf(searchText) !== -1
|| item.notes().toLowerCase().indexOf(searchText) !== -1;
if (isSearched && item) {
itemsArray.push({
...item,

View file

@ -627,6 +627,8 @@ export default {
animals.push({
key: specialKey,
eggKey,
eggName: text(),
mountName: text(),
potionKey,
name: text(),
canFind,
@ -657,7 +659,6 @@ export default {
}
this.cachedAnimalList[key] = animals;
return animals;
},
listAnimals (animalGroup, type, hideMissing, sort, searchText) {
@ -670,7 +671,9 @@ export default {
}
if (searchText && searchText !== '') {
animals = _filter(animals, a => a.name.toLowerCase().indexOf(searchText) !== -1);
animals = _filter(animals, a => a.name.toLowerCase().indexOf(searchText) !== -1
|| a.eggName.toLowerCase().indexOf(searchText) !== -1
|| a.mountName.toLowerCase().indexOf(searchText) !== -1);
}
// 2. Sort
@ -693,7 +696,6 @@ export default {
}
this.viewOptions[animalGroup.key].animalCount = animals.length;
return animals;
},
countOwnedAnimals (animalGroup, type) {

View file

@ -40,6 +40,7 @@ export function createAnimal (egg, potion, type, _content, userItems) {
imageName: type === 'pet' ? `stable_Pet-${animalKey}` : `stable_Mount_Icon_${animalKey}`,
eggKey: egg.key,
eggName: getText(egg.text),
mountName: getText(egg.mountText),
potionKey: potion.key,
potionName: getText(potion.text),
name: _content[`${type}Info`][animalKey].text(),