Commit Graph

126 Commits

Author SHA1 Message Date
fart
8e9cdafb2a
Validate tour rules in generator before setting it (#8761) 2022-05-09 14:10:27 -05:00
WeWuzNidokangz
ad1f1c5696
Enable /tour replace to directly exchange alts (#8711) 2022-04-30 18:43:26 -07:00
Kris Johnson
80621da40c
Fix typo 2022-04-15 20:02:47 -06:00
Alexander B
0475b38ae8
RoomGame: Refactor to use generic typing (#8678) 2022-03-13 18:01:54 -07:00
Kris Johnson
30c895ad0f
Tournaments: Add /recenttours (#8672) 2022-02-22 17:43:56 -08:00
WeWuzNidokangz
7097a9ac75
Hackmons Cup: Support custom team bans/unbans (#8607) 2022-01-09 14:46:41 -08:00
Mia
bd38434a2b Punishments: Don't count custom room punishments toward PunishmentMonitor 2021-10-24 20:02:17 -05:00
Kris Johnson
48f9e13b8a Sample Teams: More QoL improvements 2021-10-22 00:13:37 -06:00
Kris Johnson
17c5748c5d
Add a chat-plugin for handling sample teams (#8482) 2021-10-21 20:10:36 -07:00
PartMan
6666ba247d
Tournaments: Improve help (#8464) 2021-10-07 22:03:45 -07:00
Kris Johnson
2848166461 Tournaments: Properly fix setting autostart to 1 2021-10-07 22:08:02 -06:00
fart
82fb80d32f
Tournament options: fix /tour autostart 1 (#8490) 2021-10-07 21:01:39 -07:00
Mia
7811795344
Handle new TypeScript version (#8449)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2021-08-30 20:11:44 -07:00
Mia
09e298f15b
Punishments: Support giving multiple punishments to one user (#8265) 2021-05-31 11:06:01 -07:00
Quinton Lee
96895a6187
Tournaments: Add feedback to /tour runautodq (#8322) 2021-05-24 11:19:02 -07:00
Guangcong Luo
810aff74cd Namespace more server global types 2021-04-25 14:16:27 -07:00
Guangcong Luo
486f292904
Refactor everything to use Utils.sortBy (#8220)
A few uses of `array.sort()` have been left alone:

- sorting in `data/` because they aren't supposed to import anything

- `set-importer` because I still have no clue what that's for and what
  dependencies it is/isn't allowed to have

- `sort()` with no arguments used as a lexical sort (at which point
  `sortBy` offers no benefits)

All other cases have been replaced with `Utils.sortBy`, which should
be a massive increase in readability.

Sort orders should be much more readable now, without needing to puzzle
through sign issues. The order is always low-to-high, A-to-Z,
true-to-false.
2021-04-23 22:41:00 -07:00
Mia
d992b8f5fa
Add more support for custom punishments (#8215) 2021-04-23 22:40:31 -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
Distrib
9ba6a2e802
Tournaments: Allow regular users to check tour rules (#8161)
PR for https://www.smogon.com/forums/threads/allow-voiceds-and-regulars-to-check-tour-rules.3681028/
2021-04-02 15:38:25 -07:00
Guangcong Luo
44ef998ecc Implement free-for-all
This involves a huge refactor for how battles are constructed, but
it's totally worth it.

Currently, tournaments, challenges, and laddering are unsupported; only
unrated searches work. But it does work, and it's beautiful.
2021-04-01 04:44:16 -07:00
Distrib
2b610c039f
Tournaments: Add readmore for tour rules (#8128)
Pr for https://www.smogon.com/forums/threads/tour-getrules-tour-viewrules-codes.3673252/
2021-03-20 12:30:13 -07:00
Kris Johnson
be03d69dc8 Tournaments: Make rules capitalization consistent 2021-03-03 18:34:19 -07:00
Annika
c2e97aaaed
Use optional chaining in more places (#8063) 2021-02-22 11:42:05 -08:00
Mia
76c10841ea
Lib: Add an index file for all exports (#7972) 2021-01-31 18:00:19 -08:00
Guangcong Luo
da30a71706 Revert "Remove User#inRooms and User#games (#7815)"
This reverts commit 5c9c84c415.

This also reverts commit 1fc92ef977.
2021-01-30 15:55:55 -05:00
Guangcong Luo
f4abf52f61 Fix QueryProcessManager type signatures 2021-01-30 11:35:35 -08:00
Guangcong Luo
1fc92ef977 Fix bugs in inRooms/games refactor 2021-01-28 20:35:30 -05:00
Mia
5c9c84c415
Remove User#inRooms and User#games (#7815) 2021-01-28 10:41:35 -08:00
Kris Johnson
2ff6598905 Tournaments: Fix bug with playercap roomsetting 2021-01-11 17:35:30 -07:00
Kris Johnson
883cb02152
Tournaments: Fix bugs with replacing users (#7890) 2021-01-08 11:26:54 +04:00
Kris Johnson
7bb99e2abb
Add roomsettings for tournaments (#7876)
* Add roomsettings for tournaments

* gar ehseth et hseh

* aeth srth esg
2021-01-05 14:15:57 -08:00
Guangcong Luo
50d24998a9 Revert /tour forcepublic text change 2020-12-12 19:44:54 +00:00
Mia
f2e879320f
Tournaments: Use CommandContext#requireGame (#7778) 2020-12-11 11:35:34 +04:00
Kris Johnson
5df9c77dfc
Prevent /tour forcepublic spamming rooms (#7777) 2020-12-11 11:34:17 +04:00
Guangcong Luo
2fde654c78
Refactor subroom code (#7721)
This introduces a new function, `setParent`, to handle the details
of setting up subrooms.

`roomid`, `parent`, and `subRooms` are now read-only, so they can't
be accidentally be set directly rather than through their setters
(`rename`, `setParent`, and `clearSubRooms`).

I don't think setters should be used for this, because I think it's
important to be clear that `rename` and `setParent` will change a lot
of other state and induce network activity.
2020-12-01 06:22:44 -08:00
Volco
613fd60dd3
Fix disqualifyUser bug in tournaments (#7720) 2020-11-23 02:43:32 -08:00
Guangcong Luo
b9a0d3f494 Fix return signature of context.parse 2020-11-11 03:25:06 +00:00
Annika
cdba988551 Tournaments: More fixes for subroom handling
Co-authored-by: sirDonovan <quivistis@gmail.com>
2020-11-08 20:40:40 -08:00
Annika
39bc5e6c05 Tournaments: Properly add/remove subrooms 2020-11-08 20:31:35 -08:00
Mia
67ee30f2fd
Introduce Config.noipchecks (#7626) 2020-11-04 15:14:30 -08:00
Mia
c5907735ef
Tournaments: Start timer in all battles when forcetimer is activated (#7624) 2020-11-02 08:42:33 -08:00
Guangcong Luo
3b4a3ba7e0 Improve custom rule validation
Stray spaces are now consistently allowed in `/tour rules` and
`/challenge`, but are not allowed in `formats.ts`.

Improves #6811
2020-10-28 02:18:52 +00:00
Guangcong Luo
a38f0597f8 Remove last vestiges of tslint 2020-10-27 22:49:00 +00:00
Annika
97713bad33
Validate timeout durations (#7556) 2020-10-22 13:47:26 -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
Guangcong Luo
177b2c4af2 Fix tour autostart
Fixes #7469
2020-10-03 21:49:38 -07:00
Kris Johnson
dd494bb973
Tournaments: Modernize permission checking (#7375) 2020-09-16 03:40:15 -07:00
Kris Johnson
bbccd2e2f4
Tournaments: Fix permissions (#7370) 2020-09-15 03:27:26 -07:00
Mia
6aa55bd6b1
Tournaments: Refactor commands (#7229) 2020-09-14 02:09:30 -07:00