* Make ds collapsible
* Make other search commands collapsible.
* Remove all as a parameter for searches
* use readmore element with content attrs defined
* Rework to support chrome due to details linebreak quirk
* Move the toggle button down to the results line for broadcast commands
* Adds trap as a search param to movesearch without modifying any moves.
* minor regex optimization.
* Implement in a less hacky manner.
* clean up adding both trapping statuses to the orgroup.
* Fixed conditional mixing trapped moves with other volatilestatuses.
* Implemented tier searching using inequalities.
* Fixed the value of OU being higher than CAP.
* Fixed AND searching for tiers with inequalities.
* Update server/chat-plugins/datasearch.ts
* Update server/chat-plugins/datasearch.ts
---------
Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
"Standard NatDex" is very weird compared to how OMs usually work.
See "TierShift Mod" and "Godly Gift Mod". NatDex now gets its own mod,
which can be mixed into any other format, instead of needing to start
with NatDex.
This would make Min Source Gen overriding annoying, so it now defaults
to the current gen in Gen 9+, if Obtainable is set and +Past isn't. So
now you don't need to manually set Min Source Gen to enforce Obtainable
in Gen 9.
ESLint has a whole new config format, so I figure it's a good time to
make the config system saner.
- First, we no longer have separate eslint-no-types configs. Lint
performance shouldn't be enough of a problem to justify the
relevant maintenance complexity.
- Second, our base config should work out-of-the-box now. `npx eslint`
will work as expected, without any CLI flags. You should still use
`npm run lint` which adds the `--cached` flag for performance.
- Third, whatever updates I did fixed style linting, which apparently
has been bugged for quite some time, considering all the obvious
mixed-tabs-and-spaces issues I found in the upgrade.
Also here are some changes to our style rules. In particular:
- Curly brackets (for objects etc) now have spaces inside them. Sorry
for the huge change. ESLint doesn't support our old style, and most
projects use Prettier style, so we might as well match them in this way.
See https://github.com/eslint-stylistic/eslint-stylistic/issues/415
- String + number concatenation is no longer allowed. We now
consistently use template strings for this.
* add crude profiling to runDexSearch
No behavioral changes (other than console.log spam), this commit is just to establish a baseline and pinpoint the slow portions
* optimize datasearch.ts - pull move filter prep out of loop
Based on preliminary benchmarks, most of the time was spent getting the move validator, even for queries that don't specify a move.
More importantly, the parameters for fetching the move validator are known very early in the function and don't change during the loop.
Pulling that portion out of the loop is an easy win.
* improve profiling for runDexSearch
- add subcategories for filtering on move (the next optimization target)
- report unaccounted time amounts ('known unknowns')
- make grand total stand out more
* optimize dexsearch - fetch move list in outer loop
Move list depends on 'alts', which does not change in the loop over mons. Minor win, but simple.
* optimize dexsearch - filter move list by gen in outer loop
Neither 'mod' nor 'altMoves' changes during the inner loop.
* log pokemonSource in runDexSearch - expose possible leak
pokemonSources, which appears to act as a set, grows with each iteration, adding seemingly redundant items.
Will need to look closely at TeamValidator to identify the problem. My guess is that it's putting object references into a Set,
which, for objects other than strings, only cares about object identity.
* profile runDexSearch - count checkCanLearn calls
Also, semi-fix issue identified in prior commit - the endless growth of the restrictiveMoves list.
Counting the calls to checkCanLearn helps us reason about whether the cost per call is reasonable.
* fix perf bug in TeamValidator.checkCanLearn
use the cached ruleTable, save 100x.
* optimize runDexSearch - only init move filters when needed
For queries that never mention a move, a considerable chunk of time is wasted getting the objects needed for
'checkCanLearn'. I measure ~1ms savings for the relevant queries, which is often a decent percentage.
* profile dexsearch - delete and format
This is to document that they are not the bottlenecks.
* remove nested profiling from dexsearch
We've gotten to the point where we actually *are* measuring microseconds, so the frequent calls
are too expensive. This is a good problem to have! What we can see from running npm test is
that 'filters' and 'unaccounted' still account for a majority of the time. So, there's still
room for improvement, if that's ever a serious concern.
Personally, I think working on the moves API would be more fruitful.
* remove all profiling code
No more console.log or performance.now() calls. Ready to merge.
* Update server/chat-plugins/datasearch.ts
Format the 'format' string in-line.
Co-authored-by: Mia <49593536+mia-pi-git@users.noreply.github.com>
* Remove ts-expect-error from datasearch.ts
* Fix uninit lint in runDexSearch
---------
Co-authored-by: Mia <49593536+mia-pi-git@users.noreply.github.com>
* Fix itemsearch when specifying both gen and show all
* Update server/chat-plugins/datasearch.ts
---------
Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
After seeing fifty different ways we use `getLearnset`, most of which
are just "haphazardly assemble a movepool", I decided to write
`getFullLearnset` and `getMovePool`, which centralizes the
implementations and prevents weird bugs like 9713dc6db5 which
we spent two years trying to figure out.