Skip to content

Commit bfdd664

Browse files
committed
refactor: filter types
1 parent 527b7ee commit bfdd664

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/worker/module.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,10 @@ async function getInfo(index) {
904904
}
905905
}
906906

907+
/** @typedef {Array<[name: string, values: Array<any>]>} Filter */
908+
/** @typedef {{ [schema: number]: Filter }} Filters */
909+
910+
/** @type {{ [preset: string]: [Filters, excludes?: { [schema: number]: true }] }} */
907911
const filtersForType = {
908912
redCoins: [
909913
{ [ti.Jar]: [['dropType', [3, 6]]], [ti.Enemy]: [['size', [3]]] },
@@ -948,10 +952,15 @@ const templeNames = [
948952
'Overworld > Tower_10',
949953
]
950954

955+
/**
956+
@param {string} name
957+
@param {any} filters
958+
*/
951959
function calcMarkerFilters(name, filters) {
952960
/** @type Array<number> */
953961
let filteredIndices
954962
if(name == 'custom') {
963+
/** @type {Filters} */
955964
const fs = {}
956965
for(let i = 0; i < filters.length; i++) {
957966
fs[ti[filters[i][0]]] = filters[i][1]
@@ -1024,6 +1033,11 @@ function calcMarkerFilters(name, filters) {
10241033
onClickCompletable.update()
10251034
}
10261035

1036+
/**
1037+
@param {Filters} filters
1038+
@param {{ [schema: number]: true }=} excludes
1039+
@param {Set<string>=} filterNames
1040+
*/
10271041
function customFilters(filters, excludes, filterNames) {
10281042
/** @type Array<number> */
10291043
const filteredIndices = Array(allMarkersInfo.length)
@@ -1063,6 +1077,7 @@ function customFilters(filters, excludes, filterNames) {
10631077
return filteredIndices
10641078
}
10651079

1080+
/** @param {string[]} names */
10661081
function findNames(names) {
10671082
/** @type Array<number> */
10681083
const filteredIndices = Array(names.length)
@@ -1076,6 +1091,7 @@ function findNames(names) {
10761091
return filteredIndices
10771092
}
10781093

1094+
/** @param {boolean} transitions */
10791095
function findRaceSpirits(transitions) {
10801096
const filter1 = ti.NpcTiny
10811097
const filter2 = ti.Transition

0 commit comments

Comments
 (0)