Commit Graph

20 Commits

Author SHA1 Message Date
Guangcong Luo
f3e45fbb72 Move server code to server/
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.
2019-02-03 16:07:06 -06:00
Konrad Borowski
4f9375e5d0 Trivia alternate leaderboards (#5096) 2019-01-12 07:58:13 -06:00
Ben Davies
92c6c3e3ac Trivia: fix crash in Trivia#destroy, pause when too many players absent (#3531) 2017-05-13 19:35:57 -05:00
Ben Davies
7002810044 Tests: import the Trivia module in a sane way, clean up users/rooms (#3455)
Using internal module API to require the Trivia module is insane when it's
very simple to do without it. The trivia room is deleted after the tests
finish, and users are now destroyed properly.
2017-04-17 22:45:12 -04:00
Ben Davies
5031794f97 Sockets: fix unit tests (#3281)
* Sockets: fix Sockets.killWorker not disconnecting connections

* Sockets: fix unit tests

- Fix crash when constructing mock sockets in certain cases
- Properly prevent workers from writing to stdout
- Fix race conditions in workers-related tests that were causing false
  positives

* Tests: mock workers now more closely imitate sockets' workers

This helps catch cases where messages are being sent in the wrong order
to the workers, e.g. messages sent to sockets that no longer exist.
2017-02-24 05:38:37 -06:00
Ben Davies
b0c117ce7a Trivia: mitigate game end/question timeout callback race condition (#3080)
This isn't very easy to reproduce, so I can't properly test any fixes.
Trivia#broadcast writes to debug monitor rather than throwing if called after
the game instance destroys itself.
2017-01-07 04:13:19 -08:00
Guangcong Luo
02055d3d17 Fix mod loading order
Sometimes mods would mess up if they were loaded in the wrong order.
Specifically, some autogenerated properties of e.g. moves need to be
recalculated for mods.

Anyway, the entire cache system is replaced with a newer, faster,
slightly-more-memory-intensive-but-only-slightly cache system, which
no longer has these kinds of loading order issues.
2016-10-23 14:17:13 -05:00
Guangcong Luo
d6f5404e7e Rename CommandParser to Chat
We had a lot of discussion in Dev and a somewhat-close poll, but in
the end "Chat" was a better name than "Messages", and also has the
advantage of being shorter (which is nice for Chat.html and
Chat.plural which should be short).
2016-09-30 18:31:15 -07:00
Guangcong Luo
2bc0bf5061 Tests: Properly resolve rejected promise 2016-09-30 15:56:50 -04:00
Ben Davies
4e9577a7e5 Trivia: modlog kicks and wins, clean up unit tests (#2740)
Unit tests were still not destroying a few users.
2016-09-08 02:37:21 -05:00
Taylor Everding
1a1f64fe95 Remove .js extension from requires (#2725) 2016-08-30 00:04:40 -05:00
Ben Davies
ecb00710a7 Trivia: dispose of extra users in unit tests (#2719) 2016-08-27 14:47:08 -05:00
Ben Davies
d88561b42e Trivia: properly dispose of trivia games in mode unit tests (#2718) 2016-08-27 02:39:22 -05:00
Guangcong Luo
4523078519 Refactor User#games from Map to Set
User#games no longer retains games; it instead gets them from
Rooms(roomid).game.

The Trivia tests needed to be fixed for fidelity to continue passing.
2016-08-27 02:16:58 -05:00
Ben Davies
5c4834f3fd Tests: tweak user mocks, add Connection tests, fix Trivia tests (#2682)
Worker mocks now have proper ids. Trivia tests now dispose of user objects
rather than letting them stay in memory for the rest of the tests.
2016-08-09 04:02:27 -05:00
Ben Davies
343c67b15f Trivia: lazy loading for modules in unit tests (#2677)
This makes it possible to refer to globals normally defined in production in the
outermost scope of the trivia module without making unit tests throw.
2016-08-08 14:43:01 -05:00
Ben Davies
febba6b362 Trivia: add /trivia leave, lower answering period to 10 seconds (#2674) 2016-08-06 14:20:58 -05:00
Ben Davies
0d2d73540d Trivia: add unit tests confirming if points given aren't NaN (#2661) 2016-08-01 15:03:04 -05:00
Ben Davies
d00ba49b1c Trivia: game management code rewrite (#2626)
Part 1 of the rewrite for the entire plugin
This is the rewrite of the classes and commands that handle running
trivia games. Several bugs that happened when running trivia games were
fixed, and unit tests were added to help keep them gone.
2016-07-31 18:29:51 -05:00
Ivo Julca
bbb58d5a29 Add a test for old-gen /learn 2016-03-31 14:01:11 -05:00