Commit Graph

72 Commits

Author SHA1 Message Date
Annika
2f9af1ac36 Build: Include Battle Factory sets 2022-09-18 12:21:14 -07:00
Christopher Monsanto
08b8980daf set-import: Add pure hackmons 2022-07-29 23:39:11 -04:00
Mia
01ae28ce67 Fix Sucrase build script
We forgot to tell it to build TSX, so it's been failing to build & instead erroring out.
2021-11-13 12:33:19 -06:00
Guangcong Luo
57554dc283 Stop using fs.exists
`fs.exists` should in practice be replaced with try-catch (since the
latter isn't susceptible to race conditions).
2021-10-09 15:53:30 -04:00
Mr. Sableye
86c4de6513
Fix TypeScript declaration file generation (#8477) 2021-10-07 23:04:14 -07:00
Annika
055a01ab89 Modlog: Minor fixes from smogtours conversion 2021-09-06 17:54:30 -04:00
Mia
7811795344
Handle new TypeScript version (#8449)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2021-08-30 20:11:44 -07:00
Annika
633e061067 Modlog: Remove text logging code 2021-08-09 14:06:14 -07:00
Annika
bcbe100c41
Modlog: Use SQLite for searches (#8004) 2021-07-23 13:47:49 -07:00
Annika
74295cf506 Modlog Converter: Improve modernization
This now reaches 99.9% success rate on logs from January 2018-May 2021, and 94.6% success on logs from November 2014-May 2021. (Assuming one defines "success" as "modernizing the modlog entry without just spitting out an OLD MODLOG: entry".)
2021-07-18 21:07:29 -07:00
Annika
7bd70f8266 Modlog Converter: Fix issues with ts-node 2021-07-18 18:16:41 -07:00
Annika
33145f3fc8 Modlog Converter: Default to 0 if no time is found
This makes it clearer that no time was found, since PS didn't exist in 1970.
2021-07-17 21:21:32 -07:00
Annika
a4c1be6496 Modlog Converter: Fix bugs
The modlog converter now mostly works properly. There are some discrepancies (for example, Lobby gets 11,000 more modlog entries in SQLite than in text); I'm not sure if this is because of glitches in the previous system or a bug in my code. This script will need to be run after #8004 is merged.
2021-07-17 21:14:24 -07:00
Karthik
12abcd02c9
Fix bugs with Sucrase build process (#8393) 2021-07-14 09:50:01 -07:00
Annika
491ce58234 Fix dex-formats in Sucrase build 2021-07-10 14:37:16 -07:00
Annika
c134195915
Use ts-node instead of Sucrase (#8369) 2021-07-09 19:59:22 -07:00
Guangcong Luo
f47e38c5ad Support building TS declarations
`./build decl` now builds TS declarations for everything exported by
`sim/`. Unfortunately, the built TS declarations still refer to global
types, so some things still have `any` type, but it's much better than
nothing.
2021-06-09 17:51:49 -05:00
Guangcong Luo
55980d416c
Support value rules (#8267)
`teamLength`, `maxLevel`, `cupLevelLimit`, and `minSourceGen` no longer
exist as properties of `Format`. Instead, they're value rules that
become properties of `RuleTable`, and can be specified as custom rules
and inherited through rulesets like anything else.

See the PR for a full reckoning of changes:

https://github.com/smogon/pokemon-showdown/pull/8267
2021-05-06 01:16:16 -07:00
Guangcong Luo
c241941c61 Clear .config-dist when building
This fixes a bug where `.config-dist/custom-formats.js` wasn't getting
deleted when `config/custom-formats.ts` was deleted.

This also cleans up some other clutter in `.config-dist`.
2021-04-21 23:46:55 -07:00
Guangcong Luo
13189fdb02
Update Dex API (#8181)
This is the change that renames:

- `Dex.getMove` -> `Dex.moves.get`
- `Dex.getAbility` -> `Dex.abilities.get`
- `Dex.getItem` -> `Dex.items.get`
- `Dex.getSpecies` -> `Dex.species.get`
- `Dex.getEffect` -> `Dex.conditions.get`
- `Dex.getNature` -> `Dex.natures.get`
- `Dex.getType` -> `Dex.types.get`
- `Dex.getFormat` -> `Dex.formats.get`

In addition, some other APIs have been updated:

- `getByID` methods have also been added to every other table.
- `Dex.moves.all()` now gets an array of all moves
  - Plus equivalent methods for `abilities`, `items`, `species`, `formats`, `natures`, `types`
  - Note: there's no `Dex.conditions.all()`
- new API: `Dex.stats` for naming/iterating stats
- `Dex.getEffectByID` -> `Dex.conditions.getByID`
- `Dex.getType` -> `Dex.types.get`
- `Dex.data.Formats` -> `Dex.data.Rulesets`
- `Dex.formats` -> now an array `Dex.formats.all()`
- `Dex.getRuleTable` -> `Dex.formats.getRuleTable`
- `Dex.validateFormat` -> `Dex.formats.validate`

Team functions have been split off into a new `sim/teams` package:

- `Dex.packTeam` -> `Teams.pack`
- `Dex.fastUnpackTeam` -> `Teams.unpack`
- `Dex.generateTeam` -> `Teams.generate`
- `Dex.stringifyTeam` -> `Teams.export`

`Teams.export` has also been rewritten to better match how it works in client.

This implements #8178
2021-04-08 03:00:37 -07:00
Guangcong Luo
4f32736bdd Clean mods/ and chat-plugins/ when building
Previously, if you deleted a file from `data/mods/`, it wouldn't also
get deleted from `.data-dist/mods/`. This fixes that, and the
corresponding issue in `server/chat-plugins/`.

For reasons of performance and/or laziness, I've chosen to only clean
those two directories, not all built directories.
2021-04-07 01:33:10 -07:00
Annika
31605c36b3 Modlog: FIx converter bug in action-taker regex 2021-02-06 11:42:07 -08:00
Mia
76c10841ea
Lib: Add an index file for all exports (#7972) 2021-01-31 18:00:19 -08:00
LegoFigure11
cad1d25c4d
Add Gen 8 BSS Factory (#7843) 2020-12-31 02:09:29 +04:00
Guangcong Luo
6e281dbe31 Move build-utils from lib to tools
The current idea is for `lib` to contain shared libraries useful to
many projects. `build-utils` is specific to this repo and so doesn't go
there.
2020-12-26 10:08:30 -08:00
MacChaeger
da64d93765 Runners: Support 4P (and max games) (#7700) 2020-12-13 20:26:39 +00:00
Annika
66c043086e Modlog converter: Fix crash without SQLite library 2020-11-07 13:40:07 -08:00
Annika
ec0a92469a Modlog: Make tests work without SQLite 2020-11-05 22:40:53 -08:00
Guangcong Luo
9b5217ab70
Split up dex-data into more files (#7634)
* Split up dex-data over individual files

This commit introduces:
- `dex-abilities.ts`
- `dex-conditions.ts`
- `dex-formats.ts`
- `dex-items.ts`
- `dex-moves.ts`
- `dex-species.ts`

These files centralize definitions from `dex-data` and `global-types`.

* Inherit ItemData from Item etc

Previously, Condition inherited from ConditionData. Now, ConditionData
inherits from Condition. The advantage of the new approach is that now,
Condition and DataCondition no longer need to be separate types, and
there should be much less duplication of type definitions in general.

This has also been done for

- ItemData/Item/DataItem
- AbilityData/Ability/DataAbility
- FormatData/Format/DataFormat

Species and DataSpecies was already merged, but this also reverses
their inheritance (saving a lot of duplicated definitions in the
process!)

The only one left is MoveData, which is just super complicated and
will need its own commit.
2020-11-05 05:00:13 -08:00
Annika
aa069ce8fd
Support disabling modlogs (#7619)
Co-authored-by: Christopher Monsanto <chris@monsan.to>
2020-11-02 22:59:31 -05:00
Annika
7f2dec0797
Modlog: Avoid optional properties in ModlogEntry (#7613)
* Modlog: Avoid optional properties in ModlogEntry

* Use a type

* Make IP nullable

* Add NOT NULL constrains

* Fix typo
2020-11-01 14:07:01 -08:00
Annika
2f130e8762
Modlog: Support logging to a SQLite database (#7513)
* Modlog: Support logging to a SQLite database

Co-authored-by: Christopher Monsanto <chris@monsan.to>
2020-10-30 19:27:25 -04:00
Guangcong Luo
a38f0597f8 Remove last vestiges of tslint 2020-10-27 22:49:00 +00:00
Annika
099346ee1e Tools: Modernize modlog entries for blacklists 2020-10-25 16:13:46 -07:00
Guangcong Luo
9d87616176
Add more style linting rules (#7537)
* Lint arrow-body-style

* Lint prefer-object-spread

Object spread is faster _and_ more readable.

This also fixes a few unnecessary object clones.

* Enable no-parameter-properties

This isn't currently used, but this makes clear that it shouldn't be.

* Refactor more Promises to async/await

* Remove unnecessary code from getDataMoveHTML etc

* Lint prefer-string-starts-ends-with

* Stop using no-undef

According to the typescript-eslint FAQ, this is redundant with
TypeScript, and they're not wrong. This will save us from needing to
specify globals in two different places which will be nice.
2020-10-19 02:42:28 -07:00
Annika
0877f0ae1e
Modlog: Fix entries with an IP address and no user (#7446) 2020-09-30 17:55:41 -07:00
Annika
f1b4e3d43a
Modlog: Refactor to use ModlogEntry objects (#7403) 2020-09-28 11:06:30 -07:00
Mia
deeed6c789
Remove sim/ and data/'s globals (#7091) 2020-08-07 06:44:15 -07:00
Kirk Scheibelhut
922d292322 Simplify @pokemon-showdown/sets and rename package
@smogon is the preferred namespace for packages (eg. @smogon/calc),
but the fact that this import logic previously contained code from
two non-Smogon sources made such naming awkward. Given the damage
calc didn't end up using these sources (and the Pokémon Showdown
client doesn't either), its simpler to just remove the logic for
third party imports entirely. This allows us to remove ugly 'hidden'
JSON5 dependency, as well as `smogon.com/` namespacing on the
sources.

This commit also tidies up the package.json and type definitions to
be more robust. It makes `--access public` the default when
publishing and cleans up unpkg support.

This is obviously a breaking change, but it's also a package rename
so we get to start the version from zero there :). A corresponding
commit will be added to the client to account for these changes.
2020-06-04 19:43:56 -07:00
Kirk Scheibelhut
6d7bf4e202 Improve battleOnly forme handling in set-import
With this change we no longer make requests to Smogon for battle
only formes (as they just get duped to their base forme), instead we
try to pull out sets for the battle-only forme based on their bases.
This also more gracefully handles the Zygarde/Necrozma edge case.
2020-05-03 23:02:10 -07:00
Kirk Scheibelhut
4754076efa Update for @pokemon-showdown/sets v0.4.0
- updates smogon package dependency to the latest version
- make sure no old artifacts are left around from previous runs
- revert change from 7aa42b12: for whatever reason we do encounter
instances where `typeof species.battleOnly !== 'string'` and
`throw`-ing means no sets get output.
2020-05-03 13:24:25 -07:00
Guangcong Luo
56f6ab5489 Fix Zygarde-Complete validation 2020-05-01 13:02:30 -07:00
Guangcong Luo
7aa42b1212 Remove Dex.getOutOfBattleSpecies
Literally every current use is a bug.
2020-04-30 23:29:20 -07:00
Guangcong Luo
f6f4467265 Turn on prefer-const for .js files
Not having prefer-const on the JS side makes JS -> TS refactors really
unreadable. This commit just auto-fixes it so we're using
`prefer-const` everywhere.
2020-04-23 11:37:47 -07:00
Guangcong Luo
a049d85a98 Fix build errors from TypeScript update
I'm not entirely sure why these two errors are cropping up now, but
they are.

The "thenable" one seems to be a bug, but in what?
2020-04-17 23:00:28 -07:00
Kirk Scheibelhut
50a6b4c967 Fix long ling in set-import/importer.ts 2020-04-01 20:01:43 -07:00
Kirk Scheibelhut
59bcdab260 Update deps to get newest smogon for set-import 2020-04-01 20:00:36 -07:00
Kris Johnson
994fc60aed
Rename Template to Species (#6478) 2020-03-25 23:29:27 -07:00
Guangcong Luo
62f432c6c3 Fix build error 2020-03-17 19:49:13 -07:00
Kirk Scheibelhut
86d3cc1174 Fix handling of missing format/level in sets 2020-03-17 15:03:43 -07:00