Commit Graph

63 Commits

Author SHA1 Message Date
Aurastic
268d0f72a4
Preact: Support auto-reconnecting through web worker (#2409)
---------

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2025-05-25 11:53:44 -07:00
Kris Johnson
0abc1ef7ad
Preact: Support hovering over roomtabs with notifications (#2394)
Some checks failed
Node.js CI / build (22.x) (push) Has been cancelled
2025-04-23 13:09:28 -07:00
Mia
8e378c6129 Add static website for viewing server-side teams 2025-04-09 19:36:58 -05:00
Guangcong Luo
2db2b9bcc2 Directory listing: Support colored icons
We're using Font Awesome 5 Pro on the live site for duotone icons,
but I'm still retaining support for Font Awesome 4 for licensing
reasons.

Both are colored now, which makes for a better look, too.
2025-03-31 13:22:55 +00:00
Guangcong Luo
c724dae346 Preact: Support syntax highlighting in chat
This isn't actually too hard to backport to the old client, but I'll
leave that for someone else.

This is here partly as a tech demo of the syntax highligher, which I
plan to use in the teambuilder.
2024-08-30 13:36:05 -07:00
Guangcong Luo
c2ec42310c Support test configs
This adds support for test configs, to make it easier to test config
changes without affecting the live service.
2024-07-20 22:33:16 +00:00
Christopher Monsanto
d83000c5af Add package-lock.json 2024-03-16 12:01:51 -04:00
Guangcong Luo
49cb741f10 Move Analytics/ads into config
This stuff isn't really relevant to anyone trying to develop at
home, anyway.
2023-11-17 00:31:41 +00:00
Guangcong Luo
d66b080873 Move replay-config to config/
I'm trying to centralize config.
2023-11-16 23:49:33 +00:00
Guangcong Luo
5d41f3ec93
Reorganize directories (#2187)
Files meant to be served have been moved into
`play.pokemonshowdown.com/` and `pokemonshowdown.com/`.

We now have three directories for the three subdomains handled by this
repo:

- `pokemonshowdown.com/`
- `play.pokemonshowdown.com/`
- `replay.pokemonshowdown.com/`

Naming them after the subdomains will make it much easier to tell where
the files for each go.

The diff is probably useless; it'll be easier if you just look at the
new tree:
https://github.com/smogon/pokemon-showdown-client/tree/reorganize
2023-11-16 03:39:29 -08:00
Guangcong Luo
dc8e6cf254 Replays: Correct link previews
This should make Google search results and Discord link previews
for replays work correctly.

This actually involved a ton of work, but at least this work also
makes replays load faster.
2023-11-10 00:59:11 +00:00
Guangcong Luo
7a2b323eaf Deploy New Replays
The idea is to eventually move all client parts to their domain name
subdirectory, for clarity and better organization. New Replays is
just first.

Anyway, yeah, minor updates to New Replays, but otherwise it's just
getting deployed as-is, straight to

https://replay.pokemonshowdown.com/

The old URLs are getting taken down; they were only used for
development anyway.
2023-11-05 23:37:14 +00:00
Guangcong Luo
fd28aca33f WIP New Replays
New Replays isn't done yet but I've done a lot of work on it and
probably it deserves a commit.

Why rewrite Replays:

- I redesigned pokemonshowdown.com to look more modern and support
  dark mode, and rejiggering Old Replays would be a lot of work
  anyway.

- It'd be nice to actually deploy some of PS's whole Preact
  infrastructure somewhere, instead of it just being in development
  hell.

- Nice to get a second look at the relevant code, leading to fixes
  like fc00e68231 and f28b1e9bf3.

- Replays is due for a migration from JS/PHP to TS anyway.

Anyway, feel free to try out New Replays, it's live in:

https://pokemonshowdown.com/replays/

Old Replays will stick around until we hit feature parity, but
that shouldn't be too long (I know, famous last words).
2023-10-26 14:56:05 +00:00
Guangcong Luo
07ad64a9b1 Gitignore node_modules 2023-10-25 16:51:37 +00:00
Guangcong Luo
efa553d96b Build: Move ads/analytics into config
This keeps ads/analytics out of the repository, since they
shouldn't be used in forks and dev machines anyway.

Hiding ads in `website/news/include.php` was a thing I did in
the early days because one of the devs was ashamed of ads, and
`website/` wasn't in a public repository at the time. At this
point, though, I'm done being ashamed of it. You can obviously
see ads on the website and everyone knows they fund the server.
2021-11-25 20:52:51 -05:00
Guangcong Luo
6475e7a268 Switch .gitignore back to blacklist
VS Code's search feature doesn't support .gitignore whitelisting. :(

(Also don't compile .d.ts files.)
2021-04-14 02:02:41 -07:00
Guangcong Luo
33e6c55861 Change js/ dir to default-deny
This makes it so that new files in `src/` no longer require updating
`.gitignore` and `.eslintignore`.

The existing files still in the repo are mostly deprecated at this
point, anyway.
2021-04-13 14:06:25 -07:00
Adam Tran
a9f8adfa39
Preact Client: Ladder (#1709) 2021-01-29 08:10:36 -08:00
Adam Tran
1f3c8cf450
Add sourceMaps and vscode debug configurations (#1707)
* launch json

* vscode updates

* clientUrl rename
2021-01-10 16:58:28 -08:00
Guangcong Luo
38b66ef5ec Fix more things caused by website migration 2020-07-28 20:07:08 -04:00
Guangcong Luo
55b57799c0 Finish migrating website repository
This fixes up the last few remaining issues; from here on out,
pokemonshowdown.com should be served from `website/` with no
known problems.
2020-07-27 21:03:31 -04:00
Guangcong Luo
c1135497e0
Remove SoundManager dependency (#1563)
All sound stuff is now handled directly by BattleSound, using the
HTML5 audio API.

The main complicated thing we do with sound is loop music with an intro.
This is unfortunately not supported by ANY sound library out there
(I had to manually add support for it myself to soundManager!)

https://github.com/scottschiller/SoundManager2/pull/13

In the end, I don't think the existing libraries out there actually
give us anything I care about.
2020-07-23 12:51:47 -07:00
Annika
367ed82e56
Support configurable URLs (#1543) 2020-07-21 15:27:21 -07:00
Guangcong Luo
8a1ddcd6e2 Rename new BattleSearch -> DexSearch
(Also fix a bunch of bugs.)

The new name `DexSearch` better represents its feature-set, and allows
its name not to clash with the old `BattleSearch`.
2020-05-04 19:07:37 -07:00
Guangcong Luo
40d077903f Support playing battles
This should be a much nicer architecture than the old
`client-battle.js`.

In particular, much of the logic of choosing moves/switches has been
moved into a new `battle-choices.ts`, with `panel-battle.tsx` only
covering the UI.
2020-03-23 06:55:35 -04:00
Guangcong Luo
64e451fa61 Stop tracking past learnsets-g6
`learnsets-g6` has always been versioned because in Gen 6, it contained
START move order.

For instance, Clefairy in BW2 has the following level-up moveset:

- START: Pound
- START: Growl
- L4: Encore
- L7: Sing
- L10: Double Slap

If you catch a wild level-10 Clefairy, its moveset will be: Growl,
Encore, Sing, Double Slap. A level-10 wild Clefairy will always have
Growl and never have Pound, because the order of its first two moves
matters.

PS's regular learnsets file doesn't take this into account, so we
tracked a `learnsets-g6` file that did, but also needed to keep in sync
with new game updates.

Well, these are no longer necessary. We've updated to Gen 7 and now
Gen 8, and we've never had START ordering for any of them. Anyone who
wants START ordering for Gen 6 can find it here:

https://github.com/Zarel/Pokemon-Gen-6-Learnsets

For this repo, though, `learnsets-g6` is still around (used only by
PSdex), but it can now be automatically built from `learnsets` without
losing anything, and so it can finally be `.gitignore`d.
2020-03-17 16:55:25 -07:00
Guangcong Luo
9e06e72a35 Add support for watching battles
Playing battles is, of course, a lot harder, but watching them
is at least implemented now.
2019-09-06 02:46:54 -05:00
Guangcong Luo
e74e968e19 Stop versioning built wrapper.inc.php file 2019-07-06 03:51:27 -05:00
Guangcong Luo
b47708efa0 Implement teambuilder dropdown selector
This took way too long to get to a presentable state.

- search.js has been refactored into battle-search.ts (search logic)
  and battle-searchresults.tsx (display)

- panel-teambuilder.tsx has been split into teambuilder (team list) and
  teambuilder-team (team editor).

- The teambuilder's text editor can now detect which line it's on,
  and show the appropriate search result panel.

- The teambuilder's text editor now detects sets dynamically, and has
  the beginnings of support for set comments.

Currently, everything here is really basic, and mostly just a tech
demo for people to play around with and understand the direction of
the new teambuilder, but it'll be improved over time.
2019-06-25 00:51:27 -07:00
Guangcong Luo
029b691be1
Add replay database code to version control (#1301)
This required a new architecture for serving replays from inside the
client repository, because that seems like a better call than
introducing yet another PS repository.

(Experience gives me the impression that separating repositories wasn't
a good idea, and we should be working to make PS more mono-repo-like,
rather than less.)

License for replay code is tentatively AGPLv3, although feel free to ask
for a more permissive license if you have plans to use it in an
open-source project that requires it.
2019-06-14 17:48:34 +09:00
Guangcong Luo
7d52fd8c30 Implement TeamDropdown
Currently it's in the Main Menu where the old team dropdown was, but
the plan is for "Battle!" to eventually open a separate Search window.
2019-04-05 17:34:20 +08:00
Guangcong Luo
eb38544200 Support serving the Preact client
If you want to access it, I'm sure you can figure out how from this
code. ;)
2019-03-17 06:21:49 -04:00
Guangcong Luo
c02370f8b2 Stub teambuilder implementation 2019-03-17 19:02:53 +09:00
Guangcong Luo
25d2422a58 Add support for chat userlists and usercards
This involves a relatively substantial refactor to how panels work, but
it should be somewhat finalized now. Popups are now fully supported.
2019-03-17 19:02:53 +09:00
Guangcong Luo
f3b6352676 Stub chatroom support 2019-03-17 19:02:53 +09:00
Guangcong Luo
e501702a2a Add connection support
The actual connect function is commented out, because there's no reason
for it to do anything. But it can actually connect to a server now.
2019-03-17 19:02:53 +09:00
Guangcong Luo
bc7676838d Rename client-frame.tsx -> panels.tsx
Considering all the individual panels start with `panel-`, this should
make it easier to find and in general be a more intuitive name.

All other tsx files will start with `panel-`, putting them together in
one place when sorting alphabetically.
2019-03-17 19:02:53 +09:00
Guangcong Luo
008e3de862 Implement stub Main Menu and Rooms panels 2019-03-17 19:02:53 +09:00
Guangcong Luo
f8d251c8a1 Stub Preact rewrite
HIGHLY UNFINISHED CODE
2019-03-17 19:02:53 +09:00
Guangcong Luo
5c983df6d3 Massively improve tooltips
- Tooltips work in replays now
- Calculation is better (correctly handles more corner cases)
- Explanations are better (better messages for Magic Room etc)
- Tooltips for sidebar pokemon
- Support "locking" tooltips with long-click / long-tap
- Can copy/paste from locked tooltips
- Increased font size
2019-02-18 22:38:13 -06:00
Guangcong Luo
f6c03e0370 Implement new battle-text-parser
All battle text messages have been moved out of `src/battle.ts` and
into its own file `data/text.js`.

Code for handling this is in the new files `src/battle-log.ts` and
`src/battle-text-parser.ts`.

`data/text.js` is now extremely self-contained, and nearly ready for
translation support!

This is a significant modernization of battle.ts. In addition to moving
messages out:

Functions for getting names (`pokemon.getLowerName()` etc) have been
removed.

`battle.minorQueue` has been removed. Minor lines are now processed
directly on the main queue, with a new `battle.waitForAnimations`
flag to decide whether or not the main queue should wait for animations
to finish before moving on to the next line.

`battle.waitForResult()` and `battle.endPrevAction()` have been
removed. These confusingly-named functions closed the messagebar (and
flush the minor queue). They've been replaced with
`scene.maybeCloseMessagebar()`.

`pokemon.markMove()` and `pokemon.markAbility()` have been renamed
`pokemon.rememberMove()` and `pokemon.rememberAbility()`.
2018-11-15 18:52:53 -06:00
Guangcong Luo
5f05adc856 Split battle-log.ts off from battle-dex.ts
This splits battle-dex.ts up into:

- `battle-dex.ts`
  - dex data access, misc tools
- `battle-log.ts`
  - manipulating HTML, especially in battle logs

This turned out to be a pretty significant portion of what was
previously battle-dex.
2018-11-15 18:52:53 -06:00
Dan Huang
ee91a72dc6 Support headless client Battle (#1151) 2018-10-16 02:48:59 -05:00
Guangcong Luo
4e7f998afa TypeScript data/graphics.js 2018-05-18 17:10:58 -05:00
Guangcong Luo
d247364027 Migrate js/battle.js to TypeScript
This is only a first step and doesn't pass strictNullChecks.

I'm committing now because skipping straight to refactoring will be
easier than trying to make it pass strictNullChecks as-is.

TypeScript found at least a few bugs here, which is nice.
2018-05-16 19:49:25 -05:00
Guangcong Luo
194e07e6d0 Disable package-lock.json
For detailed justification, see the commit message for the
corresponding server change:

2e85de348f
2018-05-14 17:14:27 -05:00
Guangcong Luo
a15ec64d1d Move battledata.js to TypeScript
This is the first step of moving the entire client over to
TypeScript + Preact!!!!

The main change here is that battledata.js has been split into three
files:
- `src/battle-dex.ts`
- `src/battle-dex-data.ts`
- `src/battle-dex-misc.js`

These are concatenated back into `battledata.js` in the client, so
third parties (and specifically, old replay files) should be
unaffected. Also, this makes sure that we don't have more than two
dependencies right now.

The compilation is done with Babel 7 beta, because no stable version
of Babel supports TypeScript. We're not using `tsc` because it can't
compile to ES3 and it doesn't support preserving line numbers.

`toRoomid` has been moved from client.js to battle-dex.ts.
2018-05-14 12:53:34 -05:00
Guangcong Luo
644d5ccf91 Support Google login (two-factor auth) (#999)
This doesn't support setting accounts up for Google login: that still
has to be manually done via the database by setting the email field to
`username@gmail.com@`, where the second `@` denotes that it's using
Gmail login.

If the email field does end in `@`, `getassertion` will note this by
sending `;;@gmail`, to convey that the server is expecting a Google
login token rather than a password.

Upon receiving `;;@gmail`, the client will replace the password box will
with a Google login button, and then send the resulting Google login
token to the server in the `password` field. The server will validate
the "password" using the Google server libraries, and otherwise handle
the login as normal.

Note that Google login requires various features that a paranoid person
might disable; most notably 3rd-party cookies.

Fixes Zarel/Pokemon-Showdown#3394
2017-09-13 16:20:38 -04:00
Guangcong Luo
e96b9b9fd1 Improve animated sprite update script
BW animated sprites are now also automatically generated. In addition,
the generation script can now handle female sprites and cosmetic forms.

The storage format has also changed to be more concise.
2016-12-29 15:32:26 -05:00
Guangcong Luo
1c18bf0f4d Move config.js to /config/ 2016-10-20 13:16:06 -04:00