Commit Graph

34 Commits

Author SHA1 Message Date
Alexander B
bd8890656d
Hangman: Make guesses clearable and loggable (#8893) 2022-09-13 08:33:57 -05:00
Alexander B
0475b38ae8
RoomGame: Refactor to use generic typing (#8678) 2022-03-13 18:01:54 -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
6f6b564f7f Hangman: Don't allow filtered words in guesses 2021-06-07 22:07:09 -05:00
Mia
d9109e64bc Hangman: Allow creators to play in random hangman games 2021-05-29 20:11:48 -05:00
Guangcong Luo
810aff74cd Namespace more server global types 2021-04-25 14:16:27 -07:00
Mia
c506b2118c Hangman: Fix caps sensitivity in /hangman untag 2021-04-05 11:25:28 -05:00
Mia
a353e9ab43 Hangman: Fix case insensitivity in /hangman addtag 2021-03-29 21:11:00 -05:00
Mia
0c849570d2
Hangman: Support tagging premade phrases (#8133) 2021-03-24 16:10:33 -07:00
cheesetheorange
936b7bf15c
Hangman: Correctly check guesses with numeric characters (#8056) 2021-03-01 13:01:16 -08:00
Guangcong Luo
0dc3070229 Fix /hangman terms 2021-02-15 06:09:58 -05:00
Distrib
640eed65d1
Hangman: Improve hangman terms (#8027) 2021-02-15 02:47:14 -08:00
Annika
8f5c75cc76
Fix typo 2021-02-14 11:45:42 -08:00
Annika
2b2f5f37ba
Hangman: Fix crash when a room has no saved words 2021-02-14 11:45:18 -08:00
Annika
1c8b5f73c1
Hangman: Fix bug with whitespace
Whitespace was tripping the chat filter for hangmans.
2021-02-11 15:49:20 -08:00
Mia
76c10841ea
Lib: Add an index file for all exports (#7972) 2021-01-31 18:00:19 -08:00
Guangcong Luo
747974db34 Support diacriticals in Hangman
We now support the entire gamut of Unicode. You can still only guess the
26 English letters, though.
2021-01-30 23:02:56 -05:00
Mia
184e867761
Hangman: Support saving hangman entries (#7630) 2021-01-28 11:24:46 -08:00
Mia
6f721e31ff
CommandContext: Add a method for getting roomgames (#7531) 2020-10-28 05:20:33 -07:00
Guangcong Luo
1c0c77ff6b
Update to TypeScript 4.0 (#7504) 2020-10-10 14:43:32 -07:00
Guangcong Luo
46c470671a
Unify /guess (#7387) 2020-09-19 01:24:52 -07:00
Mia
44fc0123ad
Chat: Refactor CommandContext and PageContext to use ErrorMessage more (#7234) 2020-09-06 00:15:16 -07:00
Lusamine
3a2ca90040
Minor cleanup of global demotion messages (#7011) 2020-07-17 01:17:36 -07:00
Mia
4997a47314
Commands: Allow the room parameter to be null (#6948)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-07-05 14:25:09 -07:00
Guangcong Luo
46c9afa2f3
"Remove" the global room (#6885)
I couldn't completely remove the global room in one commit, but this
solves basically every problem with it by making it no longer a `Room`.

In particular, this means:

- It's no longer of type `Room`
- It's no longer in the `Rooms.rooms` table
- Its class name is now `GlobalRoomState` rather than `GlobalRoom`
- It no longer tracks its own user list (online user count is now
  provided by `Users.onlineCount`)
- It's no longer a socket channel (there's new syntax for "send this
  message to every user")
2020-07-02 11:31:34 -07:00
Mia
6839a1f4db
Add a library for utility functions (#6817) 2020-06-09 22:06:43 -07:00
Mia
15fed24b40
Refactor auth and room.settings (#6777)
This implements two big changes:

- All settings shared between `room.chatRoomData` and `room` have been
  merged into `room.settings` (so, for instance, `room.slowchat` is now
  only `room.settings.slowchat`).

  This makes it so we never have to worry about them getting "out of
  sync".

  - Checking to see if a room is persistent is now `if (room.persist)`
    instead of `if (room.chatRoomData)`

  - `Rooms.global.writeChatRoomData()` is now rarely called directly;
    there's a new `room.saveSettings()` which will handle it for you.

  - All properties of `room.settings` are now optional (except
    `title`).

- There's a new file `user-groups.ts` which handles authority.

  - `room.auth` and `Users.globalAuth` are now
    `Auth extends Map<ID, GroupSymbol>` objects.

  - `room.auth` is now always defined, removing the need for
    `room.auth?.[userid]` workarounds.

  - A lot of code relating to usergroups and permission checks have
    been refactored.

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-06-09 08:22:25 -07:00
Annika
f4863a9444
Update references to Global Administrators post-flattening (#6815)
Co-authored-by: Charlie Kobayashi <sparkychildcharlie@gmail.com>
2020-06-08 09:41:03 -07:00
Konrad Borowski
c687b3b0ed
Replace attributed uhtml on change (#6693)
Not doing so wastes a lot of bandwidth.

This fixes https://www.smogon.com/forums/threads/dont-send-all-uhtml-messages.3664370/

`|uhtmlchange|` is no longer automatically parsed; please use
`room.uhtmlchange(` instead.
2020-05-16 07:16:42 -07:00
Guangcong Luo
125fe31d06 Improve eslintrc
Fixed some more code style, allowing these rules to be enabled:

- `comma-dangle`
- `function-paren-newline`
- `member-delimiter-style`
- `no-eval`
- `no-fallthrough`
- `no-misused-promises`
- `no-unused-vars`
- `operator-linebreak`
2020-03-06 22:35:55 -08:00
Guangcong Luo
b21c9047e2
Migrate to typescript-eslint (#6342) 2020-03-05 08:33:06 -08:00
Kris Johnson
9aaab2c57b
Typescript Help Tickets and Modlog and fix warnings (#6352) 2020-02-12 21:48:03 -08:00
Waleed Hassan
f7e024e009
Allow safer and exact type retrieval of Room#game (#6315)
By adding a `getGame` function of type:

```
// null is returned if the gameids don't match
// or the game doesn't exist
getGame<T extends RoomGame>(constructor: new (...args: any[]) => T) => T | null
```
(Credits @urkerab and @whalemer for the function signature.)

It allows refactoring previous code of:

```
if (room.game && room.game.gameid !== 'hangman') return;
const game = room.game as Hangman;
```

to:

```
const game = room.getGame(Hangman);
if (!game) return;
```

This has a couple of advantages:
- TypeScript will throw an error if the if condition is not present.

- In the new code, the template must extends `RoomGame` and be assignable to the same ID, so it's 100% typesafe
2020-02-03 05:09:37 -08:00
Kris Johnson
649ac8ea6b Typescript uno/othermetas/hangman (#6229) 2019-12-31 17:52:26 +09:00