Commit Graph

152 Commits

Author SHA1 Message Date
Aurastic
79483f6616
Explicitly set type="submit" on form buttons (#11726)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
2026-03-17 00:17:03 -07:00
Guangcong Luo
0c69a1f7e3 Fix crash on startup with serialized bestof games
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
The parent bestof game doesn't get serialized, but their subgames do,
which crashes PS when they get deserialized. Setting the correct flag
prevents that crash.
2025-10-20 02:29:35 -07:00
Slayer95
4b8c6a4d6d
Refactor startup (#11346)
Some checks failed
Node.js CI / build (18.x) (push) Has been cancelled
This minimizes side effects of import/require across the codebase,
and lets the caller be responsible of initializing child processeses,
as well as other async logic, such as restoring saved battles.
2025-10-17 19:37:47 -07:00
Mia
06325a0b57 Room-battle: Fix crash in ladder update
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
2025-08-17 13:43:37 -05:00
Slayer95
018ea4abef
Support running PS in a single process again (#11331)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
2025-08-07 00:29:18 -07:00
Waleed Hassan
f891287bac
/savereplay: Stop re-generating passwords (#11328)
The same password is now used across all `/savereplay`s in a battle so
replay links now don't get broken just because someone saved the replay
after you.
2025-08-06 20:19:08 -07:00
Slayer95
0b6c1dbeec
Make some dependencies optional: probe-image-size, source-map-support (#11247) 2025-07-14 03:01:41 -07:00
André Bastos Dias
3b7b1d2864
Don't update the timer when an updated request is sent (#11251)
* Don't add time if there is a request update

* Ups

* Change prevRequest to updatedRequest

* Fix tests

* Refactor

* Fix tests
2025-07-13 15:38:58 -06:00
Slayer95
88d53617d6
RoomBattleTimer: Reset turn seconds on wait requests (#11240)
Previously, if a player timed out under VGC timer and knocked their opponent,
they would be treated as timing out their following 'wait' request
2025-07-05 01:32:10 -06:00
Mia
9560f87ebd Remove accidentally-committed debug info 2025-06-04 16:04:59 -05:00
Guangcong Luo
cd20be423f
Fix timer for mid-turn requests (#11127) 2025-05-28 17:07:41 -07:00
HoeenHero
7f4f4fe584 Timer: Properly detect first turn when automatically starting the timer
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
2025-05-17 09:08:24 -04:00
Guangcong Luo
f13fe4495b Fix timer bug
nextRequest is no longer called on all players simultaneously,
meaning turnSecondsLeft might not be initialized when the timer starts.
2025-05-16 10:25:50 -07:00
Guangcong Luo
c5ef8ea3e5 Update timer for requests after updates
I figured PR #11105 would have some unintended side effect, but this
one isn't bad at all. There's no longer an easy way to tell whether
requests are move requests or not, but it's easy enough to instead
track the current turn.
2025-05-16 09:15:50 -07:00
Alex "Mathy
d249e388e4
FFA/Multi: Fix simultaneous timeouts (#10311)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
2025-04-17 20:47:39 -05:00
Alex "Mathy
6793b8a6ab
Fix timer not ending when player uses /leavegame (#11035) 2025-04-17 20:47:14 -05:00
Guangcong Luo
14ec078746 Fix battles sending requests after they're over 2025-04-12 17:33:38 -07:00
Guangcong Luo
78439b4a02
Update to ESLint 9 (#10926)
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.
2025-02-25 20:03:46 -08:00
Mia
7e8b7a02d4 Artemis: Stop throwing 429 errors
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
We already throttle requests when we get 429s. We don't need to log it constantly too.
2024-12-24 02:01:51 -06:00
Alex "Mathy
073db5ee38
Never force challenge battles public (#10664)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
2024-11-09 19:11:29 -08:00
Karthik Bandagonda
4ba7f6e8fc
Use value rules for timer (#10194)
* Use value rules for timer

* lint

* fix rule overrides

* fix the "boolean" value rules

* add limits for number based rules

* Realized that you don't need boolean value rules

* oops

* fix checks for lower bounds
2024-09-29 19:10:49 -06:00
Kris Johnson
5a7533b036
Suspects: Refactor whitelisting (#10429) 2024-07-20 00:13:40 -05:00
Guangcong Luo
88be8d7b3c
Refactor types for Lowercase<string> (#10377)
TypeScript 4.8+ supports Lowercase for lowercase strings, which isn't
exactly what ID is, but can be used to type IDs in object keys and data
entries that previously required string. I'm calling it IDEntry in places
where it should be an ID but TypeScript doesn't support that.

Very conveniently, no additional casts will be needed when using ID
where IDEntry is expected.

It's caught at least a few bugs, which is also why I'm PRing: I didn't
write the code for the bugs it found, and don't know if it's the right
way to fix them.

This ballooned into several other type refactors.
2024-07-01 15:57:14 -07:00
Mia
b048de52e2 Make the logs/ directory prefix configurable 2024-05-19 12:30:22 -05:00
Mia
ded98bc2ca
Add a plugin for ladder seasons (#10222)
* Add a plugin for ladder seasons

* Force battles public during the last 3 days of every month

* Fix bug in generating season schedules

* Another oops

* Testing

* Fix up a few things

* Fix tests

* Ensure season generation functions properly

This took way too long. Yes, it's super complicated, I know. It ended up being a way more finicky problem than you'd expect.

* Increment seasons overall instead of by year
2024-04-01 09:01:26 -05:00
Mia
3f68a259d0 Helptickets: Account for changes to replay schema 2024-01-29 18:34:22 -06:00
Guangcong Luo
cec317671e Cleanup RoomGame implementations again
This reinstates the recently-reverted RoomGame refactor/cleanup, but
with the bugs (forfeiting BestOfGame, and autojoin) fixed.

This reinstates:

- 6bccd4f622 Fix crash in bestof when expiring battles
- 2a48cbd064 Cleanup more RoomGame implementations

The latter fixes these, in addition to refactoring:
- Fix a race condition when destroying bestof games
- Fix `/tour settings scouting off` error message
2024-01-16 15:54:38 +09:00
Leonard Craft III
77a26c50f5 Revert "Fix crash in bestof when expiring battles"
This reverts commit 6bccd4f622.
2024-01-15 13:38:10 -06:00
Leonard Craft III
5252aa7d7e Revert "Cleanup more battle implementations"
This reverts commit 2a48cbd064.
2024-01-15 13:38:01 -06:00
Guangcong Luo
8839bc090f Set player.id to readonly
I don't mind if people bypass this, I'm just hoping this will get
people to read the documentation on how to change it if they do.

The same may be coming to `playerTable` but there's a lot more
that needs to be fixed if we do it that way.
2024-01-16 00:01:02 +09:00
Guangcong Luo
2a48cbd064 Cleanup more battle implementations
This is mostly just refactoring, but the refactor caught a few bugs:

- Fix a race condition when destroying bestof games
- Fix `/tour settings scouting off` error message
2024-01-15 23:58:46 +09:00
Guangcong Luo
6bccd4f622 Fix crash in bestof when expiring battles
The main important change is that when `room.destroy()` is called
on an unfinished battle, `room.parent?.game?.onBattleWin?.()` is
now called (it was previously only called for tours, not bestof).

The rest is just about moving the relevant code to more sensible
places.
2024-01-15 23:58:46 +09:00
Hisuian Zoroark
b46c8af974
Bo3: Properly end sets (#10104)
Fixes a bug where players can still forfeit after a Best of X set has ended. Also added an extra safeguard to forfeiting in a Best of X set.
2024-01-11 15:57:47 -08:00
Guangcong Luo
fc31ead82a Improve support for ffa battles 2024-01-08 20:52:37 -08:00
Guangcong Luo
eb0ef53e0e
Remove unlinkUser (#10101)
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.
2024-01-08 20:49:34 -08:00
Guangcong Luo
c1100c86f1 Fix BestOf games not working on tournaments 2024-01-08 17:30:34 -08:00
Guangcong Luo
f0e9bf19a5 Refactor connection iteration 2024-01-08 16:06:06 -08:00
Guangcong Luo
a07494784a Fix bugs in RoomGame refactor 2024-01-07 20:41:09 -05:00
Mia
4936ff95c6 Fix randbat stat collection 2024-01-07 18:02:16 -06:00
Guangcong Luo
3c51f8aa1f
Refactor BestOfGame (#10026)
This replaces some pretty jank code with much cleaner code.
Anything that would be more cleanly implemented by iterating the
players array is now done by iterating the players array.

Some instances of p1/p2 are lying around but we should slowly deprecate
them.
2024-01-07 01:45:23 -08:00
Guangcong Luo
514017934b Fix battle timer with disconnected user at start
See issue comment https://github.com/smogon/pokemon-showdown/pull/10026#issuecomment-1871611295
2023-12-28 22:46:54 -06:00
Mia
7fb904972f Ensure battle processes have source maps set up 2023-12-08 09:39:37 -06:00
Leonard Craft III
97a544054b
Fix some HTML escaping in best-of rooms (#9934) 2023-12-08 03:18:18 -06:00
Guangcong Luo
6b42b4f6b2 Experimental direct replay uploading
We have a new replay server on a new engine using a new schema.

Everything's gone remarkably well, considering.
2023-12-02 11:07:08 -05:00
Guangcong Luo
13c8c19064 Improve error message for Bo3 crash 2023-12-01 17:01:48 -05:00
Mia
135e7ad6ec Room-battle: Record replay save state in battle logs 2023-11-30 01:20:19 -06:00
Leonard Craft III
b7ebde2cff Bo3: Fix Team Preview check when format has other custom rules 2023-10-12 22:34:41 -05:00
Mia
0a4f2341ee Support /forcewin on bo3 games 2023-10-01 17:46:13 -05:00
Mia
0ad9c405dc Rooms: Allow starting new Best-of child battles during prelockdown 2023-10-01 17:36:43 -05:00
Karthik
c4127bba70
Fix rated Bo3 battles updating rating twice (#9815)
* Fix rated Bo3 battles updating rating twice

* don't delete logdata early
2023-10-01 17:15:53 -05:00