Commit Graph

92 Commits

Author SHA1 Message Date
Bär Halberkamp
102e3c183c Wifi: typescript wifi plugin 2018-07-05 15:58:53 -04:00
Kris Johnson
eda6cdc108 Add OMotM and LCotM for July 2018 (#4733) 2018-07-02 01:36:26 +08:00
Kris Johnson
0b299d5168 OMotM and RoA Spotlight June 2018 (#4701) 2018-06-01 19:46:38 +08:00
HoeenHero
63eff7cdad Typescript Mafia Plugin (#4669) 2018-05-22 12:02:47 -05:00
Guangcong Luo
82911708a1 TypeScript help tickets 2018-05-07 11:13:01 -05:00
Quinton Lee
cf50a3d642 Typescript the rest of mods/ (#4588) 2018-05-05 14:56:45 -05:00
Quinton Lee
acd812c71e Typescript gens 1-4 (#4556) 2018-04-11 22:11:25 -05:00
Quinton Lee
c799393710 Typescript data/ and config/formats (#4513)
Also removes Battle Factory methods accidentally re-added in d0a4a689a7
2018-03-26 09:50:51 -05:00
Guangcong Luo
ab1f995daa Rewrite Process Manager
Process Manager is now lib/process-manager.js

It's been entirely rewritten to reflect what I think a process manager
API should look like.

In particular, there are now two Process Managers, QueryProcessManager
and StreamProcessManager.

Pass QueryProcessManager a pure-ish query function (sync or async) that
takes a JSON value and returns a JSON value, and PM.query() will
execute that function in a subprocess, and return a Promise for its
return value.

StreamProcessManager is the same idea: Pass it a function to create an
ObjectReadWriteStream, and PM.createStream() will create a stream in a
subprocess and return a stream connected to it.
2018-01-18 03:34:16 -06:00
CheeseMuffin
636b8d79ea Finish typescripting punishments.js (#4284) 2017-12-27 15:10:45 -06:00
Guangcong Luo
2b5654e307 Refactor LoginServer for Promises
(Also TypeScript it.)
2017-12-26 14:36:56 -06:00
CheeseMuffin
f27f0e21dd Typescript users.js (#4279) 2017-12-26 00:24:38 -06:00
CheeseMuffin
def2697f33 Finish typescripting chat.js (#4277) 2017-12-24 00:45:49 -06:00
Guangcong Luo
5094631fcf Implement Roomlog library
Rooms now have their logging abstracted into their own file, which also
allows the rest of rooms.js to be simplified by a decent margin.

This is in preparation for using Redis as a backing for scrollback log
storage, which will give us a lot more RAM to work with.

My newest newest plan is actually to locally cache room scrollback, and
only read battle logs from Redis. This will make chatroom-joining
faster.
2017-12-16 15:40:45 -06:00
Guangcong Luo
193e948592 Move crashlogger.js -> lib/crashlogger.js 2017-12-16 15:40:45 -06:00
Guangcong Luo
738c60ed8b Move repl.js -> lib/repl.js 2017-12-16 15:40:45 -06:00
Guangcong Luo
a9540917f5 Move fs.js -> lib/fs.js 2017-12-16 15:40:45 -06:00
Guangcong Luo
d07113dd35 New library: Dashycode
Dashycode is a library for encoding string data in restricted strings
in the [a-z0-9-] character set (namely, roomids).

...its main use is passing arbitrary string data in roomids, for HTML
rooms.
2017-12-12 03:22:09 -06:00
Guangcong Luo
7e02b57016 Refactor Matchmaker to subclass Ladder
As expected, this resulted in zero API changes. (Aside from a minor
test change.)
2017-12-09 15:45:10 -06:00
Guangcong Luo
799a6a1e44 Improve Matchmaker API
Ladder is now a subclass of Matchmaker, and all the APIs previously
attached to Matchmaker are now directly available in Ladder.

In addition, all functions that take a formatid are now of the form
`Ladders(formatid).function(other arguments)`

TODO: Reverse polarity; it makes more sense for Matchmaker to be
a subclass of Ladder. Fortunately, this wouldn't involve API changes.
2017-12-09 15:04:29 -06:00
Guangcong Luo
65517f279c Rewrite chat formatter
This new version supports significantly more client chat formatting
than before, and is more readable.

Also new: the `code` formatting now uses basically the same system as
Markdown, where you can use as many `` ` `` in a row as you want as
your delimiter.
2017-11-27 12:16:15 -06:00
Guangcong Luo
56190af620 Fix up TypeScript errors
Also suppress TypeScript validation of various files we don't want
validated right now.
2017-11-08 01:23:04 -06:00
Guangcong Luo
844f461dbb TypeScript rooms.js 2017-11-06 21:56:33 -06:00
Guangcong Luo
41028f8e54 TypeScript room-game.js 2017-10-22 04:47:35 -05:00
Guangcong Luo
7519e2de06 Simplify tsconfig.json a bit 2017-10-20 14:43:55 -05:00
Quinton Lee
a0b8228592 TypeScript: Improve Sim typing (#4069)
Also improves intellisense for Visual Studio and Visual Studio Code.
2017-10-20 07:53:26 -05:00
Ben Davies
a5bc1e0045 Typescript: ladders-matchmaker.js (#3942) 2017-09-01 19:18:59 -04:00
Ben Davies
67b25950de Typescript: Declare all globals, refactor monitor.js (#3748) 2017-07-13 12:20:03 +09:00
Ben Davies
c42c40e40b Typescript: process-manager.js, verifier.js (#3717) 2017-07-07 15:16:20 +09:00
Guangcong Luo
95e8bebeaf Revert "ProcessManager: refactor, fix memory leak, use Typescript (#3706)"
This reverts commit c9b93d3529.
2017-07-02 08:11:18 -04:00
Ben Davies
c9b93d3529 ProcessManager: refactor, fix memory leak, use Typescript (#3706)
- spawning and setting up child processes is now handled by
ProcessManager#constructor rather than needing to be done manually for
each module that uses ProcessManager
- direct references to ProcessManager in ProcessWrapper were removed to
prevent dead ProcessWrapper instances from being leaked when hotpatching
- process-manager.js and verifier.js now use Typescript
2017-06-30 09:09:13 +09:00
Guangcong Luo
0143ae28dd Replace fs module (#3686)
The new FS module is an abstraction layer over the built-in fs module.

The main reason it exists is because I need an abstraction layer I can
disable writing from. But that'll be in another commit.

Currently, mine is better because:
 - paths are always relative to PS's base directory
 - Promises (seriously wtf Node Core what are you thinking)
 - PS-style API: FS("foo.txt").write("bar") for easier argument order
 - mkdirp

This also increases the minimum supported Node version from v6.0 to
v7.7, because we now use async/await. Sorry for the inconvenience!

This also drops the mock-fs-require-fix dependency

mock-fs-require-fix was always kind of a huge hack. It's no longer
necessary, with an FS API that does everything it used to.

This removes a lot of other hacks from test/main.js, which is nice.
2017-06-24 13:42:54 -07:00
Quinton Lee
1ff35a8f03 Typescript: fix tsconfig target 2017-06-21 21:38:41 -05:00
Ben Davies
a58abab443 DNSBL: Typescript (#3614) 2017-06-11 23:07:56 -05:00
Ben Davies
74131dbf58 Typescript: crashlogger.js (#3605)
Depended on by numerous other modules to be moved over to Typescript
before they can.
2017-06-11 11:16:21 -05:00
Ben Davies
015dd8db65 REPL: add Config.repl, refactor, Typescript (#3609)
- `Config.repl` enables/disables using REPL sockets since it doesn't
make as much sense to configure whether or not it's enabled with the
REPL_ENABLED const
- exports.start takes a filename parametre rather than a prefix and a
suffix one to avoid having to mutate parametres
- dead REPL sockets are removed from the sockets list when the server
emits an error, and the server closes on error now before respawning
the server
- made the file ready for Typescript
2017-06-11 10:40:38 -05:00
Guangcong Luo
e34c77930a Start creating classes for getEffect data
Currently, getEffect/getTemplate/getMove/etc return bare objects.
Refactoring their returns into classes will allow TypeScript to type
check them.
2017-05-09 16:00:11 -05:00
Guangcong Luo
5266c7c90f Fix tsconfig lib
It's now more precise about what modern ES features we want in PS.
2017-05-08 21:09:57 -05:00
Guangcong Luo
22186f1903 Improve TypeScript typing
sim/dex.js and sim/prng.js are now valid strict TypeScript! Also they
have slightly less "any" use than before.
2017-05-08 02:58:55 -05:00
Guangcong Luo
6dd58b40d3 Refactor simulator into new sim/ directory
This is a surprisingly minor refactor considering how many files it
touches, but most of this is only renames.

In terms of file renames:
- `tools.js` is now `sim/dex.js`
- `battle-engine.js` is now `sim/index.js` and its three classes are
  in `sim/battle.js`, `sim/side.js`, and `sim/pokemon.js`
- `prng.js` is now `sim/prng.js`

In terms of variable renames:
- `Tools` is now `Dex`
- `BattleEngine` is now `Sim`
- `BattleEngine.Battle` is now `Sim.Battle`
- `BattleEngine.BattleSide` is now `Sim.Side`
- `BattleEngine.BattlePokemon` is now `Sim.Pokemon`
2017-05-05 16:48:38 -05:00
Guangcong Luo
5ed4bfe3d1 More TypeScript refactoring
prng.js is now validated by TypeScript. battle-engine is too huge and
tsc bugs out on it, but it needs to be split into a number of smaller
files anyway.
2017-05-05 16:48:38 -05:00
Guangcong Luo
3716f360ff TypeScript!
Currently TypeScript is validating tools.js and is not particularly
strict about anything and we use 'any' a lot and it's not part of
'npm test' yet, but everything has to start somewhere!

tools.js has also been refactored majorly to use accessors rather
than loader functions. This basically means you don't need to do
Tools.includeData() or anything like that anymore. The new system is
also easier to make TypeScript-compatible.

See #3278
2017-05-03 16:19:49 -07:00