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.
* Move Random Battles files to a new folder
* Fix bdsp test
* Move SSB back and move rands files into folders
* fix BF tests
* fix test
* fix bug
* fix SSB teamgen
This refactor removes `player.unlinkUser()` which was used for several
unrelated use cases.
These have been split apart into:
- at the end of a game, `game.setEnded()` now clears `user.games`,
while leaving `player.id` untouched
- when trying to change the user associated with the player, we now
consistently use the higher-level `game.updatePlayer()`
There's a good chance this fixes the lagspikes currently affecting PS.
simulate-battle now has a new option: --spectate.
As a recap:
-D --debug: simulate in debug mode
-R --replay: output only the omniscient (debug) replay, rather than the
full stream
-S --spectate: output only the spectator replay, rather than the full
stream
This adds some new `data/text/` files, which are the new home for
item/move/ability descriptions, as well as in-game messages, in one
place for ease of translation.
`server/chat-commands.js` is now a directory. It's been split into
`core`, `moderation`, and `admin`. `info` and `roomsettings` from
`chat-plugins` have also moved to `chat-commands`.
Some cleanup:
- Bot commands for inserting HTML into rooms like `/adduhtml` have been
moved from `info` into `admin`.
- `/a` has been renamed `/addline`, for clarity (and also moved from
`info` into `admin`).
- Room management commands like `/createroom` and `/roomintro` were
moved to `room-settings`
- `chat-commands/admin` has been TypeScripted
`node tools/set-import [version]` can be run to create a
`@pokemon-showdown/sets` package containing sets from Smogon, usage
stats and third party sources. Some notes:
- The build is set up so that `tools/set-import/importer.ts` is
compiled to `tools/set-import/importer.js` - creating a
`.tools-dist/set-import` directory for the sole artifact was
deemed to be overkill
- The sets package is generated such that it can be used easily on
Node or in a browser (where the large set JSON can be loaded
asynchronously)
- Supported tiers/formats are mostly arbitrary - those popular
enough to have a signficant playerbase or analyses on Smogon have
been included, but additional formats can be added based on demand
- Some set information is redundant for ease of use by downstream
users: certain formes are split out and information that could
theoretically be inferred like level/ability/HP IVs are included
to simplify parsing logic and make the sets more immediately
available. This results in what should mostly be negligible
size overhead.
- In a similar vein, display versions of effect names instead of IDs
are used (name -> ID is trivial, ID -> name requires data lookup)
- All sets pass validation, provided certain simple transformations
are applied (eg. reverting `battleOnly` formes like Megas)
This tool has primarily been tested to run on Linux - running on
other platforms is not guaranteed to result in error-free output.
- The big change here is that player.userid can now be empty. You can
now fit state into RoomGamePlayer subclasses even when there are no
users associated with them.
- `game.players` has been introduced as the new canonical list of
players, including userless players. The old `game.players` has been
renamed `game.playerTable`, for clarity.
- `game.addPlayer` now returns the added player
All existing RoomGames have been updated for the new API, and
RoomBattle is now officially a RoomGame subclass.
Tournaments was also massively refactored to be properly updated for
the old API, since that never happened, and should now be a lot more
readable.
Also move mods/ to data/mods/
This makes PS more monorepo-like. The intent is to further separate
the sim and the server code, but without fully committing to splitting
the repository itself.
We now support `./pokemon-showdown start` in addition to
`./pokemon-showdown`. I'm not clear which I want to be the default
yet.