pokemon-showdown-client/replays
Guangcong Luo 3e4b83298c
Update Battle class API (#1686)
The client Battle class API has been pretty old and crusty, so this
updates it to be saner.

The constructor now takes an options object. Any setting you'd want to
initialize with is now a constructor option, instead of needing to call
methods after the constructor.

(Deprecated settings `roomid` and `joinButtons` still need to be set
separately.)

The old callback system is removed. It's replaced with a subscription
system vaguely resembling `PSStreamModel`. Any callbacks only intended
to be used by the warstory generator are removed (anyone who wants to
write their own warstory generator should extend `BattleSceneStub`
instead).

Battles no longer start paused. You can still start them paused by
passing `paused: true` as an option.

Playback state tracking had a bunch of rearrangement:

- `playbackState` no longer exists; state should be directly read from
  `paused`, `atQueueEnd`, `turn`, and `seeking`.

- `turn` is now initialized to `-1`. `-1` now means "we haven't reached
  `|teampreview|` or `|start|` yet". Reaching those sets turn to `0`.

- "Fast forwarding" and "seeking" are now consistently named "seeking".
  - `seeking` tracks seek state; changes from `fastForward`:
    - `null` means not seeking (replaces `0`)
    - `0` means seeking the start (replaces `0.5`)
    - `Infinity` means seeking the end (replaces `-1`)
  - `fastForward` deprecated and replaced with `seeking`
  - `fastForwardTo()` deprecated and replaced with `seekTurn()`

- `resultWaiting` is removed (it's unused)

- The "activity queue" has been renamed the "step queue", which means
  some renamed properties:
  - `activityQueue` to `stepQueue`
  - `activityStep` to `currentStep`
  - `nextActivity()` to `nextStep()`

- new property: `atQueueEnd` to track if animation has caught up to the
  end of the step queue (replaces checking `playbackState`)

- new property/option: `isReplay` - will automatically set `ended` when
  reaching the end of a replay (stopping music and showing a message),
  if the replay was saved before the end of the battle

- both replay players (`replay.pokemonshowdown.com` and downloaded
  files) have been rewritten to use an observer system, instead of the
  previous manual updating

- `reset(true)` has been renamed `resetStep()`
2021-01-23 13:17:23 -08:00
..
js Update Battle class API (#1686) 2021-01-23 13:17:23 -08:00
theme Remove SoundManager dependency (#1563) 2020-07-23 12:51:47 -07:00
.htaccess Add JSON API for replays 2020-04-16 03:53:00 -04:00
404.php Update button phrasing in replay 404 page (#1339) 2019-07-26 15:00:40 -05:00
503.php Add replay database code to version control (#1301) 2019-06-14 17:48:34 +09:00
apple-touch-icon.png Add replay database code to version control (#1301) 2019-06-14 17:48:34 +09:00
battle.log.php Fix 'Content-Type' capitalization 2020-04-18 10:42:01 -04:00
battle.php Fix misc crashes 2020-09-06 21:52:50 -04:00
build Support configurable URLs (#1543) 2020-07-21 15:27:21 -07:00
converter.lib.php Fix missed instances of renaming Pokemon#species (#1486) 2020-03-27 20:21:48 -07:00
favicon.ico Add replay database code to version control (#1301) 2019-06-14 17:48:34 +09:00
index.php Update paths for servers.inc.php 2020-07-27 16:44:21 -07:00
ps_prepreplays.sql Add replay database schema 2019-06-21 16:27:33 +09:00
ps_replays.sql Update database schemas (#1546) 2020-07-09 04:59:45 -07:00
README.md Improve and document replay search API 2020-04-16 03:53:00 -04:00
replay-config.example.inc.php Add replay database code to version control (#1301) 2019-06-14 17:48:34 +09:00
replays.lib.php Fix crash in replay upload 2020-11-17 20:54:31 -05:00
search.json.php Fix 'Content-Type' capitalization 2020-04-18 10:42:01 -04:00
search.php Unify username and format replay search internals (#1346) 2019-08-12 04:26:48 -07:00
turn-image.php Standardize file/directory names in sprites/ (#1370) 2019-09-13 00:55:55 -07:00
warstory.php Refactor sides to use .isFar over .n for graphics (#1658) 2020-11-24 06:11:02 -08:00

PS replays database

This is the code powering https://replay.pokemonshowdown.com/

JSON API

The replays database has a JSON API, documented at:

https://github.com/smogon/pokemon-showdown-client/blob/master/WEB-API.md