pokemon-showdown-client/js
Guangcong Luo e1b6dd5346 Update Battle class API
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 11:24:05 -05:00
..
lib Port Net library over 2021-01-20 09:59:18 -05:00
client-battle.js Update Battle class API 2021-01-23 11:24:05 -05:00
client-chat-tournament.js Runner-ups -> Runners-up (#1355) 2019-08-26 10:30:50 -07:00
client-chat.js Update Battle class API 2021-01-23 11:24:05 -05:00
client-ladder.js Fix |tempnotify| in HTML rooms (#1632) 2020-10-10 18:16:32 -07:00
client-mainmenu.js Fix challenging "boolean" usernames (#1673) 2020-11-19 23:20:18 -08:00
client-rooms.js Support configurable URLs (#1543) 2020-07-21 15:27:21 -07:00
client-teambuilder.js Fix teambuilder top bar for boxes (#1661) 2020-11-11 19:19:28 -08:00
client-topbar.js Deprecate Dex.prefs for setting prefs 2020-10-07 16:55:20 -07:00
client.js Allow users to PM themselves with the Chat button (#1633) 2020-10-10 19:23:46 -07:00
replay-embed.template.js Update Battle class API 2021-01-23 11:24:05 -05:00
search.js Remove LC Uber references (#1712) 2021-01-19 03:34:01 +04:00
storage.js Desktop client: Save boxes as boxes (#1692) 2020-12-05 07:58:19 -08:00