Commit Graph

185 Commits

Author SHA1 Message Date
Alexander B
0475b38ae8
RoomGame: Refactor to use generic typing (#8678) 2022-03-13 18:01:54 -07:00
FeluciaPS
eac92c72b8
Allow bots to receive private mod actions (#8628) 2022-01-25 13:11:46 -08:00
Mia
cfeb1303bb
Chat: Properly typecheck Chat.runHandlers arguments (#8612) 2022-01-23 17:55:19 -08:00
Guangcong Luo
a1b7a49788 Accept strings in Monitor.crashlog 2021-12-15 20:14:08 -06:00
Mia
ab62e1af43
Add a plugin to use Perspective for monitoring battles (#8541) 2021-12-03 07:52:26 -06:00
Guangcong Luo
48df7f19bf Refactor re-saving replays at battle end
Previously, if saving a replay failed the first time around, it's
not re-saved at battle end. Commit 028abd6377 fixes that.

This commit just rewrites the implementation to be much less redundant.
2021-11-13 13:54:05 -05:00
Guangcong Luo
be0cee5a33
Refactor getIdentity not to take roomids (#8528) 2021-11-12 22:05:59 -08:00
Kris Johnson
b70865eb2e
Wi-Fi: Refactor giveaways (#8514) 2021-11-04 18:05:45 -07:00
Guangcong Luo
104fbdaa71 Revert "Rooms: Clarify error"
This reverts commit 528cd01017.
2021-10-24 17:29:12 -04:00
Annika
9c08822cff Revert Multi Battle changes 2021-10-24 17:13:10 -04:00
Mia
62eb51aee0 Fix crash 2021-10-24 16:09:30 -05:00
Mia
528cd01017 Rooms: Clarify error 2021-10-24 15:53:56 -05:00
Mia
0f5c9c133b
Support searching multi formats (#8172) 2021-10-24 12:04:57 -07:00
Guangcong Luo
09e7c8f1ea Improve documentation of uploadReplay
Closes #8480
2021-10-08 17:04:22 -04:00
Mia
0c2ed8724c Rooms: Support detecting when users join rooms 2021-09-30 08:09:59 -05:00
Mia
038404a554 Rooms: Retain previous setting when automodchat is set
Also fixes a bug with the activation declaration saying it activated after 0 seconds.
2021-09-15 19:40:13 -05: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
77861ceae6
SQL: Use a QueryProcessManager subclass (#8422) 2021-08-14 17:45:51 -07:00
Mia
51880db89c Punishments: Move punishments on room rename 2021-08-12 13:28:10 -05: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
Mia
ed34cc49b1 Friends: Add a page to spectate the battles of friends 2021-07-19 02:57:08 -05:00
Kris Johnson
40e36c8f38
Make adjustments to Section Leaders (#8387) 2021-07-16 12:51:29 -07:00
Guangcong Luo
5c5b82931d Don't break invites when renaming rooms
Fixes #8361
2021-06-15 12:46:15 -07:00
Mia
f07855a2d0 Rooms: Fix automodchat 2021-06-03 13:40:31 -05:00
Mia
e987a01427 Rooms: Partially fix bug in automodchat
This should provide a temporary bandaid in that it won't spam rooms, and it will inform us of what the setting is so that we can proceed.
2021-06-01 19:18:52 -05:00
Mia
7ae21cebf8
Chat: Support exporting custom handlers from plugins (#8319) 2021-05-28 23:13:01 -07:00
Guangcong Luo
74211859c9 Update to TypeScript 4.3
Changes relevant to our codebase:

- TypeScript now knows that `typeof id === 'string'`! A bunch of casts
  on `User | ID` or `Room | RoomID` are no longer necessary!!!

- `override` will protect against certain typoes, and we'll adopt it
  (and `--noImplicitOverride`) as soon as sucrase comes in

- `declare` is now required for properties we want to narrow the type
  of without directly overwriting - a good thing to use going forward,
	but very annoying to fix all our old code for
2021-05-26 14:16:54 -07:00
Mia
f036283a60 Rooms: Actually ensure bots don't count for automodchat 2021-05-19 09:21:05 -05:00
Mia
ac976e7aa1 Rooms: Use user#can for checking staff permissions in automodchat
isStaff includes bots, which makes this useless if the room has a roombot.
2021-05-19 08:20:25 -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
9abbe47531
Support setting a default format/mod for commands in rooms (#8237) 2021-04-27 15:38:51 -07:00
Guangcong Luo
ddd96995a1 Fix crash report display
Fixes #8234
2021-04-26 22:30:02 -04:00
Guangcong Luo
810aff74cd Namespace more server global types 2021-04-25 14:16:27 -07:00
Guangcong Luo
7336b22540 Fix support for spotlight rooms 2021-04-24 02:46:45 -04: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
7154920b2c
Support forcing modchat on ladder tour battles (#8214) 2021-04-23 22:40:09 -07:00
Kris Johnson
a1bdafbfe8
Add room sections (#8205) 2021-04-23 22:39:56 -07:00
InAShellnut
9ab4c86fe3
Add Stadium 2, Nintendo Cup 1997, and Nintendo Cup 2000 (#8195)
An implementation of Nintendo Cup 1997, Nintendo Cup 2000, and Pokemon Stadium 2, for Pokemon Showdown. The only thing which has not been implemented was showing the exact health of both Pokemon in Pokemon Stadium 2, however implementing that requires changes to the showdown client. The Nintendo Cup 1997 code was done by Enigami, and the rest was by myself (Shellnuts).

This should fulfill the requirements asked by the following accepted suggestions:
https://www.smogon.com/forums/threads/please-add-a-pok%C3%A9mon-stadium-2-simulator-in-showdown.3679486/
https://www.smogon.com/forums/threads/add-nintendo-cup-1997-and-2000-as-challenge-only-formats.3653454/
2021-04-22 00:54:14 -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
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
Mia
b7680c783d
Add infrastructure to rename chat plugin data with rooms (#8153) 2021-04-01 01:23:01 -04:00
Spandan Punwatkar
b77d6cb20f
Add simulator support for multi battle (#7929)
This doesn't include matchmaking support (which had to be removed
for reworking), but it includes everything else.

Co-authored-by: Spandamn <spandan.punwatkar@gmail.com>
Co-authored-by: MacChaeger <msaimrkon@gmail.com>
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2021-03-31 22:22:25 -07:00
Mia
b9d6b3e3f3
Punishments: Don't warn / mark staff users in banned groupchats (#7669) 2021-03-26 15:29:41 -07:00
Mia
3e1658ee07 Minor activities: Fix clearing queue 2021-02-26 17:51:50 -06:00
Annika
c2e97aaaed
Use optional chaining in more places (#8063) 2021-02-22 11:42:05 -08:00
Mia
daf650d174
Rooms: Fix automodchat (#7979) 2021-02-01 16:18:36 -08:00
Mia
76c10841ea
Lib: Add an index file for all exports (#7972) 2021-01-31 18:00:19 -08:00
Mia
a8edba9bd3
Minor activities: Don't re-display on hotpatch (#7970) 2021-01-31 00:36:07 -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